web2000 Posted May 15, 2006 Share Posted May 15, 2006 Hello,I am trying to create a script that basically looks for a session, if it is there it will write the session value in to a text box, if it isnt it will create one using a mixture of time and ip address.It doesnt work and im not to sure why, i am not a great PHP developerPlease can someone help me out hereThank you very muchif (CCGetSession("username");$shoppingcart->username->SetValue($username);else;$stamp = strtotime ("now");$username = "$stamp$REMOTE_ADDR";$username = str_replace(".", "", "$username");$shoppingcart->username->SetValue($username);CCSetSession("username", $username); Quote Link to comment Share on other sites More sharing options...
zq29 Posted May 15, 2006 Share Posted May 15, 2006 [code]<?phpif (CCGetSession("username")) { $shoppingcart->username->SetValue($username);} else { $stamp = strtotime("now"); $username = $stamp.$REMOTE_ADDR; $username = str_replace(".", "", "$username"); $shoppingcart->username->SetValue($username); CCSetSession("username", $username);}?>[/code] Quote Link to comment Share on other sites More sharing options...
trq Posted May 15, 2006 Share Posted May 15, 2006 Learn to indent your code and you might actually be able to see whats going on. Quote Link to comment Share on other sites More sharing options...
web2000 Posted May 15, 2006 Author Share Posted May 15, 2006 Sorry,I am a basic PHP developer.I have tried the modified code but with no luck.It doesn’t even give me errors it just display's a blank page Quote Link to comment Share on other sites More sharing options...
zq29 Posted May 15, 2006 Share Posted May 15, 2006 Are you experienced in another coding/scripting language then? Because OOP is [i]not[/i] a basic coding practice.A good idea when troubleshooting is to print selected variables to the screen so that you can see what data is being passed around. Quote Link to comment Share on other sites More sharing options...
trq Posted May 15, 2006 Share Posted May 15, 2006 [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]It doesn’t even give me errors it just display's a blank page[/quote]Of course it just displays a blank page. There are no echo() statements. What do you expect to see? Quote Link to comment Share on other sites More sharing options...
_will Posted May 15, 2006 Share Posted May 15, 2006 To help your session debugging, try using this to print all the session variables:[code]echo print_r($_SESSION);[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.