-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignup.php
37 lines (30 loc) · 1.2 KB
/
signup.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
// Veritabanı bağlantısı
$servername = "localhost";
$username = "root"; // phpMyAdmin kullanıcı adı
$password = ""; // phpMyAdmin şifresi
$dbname = "user_database";
// Bağlantı oluştur
$conn = new mysqli("localhost", "root", "", "user_database", 3307);
// Bağlantıyı kontrol et
if ($conn->connect_error) {
die("Bağlantı hatası: " . $conn->connect_error);
}
// Form gönderildiğinde işlem yap
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$username = $_POST['RegistrationForm']['login'];
$email = $_POST['RegistrationForm']['email'];
$first_name = $_POST['RegistrationForm']['first_name'];
$last_name = $_POST['RegistrationForm']['last_name'];
$phone = $_POST['RegistrationForm']['skype'];
$password = password_hash($_POST['RegistrationForm']['password'], PASSWORD_BCRYPT);
$sql = "INSERT INTO users (username, email, first_name, last_name, phone, password)
VALUES ('$username', '$email', '$first_name', '$last_name', '$phone', '$password')";
if ($conn->query($sql) === TRUE) {
echo "Kayıt başarılı!";
} else {
echo "Hata: " . $sql . "<br>" . $conn->error;
}
$conn->close();
}
?>