Hi,
I'm a newbie in php/mysql programming,really am.
I'm working on a web-site that allows registration and posterior
logging in. Already registered user logs in with valid username and
password. Username and password are validated against a MySQL database
of personal data that contains these fields among others.
This is done by means of a PHP script that redirects to a "page2.html"
(if user and password non-existent) OR it redirects to a
"page3.html",if username and password exist and match in the database.
Following is part of the code:
<?php
function RedirectURL($url)
{ // This calls javascript
$redir = "<script language=\"javascript\">location.href=\"$url\"</script>\n";
return $redir;
}
?> // got this function from the groups. thanks.
<?php
..
..
..
$query = "SELECT password FROM all_pers_data WHERE username =
'$loginID' ";
$result = mysql_query($query) or die
(RedirectURL('http://xxx.xxx.xxx.xxx:XXXX/ / /page2.html'));
$numentries = mysql_numrows($result); //Numero de filas
returned. mysql_close($link);
$correct_username = $loginID;
$correct_password = mysql_result($result,0,"password"); //assumming
there is only one match...
if (strcasecmp($correct_username,$loginID) ||
strcasecmp($correct_password,$loginPW) ) {
die(RedirectURL('http://xxx.xxx.xxx.xxx:XXXX/ / /page2.html'));
//loginID or password that do not match
}
else {
die(RedirectURL('http://xxx.xxx.xxx.xxx:XXXX/ /
/page3.html'));//ASSERT, print out info in .html page.
}
..
..
..
?>
My question is: how can I transfer the variable "$result" from my PHP
to the .html pages, so that I'm able to print out the info for the
existent user through page3.html. In other words, i would like to
re-use "$result" from the php/mysql query; this, in order to display
information about the successfully logged in user.
Any help or suggestions i will appreciate a lot. Thanks.
Ivan