0% found this document useful (0 votes)
80 views

Project Report

The document provides an overview of a PHP and MySQL-based website called ULTIMATECOURIERS.COM that provides online courier services. It includes sections on the project synopsis, acknowledgments, introduction describing the concept of providing cheap and convenient courier services, project profile with screenshots of homepage, registration page, upload page and status page, and coding examples from files like the courier functions PHP file and homepage code.

Uploaded by

Gaurav Gupta
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
80 views

Project Report

The document provides an overview of a PHP and MySQL-based website called ULTIMATECOURIERS.COM that provides online courier services. It includes sections on the project synopsis, acknowledgments, introduction describing the concept of providing cheap and convenient courier services, project profile with screenshots of homepage, registration page, upload page and status page, and coding examples from files like the courier functions PHP file and homepage code.

Uploaded by

Gaurav Gupta
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 41

Project Report

on
ULTIMATECOURIERS.COM
Developed in
PHP And My SQL
Synopsis
Submitted in
the Partial Fulfillment
Of
PHP Certification
To
CMC Academy
Supervised by:
Cherry Mam
Submitted by:
Sonal Maheshwari
Acknowledgement
With regard to my project with CMC Academy, I would like to thank each and every one who offered help,
guideline and support whenever required.
First and foremost I would like to express gratitude to our teacher Miss Cherry and other staffs for their
support and guidance in the project work. I am extremely grateful to my supervisor for her valuable guidance
and timely suggestions. I would like to thanks to all those teachers who have given their valuable time and
responses during the project work, to complete my project work successfully.

Sonal Maheshwari
Table of Contents
(i) Certificate
(ii) Acknowledgment
1. Introduction
2. Project Profile
1. Snapshots
2. Coding
Introduction
The concept of this project is to develop a website which provides online courier service to its users. Here
registered users can upload their digital data like photos and printable documents, then we will courier these
data to the destination. We are even providing different options with photos and files like kind of framing and
binding required. We are trying to provide all these services at the minimum cost so that users can upload
their data on our site and then we’ll courier it to the destination at local cost. In this manner, the purpose of
this site is to cheap, easy, convenient and compatible courier services to its customers.
PROJECT PROFILE
SNAPSHOTS
 Home Page

 Registration Page
 Upload Page

 Status Page
CODING
 Courier_fns.php
CODE:
<?php
function db_connect()
{
$result = new mysqli('localhost', 'root', '', 'courier');
if (!$result)
{
return false;
}
$result->autocommit(TRUE);
return $result;
}
function db_result_to_array($result)
{
$res_array = array();
for ($count=0; $row = $result->fetch_assoc(); $count++)
{
$res_array[$count] = $row;
}
return $res_array;
}
function display_status($emailid)
{
//query databse to get the current status of the logged in user
$conn=db_connect();
$query="select * from orderdet where email='".$emailid."'";
$result = @$conn->query($query);

if (!$result)
{
return false;
}
$num_orders = @$result->num_rows;
if ($num_orders== 0)
{
echo "You have not placed any order till date.";
}
$str="<table>";
for($i=0;$i<$num_orders;$i++)
{
$row=$result->fetch_assoc();
$str.="<tr><td>".$row['oid']."</td>";
$str.="<td>".$row['odt']."</td>";
$str.="<td>".$row['ddt']."</td>";
$str.="<td>".$row['amt']."</td>";
$str.="<td>".$row['raddr']."</td>";
$str.="</tr>";
}
$str.="</table>";
echo $str;
}

function generate_orderid()
{
$conn=db_connect();
$query="select * from orderdet";
$result=$conn->query($query);
$no=$result->num_rows;
if($no>0)
{
return ($no+1);
}
else
{ return 1;}
}
function get_pricep($sz)
{
$conn=db_connect();
$query="select * from photopl where size='".$sz."'";
$result=@$conn->query($query);
$row=db_result_to_array($result);
foreach ($row as $arr)
{
$pc=$arr['price'];
}
return ($pc);
}
function get_priced($ty)
{
$conn=db_connect();
$query="select * from docpl where binding='".$ty."'";
$result=$conn->query($query);
$row=db_result_to_array($result);
foreach ($row as $arr)
{
$pc=$arr['price'];
}
$pc=$row['price'];
return ($pc);
}
function filled_out($form_vars)
{
// test that each variable has a value
foreach ($form_vars as $key => $value)
{
if ((!isset($key)) || ($value == ''))
{
return false;
}
}
return true;
}
function valid_email($address)
{
// check an email address is possibly valid
if (ereg("^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$", $address))
{
return true;
}
else
{
return false;
}
}
function process_card()
{
// connect to payment gateway or
// use gpg to encrypt and mail or
// store in DB if you really want to
return true;
}
function register($email, $passwd,$addr,$phno)
{
// register new person with db
// return true or error message

// connect to db
$conn = db_connect();
// check if username is unique
$result = $conn->query("select * from userdet where email='".$email."'");
if (!$result) {
throw new Exception('Could not execute query');
}

if ($result->num_rows>0) {
throw new Exception('That email is already taken - go back and choose another one.');
}

// if ok, put in db
$result = $conn->query("insert into userdet values
('".$email."', sha1('".$password."'), '".$addr."', '".$phno."')");
if (!$result) {
throw new Exception('Could not register you in database - please try again later.');
}

return true;
}

function login($email, $password) {


// check username and password with db
// if yes, return true
// else throw exception

// connect to db
$conn = db_connect();
if (!($_SESSION['valid_user']==$email)){
// check if username is unique
$result = $conn->query("select * from userdet
where email='".$email."'
and password = sha1('".$password."')");
if (!$result) {
throw new Exception('Could not log you in.');
}

if ($result->num_rows>0) {
return true;
} else {
throw new Exception('Could not log you in.');
}
}
}

function check_valid_user() {
// see if somebody is logged in and notify them if not
if (isset($_SESSION['valid_user'])) {
// echo "Logged in as ".$_SESSION['valid_user'].".<br />";
return true;
} else {
// they are not logged in
// echo 'Problem:';
echo 'You are not logged in.<br />';
echo '<br /><a href="signinfo.php">Login</a><br />';
return false;
}
}

function change_password($email, $old_password, $new_password) {


// change password for username/old_password to new_password
// return true or false

// if the old password is right


// change their password to new_password and return true
// else throw an exception
login($email, $old_password);
$conn = db_connect();
$result = $conn->query("update userdet
set password = sha1('".$new_password."')
where email = '".$email."'");
if (!$result) {
throw new Exception('Password could not be changed.');
} else {
return true; // changed successfully
}
}

function reset_password($email) {
// set password for username to a random value
// return the new password or false on failure
// get a random dictionary word b/w 6 and 13 chars in length
$new_password = "password";

// add a number between 0 and 999 to it


// to make it a slightly better password
$rand_number = rand(0, 999);
$new_password .= $rand_number;

// set user's password to this in database or return false


$conn = db_connect();
$result = $conn->query("update userdet
set passwd = sha1('".$new_password."')
where email = '".$email."'");
if (!$result) {
throw new Exception('Could not change password.'); // not changed
} else {
return $new_password; // changed successfully
}
}
function notify_password($email, $password)
{
// notify the user that their password has been changed
$from = "From: support@ultimatecouriers \r\n";
$mesg = "Your Ultimate Courier Service password has been changed to ".$password."\r\n"."Please change it
next time you log in.\r\n";
if (mail($email, 'Ultimate Courier Services CCD', $mesg, $from))
{
return true;
}
else
{
throw new Exception('Could not send email.');
}
}
 Home Page
CODE:
<html>
<head>
<title>index</title>
<link rel=stylesheet href="style1.css" type="text/css">
</head>
<frameset rows="30%,10%,60%,*" BORDER=0 FRAMEBORDER=0 FRAMESPACING=0>
<frame name="banner" src="banner.html" noresize >
<frame name="menu" src="menu.html" >
<frameset cols="80%,*" BORDER=0 FRAMEBORDER=0 FRAMESPACING=0>
<frame name="main" src="main.html" noresize border=0>
<frame name="add" src="add.html" noresize border=0>
</frameset>
<frame name="rights" src="rights.html" noresize border=0>
</frameset><noframes></noframes>
</html>
 Concept Page
CODE:
<html>
<head><title>Concept</title>
<link rel=stylesheet href="style1.css" type="text/css">
</head>
<body>
The concept of our site is :<br>
<ul>
<li>Uploading digital data<br>
<li>Specifing Recipient Address<br>
<li>E-payment<br>
<li>Its Done now!! it now our job to send the data to the destination within time.<br>
</ul>
</body>
</html>
 Services Page
CODE:
<html>
<head>
<title>Services</title>
<link rel=stylesheet href="style1.css" type="text/css">
</head>
<body>
We provide services in two different domains:<br>
<ul>
<li>Images<br>
<ul>
<li>Photograph sizes<br>
<li>Framing<br>
</ul><br>
<li>Documents<br>
<ul>
<li>All printable formats accepted<br>
<li>Different Page Size<br>
<li>Different types of bindings as per user requirement<br>
</ul>
<ul>
</body>
</html>
 Company Policy
CODE:
<html>
<head>
<title>Company policy</title>
<link rel=stylesheet href="style1.css" type="text/css">
</head>
<body>
<b>Terms And Condition</b>
<ul>
<li>Give Correct recipient address. If found incorrect, no Money Back policy..<br>
<li>The user will be sent an e-mail on successful delivery of data to the destination.<br>
<li>User can check the status of their orders.<br>
<li>User have to provide correct information about themselves. If anything found incorrect,they will be liable
for judicial action.<br>
</ul>
</body>
</html>
 Accounts Page
CODE:
<html>
<head>
<title>Account</title>
<link rel="stylesheet" href="style1.css" type="text/css">
</head><body>
<?php
require_once('courier_fns.php');
session_start();
if(check_valid_user()==true)
{
?>
<p> My Menu</p>
<a href="imgqry.php">Images</a><br/>
<a href="docqry.php">Documents</a><br/>
<a href="status.php">My Status</a><br/>
<a href="change_passwd_form.php">Change Password</a><br/>
<?php
}
else
{
echo 'you are not permitted to view this page...<a href="newuser.html" target="main"/>New
User?</a>';
}
?>
</body>
</html>
 Register Page
CODE:
<html>
<head>
<title>Register new</title>
<link rel="stylesheet" href="style1.css" type="text/css"/>
</head>
<body>
<?php
// include function files for this application
require_once('courier_fns.php');
//create short variable names
$email=$_POST['email'];
$addr=$_POST['addr'];
$passwd=$_POST['passwd'];
$passwd2=$_POST['passwd2'];
$phno=$_POST['phno'];
// start session which may be needed later
// start it now because it must go before headers
session_start();
try {
// check forms filled in
if (!filled_out($_POST)) {
throw new Exception('You have not filled the form out correctly - please go back and try again.');
}
// email address not valid
if (!valid_email($email)) {
throw new Exception('That is not a valid email address. Please go back and try again.');
}
// passwords not the same
if ($passwd != $passwd2) {
throw new Exception('The passwords you entered do not match - please go back and try again.');
}
// check password length is ok
// ok if username truncates, but passwords will get
// munged if they are too long.
if ((strlen($passwd) < 6) || (strlen($passwd) > 16)) {
throw new Exception('Your password must be between 6 and 16 characters Please go back and try again.');
}
// attempt to register this function can also throw an exception
register($email, $passwd,$addr,$phno);
// register session variable
$_SESSION['valid_user'] = $email;
@mkdir('uploads/'.$email);
@mkdir('uploads/'.$email.'/images');
@mkdir('uploads/'.$email.'/docs');
echo "You are now logged in...Continue to see your status: ";
echo '<br /><a href="status.php">Status</a><br />';
}
catch (Exception $e) {
echo 'Problem:';
echo $e->getMessage();
exit;
}
?>
</body>
</html>
 Signinfo.php
CODE:
<html>
<head><title>Signinfo</title>
<link rel="stylesheet" href="style1.css" type="text/css"/>
<?php
include('courier_fns.php');
session_start();
if (isset($_POST['email']) && isset($_POST['passwd']))
{
// if the user has just tried to log in
$email = $_POST['email'];
$passwd = $_POST['passwd'];
$db_conn = db_connect();
if (!db_conn)
{
echo 'Connection to database failed:'.mysqli_connect_error();
exit();
}
$query = "select * from userdet where email='".$email."' and password=sha1('".$password."')";
$result = $db_conn->query($query);
if ($result->num_rows >0 )
{
// if they are in the database register the user id
$_SESSION['valid_user'] = $email;
echo "<br/>Click Here to check you <a href=\"account.php\">Account</a><br/>";
}
}
?>
</head>
<body>
<?php
if (isset($_SESSION['valid_user']))
{
echo 'You are logged in as: '.$_SESSION['valid_user'].' <br />';
echo '<br /><a href="status.php">My Status</a><br />';
echo '<a href="logout.php">Log out</a><br />';
}
else
{
if (isset($email))
{
// if they've tried and failed to log in
echo 'Could not log you in.<br />';
}
else
{
// they have not tried to log in yet or have logged out
echo 'You are not logged in.<br />';
}
?>
<a href="newuser.html" target="main">Not a member?</a><br/>
<form method="post" action="signinfo.php">
<table bgcolor="#cccccc">
<tr>
<td colspan="2">Members log in here:</td>
<tr>
<td>Email:</td>
<td><input type="text" name="email"/></td></tr>
<tr>
<td>Password:</td>
<td><input type="password" name="passwd"/></td></tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="Log in"/></td></tr>
<tr>
<td colspan="2"><a href="forgotpwd.html" target ="main">Forgot your password?</a></td>
</tr>
</table>
</form>
<?php
}
?>
<br />
</body>
</html>
 Forgot_Password.php
CODE:
<html>
<head>
<title>Forgot Password</title>
<link rel="stylesheet" href="style1.css" type="text/css">
</head>
<body>
<?php
require_once("courier_fns.php");
// creating short variable name
$email = $_POST['email'];
try {
$password = reset_password($email);
notify_password($email, $password);
echo 'Your new password has been emailed to you.<br />';
}
catch (Exception $e) {
echo 'Your password could not be reset - please try again later.';
}
echo "<br/><a href=\"signinfo.php\">Login</a>";
?>
</body>
</html>
 Docqry.php
CODE:
<html><head>
<title>Document Uploads</title>
<link rel="stylesheet" href="style1.css" type="text/css"/></head>
<body>
<?php
require_once('courier_fns.php');
session_start();
if(check_valid_user())
{
?>
<table cellpadding=4 cellspacing=0 border=0>
<form enctype="multipart/form-data" action="dupload.php" method="POST">
<tr>
<td>
<center>Upload Your Files</center>
</td>
</tr>
<tr>
<td align="left">Recipient address:</td>
<td> <textarea name="raddr"></textarea></td>
</tr>
<tr>
<td align="left">Recipient PhoneNo:</td>
<td><input type="text" maxlength="10" name="rphno"/></td>
</tr>
<?php
$max_docs=10;
for($i=0;$i<10;$i++)
{
echo '<tr><td>File '.($i+1).'</td><td>
<input type="file" name="userfile['.($i+1).']" size="60"/></td></tr>';
}
?>
<tr>
<td>Binding:</td><td><input type="checkbox" value="yes" name="binding"
checked="checked"/></td><td>Type:</td>
<td><select name="type" >
<option value="spiral" selected="selected">Spiral</option>
<option value="normal paper" >Normal Paper</option>
<option value="special paper">Special Paper</option>
</select>
</td>
</tr>
<tr>
<td>
<input type="hidden" name="max_docs" value="<?php echo $max_docs?>"/>
</td>
</tr>
<tr>
<td align="center">
<input type="submit" value="Upload"/>
</td>
</tr>
</form>
</table>
<?php
}
else
{
echo '<br/><a href="signinfo.html" target="main">Signin</a>';
}
?>
</body>
</html>
 Dupload.php
CODE:
<html>
<head><title>Document upload</title>
<link rel="stylesheet" href="style1.css" type="text/css">
</head>
<body>
<?php
$max_size=50000;
require_once('courier_fns.php');
session_start();
if($_POST['raddr'] && $_POST['rphno'])
{
$raddr=$_POST['raddr'];
$rphno=$_POST['rphno'];
}
else
{
echo "Recipient addess and phone no should be there..";
exit;
}
if(!check_valid_user())
{
echo "<p>Not Authorized</p>";
echo '<br/><a href="signinfo.html" target="main">Signin</a>';
exit;
}
$oid=generate_orderid();//function that will generate new order id
if (isset($_POST['binding']) && isset($_POST['binding'])=='yes')
{
$b=1; //Binding or Not
}
else
{
$b=0;
}
$ty='none';$price=0;
if($b==1) //if yes
{
$ty=$_POST['type']; //Size Asked
$price=get_priced($ty); //Price payable
}
$email=$_SESSION['valid_user'];
$td= strftime('%y/%m/%d');
$ddt= date('y/m/d', strtotime("+1 week"));
$time=time();
$dirnm=date('z',$time).date('y',$time);
if(!is_dir('uploads/'.$email.'/docs/'.$dirnm))
{
@mkdir('uploads/'.$email.'/docs/'.$dirnm);
}
@mkdir('uploads/'.$email.'/docs/'.$dirnm.'/'.$oid);
$i=1;
$conn=db_connect();
$conn->autocommit(FALSE);
while(($_FILES['userfile']['name'][$i]) && ($_FILES['userfile']['name'][$i]!='none'))
{
echo "<p>Uploading ".$_FILES['userfile']['name'][$i]." - ".$_FILES['userfile']['size'][$i]."
bytes</p>";
if(($_FILES['userfile']['size'][$i]==0) || ($_FILES['userfile']['size'][$i]>$max_size))
{
echo "<p>Problem with File size...Cant upload</p>";
$i++;
continue;
}
$dest="uploads/".$email."/docs/".$dirnm."/".$oid."/".$_FILES['userfile']['name'][$i];
if($f==1)
{
$query1="insert into docorderdet values(".$oid.",'".$dest."',".$b.",'".$ty."')";
}
else
{
$query1="insert into docorderdet values(".$oid.",'".$dest."',0,'none')";
}
$res=$conn->query($query1);
if ($res)
{
echo "Moving files...";
if(is_uploaded_file($_FILES['userfile']['tmp_name'][$i]))
{
if(move_uploaded_file($_FILES['userfile']['tmp_name'][$i],$dest))
{
$uploaded++;
}
}
}
$i++;
}
if($uploaded>0)
{
$amt=$uploaded*15+($uploaded*$price);
$query="insert into orderdet values(".$oid.",'".$td."','".$email."','".$ddt."',".$amt.",'".
$raddr."',".$rphno.")";
$res=$conn->query($query);
if($res)
{
echo '<a href="process.php">Click here to see the Progress..</a>';
$conn->commit();
$conn->autocommit(TRUE);
}
else
{
echo "There is some problem ...need to resolve...";
exit;
}
}
?>
</body>
</html>
 Imgqry.php
CODE:
<html><head>
<title>Image Uploads</title>
<link rel="stylesheet" href="style1.css" type="text/css"/>
</head><body>
<?php
require_once('courier_fns.php');
session_start();
if(check_valid_user())
{
?>
<table cellpadding=4 cellspacing=0 border=0>
<form enctype="multipart/form-data" action="pupload.php" method="POST">
<tr>
<td>
<center>Upload Your Images</center>
</td>
</tr>
<tr>
<td align="left">Recipient address:</td>
<td> <textarea name="raddr"></textarea></td>
</tr>
<tr>
<td align="left">Recipient PhoneNo:</td>
<td><input type="text" maxlength="10" name="rphno"/></td>
</tr>
<?php
$max_images=10;
for($i=0;$i<10;$i++)
{
echo '<tr><td>Image '.($i+1).'</td><td><input type="file"
name="userfile['.($i+1).']" size="60"/></td></tr>';
}
?>
<tr>
<td>Framing:</td><td>
<input type="checkbox" name="frameing" value="yes" checked="checked"/></td><td>Size:</td>
<td><select name="size" >
<option value="4*7" selected="selected" >4*7</option>
<option value="5*8" >5*8</option>
<option value="11*9">11*9</option>
<option value="15*11">15*11</option>
</select>
</td>
</tr>
<tr>
<td>
<input type="hidden" name="max_images" value="<?php echo $max_images?>"/>
</td>
</tr>
<tr>
<td align="center">
<input type="submit" value="Upload"/>
</td>
</tr>
</form>
</table>
<?php
}
else
{
echo '<br/><a href="signinfo.html" target="main">Signin</a>';
}
?>
</body></html>
 Pupload.php
CODE:
<html>
<head>
<title>photo upload</title>
<link rel="stylesheet" href="style1.css" type="text/css">
</head>
<body>
<?php
$max_size=50000;
require_once('courier_fns.php');
session_start();
if($_POST['raddr'] && $_POST['rphno'])
{
$raddr=$_POST['raddr'];
$rphno=$_POST['rphno'];
}
else
{
echo "Recipient addess and phone no should be there..";
exit;
}
if(!check_valid_user())
{
echo "<p>Not Authorized</p>";
echo '<br/><a href="signinfo.html" target="main">Signin</a>';
exit;
}
$oid=generate_orderid();//function that will generate new order id
if(isset($_POST['frameing']) && isset($_POST['frameing'])=='yes')
{
$f=1; //Frameing or Not
}
else
{
$f=0;
}
$price=0;
if($f==1) //if yes
{
$sz=$_POST['size']; //Size Asked
$price=get_pricep($sz); //Price payable
}
$email=$_SESSION['valid_user'];
$td= strftime('%y/%m/%d');
$ddt= date('y/m/d', strtotime("+1 week"));
$time=time();
$dirnm=date('z',$time).date('y',$time);
if(!is_dir('uploads/'.$email.'/images/'.$dirnm))
{
@mkdir('uploads/'.$email.'/images/'.$dirnm);
}
@mkdir('uploads/'.$email.'/images/'.$dirnm.'/'.$oid);
$i=1;
$conn=db_connect();
$conn->autocommit(FALSE);
while(($_FILES['userfile']['name'][$i]) && ($_FILES['userfile']['name'][$i]!='none'))
{
echo "<p>Uploading ".$_FILES['userfile']['name'][$i]." - ".$_FILES['userfile']['size'][$i]."
bytes</p>";
if(($_FILES['userfile']['size'][$i]==0) || ($_FILES['userfile']['size'][$i]>$max_size))
{
echo "<p>Problem with Image size...Cant upload</p>";
$i++;
continue;
}
$dest="uploads/".$email."/images/".$dirnm."/".$oid."/".$_FILES['userfile']['name'][$i];
if($f==1)
{
$query1="insert into photoorderdet values(".$oid.",'".$dest."',".$f.",'".$sz."')";
}
else
{
$query1="insert into photoorderdet values(".$oid.",'".$dest."',0,'0')";
}
$res=$conn->query($query1);
if ($res)
{
echo "moving Images..";
if(is_uploaded_file($_FILES['userfile']['tmp_name'][$i]))
{
if(move_uploaded_file($_FILES['userfile']['tmp_name'][$i],$dest))
{
$uploaded++;
}
}
}
$i++;
}
if($uploaded>0)
{
$amt=$uploaded*25+($uploaded*$price);
$query1="insert into orderdet values(".$oid.",'".$td."','".$email."','".$ddt."',".$amt.",'".
$raddr."',".$rphno.")";
$res=@$conn->query($query1);
if($res)
{
echo '<a href="process.php">Click here to see the Progress..</a>';
$conn->commit();
$conn->autocommit(TRUE);
}
else
{
echo "There is some problem ...need to resolve...";
exit;
}
}
?>
</body>
</html>
 Logout.php
CODE:
<html>
<head>
<title>logout</title>
<link rel="stylesheet" href="style1.css" type="text/css"/>
<?php
session_start();
// store to test if they *were* logged in
$old_user = $_SESSION['valid_user'];
unset($_SESSION['valid_user']);
session_destroy();
?>
</head>
<body>
<?php
if (!empty($old_user))
{
echo 'Logged out.<br />';
}
else
{
// if they weren't logged in but came to this page somehow
echo 'You were not logged in, and so have not been logged out.<br />';
}
?>
<a href="main.html" target="main">Back to main page</a>
</body>
</html>
 Process.php
CODE:
<html>
<head><title>Process</title>
<link rel="stylesheet" href="style1.css" type="text/css">
</head>
<body>
<?php
require_once('courier_fns.php');;
// The courier service needs sessions, so start one
session_start();
if(check_valid_user())
{
if(process_card())
{
echo "<p>Thank you for shopping with us. Your order has been placed.</p>";
echo '<center><input type="button" name="continue" value="Continue"
src="status.php" /></center>';
}
else
{
echo "<p>Could not process your card. Please contact the card issuer or try again.</p>";
exit;
}
}
else
{
echo "<p>You did not fill in all the fields, please try again.</p><hr />";
exit;
}
?>
</body>
</html>
 Status.php
CODE:
<html>
<head>
<title>status</title>
<link rel="stylesheet" href="style1.css" type="text/css">
</head>
<body>
<?php
session_start();
include('courier_fns.php');
if(check_valid_user())
{
$email=$_SESSION['valid_user'];
$conn=db_connect();
$query="select * from orderdet where email='".$email."'";
$result=$conn->query($query);
$num_result=$result->num_rows;
echo "<p>Number of Orders placed till date: ".$num_result."</p>";
if($num_result>0)
{
echo "<table><tr><th>Order id</th><th>Due Date</th><th>Recipient
Address</th><th>R PhoneNo</th></tr>";
}
for($i=0;$i<$num_result;$i++)
{
$row=$result->fetch_assoc();
echo "<tr><td>".$row['oid']."</td><td>".$row['ddt']."</td><td>".
$row['raddr']."</td><td>".$row['rphno']."</td></tr>";
}
}
else
{
echo "You are not authorized to see this page...";
}
?>
</body>
</html>

You might also like