25 Oct 2006 michaelemma   » (Observer)

php code!

login.php <table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <form action="checklogin.php" method="post"><td align="center" valign="middle"><table width="400" border="0" cellpadding="5" cellspacing="1" class="tablebg"> <tr class="tdbg"> <td colspan="2">

Administrators Login
</td> </tr> <tr class="tdbg"> <td>
</td> <td>
<input name="username" type="text" id="username">
</td> </tr> <tr class="tdbg"> <td>
</td> <td>
<input name="password" type="password" id="password">
</td> </tr> <tr class="tdbg"> <td colspan="2">
<input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Clear">
</td> </tr> </table></td></form> </tr> </table>

<? require_once('conn.php'); session_start(); $username=$_POST['username']; $password=$_POST['password']; $exec="select * from admin where username='".$username."'"; if($result=mysql_query($exec)) { if($rs=mysql_fetch_object($result)) { if($rs->password==$password) { $_SESSION['adminname']=$username; header("location:index.php"); } else { echo "<script>alert('Password Check Error!');location.href='login.php';</script>"; } } else { echo "<script>alert('Username Check Error!');location.href='login.php';</script>"; } } else { echo "<script>alert('Database Connection Error!');location.href='login.php';</script>"; }


conn.php <? $conn=mysql_connect ("", "", ""); mysql_select_db("shop"); ?>

checkadmin.asp <? session_start(); if($_SESSION['adminname']=='') { echo "<script>alert('Please Login First');location.href='login.php';</script>"; } ?>

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!