0% found this document useful (0 votes)
113 views47 pages

Admin Site: Vidyabharti Trust College of Bba & Bca. Umrakh Sub: PHP Mysql Journal

This document contains PHP code for an admin login/logout system and contact form with MySQL database integration. It includes code snippets for a login page, logout script, password change form, database connection file, and contact form with insert functionality. The login/logout system allows an admin to sign in and out of the site, and the password change form updates passwords in the database. The contact form inserts user input into a MySQL "contacts" table.

Uploaded by

dhiren
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
113 views47 pages

Admin Site: Vidyabharti Trust College of Bba & Bca. Umrakh Sub: PHP Mysql Journal

This document contains PHP code for an admin login/logout system and contact form with MySQL database integration. It includes code snippets for a login page, logout script, password change form, database connection file, and contact form with insert functionality. The login/logout system allows an admin to sign in and out of the site, and the password change form updates passwords in the database. The contact form inserts user input into a MySQL "contacts" table.

Uploaded by

dhiren
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 47

VIDYABHARTI TRUST COLLEGE OF BBA & BCA.

UMRAKH
SUB: PHP MYSQL
JOURNAL

ADMIN SITE
LOGIN PAGE

<?php

session_start();

include "conn.php";

$m="";

if(isset($_REQUEST['btnsubmit']))

$q="select * from login_master where

login_username like '".$_REQUEST['txtuname']."'

and login_possword like '".$_REQUEST['txtpass']."'

";

$res=mysql_query($q);

TYBCA (SEM: V) Page 1 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

header("location:reg_disp.php");

$c=mysql_num_rows($res);

if($c>0)

$_SESSION['user']=$_REQUEST['txtuname'];

header("location:reg_disp.php");

else

$m="<font color='white'>login NOT successfully</font>";

?>

<html>

<body BGCOLOR="black">

<FORM ALIGN="CENTER" method="post">

<CENTER><h1><font color="CYAN">LOGIN PAGE</h1></CENTER>

<TABLE ALIGN="CENTER">

<TR>

<TH><font color="YELLOW">USER NAME</TH>

<TD><font color="WHITE">:</TD>

<TD><input type="text" id="TXTUNAME" NAME="txtuname"


required></TD>

</TR>

<TR>

<TH><font color="YELLOW">PASSWORD</TH>

TYBCA (SEM: V) Page 2 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

<TD><font color="WHITE">:</TD>

<TD><font color="white"><input type="password" NAME="txtpass"


required></TD>

</TR>

<TR>

<TH><INPUT TYPE="SUBMIT" name="btnsubmit"></TH>

<TH><INPUT TYPE="RESET" TEXT="RESET"></TH>

</TR>

<TR>

<TH colspan="4"><?php echo ("$m"); ?></TH>

</TR>

</TABLE>

</BODY>

</FORM>

</HTML>

LOGOUT

logout.php

<?php

session_start();

session_destroy();

header("location:login.php");

?>

TYBCA (SEM: V) Page 3 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

CHANGE PASSWORD

chpass.php

<?php

//session_start();

include "scheck.php";

include "connect.php";

//$m="";

if(isset($_REQUEST['btnsubmit']))

$q="select * from login_master where

login_username like '".$_SESSION['user']."' and

login_possword like '".$_REQUEST['txtopass']."'";

$res=mysql_query($q);

$count=mysql_num_rows($res);

if($count>0)

TYBCA (SEM: V) Page 4 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

if($_REQUEST['txtnpass']==$_REQUEST['txtcpass'])

$u="update login_master set

login_possword='".$_REQUEST['txtnpass']."'

where login_username like '".$_SESSION['user']."'";

mysql_query($u);

$m="Password changed Successfully..!!..";

//header("location:login.php");

else

$m="<font color='red'>NEW PASSWORD AND CONFIRM


PASSWORD DOES NOT MATCH</font>";

else

$m="<font color='red'>INCORRECT OLD PASSWORD</font>";

?>

<html>

<body>

<form method="post">

<?php

TYBCA (SEM: V) Page 5 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

if(isset($m))

echo $m;

?>

<H1><CENTER><font color="red" face="Corsiva">CHANGE


PASSWORD</font></CENTER></H1>

<table border=0 align="center" bgcolor="white">

<tr>

<th>OLD PASSWORD</th>

<th>:</th>

<th><input type="password" name="txtopass" required


placeholder="OLD PASSWORD"></th>

</tr>

<tr>

<th>NEW PASSWORD</th>

<th>:</th>

<th><input type="password" name="txtnpass" required


placeholder="NEW PASSWORD"></th>

</tr>

<tr>

<th>CONFIRM PASSWORD</th>

<th>:</th>

<th><input type="password" name="txtcpass" required


placeholder="CONFIRM PASSWORD"></th>

</tr>

</table>

<center>

<tr>

TYBCA (SEM: V) Page 6 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

<input type="SUBMIT" name="btnsubmit" value="CHANGE PASSWORD">

<input type="RESET" value="Reset"><br>

</center>

</tr>

</form>

</body>

<html>

TYBCA (SEM: V) Page 7 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

CONTACT US
CONNECT.PHP

<?php

$con=mysql_connect("localhost","root","");

if(!$con)

exit("database not connected");

mysql_select_db("collage_project");

?>

INSERT

contacts_insert.php

<?php

INCLUDE "header.php";

include "connect1.php";

TYBCA (SEM: V) Page 8 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

if(isset($_REQUEST['btnsubmit']))

$q="insert into contacts_mst set

first_name='".$_REQUEST['txtfname']."',

last_name='".$_REQUEST['txtlname']."',

email='".$_REQUEST['txtemail']."',

phone='".$_REQUEST['txtphone']."',

message='".$_REQUEST['txtmsg']."'";

mysql_query($q);

header("location:contacts_display.php");

?>

<HTML>

<BODY>

<FORM METHOD="POST">

<TABLE ALIGN="CENTER" BORDER="2" >

<TR>

<TH>First Name</TH>

<TH><INPUT TYPE="TEXT" NAME="txtfname" required></TH>

</TR>

<TR>

<TH>Last Name</TH>

<TH><INPUT TYPE="TEXT" NAME="txtlname" required></TH>

</TR>

<TR>

TYBCA (SEM: V) Page 9 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

<TH>E Mail</TH>

<TH><INPUT TYPE="email" NAME="txtemail" required></TH>

</TR>

<TR>

<TH>Phone</TH>

<TH><INPUT TYPE="TEXT" NAME="txtphone" required></TH>

</TR>

<TR>

<TH>Message</TH>

<TH><textarea name="txtmsg" required></textarea></TH>

</TR>

<TR>

<TH colspan="2"><INPUT TYPE="submit" NAME="btnsubmit">

<INPUT TYPE="button" value="Cancel">

<INPUT TYPE="button" value="Back" onclick="javascript:history.go(-


1)"></TH>

</TR>

</TABLE>

</FORM>

</BODY>

</HTML>

TYBCA (SEM: V) Page 10 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

DISPLAY

contacts_delete.php

<?php

include "connect1php";

$q="delete from contacts_mst where

con_id=".$_GET['id'];

mysql_query($q);

header("location:contacts_display.php");

?>

contacts_display.php

<?php

include "scheck.php";

include "header.php";

include "connect1.php";

TYBCA (SEM: V) Page 11 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

$q="select * from contacts_mst";

if(isset($_REQUEST['btnsearch']))

$q="select * from contacts_mst where

first_name like '%".$_REQUEST['txtsearch']."%' or

last_name like '%".$_REQUEST['txtsearch']."%'";

$res=mysql_query($q);

$count=mysql_num_rows($res);

?>

<HTML>

<BODY>

<FORM METHOD="POST">

<TABLE ALIGN="CENTER" BORDER="2" width="70%">

<tr>

<th colspan="8"><h1>CONTACTS DETAIL</h1></th>

</tr>

<TH colspan="6">Search

<INPUT TYPE="TEXT" NAME="txtsearch">

<INPUT TYPE="submit" value="Search" NAME="btnsearch">

<INPUT TYPE="submit" value="Show All"></TH>

<th colspan="2"><a href="contacts_insert.php"><img


src="insert.png" height="40" width="40"></a></th>

</tr>

<tr align="right">

<td colspan="8"><a href="chpass.php">CHANGE PASSWORD||</a><a


href="logout.php">LOGOUT</td>

TYBCA (SEM: V) Page 12 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

</tr>

<TR>

<TH>ID</TH>

<TH>First Name</TH>

<TH>Last Name</TH>

<TH>E Mail</TH>

<TH>Phone</TH>

<TH>Message</TH>

<TH colspan="2">Action</TH>

</TR

<?php

if($count>0)

while($row=mysql_fetch_object($res))

{ ?>

<tr>

<TD><?PHP echo $row->con_id; ?></TD>

<TD><?PHP echo $row->first_name; ?></TD>

<TD><?PHP echo $row->last_name; ?></TD>

<TD><?PHP echo $row->email; ?></TD>

<TD><?PHP echo $row->phone; ?></TD>

<TD><?PHP echo $row->message; ?></TD>

<TD><a href="contacts_edit.php?id=<?php echo $row-


>con_id; ?>"><img src="edit.jpg" height="40" width="40"></a></TD>

<TD><a href="contacts_delete.php?id=<?php echo $row-


>con_id; ?>" onclick="return confirm('Are You Sure ?')">

<img src="delete.jpg" height="40" width="40"></a></TD>

TYBCA (SEM: V) Page 13 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

<?php } ?>

</tr>

<?php

?>

</TABLE>

</FORM>

</BODY>

</HTML>

EDIT

Formatted: Font: 12 pt, Bold, Underline, Font color: Text 1


Formatted: Font: 12 pt, Bold, Underline, Font color: Text 1

contacts_edit.php

<?php

INCLUDE "header.php";

include "connect1.php";

TYBCA (SEM: V) Page 14 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

$s="select * from contacts_mst where

con_id=".$_REQUEST['id'];

$res=mysql_query($s);

$row=mysql_fetch_object($res);

if(isset($_REQUEST['btnsubmit']))

$q="update contacts_mst set

first_name='".$_REQUEST['txtfname']."',

last_name='".$_REQUEST['txtlname']."',

email='".$_REQUEST['txtemail']."',

phone='".$_REQUEST['txtphone']."',

message='".$_REQUEST['txtmsg']."'

where con_id=".$_REQUEST['id'];

mysql_query($q);

header("location:contacts_display.php");

?>

<HTML>

<BODY>

<FORM METHOD="POST">

<TABLE ALIGN="CENTER" BORDER="2" >

<TR>

<TH>First Name</TH>

TYBCA (SEM: V) Page 15 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

<TH><INPUT TYPE="TEXT" NAME="txtfname" required


value="<?php echo $row->first_name;?>"></TH>

</TR>

<TR>

<TH>Last Name</TH>

<TH><INPUT TYPE="TEXT" NAME="txtlname" required value="<?php


echo $row->last_name;?>"></TH>

</TR>

<TR>

<TH>E Mail</TH>

<TH><INPUT TYPE="email" NAME="txtemail" required value="<?php


echo $row->email;?>"></TH>

</TR>

<TR>

<TH>Phone</TH>

<TH><INPUT TYPE="TEXT" NAME="txtphone" required


value="<?php echo $row->phone;?>"></TH>

</TR>

<TR>

<TH>Message</TH>

<TH><textarea name="txtmsg" required><?php echo $row-


>message;?>"</textarea></TH>

</TR>

<TR>

<TH colspan="2"><INPUT TYPE="submit" NAME="btnsubmit">

<INPUT TYPE="button" value="Cancel">

<INPUT TYPE="button" value="Back" onclick="javascript:history.go(-


1)"></TH>

TYBCA (SEM: V) Page 16 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

</TR>

</TABLE>

</FORM>

</BODY>

</HTML>

TYBCA (SEM: V) Page 17 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

REGISTERATION
INSERT

reg_ins.php

<?php

include "connect.php";

include "header.php";

//include "scheck.php";

if(isset ($_REQUEST['btnsubmit']))

$q="insert into reg_mst set

reg_mail='".$_REQUEST['txtemail']."',

reg_fname='".$_REQUEST['txtfname']."',

reg_lname='".$_REQUEST['txtlname']."',

reg_uname='".$_REQUEST['txtuname']."',

reg_password='".$_REQUEST['txtpass']."',

TYBCA (SEM: V) Page 18 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

reg_img='".$_FILES['imgsfile']['name']."'

";

mysql_query($q);

MOVE_UPLOADED_FILE($_FILES['imgsfile']['tmp_name'],"images/".$_FILES['imgsfile']['name'
]);

header("location:reg_disp.php");

?>

<html>

<body>

welcome.. UDIT

<form method="post" enctype="multipart/form-data">

<table border="2" align="center">

<tr>

<th colspan="2"><h1>REG DETAILS ENTRY</h1></th>

</tr>

<tr>

<td>Email</td>

<td><input type="email" required name="txtemail"></td>

</tr>

<tr>

<td>First Name</td>

<td><input type="text" required name="txtfname"></td>

TYBCA (SEM: V) Page 19 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

</tr>

<tr>

<td>Last Name</td>

<td><input type="text" required name="txtlname"></td>

</tr>

<tr>

<td>User Name</td>

<td><input type="text" required name="txtuname"></td>

</tr>

<tr>

<td>Password</td>

<td><input type="password" required name="txtpass"></td>

</tr>

<tr>

<td>Image</td>

<td><input type="file" required name="imgsfile"></td>

</tr>

<tr>

<th colspan="3"><input type="submit" name="btnsubmit" value="Save">

<input type="reset">

<input type="button" value="back" onclick="javascript:history.go(-1)"></th>

</tr>

</table>

TYBCA (SEM: V) Page 20 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

</form>

</body>

</html>

DISPLAY

reg_del.php

<?php

include("connect.php");

$q="delete from reg_mst where

reg_id=".$_REQUEST['id'];

mysql_query($q);

header("location:reg_disp.php");

?>

reg_disp.php

<?php

//session_start();

TYBCA (SEM: V) Page 21 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

include "scheck.php";

include "header.php";

include "connect.php";

$q="select * from reg_mst";

if(isset($_REQUEST['btnsearch']))

$q="select * from reg_mst where

reg_fname like '%".$_REQUEST['txtsearch']."%'

or reg_lname like '%".$_REQUEST['txtsearch']."%'

";

$res=mysql_query($q);

$count=mysql_num_rows($res);

?>

<html>

<body>

<form method="post">

<table border="3" align="center">

<tr>

<th colspan="8"><h1>REG DETAILS</h1></th>

</tr>

<tr>

<td colspan="5"><input type="text" name="txtsearch">

<input type="submit" name="btnsearch" value="Search">

<input type="submit" value="Show all">

</td>

TYBCA (SEM: V) Page 22 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

<td colspan="4" align="right"><h3><a href="reg_ins.php"><img


src="images/add.png" height="45" width="45" title="Add Record"></a></h3></td>

</tr>

<tr align="right">

<td colspan="8"><a href="chpass.php">CHANGE PASSWORD||</a><a


href="logout.php">LOGOUT</td>

</tr>

<?php if($count>0)

?>

<tr>

<th>Email</th>

<th>First Name</th>

<th>Last Name</th>

<th>User Name</th>

<th>Password</th>

<th>Image</th>

<th colspan="2">Action</th>

</tr>

<?php

while($row=mysql_fetch_object($res))

{ ?>

<tr>

<td><?php echo ucfirst($row->reg_mail); ?></td>

<td><?php echo ucfirst($row->reg_fname); ?></td>

<td><?php echo $row->reg_lname; ?></td>

TYBCA (SEM: V) Page 23 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

<td><?php echo $row->reg_uname; ?></td>

<td><?php echo $row->reg_password; ?></td>

<td ><img height="35" width="35" src="images/<?php echo $row-


>reg_img; ?>"></td>

<th><a href="reg_edit.php?sid=<?php echo $row->reg_id; ?>"><img


src="images/edit.png" height="45" width="45" title="Edit Record"></a></th>

<th><a href="reg_del.php?id=<?php echo $row->reg_id; ?>" onclick="return


confirm ('Are You Sure? ');"><img src="images/delete.png" height="45" width="45" title="Delete
Record"></a></th>

</tr>

<?php

} else

echo "<tr> <td colspan='7'>NO ROWS FOUND</td></tr>";

?>

</table>

</form>

</body>

</html>

TYBCA (SEM: V) Page 24 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

EDIT

reg_edit.php

<?php

include "header.php";

include "connect.php";

include "scheck.php";

$s="select * from reg_mst where

reg_id=".$_GET['sid'];

$res=mysql_query($s);

$row=mysql_fetch_object($res);

if(isset ($_REQUEST['btnsubmit']))

if($_FILES['imgsfile']['name']=="")

$q="update reg_mst set

TYBCA (SEM: V) Page 25 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

reg_mail='".$_REQUEST['txtemail']."',

reg_fname='".$_REQUEST['txtfname']."',

reg_lname='".$_REQUEST['txtlname']."',

reg_uname='".$_REQUEST['txtuname']."',

reg_password='".$_REQUEST['txtpass']."'

where reg_id=".$_get['sid'];

else

$q="update reg_mst set

reg_mail='".$_REQUEST['txtemail']."',

reg_fname='".$_REQUEST['txtfname']."',

reg_lname='".$_REQUEST['txtlname']."',

reg_uname='".$_REQUEST['txtuname']."',

reg_password='".$_REQUEST['txtpass']."',

reg_img='".$_FILES['imgsfile']['name']."'

where reg_id=".$_get['sid'];

mysql_query($q);

MOVE_UPLOADED_FILE($_FILES['imgsfile']['tmp_name'],"images/".$_FILES['imgsfile']['name'
]);

header("location:reg_disp.php");

?>

TYBCA (SEM: V) Page 26 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

<html>

<body>

<form method="post" enctype="multipart/form-data">

<table border="2" align="center">

<tr>

<th colspan="2"><h1>REG DETAILS ENTRY</h1></th>

</tr>

<tr>

<td>Email</td>

<td><input type="text" required name="txtemail" value="<?php echo


ucfirst($row->reg_mail); ?>"></td>

</tr>

<tr>

<td>First Name</td>

<td><input type="text" required name="txtfname" value="<?php echo


ucfirst($row->reg_fname); ?>"></td>

</tr>

<tr>

<td>Last Name</td>

<td><input type="text" required name="txtlname" value="<?php echo


$row->reg_lname; ?>"></td>

</tr>

<tr>

<td>User Name</td>

TYBCA (SEM: V) Page 27 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

<td><input type="text" required name="txtuname" value="<?php echo


$row->reg_uname; ?>"></td>

</tr>

<tr>

<td>Password</td>

<td><input type="password" required name="txtpass" value="<?php echo


$row->reg_password; ?>"></td>

</tr>

<tr>

<td>Image</td>

<td><input type="file" required name="imgsfile" ><img height="50"


width="50" src="images/<?php echo $row->reg_img; ?>"></td>

</tr>

<tr>

<th colspan="3"><input type="submit" name="btnsubmit" value="Save">

<input type="reset">

<input type="button" value="back" onclick="javascript:history.go(-1)"></th>

</tr>

</table>

</form>

</body>

</html>

TYBCA (SEM: V) Page 28 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

WEB DEVELOPMENT

INSERT

web_ins.php

<?php

include "connect.php";

include "header.php";

//include "scheck.php";

if(isset ($_REQUEST['btnsubmit']))

$q="insert into web_mst set

web_seo='".$_REQUEST['txtemail']."',

web_onlinestore='".$_REQUEST['txtfname']."',

web_blog='".$_REQUEST['txtlname']."',

web_mobilefriendly='".$_REQUEST['txtuname']."',

TYBCA (SEM: V) Page 29 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

web_coustomer='".$_REQUEST['txtpass']."',

web_img='".$_FILES['imgsfile']['name']."'

";

mysql_query($q);

MOVE_UPLOADED_FILE($_FILES['imgsfile']['tmp_name'],"images/".$_FILES['imgsfile']['name'
]);

header("location:web_disp.php");

?>

<html>

<body>

welcome.. <!--<?php// echo $_SESSION['user'];?><a href="logout.php">logout</a>-->

<form method="post" enctype="multipart/form-data">

<table border="2" align="center">

<tr>

<th colspan="2"><h1>WEB DETAILS ENTRY</h1></th>

</tr>

<tr>

<td>WEB SEO</td>

<td><input type="text" required name="txtemail"></td>

</tr>

<tr>

<td>ONLINE STORE</td>

TYBCA (SEM: V) Page 30 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

<td><input type="text" required name="txtfname"></td>

</tr>

<tr>

<td>BLOG</td>

<td><input type="text" required name="txtlname"></td>

</tr>

<tr>

<td>MOBILE FRIENDLY ans in y/n</td>

<td><input type="text" required name="txtuname"></td>

</tr>

<tr>

<td>COUSTOMER NAME</td>

<td><input type="password" required name="txtpass"></td>

</tr>

<tr>

<td>Image</td>

<td><input type="file" required name="imgsfile"></td>

</tr>

<tr>

<th colspan="3"><input type="submit" name="btnsubmit" value="Save">

<input type="reset">

<input type="button" value="back" onclick="javascript:history.go(-1)"></th>

</tr>

TYBCA (SEM: V) Page 31 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

</table>

</form>

</body>

</html>

DISPLAY

web_del.php

<?php

include("connect.php");

$q="delete from web_mst where

web_id=".$_REQUEST['id'];

mysql_query($q);

header("location:web_disp.php");

?>

web_disp.php

<?php

TYBCA (SEM: V) Page 32 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

//session_start();

include "scheck.php";

include "connect.php";

INCLUDE "header.php";

$q="select * from web_mst";

if(isset($_REQUEST['btnsearch']))

$q="select * from web_mst where

web_seo like '%".$_REQUEST['txtsearch']."%'

or web_coustomer like '%".$_REQUEST['txtsearch']."%'

";

$res=mysql_query($q);

$count=mysql_num_rows($res);

?>

<html>

<body>

<form method="post">

<table border="3" align="center">

<tr>

<th colspan="8"><h1>WEB DETAILS</h1></th>

</tr>

<tr>

<td colspan="5"><input type="text" name="txtsearch">

TYBCA (SEM: V) Page 33 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

<input type="submit" name="btnsearch" value="Search">

<input type="submit" value="Show all">

</td>

<td colspan="4" align="right"><h3><a href="web_ins.php"><img


src="images/add.png" height="45" width="45" title="Add Record"></a></h3></td>

</tr>

<tr align="right">

<td colspan="8"><a href="chpass.php">CHANGE PASSWORD||</a><a


href="logout.php">LOGOUT</td>

</tr>

<?php if($count>0)

?>

<tr>

<th>WEB SEO</th>

<th>ONLINE STORE</th>

<th>BLOG</th>

<th>MOBILE FRIENDLY</th>

<th>COUSTOMER NAME</th>

<th>Image</th>

<th colspan="2">Action</th>

</tr>

<?php

while($row=mysql_fetch_object($res))

{ ?>

<tr>

TYBCA (SEM: V) Page 34 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

<td><?php echo ucfirst($row->web_seo); ?></td>

<td><?php echo ucfirst($row->web_onlinestore); ?></td>

<td><?php echo $row->web_blog; ?></td>

<td><?php echo $row->web_mobilefriendly; ?></td>

<td><?php echo $row->web_coustomer; ?></td>

<td ><img height="35" width="35" src="images/<?php echo $row-


>web_img; ?>"></td>

<th><a href="web_edit.php?sid=<?php echo $row->web_id; ?>"><img


src="images/edit.png" height="45" width="45" title="Edit Record"></a></th>

<th><a href="web_del.php?id=<?php echo $row->web_id; ?>"


onclick="return confirm ('Are You Sure? ');"><img src="images/delete.png" height="45" width="45"
title="Delete Record"></a></th>

</tr>

<?php

} else

echo "<tr> <td colspan='7'>NO ROWS FOUND</td></tr>";

?>

</table>

</form>

</body>

</html>

EDIT

TYBCA (SEM: V) Page 35 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

web_edit.php

<?php

include "header.php";

include "connect.php";

//include "scheck.php";

$s="select * from web_mst where

web_id=".$_GET['sid'];

$res=mysql_query($s);

$row=mysql_fetch_object($res);

if(isset ($_REQUEST['btnsubmit']))

if($_FILES['imgsfile']['name']=="")

TYBCA (SEM: V) Page 36 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

$q="update web_mst set

web_seo='".$_REQUEST['txtemail']."',

web_onlinestore='".$_REQUEST['txtfname']."',

web_blog='".$_REQUEST['txtlname']."',

web_mobilefriendly='".$_REQUEST['txtuname']."',

web_coustomer='".$_REQUEST['txtpass']."'

where web_id=".$_get['sid'];

else

$q="update web_mst set

web_seo='".$_REQUEST['txtemail']."',

web_onlinestore='".$_REQUEST['txtfname']."',

web_blog='".$_REQUEST['txtlname']."',

web_mobilefriendly='".$_REQUEST['txtuname']."',

web_coustomer='".$_REQUEST['txtpass']."',

web_img='".$_FILES['imgsfile']['name']."'

where web_id=".$_get['sid'];

mysql_query($q);

TYBCA (SEM: V) Page 37 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

MOVE_UPLOADED_FILE($_FILES['imgsfile']['tmp_name'],"images/".$_FILES['imgsfile'
]['name']);

header("location:web_disp.php");

?>

<html>

<body>

welcome.. <!--<?php// echo $_SESSION['user'];?><a href="logout.php">logout</a>-->

<form method="post" enctype="multipart/form-data">

<table border="2" align="center">

<tr>

<th colspan="2"><h1>WEB DETAILS ENTRY</h1></th>

</tr>

<tr>

<td>WEB SEO</td>

<td><input type="text" required name="txtemail" value=<?php echo


ucfirst($row->web_seo); ?>"></td>

</tr>

<tr>

<td>ONLINE STORE</td>

<td><input type="text" required name="txtfname" value="<?php


echo ucfirst($row->web_onlinestore); ?>"></td>

TYBCA (SEM: V) Page 38 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

</tr>

<tr>

<td>BLOG</td>

<td><input type="text" required name="txtlname" value="<?php


echo $row->web_blog; ?>"></td>

</tr>

<tr>

<td>MOBILE FRIENDLY ans in y/n</td>

<td><input type="text" required name="txtuname" value="<?php


echo $row->web_mobilefriendly; ?>"></td>

</tr>

<tr>

<td>COUSTOMER NAME</td>

<td><input type="password" required name="txtpass" value="<?php


echo $row->web_coustomer; ?>"></td>

</tr>

<tr>

<td>Image</td>

<td><input type="file" required name="imgsfile"> <img height="35"


width="35" src="images/<?php echo $row->web_img; ?>"></td>

</tr>

<tr>

TYBCA (SEM: V) Page 39 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

<th colspan="3"><input type="submit" name="btnsubmit"


value="Save">

<input type="reset">

<input type="button" value="back" onclick="javascript:history.go(-1)"></th>

</tr>

</table>

</form>

</body>

</html>

TYBCA (SEM: V) Page 40 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

USER SITE DESIGN

TYBCA (SEM: V) Page 41 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

TYBCA (SEM: V) Page 42 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

TYBCA (SEM: V) Page 43 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

TYBCA (SEM: V) Page 44 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

TYBCA (SEM: V) Page 45 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

TYBCA (SEM: V) Page 46 of 47


VIDYABHARTI TRUST COLLEGE OF BBA & BCA. UMRAKH
SUB: PHP MYSQL
JOURNAL

TYBCA (SEM: V) Page 47 of 47

You might also like