-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsignup.php
More file actions
29 lines (24 loc) · 1.26 KB
/
signup.php
File metadata and controls
29 lines (24 loc) · 1.26 KB
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
<?php
if(isset($_POST['Signup'])){
$mysqli = mysqli_connect("localhost", "root", "", "annapp");
$author="author";
$stmt = $mysqli->prepare("INSERT INTO user(username,password,role) VALUES(?,?,?)");
$stmt->bind_param("sss",$_POST['username'], $_POST['password'],$author);
$stmt->execute();
$stmt = $mysqli->prepare("INSERT INTO authors(username,name,surname,orcidurl,url,specialty,userid) VALUES(?,?,?,?,?,?,(SELECT id FROM user WHERE username=?))");
$stmt->bind_param("sssssss",$_POST['username'],$_POST['name'],$_POST['surname'],$_POST['orcidurl'],$_POST['url'],$_POST['specialty'],$_POST['username']);
$stmt->execute();
echo "<script>alert('Sucess.Please login!');window.location.href='index.html';</script>";
$stmt->close();
}
else if(isset($_POST['Signupuser']))
{
$user="user";
$mysqli = mysqli_connect("localhost", "root", "", "annapp");
$stmt = $mysqli->prepare("INSERT INTO user(username,password,role) VALUES(?,?,?)");
$stmt->bind_param("sss",$_POST['username'],$_POST['password'],$user);
$stmt->execute();
echo "<script>alert('Sucess.Please login!');window.location.href='index.html';</script>";
$stmt->close();
}
?>