Modernvox Posted February 2, 2010 Share Posted February 2, 2010 This code works, but what happens is it won't fully load the pages (images & text). The first time the page opens it prompts the user to check there email and click on the verification link. The only problem is the page stops loading and looks like poop. When the user clicks to verify from there email the secons time the page opens it is fine. So i assume it has something to do with my if statements, eh? <?php include("DB_cred_quickp.inc"); if (isset($_POST['submit'])) $location= $_POST['location']; $title= $_POST['title']; $details= $_POST['details']; $email= $_POST['email']; $conn = mysql_connect($dbhost,$dbuser, $password); if (!$conn) { die('Could not connect: ' . mysql_error()); } mysql_select_db($dbname, $conn); if ($_POST['form_submitted'] == '1') { $activationKey = mt_rand() . mt_rand() . mt_rand() . mt_rand() . mt_rand(); if ($title == "") { echo "<font face= \"tahoma\" color= \"red\" size= \"2\">Title must be at least 10 characters, but no more than 50</font>"; exit(); } if (strlen($title) < 10) { echo "<font face= \"tahoma\" color= \ "red\" size= \"2\">Title must be at least 10 characters long</font>"; exit(); } if (strlen($title) > 50) { echo "<font face= \"tahoma\" color= \"red\" size= \"2\">Title must be at least 10 characters, but no more than 50</font>"; exit(); } if ($details == "") { echo "<font face= \"tahoma\" color= \"red\" size= \"2\">Ad must be no less than 20 characters and no more than 300</font>"; exit(); } if strlen($details <20) { echo "<font face= \"tahoma\" color= \"red\" size= \"2\">Details must be no less than 20 characters</font>"; } if (strlen($details >350) { echo "<font face= \"tahoma\" color= \"red\" size= \"2\">Max characters 350, shorten your ad</font>"; } $pattern = '/^[a-z0-9]{4,}+.?([a-z0-9]+)?@([a-z0-9]+\.)+[a-z]{3,4}$/i'; if (!preg_match($pattern, $email)) { echo "<font face= \"tahoma\" color= \"red\" size= \"2\">sorry, email is not valid</font>"; exit(); } $pattern = '/^[a-z0-9]{4,}+.?([a-z0-9]+)?@([gmail]+\.)+[a-z]{3,4}$/i';//exclude Gmail here if (preg_match($pattern, $email)) { echo "<font face= \"tahoma\" color= \"red\" size= \"2\">Sorry, Gmail accounts not allowed</font>"; exit(); } $query = "INSERT INTO quickpost (location, title, details, includeprofile, email, activationkey, status) VALUES ('$location', '$title', '$details', '$_POST[includeprofile]', '$email','$activationKey', 'verify')"; if (!mysql_query($query)) { die('Error: ' . mysql_error()); } echo "An email has been sent to $email . Please click on the verification link to verify your AD"; //No value found, user must be activating their account! //Send activation Email $to = $_POST[email]; $subject = " Activate your AD on I WANNA JAM!"; $message = "Verify your AD by clicking the following link:\rhttp://www.dezi9er.net16.net/iwj/verify.php?$activationKey\r\rRegards, I WANNA JAM!.com Team"; $headers = 'From: noreply@ IWANNAJAM.com' . "\r\n" . 'Reply-To: noreply@ IWANNAJAM.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); } else { $queryString = $_SERVER['QUERY_STRING']; $query = "SELECT * FROM quickpost"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)){ if ($queryString == $row["activationkey"]){ echo "Thank You! Your Ad has been verified and is now live! "; echo '<a href="classifieds.php">back to Classifieds<a/>.'; $sql="UPDATE quickpost SET activationkey = '', status='activated' WHERE (id = $row[id])"; if (!mysql_query($sql)) { die('Error: ' . mysql_error()); } } } } ?> Thanks in advance for looking into this for me. Quote Link to comment https://forums.phpfreaks.com/topic/190693-heres-a-puzzling-situation-to-solvepage-stops-loading-prematurely/ Share on other sites More sharing options...
wildteen88 Posted February 2, 2010 Share Posted February 2, 2010 You have a few basic syntax errors. Remove the space between the highlighted characters on line 27 echo "<font face= \"tahoma\" color= \ "red\" size= \"2\">Title must be at least 10 characters long</font>"; You forgot the parenthesises on line 41 if(strlen($details <20)) Linie 46 you left of a closing ) if (strlen($details >350)) Quote Link to comment https://forums.phpfreaks.com/topic/190693-heres-a-puzzling-situation-to-solvepage-stops-loading-prematurely/#findComment-1005663 Share on other sites More sharing options...
Modernvox Posted February 2, 2010 Author Share Posted February 2, 2010 You have a few basic syntax errors. Remove the space between the highlighted characters on line 27 echo "<font face= \"tahoma\" color= \ "red\" size= \"2\">Title must be at least 10 characters long</font>"; You forgot the parenthesises on line 41 if(strlen($details <20)) Linie 46 you left of a closing ) if (strlen($details >350)) Yes sa! That was it, never would have thought something so minor would interfere with display. Thanks dude. Quote Link to comment https://forums.phpfreaks.com/topic/190693-heres-a-puzzling-situation-to-solvepage-stops-loading-prematurely/#findComment-1005678 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.