Help needed with some code

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
countrydj
Forum Newbie
Posts: 5
Joined: Thu Oct 27, 2011 6:51 pm

Help needed with some code

Post by countrydj »

Hi Guys..

I am trying to get one of two codes to work:
Both codes work individually, but I want either of them to work.

These both work:

Code: Select all

if(getenv(REMOTE_ADDR) == $vars["admin ip"]){

Code: Select all

if($_REQUEST['passwd'] == "virgo"){
This doesn't work:

Code: Select all

if(getenv(REMOTE_ADDR) == $vars["admin ip"]) or if($_REQUEST['passwd'] == "virgo"){
Can anybody advise me what the above code should be?

Thanks,

John C
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Help needed with some code

Post by Celauran »

countrydj wrote:

Code: Select all

if (getenv(REMOTE_ADDR) == $vars["admin ip"] || $_REQUEST['passwd'] == "virgo") {
Hardcoding your password isn't a real good idea, though. Nor is storing your password in plaintext.
countrydj
Forum Newbie
Posts: 5
Joined: Thu Oct 27, 2011 6:51 pm

Re: Help needed with some code

Post by countrydj »

Hi Celauran..

That was quick !!!!

Thanks for taking the time to help me.
I should have known this but my mind is 'fuddled' at the moment.
Hardcoding your password isn't a real good idea, though. Nor is storing your password in plaintext.
I accept what you say.
However, I use my ip number to access the admin from my PC, but when I am away from my PC I need some way of accessing my admin.
Have you ay suggestions ???

John C
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Help needed with some code

Post by Celauran »

Salt your password, pepper it, hash it, and store it in a database.
countrydj
Forum Newbie
Posts: 5
Joined: Thu Oct 27, 2011 6:51 pm

Re: Help needed with some code

Post by countrydj »

Hi Celauren...

Many thanks for your reply.

It just shows how 'thick and behind the times' that I am.
I have never heard of this, but based on your advice, I will check it out AND use it.

Again, MANY THANKS...

John C
Post Reply