function &signup($edit = false) { // You need to implement it // Code below is for test purposes only! $HTML = array(); $HTML['email'] = ''; $HTML['password'] = ''; $HTML['confirm_password'] = ''; $HTML['city'] = ''; $HTML['countryID'] = ''; $HTML['country_options_escape'] = getContries(); $HTML['email_error'] = ''; //Reset Error $HTML['confirm_password_error'] = ''; //Reset Error $HTML['city_error'] = ''; //Reset Error $HTML['countryID_error'] = ''; //Reset Error $HTML['signup_error'] = ''; //Reset Error if (getRequest('submitted', true, 'post') !== 'yes') { $HTML['country_options_escape'] = getContries(); return $HTML; } print_r($_POST); // foreach($_POST as $key => $value) // { // $HTML[$key] = $value; // } foreach ($HTML as $key => &$value) { $value = utf8HTML(getRequest($key, true, 'post')); } $userID = array(); if (empty($HTML['email'])) { $HTML['email_error'] = 'Email Cannot be empty'; } if (empty($HTML['password'])) { $HTML['confirm_password_error'] = 'Password cannot be empty'; //Security measure! } if (empty($HTML['confirm_password'])) { $HTML['confirm_password_error'] = 'Confirm password cannot be empty'; //Security measure! } if (!preg_match('((?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%]).{6,20})', $HTML['password'])) { $HTML['confirm_password_error'] = 'Passwords have to be 6-20 chars and more secure!'; } if ($HTML['password'] != $HTML['confirm_password']) { $HTML['confirm_password_error'] = 'Passwords do not match'; } if (empty($HTML['city'])) { $HTML['city_error'] = 'City cannot be empty'; //Security measure! } if (empty($HTML['countryID'])) { $HTML['countryID_error'] = 'Country cannot be empty'; //Security measure! } if (filter_var($HTML['email'], FILTER_VALIDATE_EMAIL) === false) { $HTML['email_error'] = 'Invalid Email Address'; } // FILTER_SANITIZE_SPECIAL_CHARS if (filter_var($HTML['city'], FILTER_SANITIZE_SPECIAL_CHARS) === false) { $HTML['city_error'] = 'Invalid city input'; } set_SESSION("country", $HTML['countryID']); $arr = connect('Select * from users where email="' . $HTML['email'] . '"'); $count = count($arr); if ($count > 0) { $HTML['signup_error'] = "That email already exists"; } $HTML['encrypted'] = encrypt($HTML['password']); if (empty($HTML['signup_error']) and empty($HTML['city_error']) and empty($HTML['countryID_error']) and empty($HTML['confirm_password_error'])) { connect("INSERT INTO users (email, password, city, country) VALUES ('" . $HTML['email'] . "', '" . encrypt($HTML['password']) . "' , '" . $HTML['city'] . "' , '" . $HTML['countryID'] . "')"); print_r($arr); set_SESSION("userid", mysql_insert_id()); set_SESSION("email", $HTML['email']); set_SESSION("city", $HTML['city']); set_SESSION("country", $HTML['countryID']); set_header('account'); //If no errors -> go to account exit; } $HTML['country_options_escape'] = getSContries($HTML['countryID']); return $HTML; // $HTML=array(); // $HTML['country_options_escape'] = getContries(); // return $HTML; }
<!--Slider--> <div class="clear" ></div> <!--Contain--> <div id="printable" class="article article-body" style="width:950px; height:60% !important ;clear:none;"> <div class="article-content" style="height:60%;clear:none;"> <div style="padding-right: 30px; padding-left:30px; margin-top:25px; margin-bottom:25px;"> <h1>بيانات الطالب/ة الأساسية</h1> <form method="post" action="addmision04.php" id="nationality" > <table> <tr><td >الجنسية*</td><td colspan="2"> <select id="ddlViewBy" onchange="changeTest()" name = "nationality" required class="css-input"> <?php echo getContries($nationalityindex); ?> </select> </td><td></td></tr> <tr><td> <div <?php if (!$isSaudi) { echo 'hidden'; } ?> class="nationalid" >السجل المدني *</div></td><td colspan="3"> <input <?php if (!$isSaudi) {