Hi all, please note that i have the following code: please note that i dont have data base as i have only few people so i want to add them inside the code:
I have 2 files the first one is:
<body>
<html>
<form action="userpass.php" method="post">
Username:
<input type="text" name="username" />
<br />
Password:
<input type="text" name="password" /> <br/>
<input type="submit" value="submit" />
<action="action.html">
</form>
</body>
</html>
the file above is working fine and the issue with the code below:
the userpass.php file code is:
<?php
$username = "alaa";//change it to posted user name
$pass = "alaa"; // change it to posted pass
$users = array("alaa"=>"alaa","ahmad"=>"aaa","soso"=>"22");
//this func to see if there is user with this name
if(array_key_exists("alaa",$users))
{
//this to look if pass related to user
foreach($users as $key => $value)
{
if($key =="alaa" and $value == "55")
{
echo "welcome111111"; // here you can make redirect or any thing
}
}
}
else{
echo "you are not registered";
}
?>
please note that i have enter soso as username and 22 as password but it seems the func is not working (welcome111111) so would you please let me know if the code above is correct ?
Thanks and have a nice day
P.S my friend help me to write the code above but still i didnt understand it
thanks alot i have updated my code and everything is ok only one thing that i want to add HTML table instead of (echo "you are in"
would you please let me know how and should i add the table in the html file and add seomthing there so it will recited to the html file ?
I have 2 files the first one is:
<body>
<html>
<form action="userpass.php" method="post">
Username:
<input type="text" name="username" />
<br />
Password:
<input type="text" name="password" /> <br/>
<input type="submit" value="submit" />
<action="action.html">
</form>
</body>
</html>
the file above is working fine and the issue with the code below:
the userpass.php file code is:
<?php
$username = "alaa";//change it to posted user name
$pass = "alaa"; // change it to posted pass
$users = array("alaa"=>"alaa","ahmad"=>"aaa","soso"=>"22");
//this func to see if there is user with this name
if(array_key_exists("alaa",$users))
{
//this to look if pass related to user
foreach($users as $key => $value)
{
if($key =="alaa" and $value == "55")
{
echo "welcome111111"; // here you can make redirect or any thing
}
}
}
else{
echo "you are not registered";
}
?>
please note that i have enter soso as username and 22 as password but it seems the func is not working (welcome111111) so would you please let me know if the code above is correct ?
Thanks and have a nice day

P.S my friend help me to write the code above but still i didnt understand it
thanks alot i have updated my code and everything is ok only one thing that i want to add HTML table instead of (echo "you are in"

would you please let me know how and should i add the table in the html file and add seomthing there so it will recited to the html file ?