Closed Thread Icon

Topic awaiting preservation: Login PHP/mySQL (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12526" title="Pages that link to Topic awaiting preservation: Login PHP/mySQL (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Login PHP/mySQL <span class="small">(Page 1 of 1)</span>\

 
Genevieve
Paranoid (IV) Inmate

From: Santa Clara, CA, USA
Insane since: Jul 2002

posted posted 11-25-2002 21:28

Hi everyone! I've been searching and searching but can't seem to find what I'm looking for so I thought I'd ask here.

My database looks like this:

User
userID(PK)
password
usertype (S/SA/A/Ad) S for student, SA for system administrator, A
for advisor, AA advisor administrator


Student
studentID (PK)
password
lastname
firstname
major
year
transfer (Y/N)
email
[phone]


Advisor
userID (PK)
password
lastname
firstname
speciality
email


Appointment
advisor (PK)
begintime (PK)
endtime
[studentID]
[appointmenttype]
[advisorcomment]

and I need to use PHP on my login (Username and Password) to connect to the database, search it for that username, check the password, see if it is a student or advisor (if student, send to one page, if advisor, send to another and if neither send to another page).

Does that make sense?

Any help would be very much appreciated.

Thanks!
Genevieve

Genevieve

Wowzers! o.O

Visit my cell! 754

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 11-25-2002 22:33

Are you using this with password protection?

Here's here's a nice little password script from zend.

It doesn't do any checking though you are going to have to do that code yourself.

I've used this and wrapped it up in a class you can use if you want.
You can find that here

It would take some tweaking but not much. Lemme document it a bit. Take a look and see if that's what you need. It does support multiple level checking.



.:[ Never resist a perfect moment ]:.

butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 11-25-2002 22:47

Hi Genevieve

You would basically run a SELECT statement something like this:

$sql = "SELECT * FROM User WHERE userID = '$id' AND password = '$password'";
$result = mysql_query($sql, $link);

Then you can use mysql_num_rows() to see if anything was returned. If mysql_num_rows() returns 0 then the user is not authenticated and can be redirected to another page or given an error message and asked to try again. If mysql_num_rows() returns anything greater than 0 the user can be logged in and you can check the other variables to direct them to the proper page according to student or advisor.

if (mysql_num_rows($result) > 0) {

while ($rows = mysql_fetch_array($result)) {

//break your db fields into variables here

}
else {

//redirect or send sorry user name and pass not found message here
}

Then you can do your checks here to see if it's an advisor or a student and send them off to the proper page.

Hope this helps!





-Butcher-

Genevieve
Paranoid (IV) Inmate

From: Santa Clara, CA, USA
Insane since: Jul 2002

posted posted 11-26-2002 03:41

Thanks! Both are helpful. I'll tweak 'em around and see what I can do.

Thanks guys!

Genevieve

Wowzers! o.O

Visit my cell! 754

« BackwardsOnwards »

Show Forum Drop Down Menu