My Script uses a Session ID Variable when verifying the user
You don't have a field setup for this.  So either change the code
in this section

 $timer = md5(time());
 $sid = $email . "+" . $timer;
 SetCookie("ElectrocutedClanRemains",$sid,time()+2592000);
 $query = "update members set sid=\"$timer\" where email=\"$email\"";

or Add to your DB
sid char(32)

(md5 always returns a 32 character long string)

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


----- Original Message -----
From: Cato Larsen <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 13, 2001 10:10 AM
Subject: Re: [PHP-DB] Member authentication with PHP and MySQL


> Arg...
>
> I get this error:
>
>
> Unable to update database. Please contact [EMAIL PROTECTED]
>
>
>
> Am I missing something in my DB?
>
> Fields in DB:
>
> id, email, password, name, loc, aim, icq, msn, yahoo, charname ,charsname,
> charnick, tit, lvl, picurl, born, appearance, charac, streng, bio, breed,
> prof, posn.
>
>
>
> This is the current source:
>
>
>
> <?php
>
> file://Put in your own info for username, password, DB, email@address,
> Cookiename,
> file://the name of this page (currently login.php) and the name of your
subscribe
> file://or new user page (currently new.php).  I went ahead and included
all the
> HTML
> file://so this page should work as is, with only the changes described
above
> needed
> // - Lysander ([EMAIL PROTECTED])
>
> $dblink = mysql_pconnect("localhost","Xephiroth","lordoftherings");
> mysql_select_db("members");
>
> $headers=0; file://Make Sure HTML Headers are in place before the form
>
>
> file://after Authenticating the script automatically sends the browser to
> file://the webpage of your choice (note if your page calls this
> file://script with ?redirect="foobar.php" it will automatically
> file://redirect to foobar.php after authenticating.  Set the default
> file://redirect page here
>
> if ( !isset($redirect))
>    {
>      $redirect = "default.php";
>    }
>
> if (isset($email) && isset($password)) {
>
>   $query = "select * from memberinfo where email = \"$email\" and password
=
> \"$password\"";
>
>   if ( !($dbq = mysql_query($query, $dblink))) {
>     echo "Unable to query database.  Please Contact <a
> href=\"mailto:[EMAIL PROTECTED]\";>[EMAIL PROTECTED]</a>.\n";
>     exit;
>   }
>
>   $lim = mysql_num_rows( $dbq );
>
>   if ($lim != 1) {
>
>   $headers=1; file://HTML headers in place
> echo "<html>";
> echo "<head>";
> echo "<title>Member logon</title>";
> echo "<meta http-equiv=\"Content-Type\" content=\"text/html;
> charset=iso-8859-1\">";
> echo "</head>";
> echo "<body bgcolor=\"#000000\" text=\"#FFFFFF\" leftmargin=\"0\"
> topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\"
> background=\"../images/back.gif\"  bgproperties=\"fixed\" link=\"#CCCCCC\"
> vlink=\"#CCCCCC\" alink=\"#CCCCCC\">";
> echo "<B>Invalid E-Mail adress and/or Password. Please Try again</B><BR>";
>
>   }
>
>   if ($lim == 1) {
>
> file://make unique session id and store it in Database
>   $timer = md5(time());
>   $sid = $email . "+" . $timer;
>   SetCookie("ElectrocutedClanRemains",$sid,time()+2592000); file://Set
Cookie for
> 30 days
>   $query = "update members set sid=\"$timer\" where email=\"$email\"";
>
>   if( !($dbq = mysql_query( $query, $dblink))) {
>     echo "Unable to update database.  Please contact <a
> href=\"[EMAIL PROTECTED]\">[EMAIL PROTECTED]</a>.\n";
>   exit;
>   }
>
>   $headers=1;
>   header("Location: $redirect");
>   exit;
>   }
>
> }
>
> if (isset($ElectrocutedClanRemains)) {
>   $headers=1; file://make sure HTML headers are in place before the form
>   $sidarray = explode("+", "$ElectrocutedClanRemains");
>   $query = "select * from memberinfo where email = \"$sidarray[0]\" and
sid
> = \"$sidarray[1]\"";
>
>   if ( !($dbq = mysql_query($query, $dblink))) {
>     echo "Unable to find database.  Please Contact <a
> href=\"mailto:[EMAIL PROTECTED]\";>[EMAIL PROTECTED]</a>.\n";
>     exit;
>   }
>
>   if (mysql_num_rows( $dbq ) == 1) {
> echo "<html>";
> echo "<head>";
> echo "<title>Member logon</title>";
> echo "<meta http-equiv=\"Content-Type\" content=\"text/html;
> charset=iso-8859-1\">";
> echo "</head>";
> echo "<body bgcolor=\"#000000\" text=\"#FFFFFF\" leftmargin=\"0\"
> topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\"
> background=\"../images/back.gif\"  bgproperties=\"fixed\" link=\"#CCCCCC\"
> vlink=\"#CCCCCC\" alink=\"#CCCCCC\">";
> echo "You are already logged in as $sidarray[0].<BR>";
> echo "You may logon as another user or simply begin using our services
with
> your current session.<BR>";
>   }
> }
>
> if ($headers == 0) {
> echo "<html>";
> echo "<head>";
> echo "<title>Member logon</title>";
> echo "<meta http-equiv=\"Content-Type\" content=\"text/html;
> charset=iso-8859-1\">";
> echo "</head>";
> echo "<body bgcolor=\"#000000\" text=\"#FFFFFF\" leftmargin=\"0\"
> topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\"
> background=\"../images/back.gif\"  bgproperties=\"fixed\" link=\"#CCCCCC\"
> vlink=\"#CCCCCC\" alink=\"#CCCCCC\">";
> }
>
> echo "<table width=\"846\" border=\"0\" cellspacing=\"0\"
> cellpadding=\"0\">";
> echo "<tr>";
> echo "<td width=\"80\" height=\"30\">&nbsp;</td>";
> echo "<td height=\"30\">&nbsp;</td>";
> echo "</tr>";
> echo "<tr>";
> echo "<td width=\"80\">&nbsp;</td>";
> echo "<td>";
> echo "<table width=\"766\" border=\"0\" cellpadding=\"0\"
> cellspacing=\"0\">";
> echo "<tr>";
> echo "<td colspan=\"3\">";
> echo "<div align=\"center\">";
> echo "<table width=\"766\" border=\"0\" cellspacing=\"0\"
cellpadding=\"0\"
> background=\"../images/middletop.gif\">";
> echo "<tr>" ;
> echo "<td width=\"8\"><img src=\"../images/left.gif\" width=\"8\"
> height=\"29\"></td>";
> echo "<td background=\"../images/middletop.gif\" align=\"left\"
> valign=\"middle\"><font color=\"#333333\"><b><font size=\"4\">Member Logon
> </font></b></font><font size=\"4\" face=\"Times New Roman, Times, serif\"
> color=\"#333333\">";
> echo "<b> </b></font></td>";
> echo "<td width=\"9\">";
> echo "<div align=\"right\"><img src=\"../images/right.gif\" width=\"8\"
> height=\"29\"></div>";
> echo "</td>";
> echo "</tr>";
> echo "</table>";
> echo "</div>";
> echo "</td>";
> echo "</tr>";
> echo "<tr>";
> echo "<td width=\"3\" background=\"../images/framev.gif\"><img
> src=\"../images/framev.gif\" width=\"3\" height=\"100%\"></td>";
> echo "<td bgcolor=\"#333333\" width=\"760\" align=\"center\"
> valign=\"middle\">";
> echo "<form name=\"auth\" method=\"post\" action=\"vault.php\">";
> echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\"
> cellpadding=\"0\">";
> echo "<tr>";
> echo "<td colspan=\"2\">Please enter your e-mail adress and password to
> access the supersecretandultracool members section:</td>";
> echo "</tr>";
> echo "<tr>";
> echo "<td width=\"50%\" align=\"right\" valign=\"middle\">E-Mail: </td>";
> echo "<td width=\"50%\" valign=\"middle\">";
> echo "<input type=\"text\" name=\"email\" size=\"45\">";
> echo "</td>";
> echo "</tr>";
> echo "<tr>";
> echo "<td align=\"right\" valign=\"middle\">Password: </td>";
> echo "<td valign=\"middle\">";
> echo "<input type=\"password\" name=\"password\" size=\"45\">";
> echo "</td>";
> echo "</tr>";
> echo "</table>";
> echo "<input type=\"submit\" name=\"Submit\" value=\"Login\">";
> echo "<Input Type=\"hidden\" Name=\"redirect\" Value=\"$redirect\">";
> echo "</form>";
> echo "</td>";
> echo "<td width=\"3\" background=\"../images/framev.gif\"><img
> src=\"../images/framev.gif\" width=\"3\" height=\"100%\"></td>";
> echo "</tr>";
> echo "<tr>";
> echo "<td height=\"3\"><img src=\"../images/blcorner.gif\" width=\"3\"
> height=\"3\"></td>";
> echo "<td height=\"3\" background=\"../images/frameh.gif\"><img
> src=\"../images/frameh.gif\" width=\"100%\" height=\"3\"></td>";
> echo "<td height=\"3\"><img src=\"../images/brcorner.gif\" width=\"3\"
> height=\"3\"></td>";
> echo "</tr>";
> echo "</table>";
> echo "</td>";
> echo "</tr>";
> echo "</table>";
> echo "</body>";
> echo "</html>";
> ?>
>
>
>
>
>
> Thanks for your support!
>
>
>
> Best Regards Cato
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to