Jump to content

mylogin - SOLVED


chriscloyd

Recommended Posts

my login form is not working hmm and it should be i dont see anythign wrong with it can someoen help me
it keeps sending me to the ?page=login

[code]<?php
session_start();
include("db.php");
if(isset($_POST['username'])){
$username = $_POST['username'];
$password = $_POST['password'];
if ($username == NULL){
$error = 1;
$reason = "You did not enter a username";
} else {
$error = 0;
}
if ($password == NULL){
$error = 1;
$reason = "You did not enter a username<br>";
} else {
$error = 0;
$password = md5($password);
}
if ($error = 0){
$check_info = mysql_query("SELECT * FROM users WHERE username = '$username' ");
$info = mysql_fetch_assoc($check_info);
if($info > 0){
if($info['password'] == $password){
$_SESSION['sirix'] = $username;
} else {
$error = 1;
$reason = "Your password and the account password did not match!";
}
if($info['level'] == "admin"){
$_SESSION['sirixadmin'] = $username;
}
}
header("Location: index.php?page=profile");
} else {
header("Location: index.php?page=login&reason=".$reason);
}
}
?>[/code]
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.