Jump to content

Garnet

Members
  • Posts

    5
  • Joined

  • Last visited

Garnet's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Garnet

    Login Page Codes

    Anyone got any codes on login page that is workable? i need it ~
  2. all the php i done came out all the same errors .here are the codes.. Please help me checklogin.php<!doctype html public "-//W3C//DTD HTML 4.0 //EN"> <html> <head> <title>Login check</title> </head> <body> <?php ob_start(); $host="localhost"; // Host name $username=""; // Mysql username $password=""; // Mysql password $db_name="test"; // Database name $tbl_name="members"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); if($result){ echo "go"; } //mysql_num_row is counting table row $count=mysql_num_rows($result); //if result match $myusername and mypassword table row must be 1 row if($count==1){ session_register("myusername"); header("location:login_success.php"); } else { echo "Wrong Username or Password"; } ob_end_flush(); ?> </body> </html>main_login.php<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"><tr><form name="form1" method="post" action="checklogin.php"><td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"><tr><td colspan="3"><strong>Member Login </strong></td></tr><tr><td width="78">Username</td><td width="6">:</td><td width="294"><input name="myusername" type="text" id="myusername"></td></tr><tr><td>Password</td><td>:</td><td><input name="mypassword" type="text" id="mypassword"></td></tr><tr><td> </td><td> </td><td><input type="submit" name="Submit" value="Login"></td></tr><a href="register.php">Not a member? Join now!</a> </table></td></form></tr></table>login_successful.php// Check if session is not registered , redirect back to main page. // Put this code in first line of web page. <? session_start();if(!session_is_registered(myusername)){header("location:main_login.php");}?><html><body>Login Successful</body></html>
  3. Yea. I did installed everything accordingly... I been stuck on this error for 2 weeks... . I wasnt sure is it because the libraries in mysql is not turn on . *headache*
  4. Basically , i got my php 5.12 installed , using keyfocus and mysql.. When i start to test my database and run out the php i get this error :Fatal error: Call to undefined function mysql_connect() in C:\Program Files\KeyFocus\KFWS\htdocs\Logintest\checklogin.php on line 16Can anyone help me out in this? i need to finish my project Anyone can intro me some cool webbies for reference , currently doing a project on Business Management System. thanks a lot..
×
×
  • Create New...