Untitled

mail@pastecode.io avatar
unknown
php
2 years ago
777 B
10
Indexable
Never
<?php

require("connect.php");

$regex_imie = '/([A-Z]{1}[a-z])/';
$regex_nazwisko = '/([A-Z]{1}[a-z])/';
$regex_telefon = '/([0-9]{9}/';



if (($_POST["haslo"] === $_POST["haslo1"]) && (preg_match($_POST["imie"], $regex_imie)) && (preg_match($_POST["nazwisko"], $regex_nazwisko)) && (preg_match($_POST["telefon"], $regex_telefon))){
$st = $_POST['imie'];
$nd = $_POST['nazwisko'];
$rd = $_POST['telefon'];
$th1 = $_POST['email'];
$th2 = $_POST['login'];
$th3 = $_POST['haslo'];
/*$th3 = md5($_POST['haslo']);
$th4 = password_hash($th3, PASSWORD_DEFAULT);
echo $th3; */
$sql = "INSERT INTO zadanie(imie, nazwisko, telefon, email, login, haslo) VALUES ('$st','$nd','$rd','$th1','$th2','$th3')";

$result = $conn->query($sql);
 }
 else {
    echo "Dane nieprawidlowe";
 }
 


?>