Jump to content

Login Applicatins


steepe

Recommended Posts

$username = $_POST['username'];

$password = $_POST['password'];

  if(isset($username)){

  $conn = mysql_pconnect("localhost","root","");

mysql_select_db("useraccount");

//$sql = ;

//echo "sql = $sql";

  $result = mysql_query("SELECT * FROM userauth WHERE username = '$username' AND pswd = md5('$password')");

  $rows = mysql_fetch_assoc($result);

 

      if(is_array($rows)){

  session_start();

      $_SESSION['username'] = $rows['username'];

  echo "do_login: name =".$_SESSION['username'];

  //echo $rows['pswd'];

      if($_GET['p']){

    $page = $_GET['p'];

  }else{

    $page = "member.php";

  }

  //echo "page ".$page;

      header("Location: ./$page");

  }

  else

  {

    header("Location: ./fail.php");

  }

}

 

 

?>

 

utils.php

<?

session_start();

$array = explode('/', $_SERVER['SCRIPT_FILENAME']);

$page = array_pop($array);

//echo "page ".$page;

//echo "name =".$_SESSION['username'];

$username = $_SESSION['username'];

if(!$username){

    header("Location: login.php?p=$page");

?>

Link to comment
https://forums.phpfreaks.com/topic/74746-login-applicatins/#findComment-377887
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.