-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess.php
More file actions
25 lines (24 loc) · 756 Bytes
/
process.php
File metadata and controls
25 lines (24 loc) · 756 Bytes
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
<?php
if(!isset($_COOKIE['userid'])){
header("location: index.php");
}
else{
require "partials/dbconnect.php";
session_start();
$_SESSION['userid'] = $_COOKIE['userid'];
$user = $_SESSION['userid'];
$existsql = "SELECT * FROM `usershost` WHERE username='$user'";
$result = mysqli_query($conn, $existsql);
$numExistrows = mysqli_num_rows($result);
if($numExistrows > 0){
header("location: welcome.php");
}
else{
$sql = "INSERT INTO `usershost` (`sno`, `username`, `password`, `date`) VALUES (NULL, '$user', '123', current_timestamp());";
$result = mysqli_query($conn, $sql);
if($result){
header("location: welcome2.php");
}
}
}
?>