Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 06-13-2005, 05:37 PM IF statement trouble
feraira's Avatar
BeTheBand!

Posts: 350
Trades: 0
Hey guys... OK, heres the scenario:

You have a session when you log in
You have a $_GET['user']

You need to combine the 2... If your not logged in say you need to log in, if you select a user show that information, and if the $_GET['user'] is blank, only show that user (who is logged in)'s profile!

If you need code just ask!

Cheers in advance
feraira is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-14-2005, 01:05 AM
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
PHP Code:
if (!isset($_SESSION['userid'])) {
   
// you must login
}
else {
   if (isset(
$_GET['user'])) {
      
// display selected user
   
}
   else {
      
// display user who is currently logged in
   
}

Correct?
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 06-14-2005, 07:44 AM
feraira's Avatar
BeTheBand!

Posts: 350
Trades: 0
What does the isset function do? Here the code i have (it doesn't include the login thing at the moment, hopefully going to add that as soon as I know how!)
feraira is offline
Reply With Quote
View Public Profile
 
Old 06-14-2005, 08:09 AM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
isset() checks to see if a variable is set:

PHP Code:
 
 
echo isset($foo); //false
 
 
$foo 42;
 
 echo isset(
$foo); //true
 
 
unset($foo);
 
  echo isset(
$foo); //false 
It's main use is to check if there are any POST or GET variables that have been submitted, since on self submitting pages there may or may not be.
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 06-14-2005, 08:36 AM
feraira's Avatar
BeTheBand!

Posts: 350
Trades: 0
OK great, once again, thanks 0beron and other peeps! Hopefully get it sorted now! Thanks!
feraira is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to IF statement trouble
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.33892 seconds with 12 queries