For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > May 2007 > Re: [PHP-DB] $_POST["mypassword"]; ***Undefined index: mypassword









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PHP-DB] $_POST["mypassword"]; ***Undefined index: mypassword
Chetanji

2007-05-14, 7:58 am


I corrected a small spelling error to make the situation more understandable.
Everything is the same I am stuck!
Thanks in Advance, Chetanji

Chetanji wrote:
>
>
>
> All the errors are gone but this nagging one. I am running a login script
> and getting this error...
>
> To bring the username and password into the processing script I am doing
> it this way, and having trouble.
> I have spent too many hours working on this one issue. Please help
> someone.
> Blessings, Chetan
>
> $myusername=$_POST["myusername"];
> $mypassword=$_POST["mypassword"];
>
> ::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::
::::::::::::::
> Notice: Undefined index: myusername in
> C:\Inetpub\wwwroot\AimsSite\docproedit\l
ogin.php on line 13
>
> Notice: Undefined index: mypassword in
> C:\Inetpub\wwwroot\AimsSite\docproedit\l
ogin.php on line 13
> ::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::
::::::::::::::
> The login script is simple HTML using.....
>
> <form name="Flogin.html" method="post" action="login.php">
> <input name="myusername" type="text" >
> <input name="mypassword" type="password" >
> <input type="button" value="submit" >
>
> Note: "Flogin.html is where you log on; login.php, the script below,
> processes the password and username."
>
> Here is the Code...
>
> <?php
> ob_start();session_start();
> / ****************************************
********
> *********Login.php Begin End************
> ****************************************
********/
> /**
> ** Process username 1st by md5, then Encrypt,
> ** then compare with appropiate password in DB.
> **/
>
> session_register("myusername"); session_register("mypassword");
> $db_name='aims site'; $tbl_name='docproedit'; $db_server='localhost';
> $db_user='root';
> $db_pass='somepass';$myusername=$_POST["myusername"];$mypassword=$_POST["mypassword"];
> $auth = false;
>
> //----Encrypting begins for username and password
> //----entered by the user on login page.
> $uname=$myusername;
> $pname=$mypassword;
> hashinput($uname,$pname);
>
> //----The hash function, which includes the encrypt function.
> function hashinput($uname,$pname){
> global $user; global $pass; global $uname; global $pname; global $p;
> $usrname=md5($uname);
> $passname=md5($pname);
>
> //----the Encrypt function.
> function Encrypt($string) {$Encryption = crypt(md5($string),
> md5($string));return $Encryption;}
> $user = encrypt($usrname);
> $p = encrypt($passname);
> }
>
> //----Connecting with DB, selecting array from DB to analyze.
> $linkID = mysql_connect($db_server, $db_user, $db_pass);
> mysql_select_db("$db_name", $linkID);
> $result = mysql_query("SELECT password FROM docproedit WHERE username =
> '$user'", $linkID);
> $pass = mysql_fetch_row($result);
> mysql_close($linkID);
>
> //----Based on the comparision of encryped "login" username
> //----against the permanent DB password, $auth is 1 if 'good' login, and 0
> if 'bad'.
> if ($pass[0] === $p) {
> $auth = true;
> if ($auth = 1) {
> echo "<meta http-equiv=\"Refresh\"
> content=\"0;url=http://localhost/aimssite/docproedit/welcome.html\">";
> return;
> }
> }
> return $auth;
>
> ob_end_flush();
>
> / ****************************************
********
> *************Function Loginphp End***************
> ****************************************
********/
>
>
>


--
View this message in context: http://www.nabble.com/PHP-to-md5-th....html#a10602633
Sent from the Php - Database mailing list archive at Nabble.com.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com