josh48202 Posted August 21, 2007 Share Posted August 21, 2007 does anyone know of a simple login script using mysql? iv tried a couple n i swore i saw one around here someone but couldnt find it. Quote Link to comment https://forums.phpfreaks.com/topic/65926-login-script/ Share on other sites More sharing options...
vijayfreaks Posted August 21, 2007 Share Posted August 21, 2007 Hi... For that you can store it in to "date time" and you can store it in format of "Y-m-d H:i:s" Or You can directly store via time() function and pass it into date('Y-m-d H:i:s',time_stamp) to retrieve date whatever entered.. for this keep field datatype as bigint.. Regards, Vijay Quote Link to comment https://forums.phpfreaks.com/topic/65926-login-script/#findComment-329552 Share on other sites More sharing options...
josh48202 Posted August 21, 2007 Author Share Posted August 21, 2007 oops my bad i meant data. sorry Quote Link to comment https://forums.phpfreaks.com/topic/65926-login-script/#findComment-329554 Share on other sites More sharing options...
josh48202 Posted August 22, 2007 Author Share Posted August 22, 2007 anyone? Quote Link to comment https://forums.phpfreaks.com/topic/65926-login-script/#findComment-330527 Share on other sites More sharing options...
andz Posted August 22, 2007 Share Posted August 22, 2007 /*********************************************/ /******** FUNCTION FOR CHECKING LOGIN ************/ <?php function checkLogin($username, $password) { $query = mysql_query("SELECT username, password FROM users_table WHERE username='$username' AND password='$password'); if (mysql_num_rows($result)) { return TRUE; } else { return FALSE; } } ?> /********END OF FUNCTION **************************/ <?php $username = $_POST['username']; $password = $_POST['password']; if ($_POST) { if (checkLogin($username, $password)) { echo 'You have loggedin'; } else { echo 'Login failed.'; } } ?> <form method="post" action="<?=$_SERVER['PHP_SELF']?>"> <input type="text" name="username"> <input type="password" password"> <input type="submit" name="login"> </form> Quote Link to comment https://forums.phpfreaks.com/topic/65926-login-script/#findComment-330666 Share on other sites More sharing options...
beboo002 Posted August 22, 2007 Share Posted August 22, 2007 <?php if($_POST["submit"]!="") { $link=mysql_connect("localhost","root",""); if(!$link) die("can not connect to mysql"); mysql_select_db("timesheet",$link); if($_POST["submit"]!="") { $username1=$HTTP_POST_VARS['username']; $password1=$HTTP_POST_VARS['password']; $sql="select * from login where username ='".$_POST['username']."' and password='".$_POST['password']."' "; $result=mysql_query($sql,$link); $row = mysql_fetch_array( $result ); $username = $row['username']; $password = $row['password']; if($username!=$username1 && $password!=$password1) { $msg="invalid username or password "; //z<hr> include "notmember.php"; // header("Location:memberlogin.php"); } if($username==$username1 && $password==$password1) { header("location:bookentry.php"); } } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/65926-login-script/#findComment-330673 Share on other sites More sharing options...
johlwiler Posted August 22, 2007 Share Posted August 22, 2007 If you are looking for a full fledge tutorial there is one on evolt.com by a guy named jpmaster77 his second edition is published now and it is a full featured login script. I followed it a few years ago when he published his first one. The second edition has more complex things like remember me feature admin tools and so on and so on. His first script is a little more simplier. I'm sure if you google evolt php login script jpmaster77 you should be able to find both. It will walk you through setting up the forms and query the database and everything it you go through it step by step as he has it laid out. Quote Link to comment https://forums.phpfreaks.com/topic/65926-login-script/#findComment-330677 Share on other sites More sharing options...
josh48202 Posted August 22, 2007 Author Share Posted August 22, 2007 thx guys il try them out n see if they work! =] Quote Link to comment https://forums.phpfreaks.com/topic/65926-login-script/#findComment-331393 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.