forked from jochen-jung/phpcodeedit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser-signup.php
More file actions
executable file
·27 lines (24 loc) · 887 Bytes
/
user-signup.php
File metadata and controls
executable file
·27 lines (24 loc) · 887 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
26
27
<?php
session_start();
include_once('config.php');
$link = mysqli_connect($mysql_host, $mysql_user, $mysql_pass, $mysql_db);
if (!$link) die('Could not connect: ' . mysqli_error());
if ($_POST['userid']) {
if ($_SESSION['userid'] == $_POST['userid']) {
mysqli_query($link, 'UPDATE user SET first = "'. addslashes($_POST['first']) .'",
last = "'. addslashes($_POST['last']) .'",
email = "'. addslashes($_POST['email']) .'"
WHERE userid = "'. (int)($_POST['userid']) .'"
');
} else die('Auth Error');
} else {
$res = mysqli_query($link, 'INSERT INTO user SET first = "'. addslashes($_POST['first']) .'",
last = "'. addslashes($_POST['last']) .'",
email = "'. addslashes($_POST['email']) .'",
password = "'. sha1($_POST['password']) .'"
');
$id = mysqli_insert_id();
mkdir('../edit-files/'. (int)$id .'/');
}
mysqli_close($link);
?>