Jump to content

Archived

This topic is now archived and is closed to further replies.

l!m!t

Please help PHP question

Recommended Posts


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!!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.