Jump to content


Photo

Please help PHP question


  • Please log in to reply
2 replies to this topic

#1 l!m!t

l!m!t
  • Members
  • PipPipPip
  • Advanced Member
  • 50 posts

Posted 26 September 2006 - 06:17 AM


Hello I am just learning PHP I am trying modify some login code to allow me in if my variables match. Basically I have this

        if ($check_customer['level'] == 2 ) {
          $HTTP_GET_VARS['login'] = 'invalid';
    $messageStack->add('login', TEXT_NOT_APPROVED);
        } else {

but want it so if I am level 2 and my IP = xxx xxxx xxx to let me in

example

        if ($check_customer['level'] == 2 ) {
          $HTTP_GET_VARS['login'] = 'invalid';
    $messageStack->add('login', TEXT_NOT_APPROVED);
        } else {
  if ($_SERVER['REMOTE_ADDR'] != 123.12.124.23 && $row['level'] == 2 ){ LET ME IN

Im not sure if its formatted correctly, but maybe someone can help me I have been on this for 24 hours any help would be great.

I just need it to approve me if I am level 2 and if my IP matches, but in needs to deny everyone who is just level 2

Even if you have some example codes I can probably figure it out.

Thanks for your time!!


#2 steveclondon

steveclondon
  • Members
  • PipPipPip
  • Advanced Member
  • 161 posts

Posted 26 September 2006 - 07:13 AM

One thing to keep in mind with this is that even if you are on broadband you do not always get your own ip address. Providers normally give you an ip address on connection and this can change. Unless you know 100% for sure that you always have the same ip address on different connections I would not use this method. Also you can have more than one user using the same ip address.



#3 l!m!t

l!m!t
  • Members
  • PipPipPip
  • Advanced Member
  • 50 posts

Posted 26 September 2006 - 10:04 AM


Hi thanks for the info I am acutally using a database option where I can update the address each time. I was just trying to keep the code simple read.

Thanks for the reply!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users