IIC University of Technology Evening Class (B205)
Code by Student Name: Hort Pheakdey
email: pp.pheakdey@gmail.com
filename: signup.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=utf-8" />
<title>sign in</title>
</head>
<body>
<body>
<form action="condition.php" method="post">
<table width="267" height="148" align="left" bgcolor="#FFFF00" >
<tr>
<td height="39" colspan="2" align="center" bgcolor="#FF0000" ><b> Sign In With Your Google Account </b></td>
</tr>
<tr>
<td colspan="2" align="left" ><font color="#660000">
<?php
if (isset ($_GET['invalid'])){
echo "There are no Username and Database";
}
?>
</font>
</td>
<tr>
<td height="21" colspan="2" align="left" ><font color="#000066"></font></td>
</tr>
<tr>
<td width="75"> User Name:</td>
<td><input type="text" name="txtusername" width="180" />
</tr>
<tr>
<td width="75"> Password:</td>
<td><input type="text" name="txtpassword" width="180" /></td>
</tr>
<tr><td height="26" colspan="2" align="center"><input type="submit" name="btnsignin" value="Sign In" /></td></tr>
</table>
</form>
</body>
</html>
filename: condition.php
<?php
$username = "";
$password = "";
$success = false ;
$user = array ("dara"=>"12345","bopha"=>"abcde","lina"=>"a1345","lida"=>"bcdel","kanha"=>"34567");
foreach($user as $username => $password){
if (strcmp($username,trim (strtolower($_POST['txtusername'])))==0 and substr_compare ($password ,trim (strtolower($_POST['txtpassword'])),0,1,false )==0){
header ("Location:welcome.php?user=$username & password = $password");
$success = true ;
break;
}
}
if (!$success){
header ("Location:signin.php?invalid=true");
}
?>
filename: welcome.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=utf-8" />
<title>welcome to user</title>
</head>
<body>
<table width="150" bgcolor="#9933FF" >
<tr>
<td> Welcome to
<?php
echo $_GET['user'];
?>
</td>
</tr>
</table>
</body>
</html>