Jump to content

login script


josh48202

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/65926-login-script/#findComment-329552
Share on other sites

/*********************************************/

/******** 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>

Link to comment
https://forums.phpfreaks.com/topic/65926-login-script/#findComment-330666
Share on other sites

<?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");

}

}

}

 

?>

Link to comment
https://forums.phpfreaks.com/topic/65926-login-script/#findComment-330673
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/65926-login-script/#findComment-330677
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.