4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 Adding $ in front of variable
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
Kdawg
Senior WebHelper
Senior WebHelper


Joined: 21 Apr 2003
Posts: 153

PostPosted: Tue May 13, 2003 10:20 pm (20 years, 11 months ago) Reply with QuoteBack to Top

This is what im trying to do and I can figure it out, The variable $name = gruhn, I want to check if $name == $gruhn. How could i make it so it adds the $ on the front of the value of $name?
OfflineView User's ProfileFind all posts by KdawgSend Personal Message
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Wed May 14, 2003 2:08 pm (20 years, 11 months ago) Reply with QuoteBack to Top

Sorry but I don't understand your question. It seems simple enough, but I'm just not sure what you mean Smile. Could you rephrase? Wink

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
Kdawg
Senior WebHelper
Senior WebHelper


Joined: 21 Apr 2003
Posts: 153

PostPosted: Wed May 14, 2003 4:26 pm (20 years, 11 months ago) Reply with QuoteBack to Top

Ok, Il try to explain this better, although it is hard to explain. The variable $name contains the username, ex: gruhn. The variable $pass contains the password they entered. There is a variable for each user that contains there real password, like the variable $gruhn contains gruhns password, etc. If the name in $name is gruhn I want to see if $pass == $gruhn. If the name in $name is karlyn I want to see if $pass == $karyln without using an if statment for each one.
OfflineView User's ProfileFind all posts by KdawgSend Personal Message
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Wed May 14, 2003 4:39 pm (20 years, 11 months ago) Reply with QuoteBack to Top

Code:
if ($pass == $$name) {
  $correct_password = true;
}


Question

[The double $ sign is intentional Smile]

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
adam
Forum Moderator & Developer



Joined: 26 Jul 2002
Posts: 704
Location: UK

PostPosted: Wed May 14, 2003 4:56 pm (20 years, 11 months ago) Reply with QuoteBack to Top

$$name, eh? cool...though I think it would be better if the usernames/passwords were stored in arrays, would just be tidier.

________________________________
It's turtles all the way down...
OfflineView User's ProfileFind all posts by adamSend Personal MessageVisit Poster's Website
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Wed May 14, 2003 4:59 pm (20 years, 11 months ago) Reply with QuoteBack to Top

Yes, I have to agree with adam, storing passwords in such a way is crazy, unless you only have a few Smile.

If $name = 'Daniel' then $$name is the same as $Daniel
Nice, isn't it Razz

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
Kdawg
Senior WebHelper
Senior WebHelper


Joined: 21 Apr 2003
Posts: 153

PostPosted: Wed May 14, 2003 6:55 pm (20 years, 11 months ago) Reply with QuoteBack to Top

I only have 11 passwords plus they come out of a database so they have to be seperate.
OfflineView User's ProfileFind all posts by KdawgSend Personal Message
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot edit your posts in this forum.
You cannot delete your posts in this forum.
You cannot vote in polls in this forum.


Page generation time: 0.201858 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme