473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Log In Student With Unique Id

Good day Admins,

I have now variables

$learner_id
$student_pasword

The learner_id and student_password are being used as their log in accounts. While the student_id is being used as their unique id and it is auto-incremented.

Here are my codes.

Student_login_handler.php

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. session_start();
  3. include 'Connect.php';
  4. $flag = "";
  5. $learner_id = $_POST['learner_id'];
  6. $student_password =  $_POST['student_password'];
  7. $query = "select last_login_date from student_information where learner_id='$learner_id' and student_password='$student_password'";
  8. $result = mysql_query($query,$link_id);
  9. if(mysql_error() != null){
  10. die(mysql_error());
  11. }
  12. if($date = mysql_fetch_array($result))
  13. {
  14. $lastdate = $date['last_login_date'];
  15. $date2 = date("d-m-Y h:i A",strtotime($lastdate));
  16. $_SESSION["user_id"] = $_POST["student_id"];
  17. $_SESSION["lastlogin"] =$date2;
  18. $_SESSION["type"] = "Student";
  19. mysql_query("UPDATE student_information SET last_login_date=now() where student_id='$GET[id]'",$link_id);
  20. if(mysql_error() != null){
  21. die(mysql_error());
  22. }
  23. header("location:  Student_Home.php?id={$student_id}"); 
  24. die();
  25. }
  26. else
  27. {
  28. $flag = "invalid";
  29. header("location:Student_login.php?flag=$flag");
  30. die();
  31. ?>
  32.  
Here is my Student_login.php

Expand|Select|Wrap|Line Numbers
  1. <td width="35%" align="left" class="style7 style1">Learner Id : </td>
  2.            <td width="65%" align="left"><input name="learner_id" type="text" id="learner_id" action="Student_Home.php" method="post"></td>
  3.         </tr>
  4.         <tr bgcolor="#E1E1E1" class="stylesmall">
  5.            <td align="left" class="style7 style1">Password:</td>
  6.            <td align="left"><input name="student_password" type="password" id="student_password"></td>
  7.         </tr>
  8.         <tr bgcolor="#E1E1E1">    
  9.            <td colspan="2" align="center">&nbsp;
  10.              <?php if(!empty($_GET['flag']) && $_GET['flag'] == "invalid") { ?>
  11.              <span class="stylered style1">Invalid Learner Id or Password</span>
  12.              <?php }?></td>
  13.         </tr>
  14.         <tr bgcolor="#E1E1E1">
  15.            <td colspan="2" align="center">
  16.                 <p><input name="login" class="style10" type="submit" id="login" value="Login"></p> 
  17.  
This is so far what i've got and it's wrong. Help me to modify this gentlemen to achieve the objectives given above.

It directs me to URL
http://localhost/a/S...nt_Home.php?id=

which i expect to be

http://localhost/a/S..._Home.php?id=51 (51 is the auto-incremented student_id, bears unique id of student)

Please help me modify the codes.
Jun 29 '14 #1
2 1496
There is no need to redirect to different URL, just set a session for this studentid.
Jun 29 '14 #2
Hello android app,

i suppose your not only that android app. Maybe that is what i am missing.

I would be delighted if you help me to make that session and declared that student_id variable.

Please modify my codes. I dont really have an idea where to start with that except for what i have posted.
Please :-(
Jun 30 '14 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: rakesh | last post by:
Hi I have a form which displays the rows from the table. The table does not have a unique index.It has the following columns: studentname todate fromdate location Now a particular...
8
by: ChrisMac | last post by:
Greetings, I have a database that keeps track of students grades (and lots of other info)for a non-profit training center. I have created an access database to track all of the student's...
5
by: Newton | last post by:
Hi, I got here the following problem. I am programming web application for examing students. After student will log on I need to keep his ID, Privileges, Login, Password for manipulating with...
1
by: Muhammad Usman | last post by:
hi, I have a table of student which contain four fields that are id(primary key number) , name(text),semester(text)and corse(text), When I insert values in a student table.Explorer Show the...
2
by: Benjamin Smith | last post by:
I have two tables like following: create table attendancereport ( id serial unique not null, staff_id integer not null references staff(id), schoolyear varchar not null references...
2
by: rcamarda | last post by:
I've been trying to solve this problem for better of 4 days: We summarize registrations of students on a daily basis, however they are net changes. Example: A student registers one class for...
3
by: Suyash Upadhyay | last post by:
Hi all, I want to ask whether MySQL also treat two NULL values as different values like Oracle. I write following commands but MySQL generate NULL value for all enrollment no field...
0
by: Bijoy Thangaraj | last post by:
Hello Programmers, If you are passionate about Technology and looking for a unique opportunity to share that talent, we are looking for you. If you are a college student from India, download...
4
by: kdubble | last post by:
Hi I am trying to get the results of a query to show only unique student records (not duplicates). Is there a simple way to make the criteria field do this? I am not too familiar with SQL. ...
0
by: DesperateStdnt | last post by:
Basically, the program needs to take a data set of X (i.e. 80) students and assign them them into Y (i.e. 10) groups. Then assign Y (i.e. 10) number of faculty members, one to each group. But,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.