Pasta: 9464c358633fc2c933b0d6ca2b79387fe6cfa20d (2014-12-20)

Język: PHP
Adres: p43.pl/p,9464c358633fc2c933b0d6ca2b79387fe6cfa20d
Ilość linii: 106
Rozmiar: 2.64 kB
Wyświetleń: 436
Ostatnio użyto: 2017-11-18 04:46:06
<?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); $email = $_POST['email']; $password1 = $_POST['password1']; $password2 = $_POST['password2']; $funame = $_POST['funame']; $profilefr = $_POST['profilefr']; $gender = $_POST['gender']; $dob_day = $_POST['dob_day']; $month = $_POST['month']; $year = $_POST['year']; $ages_yurs = $_POST['ages_yurs']; $community = $_POST['community']; $mother_tongue = $_POST['mother_tongue']; $country = $_POST['country']; $state = $_POST['state']; $mobileno = $_POST['mobileno']; $country_code = $_POST['country_code']; $agree = $_POST['agree']; if ($password1 != $password2) { header('Location: index.php'); exit(); } if (strlen($funame) > 30) { header('Location: index.php'); exit(); } $hash = hash('sha256', $password1); function createSalt() { $text = md5(uniqid(rand(), true)); return substr($text, 0, 3); } $salt = createSalt(); $password = hash('sha256', $salt . $hash); $mysqli = new mysqli('localhost', 'root', '', 'aatsirka'); if (mysqli_connect_error()) { die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error()); } //sanitize username $email = $mysqli->real_escape_string($email); // BTW you should have all user-input values sanitized... $q = "INSERT INTO members ( email, password, funame, profilefr, gender, dob_day, month, year, ages_yurs, community, mother_tongue, country, state, mobileno, country_code, agree, salt, created ) VALUES ( '$email'," . "'$password'," . "'$funame'," . "'$profilefr'," . "'$gender'," . "'$dob_day'," . "'$month'," . "'$year'," . "'$ages_yurs'," . "'$community'," . "'$mother_tongue'," . "'$country'," . "'$state'," . "'$mobileno'," . "'$country_code'," . "'$agree', " . "'$salt'," . "now()" . ")"; // var_dump($q); die(); // uncomment this line to copy-paste the query into your PhpMyAdmin - this way you will check if the query itself is ok $mysqli->query($q); $mysqli->close(); header('Location: home.php'); exit();