-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase.php
72 lines (55 loc) · 2 KB
/
base.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
$username = $_POST['username'];
$name = $_POST['name'];
if($_POST['btn']){
if($_POST['username']!="" && $_POST['password']!="" ){
include 'connect.php';
$email = strtolower($_POST['email']);
$image = strtolower($_POST['image']);
$timestamp = time();
$client= getenv('HTTP_USER_AGENT'); //will output what web browser is currently viewing the page
// $REMOTE_ADDR
$ip = $_SERVER['REMOTE_ADDR'];
$queryaw = "SELECT username
FROM users
WHERE username='$username'
";
$query=mysqli_query($conn, $queryaw) ;
mysqli_close($conn);
if(!(mysqli_num_rows($query)>=1)){
$password = md5($_POST['password']);
include 'connect.php';
$user="INSERT INTO users(username,name,avatar,avatarpro,email,timestamp, password)
VALUES ('$username','$name','$image','$image','$email', '$timestamp', '$password')
";
mysqli_query($conn, $user) or die(mysql_error());
$queryyq = "SELECT id,password,img
FROM users
WHERE username='$username'
";
$queryy=mysqli_query($conn, $queryyq) ;
mysqli_close($conn);
$row = mysqli_fetch_assoc($queryy);
$images = $row['img'] ;
$user = $row['id'];
$gwan = $user*2000;
session_start();
setcookie("img", "1", time()+86400);
setcookie("path", "$gwan", time()+3600*24*365);
$_SESSION['user_id'] = $rows['id'];
$_SESSION['last_active'] = time();
$_SESSION['facebook'] = $rows['facebook'];
header("location: home.php?success=welcome");
exit;
}
else{
header("location: home.php?success=welcome");
exit;
}
}
else{
header("location: home.php?success=welcome");
exit;
}
}
?>