
Shadow_Walker
Members-
Posts
50 -
Joined
-
Last visited
Everything posted by Shadow_Walker
-
Will not echo the new user welcome paragraph
Shadow_Walker replied to Shadow_Walker's topic in PHP Coding Help
@quick old car: Your not helping and your making a dumb question. If you could analyze first before making a comment. You would understand that i want to know how to make it exist and to show it. -
Will not echo the new user welcome paragraph
Shadow_Walker replied to Shadow_Walker's topic in PHP Coding Help
@mac gyver: I dont really have a problem with the form. It's a form inside the table and the log in process works very well (the user who logged in the database if registered is directed to its profle and those who don't will be invalid and will stay in the log in page). The only problem is i wanted that on the upper left of the page they will be welcome like WELCOME 'user_id'. I need someone help for the PHP code so that 'student_id' will be identified in this code <?php if(isset($_POST['student_id'])) { echo 'Welcome, ' . $_POST['student_id']; } // $_POST['student_id'] does not exist, display a message else { echo 'Please provide Student ID!'; } ?> The present situation is the webpage will echo the ELSE part which is: Please provide Student ID! of course without the underline. -
Will not echo the new user welcome paragraph
Shadow_Walker replied to Shadow_Walker's topic in PHP Coding Help
here are the codes including the submit button found in login.php <tr bgcolor="#E1E1E1" class="stylesmall"> <td width="35%" align="left" class="style7 style1">Learner Id : </td> <td width="65%" align="left"> <form action="Student_Home.php" method="post"> <input name="student_id" type="text" id="student_id"> </form> </td> </tr> <tr bgcolor="#E1E1E1" class="stylesmall"> <td align="left" class="style7 style1">Password:</td> <td align="left"><input name="student_password" type="password" id="student_password"> </td> </tr> <tr bgcolor="#E1E1E1"> <td colspan="2" align="center"> <?php if(!empty($_GET['flag']) && $_GET['flag'] == "invalid") { ?> <span class="stylered style1">Invalid Login Id or Password</span> <?php }?> </td> </tr> <tr bgcolor="#E1E1E1"> <td colspan="2" align="center"> <form action="Student_Home.php" method="post"> <input name="login" class="style10" type="submit" id="login" value="Login"> </form> <p class="style1">New Learner?<a href="Student_Registration.php"> Register Here</a> </p> </td> </tr> here is also my login.php handler. <?php session_start(); include 'Connect.php'; $flag = ""; $student_id = $_POST['student_id']; $student_password = $_POST['student_password']; $query = "select last_login_date from student_information where student_id='$student_id' and student_password='$student_password' and student_status ='Disable'"; $result = mysql_query($query,$link_id); if(mysql_error() != null){ die(mysql_error()); } if($date = mysql_fetch_array($result)) { $lastdate = $date['last_login_date']; $date2 = date("d-m-Y h:i A",strtotime($lastdate)); $_SESSION["student_id"] = $_POST["student_id"]; $_SESSION["lastlogin"] =$date2; $_SESSION["type"] = "Student"; mysql_query("update student_information set last_login_date=now() where student_id='$student_id'",$link_id); if(mysql_error() != null){ die(mysql_error()); } header("location: Student_Home.php"); die(); } else { $flag = "invalid"; header("location:Student_login.php?flag=$flag"); die(); } ?> I am starting to feel ashame on this for your time but i need to forget it just to solve this problem of mine.. hope this info will help you analyze to help me more on this. Please help me again.. -
Will not echo the new user welcome paragraph
Shadow_Walker replied to Shadow_Walker's topic in PHP Coding Help
To Ch0cu3r, You've been a great help to me. I have followed your instructions and it went well. Your code is good but i have my problem--it echoes the ELSE_part. <?php if(isset($_POST['student_id'])) { echo 'Welcome, ' . $_POST['student_id']; } // $_POST['student_id'] does not exist, display a message else { echo 'Please provide Student ID!'; } ?> The webpage indicate Please provide Student ID. Literally it doesn't define found out the $_POST['student_id'] inspite that we have created it already on the Login.php <td width="35%" align="left" class="style7 style1">Learner Id : </td> <td width="65%" align="left"> <form action="Student_Home.php" method="post"> <input name="student_id" type="text" id="student_id"> </form> </td> Please help me again. -
Will not echo the new user welcome paragraph
Shadow_Walker replied to Shadow_Walker's topic in PHP Coding Help
@jacques: Yeah!! i have no problem with that.. For the number 3. it is a page where they can see their profile and on the upper left is a welcome message (Welcome 'user_id') and that is im referring to which i get stuck and have prob on the codes. -
Will not echo the new user welcome paragraph
Shadow_Walker replied to Shadow_Walker's topic in PHP Coding Help
To Ch0cu3r, I am very thankful for your immediate response. I will try that complete PHP tag later. I hope this time it will work, i'll update you then. -
Will not echo the new user welcome paragraph
Shadow_Walker replied to Shadow_Walker's topic in PHP Coding Help
To Jacques: Thank you for your insights. I have already done your suggestion that if the user can't log in, they will still remain in the form. They can only enter in Student_Home.php as long as they are already registered. The only problem left is after they logged-in (database registered user). I wanted that on the upper left of the page they will be welcome as Welcome 'user_id'. I am grateful for your advice in preventing the inject of malicious JavaScript code. I'll also add that in my code. Do you have any suggestions other than Ch0cu3r advice to welcome the user? -
Will not echo the new user welcome paragraph
Shadow_Walker replied to Shadow_Walker's topic in PHP Coding Help
Sorry im a beginner here. this is how i improved my codes in Login.php <tr bgcolor="#E1E1E1" class="stylesmall"> <td width="35%" align="left" class="style7 style1">Learner Id : </td> <td width="65%" align="left"> <form action="Student_Home.php" method="post"> <input name="student_id" type="text" id="student_id"> </form> </td> </tr> and in Student_Home.php i just copy and paste your code. <? if(isset($_POST['student_id'])) { echo 'Welcome, ' . $_POST['student_id']; } // $_POST['student_id'] does not exist, display a message else { echo 'Please provide Student ID!'; } ?> I have done thru this, there is no notifications but still doesn't work. Please help. -
Will not echo the new user welcome paragraph
Shadow_Walker replied to Shadow_Walker's topic in PHP Coding Help
I have resolved your first suggestion in the codes. Of course i edit my login.php On the second suggestion. May i ask to what file i'll insert your if-else code? -
Please any suggestion or comments here: Login.php <td width="65%" align="left"><input name="student_id" type="text" id="student_id" action="Student_Home.php" method="post"></td> Student_Home.php <blockquote> <p>Welcome <?php echo $_POST["student_id"];?> </p> </blockquote> OUTPUT: Welcome Notice: Undefined index: student_id in C:\xampp\htdocs\a\Student_Home.php on line 44 DESIRED OUTPUT: Welcome "student_id" !!!
-
Log in button won't direct to Home
Shadow_Walker replied to Shadow_Walker's topic in PHP Coding Help
+ Options student_id student_password first_name last_name registration_date gender date_of_birth student_status contact_no jenny 777 jenny hermoso 2014-03-02 Female 1980-11-24 Enable 09107757753 i have managed to edit some of my codes and i registered another student id "jenny" and password "777". It shows that she is "enable" on student status unlike the previous one..but still the said student can't log in using her id and password. -
Log in button won't direct to Home
Shadow_Walker replied to Shadow_Walker's topic in PHP Coding Help
ohh i'm, sorry jazzman. i got what you mean..can you teach me how to enable this disabled columns. so probably the problem is not in my codes.huh? -
Log in button won't direct to Home
Shadow_Walker replied to Shadow_Walker's topic in PHP Coding Help
Hello jazzman, From what column is that? is there any part of my codes need to be change and would you be more help if i have your suggested codes? Please. -
Log in button won't direct to Home
Shadow_Walker replied to Shadow_Walker's topic in PHP Coding Help
i already change the LINE 6 of Student_Registration_Handler.php from $st_pass = $_POST['student_password']; to $student_password = $_POST['student_password']; still Invalid Log in ID and password even it was entered correctly according to database. Please help.. -
Log in button won't direct to Home
Shadow_Walker replied to Shadow_Walker's topic in PHP Coding Help
i would like to send you the screenshot of my database so you can inspect it but i can't be able to post it here. can i email you? -
Log in button won't direct to Home
Shadow_Walker replied to Shadow_Walker's topic in PHP Coding Help
+ Options student_id student_password first_name last_name registration_date gender date_of_birth student_status contact_no grade LRN email1 email2 address description LRCFORM image last_login_date hanspeare 765632 hanspeare chavez 2014-02-27 Male 1982-01-18 Disable 09076317083 Grade 7 2011-81286 [email protected] [email protected] Purok 8, Poblacion, Prosperidad Agusan del Sur Enabled hanspeare_morn.jpg 2014-02-27 13:35:36 rodrigo 123 verger limas 2014-02-27 Male 2004-01-13 Disable 09081845678 Grade 7 2014-01 [email protected] mcsldkn@cwle cdslknwl cldnnls rodrigo_155291_1682944869284_1622405_n.jpg 2014-02-27 13:47:32 van van van dam 2014-02-27 Female 1989-01-18 Disable 09076789087 Grade 8 2011-01 [email protected] [email protected] ve geer rethe rhrhtr van_before.jpg 2014-02-27 14:32:16 jan jan fwfwe feawfrw 2014-02-28 Female 1996-12-12 Disable -
Log in button won't direct to Home
Shadow_Walker replied to Shadow_Walker's topic in PHP Coding Help
thank you mac_gyver, i will try it now. but in case it still doesn't run do you have any suggested codes to replace what i have? and what part i need to replace. Im very much sorry if this questions are novice. i am just new in PHP. -
Good Day PHP Freaks, I would like to ask help from all of you. It seems my Log-in button does not direct to Home (Student_Home.php). Student ID and password has been registered to database already. Here is the script for Student_login.php <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Login Page</title> <link rel="stylesheet" href="Style.css" type="text/css"/> <script type="text/javascript"> function validate() { if(document.form1.student_id.value=="") { alert("Please enter your login Id."); document.form1.student_id.focus(); return false; } if(document.form1.student_password.value=="") { alert("Please enter your password."); document.form1.student_password.focus(); return false; } } </script> <style type="text/css"> <!-- body { background-color: #0099FF; } --> </style></head> <body onLoad="javascript:document.form1.student_id.focus()"> <form name="form1" method="post" action="Student_login_handler.php" onSubmit="return validate();"> <table width="100%" height="100%" > <tr> <td height="15%"><?php include 'Header.php';?></td> </tr> <tr> <td width="100%" height="80%" align="center" valign="baseline"><table width="90%" > <tr> <td width="8%"><a href="index.php" class="stylelink" style="text-decoration:none; font-family: "Times New Roman", Times, serif;">Home</a></td> <td width="35%" align="center"> </td> <td width="27%"> </td> <td width="30%" align="right"><a href="Student_Registration.php" class="stylelink" style="text-decoration:none ; font-weight: bold;">New Student Click Here</a></td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <?php if(!empty($_GET['flag']) && $_GET['flag'] == "success") { ?> <tr> <td class="stylegreen" colspan="4" align="center">Congratulations! You Are successfully registered. You can use your Login Id and Password to login to your account.</td> </tr> <?php } else if(!empty($_GET['flag']) && $_GET['flag'] == "exists") { ?> <tr> <td class="stylered" colspan="4" align="center">This Login Id( <?=$_GET['student_id']?>) already exists.Please, try again with another Login Id</td> </tr> <?php }else if(!empty($_GET['flag']) && $_GET['flag'] == "error") { ?> <tr> <td class="stylered" colspan="4" align="center">Error while inserting data. Please, try again.</td> </tr> <?php } ?> <tr> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td colspan="4"><table width="30%" border="1" align="center" cellpadding="3" cellspacing="0" bordercolor="#CCCCCC" bgcolor="#CCCCCC"> <tr align="center" bgcolor="#999999"> <td colspan="2" bgcolor="#99CC33" class="stylebig">Student Login Here</td> </tr> <tr bgcolor="#E1E1E1" class="stylesmall"> <td width="35%" align="left" class="style7">Login Id : </td> <td width="65%" align="left"><input name="student_id" type="text" id="student_id"></td> </tr> <tr bgcolor="#E1E1E1" class="stylesmall"> <td align="left" class="style7">Password:</td> <td align="left"><input name="student_password" type="password" id="student_password"></td> </tr> <tr bgcolor="#E1E1E1"> <td colspan="2" align="center"> <?php if(!empty($_GET['flag']) && $_GET['flag'] == "invalid") { ?> <span class="stylered">Invalid Login Id or Password</span> <?php }?> </td> </tr> <tr bgcolor="#E1E1E1"> <td colspan="2" align="center"><input name="login" class="style10" type="submit" id="login" value="Login"> <input name="close" type="button" id="close" class="style10" value="Close" onClick="self.location='index.php'"> </td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td height="5%" align="center"><?php include 'Footer.php';?></td> </tr> </table> </form> </body> </html> ,,and here is the Student_login_handler.php. <?php session_start(); include 'Connect.php'; $flag = ""; $student_id = $_POST['student_id']; $st_pass = $_POST['student_password']; $query = "select last_login_date from student_information where student_id='$student_id' and student_password='$student_password' and student_status ='Enable'"; $result = mysql_query($query,$link_id); if(mysql_error() != null){ die(mysql_error()); } if($date = mysql_fetch_array($result)) { $lastdate = $date['last_login_date']; $date2 = date("d-m-Y h:i A",strtotime($lastdate)); $_SESSION['student_id'] = $_POST['student_id']; $_SESSION['lastlogin'] =$date2; $_SESSION['type'] = "Student"; mysql_query("update student_information set last_login_date=now() where student_id='$student_id'",$link_id); if(mysql_error() != null){ die(mysql_error()); } header("location:Student_Home.php"); die(); } else { $flag = "invalid"; header("location:Student_login.php?flag=$flag"); die(); } ?> It keeps saying "Invalid ID or password" Hope you can help me troubleshoot this..
-
To gizmola and jazzman 1,, That was a very big help,,i combine both of your ideas and find the best solution that fits,,and it turns out both of yours insights were right,, thank you so much guys and more power.. this problem is SOLVED until further discoveries as i go on to finish the whole information system
-
Hello Augury,, yes literally,, i f**ked it up.. it isn't easy being novice :-)
-
English please :-) does it mean i'll need to check another page or could be the index page and it should contain value???
-
what does it mean? how i need to solve it?
-
This is the handler. <?php session_start(); include 'Connect.php'; $flag = ""; $student_id = $_POST['st_id']; $st_pass = $_POST['st_pass']; $query = "select last_login_date from student_information where student_id='$student_id' and student_password='$st_pass' and student_status ='Enable'"; $result = mysql_query($query,$link_id); if(mysql_error() != null){ die(mysql_error()); } if($date = mysql_fetch_array($result)) { $lastdate = $date['last_login_date']; $date2 = date("d-m-Y h:i A",strtotime($lastdate)); $_SESSION['userid'] = $_POST['st_id']; $_SESSION['lastlogin'] =$date2; $_SESSION['type'] = "Student"; mysql_query("update student_information set last_login_date=now() where student_id='$student_id'",$link_id); if(mysql_error() != null){ die(mysql_error()); } header("location:Student_Home.php"); die(); } else { $flag = "invalid"; header("location:Student_login.php?flag=$flag"); die(); } ?>
-
Notice: Undefined index: flag in C:\xampp\htdocs\a\Student_login.php on line 47 Notice: Undefined index: flag in C:\xampp\htdocs\a\Student_login.php on line 53 Notice: Undefined index: flag in C:\xampp\htdocs\a\Student_login.php on line 58 What's wrong? <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Login Page</title> <link rel="stylesheet" href="Style.css" type="text/css"/> <script type="text/javascript"> function validate() { if(document.form1.st_id.value=="") { alert("Please enter your login Id."); document.form1.st_id.focus(); return false; } if(document.form1.st_pass.value=="") { alert("Please enter your password."); document.form1.st_pass.focus(); return false; } } </script> <style type="text/css"> <!-- body { background-color: #CCCCFF; } --> </style></head> <body onLoad="javascript:document.form1.st_id.focus()"> <form name="form1" method="post" action="Student_login_handler.php" onSubmit="return validate();"> <table width="100%" height="100%" > <tr> <td height="15%"><?php include 'Header.php';?></td> </tr> <tr> <td width="100%" height="80%" align="center" valign="baseline"><table width="90%" > <tr> <td width="8%"><a href="index.php" class="stylelink" style="text-decoration:none; font-family: "Times New Roman", Times, serif;">Home</a></td> <td width="35%" align="center"> </td> <td width="27%"> </td> <td width="30%" align="right"><a href="Student_Registration.php" class="stylelink" style="text-decoration:none ; font-weight: bold;">New Student Click Here</a></td> </tr> <?php if($_GET['flag'] == "success") { ?> <tr> <td class="stylegreen" colspan="4" align="center">Congratulations! You Are successfully registered. You can use your Login Id and Password to login to your account.</td> </tr> <?php } else if($_GET['flag'] == "exists") { ?> <tr> <td class="stylered" colspan="4" align="center">This Login Id( <?=$_GET['student_id']?>) already exists.Please, try again with another Login Id</td> </tr> <?php }else if($_GET['flag'] == "error") { ?> <tr> <td class="stylered" colspan="4" align="center">Error while inserting data. Please, try again.</td> </tr> <?php } ?> <tr> <td colspan="4"><table width="30%" border="1" align="center" cellpadding="3" cellspacing="0" bordercolor="#CCCCCC" bgcolor="#CCCCCC"> <tr align="center" bgcolor="#999999"> <td colspan="2" class="stylebig">Student Login Here</td> </tr> <tr bgcolor="#E1E1E1" class="stylesmall"> <td width="35%" align="left" class="style7">Login Id : </td> <td width="65%" align="left"><input name="st_id" type="text" id="st_id"></td> </tr> <tr bgcolor="#E1E1E1" class="stylesmall"> <td align="left" class="style7">Password:</td> <td align="left"><input name="st_pass" type="password" id="st_pass"></td> </tr> <tr bgcolor="#E1E1E1"> <td colspan="2" align="center"> <?php if($_GET['flag'] == "invalid") { ?> <span class="stylered">Invalid Login Id or Password</span> <?php }?> </td> </tr> <tr bgcolor="#E1E1E1"> <td colspan="2" align="center"><input name="login" class="style10" type="submit" id="login" value="Login"> <input name="close" type="button" id="close" class="style10" value="Close" onClick="self.location='index.php'"> </td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td height="5%" align="center"><?php include 'Footer.php';?></td> </tr> </table> </form> </body> </html>