-
Notifications
You must be signed in to change notification settings - Fork 0
/
accept.php
42 lines (32 loc) · 1.33 KB
/
accept.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
38
39
40
41
42
<?php
require 'loginsystem/partials/dbconnect.php';
$id = $_GET['id'];
$query = "select * from `requests` where `id` = '$id' ";
$result=mysqli_query($con,$query);
$num=mysqli_num_rows($result);
if($num > 0){
while(($fetch=mysqli_fetch_assoc($result))){
$firstname = $fetch['firstname'];
$lastname = $fetch['lastname'];
$username = $fetch['username'];
$password = $fetch['password'];
$pack=$fetch['pack'];
$email=$fetch['email'];
$code = 0;
$query = "INSERT INTO `accounts` (`firstname`, `lastname`, `username`, `password`, `pack`, `email`,`time`,`code`) VALUES ('$firstname', '$lastname', '$username', '$password', '$pack', '$email', current_timestamp(),'$code');";
$result=mysqli_query($con,$query);
if($result){
echo "Account has been accepted.";
}
else {
echo "Unknown error occured. Please try again.";
}
}
$query = "DELETE FROM `requests` WHERE `requests`.`id` = '$id'";
$result=mysqli_query($con,$query);
// header("location:home.php");
echo "<script>window.location.href='home.php'</script>";
}else{
echo "Error occured.";
}
?>