simple login edit delete display-Arc

index.php

<?php
ob_start();

include “config.php”;
include “opendb.php”;

//$conn = mysql_connect(“localhost”,”",”");
//mysql_select_db(“admin”);

if(isset($_POST['Submit']))
{
$user = $_POST['user_name'];
$pass = $_POST['pass_word'];

$qry = “select * from test where user=’$user’ and pass=’$pass’”;
//echo $qry;

$res = mysql_query($qry) or die(“error in query”.mysql_error());
$no =mysql_num_rows($res);

if($no>0)
{
header(“location:welcome.php”);
}
else
{
echo “error in username password”;
}
}
?>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<title>Untitled Document</title>
<style type=”text/css”>
.tab{
border-bottom:dotted #000066 1px;
border-left:dotted #000066 1px;
border-top:dotted #000066 1px;
border-right:dotted #000066 1px;
font-family:Trebuchet MS;
font-size:12px;
color:#003366;
}
</style>
</head>

<body>
<form id=”form1″ name=”form1″ method=”post” action=”">
<div align=”center”>
<table class=”tab”>
<tr>
<td><h3 align=”center”>Login</h3></td></tr>
<tr>
<td><p>UserName:&nbsp;<input name=”user_name” type=”text” value=”" /></p></td></tr>
<tr> <td> <p>PassWord:&nbsp;&nbsp;<input name=”pass_word” type=”password” value=”" /></p></td>
</tr>
<tr> <td> <p align=”right”>
<label>
<input type=”submit” name=”Submit” value=”Submit” style=”font-family:Trebuchet MS; color:#003366; font-size:12px;” />
</label>

</p></td>
</tr>
</table>
</div>
</form>
</body>
</html>

Register.php

<?php
ob_start();
include “config.php”;
include “opendb.php”;

if(isset($_POST['Submit']))
{
$first = $_POST['first'];
$middle = $_POST['middle'];
$last = $_POST['last'];
$dob = $_POST['dob'];
$email = $_POST['email'];
$phone = $_POST['phone'];

$qry = “INSERT INTO register (first,middle,last,dob,email,phone) VAlUES(‘$first’,'$middle’,'$last’,'$dob’,'$email’,'$phone’) “;
//echo $qry;
$res = mysql_query($qry);
//if(!$res)die(“Error In Query”.mysql_error())
header(“location:thanks.php?display=$first”);
}
?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<title>Untitled Document</title>
<style type=”text/css”>
<!–
body,p,label{
font-family:Trebuchet MS;
color: #004080;
font-size:12px;
}

.tab{
border-bottom:#FF0000 dotted 1px;
border-left:#FF0000 dotted 1px;
border-top:#FF0000 dotted 1px;
border-right:#FF0000 dotted 1px;
}
–>
</style>
</head>

<form id=”form1″ name=”form1″ method=”post” action=”">
<div align=”center”>
<table class=”tab” cellpadding=”5″ cellspacing=”5″ border=”0″>
<tr>
<td align=”center”><strong><font size=”3px”>User’s Registration:</font></strong></td>
</tr>
<tr>
<td><div align=”left”>First Name: </div></td>
<td><input name=”first” type=”text” id=”first” /></td>
</tr>
<tr>
<td><div align=”left”>Middle Name: </div></td>
<td><input name=”middle” type=”text” id=”middle” /></td>
</tr>
<tr>
<td><div align=”left”>Last Name:</div></td>
<td><input name=”last” type=”text” id=”last” /></td>
</tr>
<tr>
<td><div align=”left”>Date Of Birth:</div></td>
<td><input name=”dob” type=”text” id=”dob” /></td>
</tr>
<tr>
<td><div align=”left”>Email:</div></td>
<td><input name=”email” type=”text” id=”email” /></td>
</tr>
<tr>
<td><div align=”left”>Valid Phone </div></td>
<td><input name=”phone” type=”text” id=”phone” /></td>
</tr>
<tr>
<td colspan=”2″><div align=”center”>
<input type=”submit” name=”Submit” value=”Register” style=”font-family:Trebuchet MS; color:#003366; font-size:12px;” />
</div></td>
</tr>
</table>
</div>
</form>
</body>
</html>

display.php

<?
ob_start();
include”config.php”;
include”opendb.php”;
?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<title>Untitled Document</title>
<style type=”text/css”>

A:link {text-decoration: none}
A:visited {text-decoration: none}
A:active {text-decoration: none}
A:hover {text-decoration: underline; color: red;}

A:link {text-decoration: none}
A:visited {text-decoration: none}
A:active {text-decoration: none}
A:hover {font-size:24; font-weight:bold; color: red;}

A:link {background: #FFCC00; text-decoration: none}
A:visited {background: #FFCC00; text-decoration: none}
A:active {background: #FFCC00; text-decoration: none}
A:hover {background: #FFCC00; font-weight:bold; color: red;}

.tab{
border-bottom:dotted #000066 1px;
border-left:dotted #000066 1px;
border-top:dotted #000066 1px;
border-right:dotted #000066 1px;
font-family:Trebuchet MS;
font-size:12px;
color:#003366;
}
</style>
</head>

<body>
<form id=”form1″ name=”form1″ method=”post” action=”">
<div align=”center”>
<table width=”0″ border=”0″ cellspacing=”2″ cellpadding=”10″ class=”tab”>
<tr>
<td width=”63″ bgcolor=”#33CCFF”>First Name</td>
<td width=”79″ bgcolor=”#33CCFF”>Middle Name</td>
<td width=”52″ bgcolor=”#33CCFF”>Last Name</td>
<td width=”100″ bgcolor=”#33CCFF”>Date Of Birth </td>
<td width=”27″ bgcolor=”#33CCFF”>Email</td>
<td width=”59″ bgcolor=”#33CCFF”>Phone</td>

<td width=”126″ bgcolor=”#33CCFF”>Allow/DisAllow </td>
<td width=”44″ bgcolor=”#33CCFF”>Edit</td>
<td width=”77″ bgcolor=”#33CCFF”>Delete</td>
</tr>
<tr>
<?
$reg_query=”select * from register”;
$reg_result=mysql_query($reg_query);

while($reg_row=mysql_fetch_array($reg_result))
{

?>
<td><? echo $reg_row['first'];?></td>
<td><? echo $reg_row['middle'];?></td>
<td><? echo $reg_row['last'];?></td>
<td><? echo $reg_row['dob'];?></td>
<td><? echo $reg_row['email'];?></td>
<td><? echo $reg_row['phone'];?></td>
<td><a href=”#” style=”text-decoration:none; color:#333366;”>Allow/DisAllow</a></td>
<td><a href=”edit.php?id=<? echo $reg_row['reg_id']; ?>”>Edit</a></td>
<td><a href=”delete.php?id=<? echo $reg_row['reg_id']; ?>” style=”text-decoration:none; color:#333366;”>Delete</a></td>

</tr>
<?
}
?>

</table>
</div>
</form>

</body>
</html>

edit.php

<?php
ob_start();
include “config.php”;
include “opendb.php”;
$regid = $_REQUEST['id'];

//echo $regid;

if(isset($_POST['Submit']))
{
$first = $_POST['first'];
$middle = $_POST['middle'];
$last = $_POST['last'];
$dob = $_POST['dob'];
$email = $_POST['email'];
$phone = $_POST['phone'];

$qry = “UPDATE register SET first=’$first’, middle=’$middle’, last=’$last’, dob=’$dob’, email=’$email’, phone=’$phone’  WHERE reg_id=’$regid’”;

//echo $qry;

$res = mysql_query($qry);

//if(!$res)die(“Error In Query”.mysql_error())
//header(“location:thanks.php?display=$first”);
}
//header(“location:display.php”);
?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<title>Untitled Document</title>
<style type=”text/css”>
<!–
body,p,label{
font-family:Trebuchet MS;
color: #004080;
font-size:12px;
}
.tab{
border-bottom:#FF0000 dotted 1px;
border-left:#FF0000 dotted 1px;
border-top:#FF0000 dotted 1px;
border-right:#FF0000 dotted 1px;
}
–>
</style>
</head>

<form id=”form1″ name=”form1″ method=”post” action=”">
<div align=”center”>
<table class=”tab” cellpadding=”5″ cellspacing=”5″ border=”0″>
<tr>
<td align=”center”><strong><font size=”3px”>EDIT PAGE</font></strong></td>
</tr>
<?
$qry =”SELECT * FROM register WHERE reg_id = ‘$regid’ “;
$res = mysql_query($qry);
$fetc_row=mysql_fetch_array($res);
?>

<tr>
<td><div align=”left”>First Name: </div></td>
<td><input name=”first” type=”text” id=”first” value=”<? echo $fetc_row['first']; ?>” /></td>
</tr>
<tr>
<td><div align=”left”>Middle Name: </div></td>
<td><input name=”middle” type=”text” id=”middle”  value=”<? echo $fetc_row['middle']; ?>” /></td>
</tr>
<tr>
<td><div align=”left”>Last Name:</div></td>
<td><input name=”last” type=”text” id=”last”  value=”<? echo $fetc_row['last']; ?>” /></td>
</tr>
<tr>
<td><div align=”left”>Date Of Birth:</div></td>
<td><input name=”dob” type=”text” id=”dob” value=”<? echo $fetc_row['dob']; ?>” /></td>
</tr>
<tr>
<td><div align=”left”>Email:</div></td>
<td><input name=”email” type=”text” id=”email” value=”<? echo $fetc_row['email']; ?>” /></td>
</tr>
<tr>
<td><div align=”left”>Valid Phone </div></td>
<td><input name=”phone” type=”text” id=”phone” value=”<? echo $fetc_row['phone']; ?>” /></td>
</tr>
<tr>
<td colspan=”2″><div align=”center”>
<input type=”submit” name=”Submit”  value=”submit” style=”font-family:Trebuchet MS; color:#003366; font-size:12px;” />
</div></td>
</tr>
</table>
</div>
</form>
</body>
</html>

delete.php

<?php
ob_start();
include “config.php”;
include “opendb.php”;
$regid = $_REQUEST['id'];
$del = “DELETE from register WHERE reg_id=’$regid’”;
$res = mysql_query($del);
header(“location:display.php”);
?>

Leave a Comment