hi,
when i try to log with a wrong account to mysql account, i get warning displayed. I would like to bypass these messages but also be able to know if something went wrong.
thanks
Moderators: macek, egami, gesf




if(isset($HTTP_POST_VARS["submit"])){//this var comes from the login form, the button should be named "submit"
$server="localhost";
$login="my_login";
$pass="xxxxxxx";
$database="jmontcer";
$table="foro_users";
$user = $HTTP_POST_VARS["user"];
$passwrd = $HTTP_POST_VARS["pass"];
$conection=mysql_connect($server,$login,$pass) or die("<h3>Couldn't connect to the database server</h3></BODY></HTML>");
mysql_select_db($database,$conection)or die ("<h3>Couldn't select database</h3></BODY></HTML>");
$sql = "SELECT user_id, username, user_password FROM ".$table." where username='$user' and user_password='$passwrd'";
$sql_result= mysql_query($sql,$conection) or die ("<h3>Couldn't select iformation</h3></BODY></HTML>");
if ($row = mysql_fetch_array($sql_result)){
do{
anything_you_want($row["user_id"],$row["username"]);
}while ($row = mysql_fetch_array($sql_result));
}else{
echo "No coincidences were found, try again please.";
}
mysql_close($conection); 
Users browsing this forum: No registered users and 1 guest