Jump to content

Shadow_Walker

Members
  • Posts

    50
  • Joined

  • Last visited

Everything posted by Shadow_Walker

  1. Hello Guys, I have coded a successful log of accounts in localhost but when i uploaded this to webhost. These set of codes dont work anymore. Please help these are the codes. Student_login_handler.php include_once 'Connect.php'; $flag = ""; $learner_id = mysql_real_escape_string(htmlentities($_POST['learner_id'])); $student_password = mysql_real_escape_string(htmlentities($_POST['student_password'])); $student_id = htmlentities($_GET['id'], ENT_QUOTES); $student_id = htmlentities($_GET['id'], ENT_QUOTES); $query = "SELECT student_id,last_login_date FROM student_information WHERE learner_id='$learner_id' and student_password='$student_password'"; $result = mysqli_query($link_id, $query); if(mysqli_error() != null){ die(mysqli_error()); } if($date = mysqli_fetch_array($result)) { $lastdate = $date['last_login_date']; $date2 = date("d-m-Y h:i A",strtotime($lastdate)); $_SESSION['user_id'] = $date['student_id']; $_SESSION["lastlogin"] =$date2; $_SESSION["type"] = "Student"; mysqli_query("UPDATE student_information SET last_login_date=now() where student_id='{$_SESSION['user_id']}'",$link_id); if(mysqli_error() != null){ die(mysqli_error()); } header("location: Student_Home.php?id={$_SESSION['user_id']}"); die(); } else { $flag = "invalid"; header("location:Student_login.php?flag=$flag"); die(); } ?> Student_login.php <form name="form2" method="post" action="Student_login_handler.php" onSubmit="return validate();"> <tr> <td colspan="4"><table width="30%" border="1" align="center" cellpadding="3" cellspacing="0" bordercolor="#666666" bgcolor="#CCCCCC"> <tr align="center" bgcolor="#999999"> <td colspan="2" bgcolor="#99CC33" class="styleblock">Learner Login Here</td> </tr> <tr bgcolor="#E1E1E1" class="stylesmall"> <td width="35%" align="left" class="stylesmall">Learner Id : </td> <td width="65%" align="left"><input name="learner_id" type="text" id="learner_id" method="post"></td> </tr> <tr bgcolor="#E1E1E1" class="stylesmall"> <td align="left" class="stylesmall">Password:</td> <td align="left"><input name="student_password" type="password" id="student_password" method="post"></td> </tr> <tr bgcolor="#E1E1E1"> <td colspan="2" align="center"> <?php if(!empty($_GET['flag']) && $_GET['flag'] == "invalid") { ?> <span class="stylered">Invalid Learner Id or Password</span> <?php }?></td> </tr> <tr bgcolor="#E1E1E1"> <td colspan="2" align="center"> <p><input name="login" class="stylesmall" type="submit" id="login" value="Login"></p> Note: This perfectly function on localhost but not in webhosts. function: the user can log in to its user account problem: different user log in directed to same account Please anyone spare time for me.
×
×
  • 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.