Single quoted variables don't get parsed in php [syntax=php]<script type="text/javascript"> <!--Invocation code--> var infobar=new informationbar() infobar.setContent('<?php if ($_SESSION['username']){ echo "Welcome $_SESSION['username']"; }else{ echo 'Welcome to GameCrayz! Pleas...
Your error is that sha1() creates a 40-byte password (40 characters in length) and you have a limit of 30 characters in the password field, thus cutting off 10 from the string. Until you fix that and register a new user, you will never be able to log in.
More of a question then a problem... Is there any reason that I might want to put a sessions check in a functions file to check if only an admin uses it? For clarification I will give an example. I'm creating an admin backend for a friend's website and I am checking if say: add_user.php and mod_user...
The only thing I see that could be happening is your query is failing or you are entering the wrong username and password...try changing your query in the valid_credentials functions to match the one below. [syntax=php] function valid_credentials($user, $pass){ $user = mysql_real_escape_string(htmle...
In which function is it not updating? I also notice that you aren't displaying any of the $errors[]. Perhaps there are some and you can't see them because of that.
mysql_error() and msql_error() are totally different. Did you try mysql_error in your add_user function like this: [syntax=php] <?php //Adds a user to the database. function add_user($user, $pass){ $user = mysql_real_escape_string(htmlentities($user)); $pass = sha1($pass); mysql_query("INSERT I...
Yes, you're going to have to change your form action to [syntax=php]<form action="?pid=<?php echo $_GET['pid']; ?>"[/syntax] Then your if(): [syntax=php]if (isset($_POST['title'], $_POST['body'], $_GET['pid'])){ edit_post($_POST['title'], $_POST['body'], $_GET['pid']); die(); }[/syntax] Th...
Remove the $pid = $_POST['id'] as it will always return blank because your form contains no field of id. Remove it from the if statement as well. I believe what you are looking for is $post['id'] for the function variable instead of $_POST['id']; However, to get this to work your form action will ne...
You are supposed to use $user_info = fetch_user_info($_SESSION['uid']); I'm not sure if that whitespace you added matters. It shouldn't. Looking back at what Temor said, I believe I see what they were talking about. [syntax=php] if (empty($errors)){ $grad = htmlentities($_POST['grad']); $drzava = ht...
Whatever column in the database you are using to store the user's uid (I believe it is just called uid) set the $_SESSION['uid'] with it. [syntax=php] if(mysql_num_rows($checklogin) == 1) { $row = mysql_fetch_array($checklogin); $_SESSION['Username'] = $username; $_SESSION['LoggedIn'] = 1; echo &quo...
That does not mean you are setting $_SESSION['uid'] Wherever you are processing the user login, if you do not see yourself setting $_SESSION['uid'] You need to.
All files already call each other. You can not call a file with functions twice because a function can not be redeclared, hence the error you are getting. You must remove that include you added to remove the error. Are you setting $_SESSION['uid'] when you log in your users? If not, you need to. I r...
The fetch_user_info function is gathering data from the user using their uid. Not their username, as your previously posted. Replace $_SESSION['Username'] with whatever their session uid is stored as. I'm not sure why you are setting their $_SESSION['uid'] to 1 in init.inc.php either as each user sh...