Jump to content

password Login


Jay2391

Recommended Posts

I have a DB call " users " and i have table call "userinfo" and "email" is the primary key password is MD5 encryption

before i copy the code my issue is that it dosen't authenticate i get a t_Variable error in line 10

and i enter my password and email in a hTML page that send the info to this page ... I tested that pasrt and it echos the right info...

can you see what an i doing wrong...

<?php
session_start();
include("loginfo.php");
$table = 'userinfo';
$email = $_POST['email'];
$password = md5($_POST['password']);
$wtd = "relogin";

if($wtd == "relogin"){
 
mysql_pconnect ($host, $user, $pass);
            mysql_select_db ($database);

$query = "SELECT password FROM $table WHERE email='$email' ";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
 
  if($password == $row['password']){
  echo "You sre loged In";
  }else{
  echo "Not loged in";
  }
}
?>


Link to comment
https://forums.phpfreaks.com/topic/30684-password-login/
Share on other sites

Under certain conditions it is, if you are running php as cgi, then it's not.

from http://www.php.net/mysql_pconnect:
[quote]Note, that these kind of links only work if you are using a module version of PHP[/quote]

Read this page for more details:

http://us3.php.net/manual/en/features.persistent-connections.php

Did you even try the code that I gave you?  Assuming that your code is exactly as you posted it, then you are getting the error on that line (the mysql_pconnect that is not assigned to a variable).  If you haven't tried it, do so.  If you have, are you still getting an error?
Link to comment
https://forums.phpfreaks.com/topic/30684-password-login/#findComment-141387
Share on other sites

no all i get is not logged in ...

???

here is what i have


<?php
session_start();
include("loginfo.php");
$table = 'userinfo';
$email = $_POST['email'];
$password = md5($_POST['password']);
$wtd = "relogin";
       
           
            if($wtd == "relogin"){
 
$tc = mysql_connect ($host, $user, $pass);
            $db = mysql_select_db ($database, $tc);

$query = "SELECT password FROM $table WHERE email='$email' ";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
 
  if($password == $row['password']){
  echo "You sre loged In";
  }else{
  echo "Not loged in";
  }
}
?>
Link to comment
https://forums.phpfreaks.com/topic/30684-password-login/#findComment-141390
Share on other sites

Add in error checking and an echo to see what the value of $row['password'] is...

[code]<?php
session_start();
include("loginfo.php");
$table = 'userinfo';
$email = $_POST['email'];
$password = md5($_POST['password']);
$wtd = "relogin";


if ($wtd == "relogin") {
$tc = mysql_connect($host, $user, $pass) or die(mysql_error());
$db = mysql_select_db($database, $tc) or die(mysql_error());

$query = "SELECT password FROM $table WHERE email='$email'";
$result = mysql_query($query) or die(mysql_error());

$password_check = mysql_result($result, 0);

if ($password == $password_check) {
echo "You are logged in";
} else {
echo "Not logged in: <br />submitted password md5: $password<br />stored password md5: $password_check";
}
}
?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/30684-password-login/#findComment-141393
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.