Jump to content


Admin Login


9 replies to this topic

#1 Crofty

    Young Padawan

  • Members
  • Pip
  • 32 posts

Posted 27 August 2006 - 02:37 PM

Hey, i have made a login script and so far its knows when people sign in but i want to be able to know when the admin logs in.

at the moment i am using this

if (isset($_SESSION['s_username']))


#2 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 27 August 2006 - 02:40 PM

I'm assuming you're using a database to keep track of registered users? If so, just add a user_level/admin field, and give it a special value if the user is an admin. The select that when you select the rest of the user info, and use it to see if a user is an admin.

#3 Crofty

    Young Padawan

  • Members
  • Pip
  • 32 posts

Posted 27 August 2006 - 03:02 PM

yeah ok that sounds like it will work thanks for the advice

#4 Demonslay

    P2L Jedi

  • Members
  • PipPipPip
  • 970 posts
  • Gender:Male
  • Location:A strange world where water falls out of the sky... for no reason.
  • Interests:Graphic Design, Coding, Splinter Cell, Cats

Posted 27 August 2006 - 06:08 PM

Try not to make it something like 'admin=yes' or 'level=1' or someone could try some simple SQL hacks.
Just be sure to make your querys very secure anyways. :huh:

#5 coolaid

    P2L Jedi Master

  • Members
  • PipPipPipPip
  • 1,435 posts
  • Gender:Male
  • Interests:i wonder..

Posted 28 August 2006 - 12:01 AM

Quote

'admin=yes' or 'level=1'
isn't all sql like that.... besides, if they can do some simple sql hack, then your not doing your part as a programmer :)

#6 Crofty

    Young Padawan

  • Members
  • Pip
  • 32 posts

Posted 28 August 2006 - 09:39 AM

well what is the safest way of doing it

#7 Demonslay

    P2L Jedi

  • Members
  • PipPipPip
  • 970 posts
  • Gender:Male
  • Location:A strange world where water falls out of the sky... for no reason.
  • Interests:Graphic Design, Coding, Splinter Cell, Cats

Posted 28 August 2006 - 03:16 PM

Ya I know, lol, just bringing up a point. If he has it very secure it wouldn't matter, but I wouldn't make it obvious just incase there is some flaw I didn't know of. :(

#8 Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 28 August 2006 - 04:35 PM

Do a really long code sort of password thing no will will guess. like K0eeE2R442b1258F816kwqs154eyt6546B46qawe6jy

:(

#9 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 28 August 2006 - 10:22 PM

If you know half of what you're doing, you're password will end up that way anyway (it's called encryption, md5() look it up :P).

The safest way to do it would be the easiest way (user_level = 1, or what ever). Just make sure you use mysql_real_escape_string() on the query to get the user info, and make sure you declare what ever variable will contain the extracted user info so as to prevent hacking via register globals.

#10 Crofty

    Young Padawan

  • Members
  • Pip
  • 32 posts

Posted 29 August 2006 - 09:50 AM

ok thanks for the advice my password where already encrypted into md5 hashes lol and yeah my admin verifying is now ok i think lol soon find out

thanks for the help





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users