
benjahnee
Members-
Posts
24 -
Joined
-
Last visited
benjahnee's Achievements

Member (2/5)
0
Reputation
-
when there is a user logged in they should be directed to members.php but even when logged in i get redirected to login.php instead of members.php, how do i fix this? im new aswell so try and make it simple for me <?php require('connect.php'); $sesuser = @$_SESSION['username']; $username = @$_POST['username']; $password = @$_POST['password']; $submit = @$_POST['submit']; if ($sesuser) { header( 'Location: members.php' ) ; } else { header( 'Location: login.php' ) ; } ?>
-
thanks alot il give it a shot
-
thats fine about email sorry i wasnt very clear.. i need it to sumhow display what actual numbers have been guessed, as well as how many guesses have been made?
-
oh one more thing paul ryan could you show me what code to add so that it displays what numbers have been guessed please thanks a bunch
-
paul ryan u sir are my hero are u open to giving me ur email so i could discuss problems i may have with u in the future? i wont pester you all the time i promise
-
ok i have tried some code but i have an error on the first line. could someone please tell me how to fix it. the error is Parse error: syntax error, unexpected '=', expecting ',' or ')' in F:\EasyPHP-12.1\www\scripting\guessinggame.php on line 1 and my code is <?phpif(isset($_POST['guess'])){if(!isset($_SESSION['life']=1);else if($_SESSION['life']==7){echo "Your Life end<br>Thanks for playing<br>";unset($_SESSION['life']);}else$_SESSION['life']++;$guess=intval($_POST['guess']);$secret=rand(1,10);if($guess==$secret){$output="<h1>Correct!</h1>";$output .="<a href='guessinggame.php'>Play again</a>";unset($_SESSION['life']);}elseif($guess<$secret){$output.="<h1>Your answer was too low. Please try again!";}else{$output.="<h2>Your answer was too high. Please try again!</h2>";}}?> [code/] any ideas???
-
hello guys i have some guessing game code that works fine i just need a few things adding to it that i dont know how to do if some body could please show me how. its just a simple number game where the user has to keep guessing numbers between 1 and 10 till they get it right. could somebody please how me how to add to the code so that. - there is a counter that tells the user how many guesses they have had. - the program stops at 7 guesses. thanks guys my code is if(isset($_POST['guess'])) { $guess = intval($_POST['guess']); $secret = intval($_POST['secret']); $output = ""; if($guess == $secret) { $output .= "<h1>Correct!</h1>"; $output .= "<a href='guessinggame.php'>Play again</a>"; } elseif($guess < $secret) { $output .= "<h1>Your answer was too low. Please try again!"; } else { $output .= "<h2>Your answer was too high. Please try again!</h2>"; } } ?>
-
hi guys i have created my first login and registration page but it does not work correctly. After submitting registration deals, the details are accepted and the user gets taken to a page that just says registration succesful. but when i run the logout script and try to log in using the details it says user details not recognised. so when i look in the database connected to the registration details, i found out that the registration details havent saved there. could someone please look at my code and tell me why these details arent being saved in the database? i appreciate it a lot thankyou the code is here http://pastebin.com/sSf3LnCu
-
hello guys im kind of new to this so please be nice. i am looking for advice more on the hprocess of how to do something rather than the exact code. maybe somebody could give me a short guide or step to step process idea. my task is to have an events page on a website i am making for an assignment. the events page must display the 5 nearest upcoming events the user must also be able to rearrange the events by distance or type of even. the events will be stored in a database. could somebody please offer me some advice on the best process to follow to do this task. thanks a bunch
-
thanks for the advice guys very helpful all is now sorted
-
Notice: Undefined variable: _SESSION in F:\EasyPHP-12.1\www\scripting\inc\header.php on line 42 i dont understand why i get this??
-
hi guys i haver a problem with my code it works but also shows an error when i run it the line of code where there is an error is this <code> <?php echo ($_SESSION['switchcss'])? $_SESSION['switchcss']: '<link href="css/alternate.css" type="text/css" rel="stylesheet">';?> <code> its for a php based css style switcher. if u need to know all of the code i am using to diagnose the problem i will leave it below, thanks alot guys <code> <?php include ("inc/css.php"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <div id="header"> </div> <?php if(isset($_GET['css'])){ switch ($_GET['css']) { case 'main': $stylesheet = '<link rel="stylesheet" type="text/css" href="css/main.css">'; $_SESSION['switchcss']=$stylesheet; break; case 'alternate2': $stylesheet = '<link rel="stylesheet" type="text/css" href="css/alternate2.css">'; $_SESSION['switchcss']=$stylesheet; break; case 'alternate3': $stylesheet = '<link rel="stylesheet" type="text/css" href="css/alternate3.css">'; $_SESSION['switchcss']=$stylesheet; break; // Our default stylesheet default: $stylesheet = '<link rel="stylesheet" type="text/css" href="css/alternate.css">'; $_SESSION['switchcss']=$stylesheet; } } ?> <?php echo ($_SESSION['switchcss'])? $_SESSION['switchcss']: '<link href="css/alternate.css" type="text/css" rel="stylesheet">';?> <a href="index1.php?css=main">[style 1]</a> |<a href="index1.php?css=alternate">[style 2]</a> | <a href="index1.php?css=alternate2">[style 3]</a> <a href="index1.php?css=alternate3">[style 4]</a> <code>
-
i called both the table and the database "products" would this cause a problem?
-
hello guys i have made a basic database in myadmin and i have written php code to connect to it. my database is called products. When i run the page i get the output - Connection Successful could not connect to products can somebody look at my code and tell me why i can not connect to my database <?php $host="localhost"; $user=""; $password=""; $db = "products"; $connect = mysql_connect($host, $user, $password); if($connect) { echo "Connection Successful"; $select = mysql_select_db($db); if ($select) { echo "<br /> connected to ".$db; } else { echo "<be /> could not connect to ".$db; } } else { echo "failed connection"; } ?> thankyou
-
Thanks alot love2code that is much better for me. Woud your be able to expand a little further for me though please. I would like it if when the guess was correct, the guess box is omitted and just the message and option to play again is displayed. i cant figure out how to do it. thanks