Ok... On my website, I have a login form that submits the information through POST to a php page, but my problem is that my php page is not getting the POST information. I know my form is sending the information, but the php page gets "" strings. My code is here:
[PHP]
<?php
$GLOBALS['username'] = ucfirst(strtolo wer($POST['Username']));
$GLOBALS['password'] = $POST['Password'];
@mysql_connect( "mysql3.freehos tia.com", "jonaxt3_genera l", "mellon") or die("Cannot Connect To DB!");
@mysql_select_d b("jonaxt3_gene ral") or die("Cannot Select DB!");
$sql = 'SELECT id FROM users WHERE username=\''
.
$GLOBALS['username']
.
'\' and password=\''
.
$GLOBALS['password']
.
'\'';
$r = mysql_query($sq l);
if(!$r) {
$err=mysql_erro r();
print $err;
exit();
}
if(mysql_num_ro ws($r)==0){
print "no such login in the system. please try again.";
echo "<br>Userna me: " . $POST['Username'];
echo "<br>Passwo rd: " . $POST['Password'];
exit();
}
else{
echo "Congrats!" ;
//proceed to perform website’s functionality – e.g. present information to the user
}
?>
[/PHP]
I know it is not very secure, but it is a work in progress, and I plan to add that later.
[PHP]
<?php
$GLOBALS['username'] = ucfirst(strtolo wer($POST['Username']));
$GLOBALS['password'] = $POST['Password'];
@mysql_connect( "mysql3.freehos tia.com", "jonaxt3_genera l", "mellon") or die("Cannot Connect To DB!");
@mysql_select_d b("jonaxt3_gene ral") or die("Cannot Select DB!");
$sql = 'SELECT id FROM users WHERE username=\''
.
$GLOBALS['username']
.
'\' and password=\''
.
$GLOBALS['password']
.
'\'';
$r = mysql_query($sq l);
if(!$r) {
$err=mysql_erro r();
print $err;
exit();
}
if(mysql_num_ro ws($r)==0){
print "no such login in the system. please try again.";
echo "<br>Userna me: " . $POST['Username'];
echo "<br>Passwo rd: " . $POST['Password'];
exit();
}
else{
echo "Congrats!" ;
//proceed to perform website’s functionality – e.g. present information to the user
}
?>
[/PHP]
I know it is not very secure, but it is a work in progress, and I plan to add that later.
Comment