Danny620 Posted July 7, 2009 Share Posted July 7, 2009 <?php # Script 11.13 - loggedin.php #3 // The user is redirected here from login.php. session_start(); // Start the session. // If no session value is present, redirect the user: // Also validate the HTTP_USER_AGENT! $page_title = 'Logged In!'; include ($_SERVER['DOCUMENT_ROOT'].'/includes/header.html'); if(isset($_SESSION['agent'])){ // Print a customized message: echo "<h1>Logged In!</h1> <p>You are now logged in, {$_SESSION['first_name']}!</p> <p><a href=\"logout.php\">Logout</a></p>"; }else{ echo' <h1>Login</h1> <form action="login.php" method="post"> <p>Email Address: <input type="text" name="email" size="20" maxlength="80" /> </p> <p>Password: <input type="password" name="pass" size="20" maxlength="20" /></p> <p><input type="submit" name="submit" value="Login" /></p> <input type="hidden" name="submitted" value="TRUE" /> </form>'; } if(isset($_POST['sent'])){ // Trim all the incoming data: $trimmed = array_map('trim', $_POST); // Assume invalid values: $m = FALSE; // Check for a first name: if (preg_match ('/^[A-Z \'.-]{2,20}$/i', $trimmed['message'])) { $m = mysqli_real_escape_string ($dbc, $trimmed['message']); } else { echo '<p class="error">You forgot to enter a message!</p>'; } if ($m) { $from = $_SESSION['user_id']; $q = "INSERT INTO messages (to_user, from_user, message) VALUES ('4','$from','$m')"; $r = mysqli_query ($dbc, $q) or trigger_error("Query: $q\n<br />MySQL Error: " . mysqli_error($dbc)); if (mysqli_affected_rows($dbc) == 1) { echo 'you message was succsufuly saved'; exit(); } } ?> <form id="form1" name="form1" method="post" action=""> <label> <textarea name="message" cols="45" rows="5" id="message">Message Here </textarea> </label> <p> <label> <input type="submit" name="message_send" id="message_send" value="Send" /> </label> <input name="sent" type="hidden" id="sent" value="true" /> </p> </form> <?php include ($_SERVER['DOCUMENT_ROOT'].'/includes/footer.html'); ?> Link to comment https://forums.phpfreaks.com/topic/165088-solved-parse-error-parse-error-in-cxampphtdocsmessagesphp-on-line-71/ Share on other sites More sharing options...
Danny620 Posted July 7, 2009 Author Share Posted July 7, 2009 i get an error message when trying to run the script Parse error: parse error in C:\xampp\htdocs\messages.php on line 71 Link to comment https://forums.phpfreaks.com/topic/165088-solved-parse-error-parse-error-in-cxampphtdocsmessagesphp-on-line-71/#findComment-870524 Share on other sites More sharing options...
wildteen88 Posted July 7, 2009 Share Posted July 7, 2009 You forgot to close your if statement (started on line 30). You need to place a } after line 55 Link to comment https://forums.phpfreaks.com/topic/165088-solved-parse-error-parse-error-in-cxampphtdocsmessagesphp-on-line-71/#findComment-870538 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.