{ "key_pair_value_system": true, "answer_rating_count": "", "question_feedback_html": { "html_star": "", "html_star_feedback": "" }, "answer_average_rating_value": "", "answer_date_js": "2024-09-09T07:06:26-04:00", "answer_date": "2024-09-09 07:06:26", "is_docs_available": null, "is_excel_available": null, "is_pdf_available": null, "count_file_available": 0, "main_page": "student_question_view", "question_id": "9785718", "url": "\/study-help\/questions\/why-will-this-code-not-work-9785718", "question_creation_date_js": "2024-09-09T07:06:26-04:00", "question_creation_date": "Sep 09, 2024 07:06 AM", "meta_title": "[Solved] why will this code not work? Chinese Zodi | SolutionInn", "meta_description": "Answer of - why will this code not work? Chinese Zodiac Networking body, .navbar navbar-default { backgroung-color: rgb(235,244,25 | SolutionInn", "meta_keywords": "will,code,work,chinese,zodiac,networking,body,navbar,navbar-default,backgroung-color,rgb,235,244,251", "question_title_h1": "why will this code not work? Chinese Zodiac Networking body, .navbar navbar-default { backgroung-color: rgb(235,244,251); } Toggle navigation Chinese Zodiac Social Networking Login Register Register", "question_title": "why will this code not work? Chinese Zodiac Networking body, .navbar navbar-default", "question_title_for_js_snippet": "why will this code not work ", "question_description": "

why will this code not work?<\/p>

<\/p>

session_start();<\/p>

if(isset($_SESSION['member_id']))<\/p>

{<\/p>

header(\"Location:index.php\");\/\/redirects to the home page<\/p>

} \/\/ ends isset session<\/p>

<\/p>

\/\/insert the connection script and end the script if the connection fails<\/p>

require_once '..\/..\/..\/..\/..\/inc_connect.php';<\/p>

<\/p>

\/\/function to store password as a hashed value<\/p>

function randomString()<\/p>

{<\/p>

$string = md5(rand());<\/p>

return $string;<\/p>

}<\/p>

\/\/initially there are no erros<\/p>

$error = false;<\/p>

<\/p>

\/\/check if form s submitted<\/p>

if(isset($_POST['register']))<\/p>

{<\/p>

$fname = mysql_real_escape_string($_POST['fname']);<\/p>

$lname = mysql_real_escape_string($_POST['lname']);<\/p>

$email = mysql_real_escape_string($_POST['email']);<\/p>

$password = mysql_real_escape_string($_POST['password']);<\/p>

$cpassword = mysql_real_escape_string($_POST['cpassword']);<\/p>

<\/p>

<\/p>

\/\/validate form data<\/p>

\/\/fname can contain only letters and spaces<\/p>

if(!preg_match('\/^[a-zA-Z\\s]+$\/',$fname))<\/p>

{<\/p>

$error = true;<\/p>

\/\/message to member if error occurs<\/p>

$fname_error = \"Name must contain only letters and spaces\";<\/p>

}<\/p>

\/\/lname can contain only letters and spaces<\/p>

if(!preg_match('\/^[a-zA-Z\\s]+$\/',$lname))<\/p>

{<\/p>

$error = true;<\/p>

\/\/message to member if error occurs<\/p>

$lname_error = \"Name must contain only letters and spaces\";<\/p>

}<\/p>

\/\/validate email to valid maine account<\/p>

if(!preg_match('\/^[a-zA-Z\\.]+@(unit\\.maine|maine)\\.edu\/', $email))<\/p>

{<\/p>

$error = true;<\/p>

\/\/message to member if error occurs<\/p>

$email_error = \"Please enter a valid University account.\";<\/p>

}\/\/ ends email<\/p>

\/\/text striing with at lease one Number and one Character between 6 and 10 characters<\/p>

if(strlen($password) < 7)<\/p>

{<\/p>

$error = true;<\/p>

$password_error = \"Password must be minimum of 7 characters.\";<\/p>

}<\/p>

if($password != $cpassword)<\/p>

{<\/p>

$error = true;<\/p>

\/\/messare to member if error occurs<\/p>

$cpassword_error = \"Password and Comfirm Password do not match.\";<\/p>

}<\/p>

if(!$error)<\/p>

{<\/p>

\/\/hash and salt the password to make it more secure<\/p>

$hash = \"\";<\/p>

$password = $_POST['password'];<\/p>

$salt = randomString();<\/p>

$hash = md5($password.$salt);<\/p>

$TableName = \"members\"; \/\/assign the table name to a variable<\/p>

\/\/insert posted data to the mebers table<\/p>

$SQLString = \"INSERT INTO $TableName \" .<\/p>

\"(fname, lname, password_hash, password_salt) VALUES\" .<\/p>

\"('$fname', '$lname', '$email', '$hash', '$salt')\";<\/p>

$QueryResults = @mysql_query($SQLString, $DBConnect);<\/p>

if($QueryResults)<\/p>

{<\/p>

\/\/message on successful registration<\/p>

$successmsg = \"Successfully Registered! Click here to Login\";<\/p>

}\/\/ends if QR<\/p>

else<\/p>

{<\/p>

\/\/message on uncuccessful registration<\/p>

echo mysql_error();<\/p>

$errormsg = \"Error in registering... Pleae try again later!.\";<\/p>

}\/\/ends else QR<\/p>

<\/p>

}\/\/ends if !$error<\/p>

<\/p>

}\/\/ends isset for register<\/p>

?><\/p>

<\/p>

<\/p>

<\/p>

<\/p>

Chinese Zodiac Networking<\/title><\/p> <p><meta name=\"viewport\" content=\" width=device=width, initial-scale=1\"><\/p> <p><link rel=\"stylesheet\" type=\"text\/css\" href=\"css\/bootstrap.min.css\"><\/p> <p><style type= \"text\/css\"><\/p> <p>body, .navbar navbar-default<\/p> <p>{<\/p> <p>backgroung-color: rgb(235,244,251);<\/p> <p>}<\/p> <p><\/style><\/p> <p><\/head><\/p> <p><body><\/p> <p><nav role=\"navigation\"><\/p> <p><div><\/p> <p><div><\/p> <p><button type=\"button\" data-toggle=\"collapse\" data-target=\"#cz_navbar\"><\/p> <p><span>Toggle navigation<\/span><\/p> <p><span><\/span><\/p> <p><span><\/span><\/p> <p><span><\/span><\/p> <p><\/button><\/p> <p>Chinese Zodiac Social Networking<\/p> <p><\/div><!-- ends class navbar-header--><\/p> <p><div id=\"cz-navbar\"><\/p> <p><ul><\/p> <p><li>Login<\/li><\/p> <p><li>Register<\/li><\/p> <p><\/ul><!-- ends class nav bar right--><\/p> <p><\/div><!-- ends class navbar collapse--><\/p> <p><\/div><!-- class container fluid--><\/p> <p><\/nav><!-- ends nav--><\/p> <p> <\/p> <p><!-- Begin Registration form --><\/p> <p><div><\/p> <p><div><\/p> <p><div><\/p> <p><form role=\"form\" action=\"register.php\" method=\"post\" name=\"registration_form\"><\/p> <p><fieldset><\/p> <p><legend>Register<\/legend><\/p> <p><div><\/p> <p><label for=\"fname\">First Name<\/label><\/p> <p><!--use function to remove html characters --><\/p> <p><input type=\"text\" id = \"fname\" name=\"fname\" placeholder=\"Enter First Name\" required value=\"<?php echo htmlspecialchars($_POST['fname']);?>\"><\/p> <p><!--displays error message if user input is not valid --><\/p> <p><?php echo \"<p class='text-danger'>$fname_error<\/p>\";?><\/p> <p><\/div><\/p> <p><div><\/p> <p><label for=\"lname\">Last Name<\/label><\/p> <p><!--use function to remove html characters --><\/p> <p><input type=\"text\" id = \"lname\" name=\"lname\" placeholder=\"Enter Last Name\" required value=\"<?php echo htmlspecialchars($_POST['lname']);?>\"><\/p> <p><!--displays error message if user input is not valid --><\/p> <p><?php echo \"<p class='text-danger'>$lname_error<\/p>\";?><\/p> <p><\/div><\/p> <p><div><\/p> <p><label for=\"email\">Email<\/label><\/p> <p><!--use function to remove html characters --><\/p> <p><input type=\"text\" class = \"form-control\" id = \"email\" name=\"email\" placeholder=\"Enter Email\" <\/p> <p>required value=\"<?php echo htmlspecialchars($_POST['email']);?>\"><\/p> <p><!--displays error message if user input is not valid --><\/p> <p><?php echo \"<p class='text-danger'>$email_error<\/p>\";?><\/p> <p><\/div><\/p> <p><div><\/p> <p><label for=\"password\">Password<\/label><\/p> <p><!--use function to remove html characters --><\/p> <p><input type=\"text\" class = \"form-control\" id = \"password\" name=\"password\" placeholder=\"Enter Password\" <\/p> <p>required value=\"<?php echo htmlspecialchars($_POST['password']);?>\"><\/p> <p><!--displays error message if user input is not valid --><\/p> <p><?php echo \"<p class='text-danger'>$password_error<\/p>\";?><\/p> <p><\/div><\/p> <p><div><\/p> <p><label for=\"cpassword\">Comfirm Password<\/label><\/p> <p><!--use function to remove html characters --><\/p> <p><input type=\"text\" class = \"form-control\" id = \"cpassword\" name=\"cpassword\" placeholder=\"Comfirm Password\" <\/p> <p>required value=\"<?php echo htmlspecialchars($_POST['cpassword']);?>\"><\/p> <p><!--displays error message if user input is not valid --><\/p> <p><?php echo \"<p class='text-danger'>$cpassword_error<\/p>\";?><\/p> <p><\/div><\/p> <p><div><\/p> <p><input type=\"submit\" name=\"register\" value=\"register\" \/><\/p> <p><\/div><!--ends form submit--><\/p> <p><\/fieldset><!-- ends fields--><\/p> <p><\/form><!--ends from--><\/p> <p><span><?php if (isset($successmsg)) { echo $successmsg;} ?><\/span><\/p> <p><span><?php if (isset($errormsg)) { echo $errormsg;} ?><\/span><\/p> <p><\/div><!-- ends col-md-4--><\/p> <p><\/div><!-- ends row--><\/p> <p><div><\/p> <p><div><\/p> <p>Already Registered? Login Here<\/p> <p><\/div><!-- ends center text --><\/p> <p><\/div><!-- ends row --><\/p> <p><\/div><!--ends form container--><\/p> <p><\/body><\/p> <p><\/html> <!--Ends Registration from--><\/p>", "transcribed_text": "", "related_book": { "title": null, "isbn": null, "edition": null, "authors": null, "cover_image": null, "uri": null, "see_more_uri": "" }, "free_related_book": { "isbn": "", "uri": "", "name": "", "edition": "" }, "question_posted": "2024-09-09 07:06:26", "see_more_questions_link": "\/study-help\/questions\/computer-science-programming-2022-November-11", "step_by_step_answer": "The Answer is in the image, click to view ...", "students_also_viewed": [ { "url": "\/study-help\/introduction-to-probability-statistics\/101-find-the-following-tvalues-in-table-4-of-appendix-1986664", "description": "10.1 Find the following t-values in Table 4 of Appendix I: a. 10.05 for 5 df c. 10.10 for 18 df b. 10.025 for 8 df d. 10.025 for 30 df", "stars": 0 }, { "url": "\/selected-comparative-financial-statements-of-korbin-company-follow-required-1-compute-each-years", "description": "Selected comparative financial statements of Korbin Company follow. Required 1. Compute each year's current ratio. (Round ratio amounts to one decimal.) 2. Express the income statement data in...", "stars": 3 }, { "url": "\/study-help\/questions\/hapter-8-homework-saved-help-agarwal-expeditions-disclosed-the-following-10113882", "description": "hapter 8 Homework Saved Help Agarwal Expeditions, disclosed the following rounded amounts ( in millions ) concerning the Allowance for Doubtful Accounts on its Form 1 0 - K annual report. \\ table [ [...", "stars": 3 }, { "url": "\/study-help\/questions\/explain-the-difference-between-operating-project-and-capital-budgets-2803893", "description": "Explain the difference between operating, project, and capital budgets.", "stars": 3 }, { "url": "\/study-help\/questions\/using-the-porters-five-forces-industry-analysis-framework-discuss-your-1003774", "description": "Using the Porter's Five Forces Industry Analysis Framework, discuss your company's industry structure. Why do you think some companies in poorly performing industries do very well?", "stars": 3 }, { "url": "\/study-help\/questions\/what-is-the-value-of-information-systems-discuss-your-opinion-1004463", "description": "What is the value of information systems? Discuss your opinion on the value of information systems and how you can make that value transparent", "stars": 3 }, { "url": "\/study-help\/questions\/compare-austinbergstom-international-airport-located-in-texas-and-athens-international-1004841", "description": "Compare Austin-bergstom International airport located in Texas and Athens International Airport located in Greece air traffic and airspace operations. Describe the important air traffic and airspace...", "stars": 3 }, { "url": "\/study-help\/questions\/brown-stone-restaurant-is-located-in-an-historic-building-within-1004909", "description": "Brown Stone Restaurant is located in an historic building within the historic business district of a mid-size city. The menu is designed to accommodate often hurried lunch customers as well as...", "stars": 3 }, { "url": "\/study-help\/questions\/multinational-companies-from-emerging-and-developed-countries-multinational-companies-from-1005143", "description": "Multinational Companies from Emerging and Developed Countries Multinational companies from countries with emerging economies such as Brazil, Russia, India, and China are beginning to expand...", "stars": 3 } ], "next_back_navigation": { "previous": "\/study-help\/questions\/at-salford-university-four-instructors-teach-foundations-of-business-analytics-9785717", "next": "\/study-help\/questions\/question-1-suppose-you-hold-a-european-put-option-written-9785719" }, "breadcrumbs": [ { "name": "Study help", "link": "https:\/\/www.solutioninn.com\/study-help\/questions-and-answers" }, { "name": "Computer Science", "link": "https:\/\/www.solutioninn.com\/study-help\/questions-and-answers\/computer-science" }, { "name": "Databases", "link": "https:\/\/www.solutioninn.com\/study-help\/questions\/computer-science-databases" }, { "name": "why will this code not work? Chinese Zodiac Networking body, .navbar navbar-default", "link": "https:\/\/www.solutioninn.com\/study-help\/questions\/why-will-this-code-not-work-9785718" } ], "skill_details": { "skill_id": "656", "skill_name": "Databases", "parent_id": "8" } }