xXREDXIIIXx Posted August 19, 2009 Share Posted August 19, 2009 ok here is a snippet from my code from Line everything in bold tags is only showing up as blue DW says the it is invalid markup Im only asking this because some of my form fields are not 'posting' think this is the error dont really wanna post the entire page as it is over 300 lines long. Thanks in advance for any advice [b]<?php session_start(); include('inc/config.php'); if(!isset($_SESSION['username'])){ ## General Info if(isset($_POST['generalbtn'])){ // USERNAME $username = mysql_real_escape_string($_POST['username']); $_SESSION['username_a'] = $username; $result = mysql_query("SELECT * FROM gamers WHERE username = '$username'"); $field = mysql_fetch_array($result); if ($username == NULL){ $_SESSION['username_check'] = "[/b]<br /><span class=\"text_error\">Username is required.</span>";} else { if ($username == $field['username']){ $_SESSION['username_check'] = "<br /><span class=\"text_error\">Username already in use.</span>";} } Quote Link to comment https://forums.phpfreaks.com/topic/171056-solved-dreamwaver-says-error/ Share on other sites More sharing options...
MatthewJ Posted August 19, 2009 Share Posted August 19, 2009 Post all of the code... that looks okay, and 300 lines is small In fact, you should be able to tell it's okay since this site has syntaxt highlighting and it does not appear broke Quote Link to comment https://forums.phpfreaks.com/topic/171056-solved-dreamwaver-says-error/#findComment-902152 Share on other sites More sharing options...
xXREDXIIIXx Posted August 19, 2009 Author Share Posted August 19, 2009 Post all of the code... that looks okay, and 300 lines is small In fact, you should be able to tell it's okay since this site has syntaxt highlighting and it does not appear broke I seen the ! messes a bit up could that be it on line 5? EDIT just tested it the code went from blue to red if i removed it <?php session_start(); include('inc/config.php'); if(!isset($_SESSION['username'])){ ## General Info if(isset($_POST['generalbtn'])){ // USERNAME $username = mysql_real_escape_string($_POST['username']); $_SESSION['username_a'] = $username; $result = mysql_query("SELECT * FROM gamers WHERE username = '$username'"); $field = mysql_fetch_array($result); if ($username == NULL){ $_SESSION['username_check'] = "<br /><span class=\"text_error\">Username is required.</span>";} else { if ($username == $field['username']){ $_SESSION['username_check'] = "<br /><span class=\"text_error\">Username already in use.</span>";} } // PASSWORD $password = mysql_real_escape_string($_POST['password']); if ($password == NULL){ $_SESSION['password_check'] = "<br /><span class=\"text_error\">Password is required.</span>";} else { if($_POST['password'] == $_POST['password_confirm']){ $e_pass = md5($password);} else { $_SESSION['password_confirm_check'] = "<br /><span class=\"text_error\">Passwords do not match.</span>";} } // PASSWORD CONFIRM $password_confirm = mysql_real_escape_string($_POST['password_confirm']); if ($password_confirm == NULL){ $_SESSION['password_confirm_check'] = "<br /><span class=\"text_error\">Password is required.</span>";} else { if($_POST['password'] == $_POST['password_confirm']){} else { $_SESSION['password_confirm_check'] = "<br /><span class=\"text_error\">Passwords do not match.</span>";} } // EMAIL $email = mysql_real_escape_string($_POST['email']); $_SESSION['email'] = $email; // This function tests whether the email address is valid function isValidEmail($email){ $pattern = "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"; if (eregi($pattern, $_SESSION['email'])){ return true;} else { return false;} } $result = mysql_query("SELECT * FROM gamers WHERE email = '$email'"); $field = mysql_fetch_array($result); if ($email == NULL){ $_SESSION['email_check'] = "<br /><span class=\"text_error\">Email address is required.</span>";} else { if(isValidEmail($email)){ if ($email == $field['email']){ $_SESSION['email_check'] = "<br /><span class=\"text_error\">Email already in use.</span>";} else {} } else {$_SESSION['email_check'] = "<br /><span class=\"text_error\">That is not an email address.</span>";} } // EMAIL CONFIRM $email_confirm = mysql_real_escape_string($_POST['email_confirm']); if ($email_confirm == NULL){ $_SESSION['email_confirm_check'] = "<br /><span class=\"text_error\">Email address is required.</span>";} else { if(isValidEmail($_POST['email'])){} else {$_SESSION['email_confirm_check'] = "<br /><span class=\"text_error\">Email already in use.</span>";} } ## CHECKS if($_SESSION['username_check'] == "" and $_SESSION['password_check'] == "" and $_SESSION['password_confirm_check'] == "" and $_SESSION['email_check'] == "" and $_SESSION['email_confirm_check'] == "") { header('Location: register2.php'); $_SESSION['tab'] = 'personal'; exit; }else{ $_SESSION['general_error'] = "<span class=\"text_error\">There is an error below.</span>"; header('Location: register2.php'); $_SESSION['tab'] = 'general'; exit; } } ## Persoanla Info if(isset($_POST['personalbtn'])){ // FIRST NAME $first_name = mysql_real_escape_string($_POST['first_name']); $_SESSION['first_name'] = $first_name; if ($first_name == NULL){ $_SESSION['first_name_check'] = "<br /><span class=\"text_error\">First name is required.</span>";} // LAST NAME $last_name = mysql_real_escape_string($_POST['last_name']); $_SESSION['last_name'] = $last_name; if ($last_name == NULL){ $_SESSION['last_name_check'] = "<br /><span class=\"text_error\">Last name is required.</span>";} // GENDER $gen = $_POST['gender']; $_SESSION['gender'] = $gen; if ($gen == 'Gender'){ $_SESSION['gender_check'] = "<br /><span class=\"text_error\">Gender is required.</span>";} // BIRTHDAY $b_day = $_POST['b_day']; $b_month = $_POST['b_month']; $b_year = $_POST['b_year']; $_SESSION['b_day'] = $b_day; $_SESSION['b_month'] = $b_month; $_SESSION['b_year'] = $b_year; if($b_day == 1 || $b_day == 21 || $b_day == 31){$b_suffix = 'st';} else if($b_day == 2 || $b_day == 22){$b_suffix = 'nd';} else if($b_day == 3 || $b_day == 23){$b_suffix = 'rd';} else {$b_suffix = 'th';} $dob = $b_day.$b_suffix.' '.$b_month.' '.$b_year; if($_POST['b_day'] == '' or $_POST['b_month'] == '' or $_POST['b_year'] == ''){ $_SESSION['dob_check'] = "<br /><span class=\"text_error\">Birthday is required.</span>";} // LOCATION $lo = $_POST['location']; $_SESSION['location'] = $lo; if ($lo == 'Location'){ $_SESSION['location_check'] = "<br /><span class=\"text_error\">Location is required.</span>";} // LANGUAGES $lang1 = $_POST['lang1']; $_SESSION['lang1'] = $lang1; if ($lang1 == 'Primary Language'){ $_SESSION['lang_check'] = "<br /><span class=\"text_error\">Primary Language is required.</span>";} $lang2 = $_POST['lang2']; $_SESSION['lang2'] = $lang2; $lang3 = $_POST['lang3']; $_SESSION['lang3'] = $lang3; ## CHECKS if($_SESSION['first_name_check'] == "" and $_SESSION['last_name_check'] == "" and $_SESSION['gender_check'] == "" and $_SESSION['dob_check'] == "" and $_SESSION['location_check'] == "" and $_SESSION['lang_check'] == "") { header('Location: register2.php'); $_SESSION['tab'] = 'gamer'; exit; }else{ $_SESSION['personal_error'] = "<span class=\"text_error\">There is an error below.</span>"; header('Location: register2.php'); $_SESSION['tab'] = 'personal'; exit; } } ## Gamer Info if(isset($_POST['gamerbtn'])){ // PSN $psn = mysql_real_escape_string($_POST['psn']); $_SESSION['psn'] = $psn; $result = mysql_query("SELECT * FROM gamertags WHERE psn = '$psn'"); $field = mysql_fetch_array($result); if ($psn == NULL) {$psn_check_ok = "OK";} else { if ($psn == $field['psn']){$_SESSION['psn_check'] = "<br /><span class=\"text_error\">This PSN is already in use.</span>";} else {$psn_check_ok = "OK";}} // XBL $xbl = mysql_real_escape_string($_POST['xbl']); $_SESSION['xbl'] = $xbl; $result = mysql_query("SELECT * FROM gamertags WHERE xbl = '$xbl'"); $field = mysql_fetch_array($result); if ($xbl == NULL) {$xbl_check_ok = "OK";} else { if ($xbl == $field['xbl']){$_SESSION['xbl_check'] = "<br /><span class=\"text_error\">This XBL is already in use.</span>";} else {$xbl_check_ok = "OK";}} ## CHECKS if($_SESSION['psn_check'] == "" and $_SESSION['xbl_check'] == "") { ## Register // CREATE ACTIVATION KEY function activationkey() { $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; srand((double)microtime()*1000000); $i = 0; $pass = ''; while ($i <= 19) { $num = rand() % 33; $tmp = substr($chars, $num, 1); $pass = $pass . $tmp; $i++; }return $pass; } $activationkey = activationkey(); // CREATE SECURITY KEY $encrypted_password = md5($password); function securitykey(){ $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; srand((double)microtime()*1000000); $i = 0; $pass = ''; while ($i <= 39) { $num = rand() % 33; $tmp = substr($chars, $num, 1); $pass = $pass . $tmp; $i++; }return $pass; } $securitykey = securitykey(); // JOIN DATE $join_date = date("jS F, Y"); $join_time = date("H:ia"); mysql_query("INSERT INTO gamers (username, password, securitykey, activationkey, email, join_date, join_time) VALUES ('$username','$e_pass','$securitykey','$activationkey','$email','$join_date','$join_time');"); $row = mysql_fetch_array(mysql_query("SELECT gamerid, username FROM gamers WHERE username = '$username'")); $gamerid = $row['gamerid']; mysql_query("INSERT INTO personal (gamerid, first_name, last_name, gender, dob, location, lang1, lang2, lang3) VALUES ('$gamerid','$first_name','$last_name','$gen','$dob','$lo','$lang1','$lang2','$lang3');"); mysql_query("INSERT INTO gamertags (gamerid, psn, xbl) VALUES ('$gamerid', '$psn', '$xbl');"); mysql_query("INSERT INTO online (gamerid, username, stamp) VALUES ('$gamerid', '$username', '0');"); mysql_query("INSERT INTO ratings_gamers (id, total_votes, total_value, avg, used_ips) VALUES ('$gamerid', '0', '0', '0', 'NULL');"); $subject = 'Account Activation'; $message = "Dear $username Thank you for registering at the Clansngamers.com. To finish your registration, please visit this URL: http://www.clansngamers.com/register2.php?act=activate&username=$username&id=$activationkey If you are still having problems logging in please contact a member of our support staff at mailto:accounthelp@clansngamers.com, Please do not reply to this email it is un-monitored and automated. All the best, The Clansngamers.com Management."; $headers = 'From: Clansngamers.com'; mail($email,$subject,$message,$headers); # REDIRECT # header('location: register2.php'); $_SESSION['tab'] = 'register'; exit; }else{ $_SESSION['gamer_error'] = "<span class=\"text_error\">There is an error below.</span>"; header('Location: register2.php'); $_SESSION['tab'] = 'gamer'; exit; } } ## Activate if(isset($_POST['activatebtn'])){ if($_POST['acode'] == ''){ $_SESSION['acode_check'] = "<br /><span class=\"text_error\">Please enter the code for checking</span>"; header('Location: register2.php'); $_SESSION['tab'] = 'register'; exit; $activationid = $_POST['acode']; $username = $_SESSION['actuser']; $row = mysql_fetch_array(mysql_query("SELECT * FROM gamers WHERE username = '$username'")); if($row['activated'] == "1"){ $_SESSION['message'] = "This account has already been activated!"; header('Location: register2.php'); $_SESSION['tab'] = 'activate_error'; exit; } else { if ($activationid == $row['activationkey']){ mysql_query("UPDATE gamers SET activated = '1' WHERE username = '$username'"); $_SESSION['message'] = "Welcome ".$_SESSION['first_name'].", you have successfully activated your account.<br /><br /> You can now login with your username and password <a href=\"http://www.clansngamers.com/login.php\">here</a>. Thank you for registering with Clansngamers.com."; header('Location: register2.php'); $_SESSION['tab'] = 'activate'; exit; } else { $_SESSION['message'] = "There seems to have been an error please contact a member of staff for assistance!"; header('Location: register2.php'); $_SESSION['tab'] = 'activate_error'; exit; } } } } } Quote Link to comment https://forums.phpfreaks.com/topic/171056-solved-dreamwaver-says-error/#findComment-902153 Share on other sites More sharing options...
MatthewJ Posted August 19, 2009 Share Posted August 19, 2009 When I load it into dreamweaver the highlighting looks okay to me (DW CS4). What line did you say highlighting changes on? Quote Link to comment https://forums.phpfreaks.com/topic/171056-solved-dreamwaver-says-error/#findComment-902157 Share on other sites More sharing options...
xXREDXIIIXx Posted August 19, 2009 Author Share Posted August 19, 2009 When I load it into dreamweaver the highlighting looks okay to me (DW CS4). What line did you say highlighting changes on? only changes on save but its from lines 1 to 14 $_SESSION['username_check'] =" after that it returns to normal Quote Link to comment https://forums.phpfreaks.com/topic/171056-solved-dreamwaver-says-error/#findComment-902159 Share on other sites More sharing options...
MatthewJ Posted August 19, 2009 Share Posted August 19, 2009 you didn't post a closing php tag... might that be it? Quote Link to comment https://forums.phpfreaks.com/topic/171056-solved-dreamwaver-says-error/#findComment-902164 Share on other sites More sharing options...
xXREDXIIIXx Posted August 19, 2009 Author Share Posted August 19, 2009 you didn't post a closing php tag... might that be it? I cant belive it was that simple oh well live and learn well spotted and thanks for the help gave me a chance to figure out why some stuff was not posting and fixed that Quote Link to comment https://forums.phpfreaks.com/topic/171056-solved-dreamwaver-says-error/#findComment-902169 Share on other sites More sharing options...
MatthewJ Posted August 19, 2009 Share Posted August 19, 2009 No problem at all Quote Link to comment https://forums.phpfreaks.com/topic/171056-solved-dreamwaver-says-error/#findComment-902170 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.