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
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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.