--- In [email protected], "fremaje31" <[EMAIL PROTECTED]> wrote: > > I hope someone can help me with this issue. > > I'm working on this project with another person. They are away today > and I need to findout what happened. The login doesn't work. Below > is the php code. > > > > <? > include '../include/open_con.php'; > > if (session_is_registered("session_admin")){ > header('location: home.php'); > exit; > } > > if($_REQUEST["login"] == "1"){ > $error_msg=""; > if(trim($_REQUEST["username"])=="") > $error_msg .="- Enter valid user name."; > if(trim($_REQUEST["password"])=="") > $error_msg .=" <br>- Enter valid password."; > > if($error_msg==""){ > $sql="SELECT * FROM mbc_administrator WHERE username > = '".$_REQUEST["username"]."' and `password` = '".$_REQUEST > ["password"]."' AND status = 1 "; > > $query=mysql_query($sql)or die(mysql_error()); > > if(mysql_num_rows($query) > 0 ){ > $row=mysql_fetch_array($query); > $_SESSION["session_admin"]=$row["username"]; > $_SESSION["session_admin_id"]=$row["id"]; > $_SESSION["session_admin_type"]=$row["type"]; > if($_REQUEST["rem"] == "1"){ > @setcookie("cook_user_name", $row > ["username"], time() + 2419200); > @setcookie("cook_user_pass", base64_encode > ($row["password"]), time() + 2419200); > } > else{ > @setcookie("cook_user_name", "", time() + > 2419200); > @setcookie("cook_user_pass", "", time() + > 2419200); > } > header('location: home.php'); > }else{ > $error_msg .="- User Name or Password is > Incorrect."; > }// Inner If > } > }// > if(isset($_REQUEST["msg"])){ > $error_msg="- Please login first."; > } > > ########### Getting Info from Cookies ################### > if($_REQUEST["username"] == ""){ > if (isset($_COOKIE['cook_user_name'])) { > $user_name = $_COOKIE["cook_user_name"]; > $user_pass = base64_decode($_COOKIE > ["cook_user_pass"]); > $chkRem = "checked"; > } > } > else{ > $email = $_REQUEST["username"] ; > $chkRem = ""; > } > ############################## > ?> > > > > I'm getting this alert "Error: > - Please login first." > > I'm using the correct username and password. > > The login is not working for the users website as well. > > Please give me any suggesetions you might have. > > I'm open to paying someone to fix this issue for me. I need this > project finished yesterday. >
I suggest you read up on sessions, particularly session_start() and session_write_close() Greg
