$_POST["mypassword"]; ***Undefined index: mypassword

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



To All a Welcome,

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\checklogin.php on line 12

Notice: Undefined index: mypassword in
C:\Inetpub\wwwroot\AimsSite\docproedit\checklogin.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 name of Login page script; login.php is name of script
below, processing the pass and user."

Here is the Code...

<?php
ob_start();session_start();
/************************************************
*********Function Login.php Begin End************  
************************************************/
/**
** Process username 1st by md5, then Encrypt,
** then compare with appropiate password in DB.                             
**/
//----Basic connecting $vars----
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);
if (!isset ($_POST['myusername']) ||($_POST['myusername'] !='myusername'))
{}else{} 
//----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-the-%24var-before-it-reaches-MySQL%27s-gen-query-log-tf3731340.html#a10599058
Sent from the Php - Database mailing list archive at Nabble.com.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux