hey! bought , settled site long ago.. site facebook site people can add own or others. thought adding login system people can post username , make easier make posting-liking contests. have system - using http://www.evolt.org/node/60384
i tried add option in process file when session 'loggedin' code retrieves username , in other cases, 'anonymous'.
problem doesn't work :(
the code is:
$today = date("ymdhis"); $rand = $today.mt_rand().mt_rand().mt_rand(); $count = '0'; $type = 'picture'; $username = '<? if($session->logged_in){ echo "$session->username" } else { echo "anonymous" } ?>'; $sql = "insert `like` (`rand`, `like`, `count`, `created`, `youtube`, `type`,`username`) values ('$rand', '$like', 0, '$today', '$string', '$type', '$username')";
i first defined $username , 'told' script insert $username entry it's field.
the problem when try in real-time, field shows actual code; <? if($session->logged_in){ echo "$session->username" } else { echo "anonymous" } ?>
instead of desired output.
also, i've included session.php login in start of process document.
the session.php used along of other files available @ http://www.evolt.org/node/60384 without download.
p.s code used $username used on main page output username after logged in.. added 'anonymous' part myself.. cause not work..
the code post php, gets put side after parsed. never 'run'.
unless using sort of templating system parses code twice, don't mean this?
if($session->logged_in){ $username = $session->username; } else { $username = "anonymous" ; }
Comments
Post a Comment