forked from VovaGurovskiy/EnergoRemote
-
Notifications
You must be signed in to change notification settings - Fork 0
/
reguser.php
38 lines (35 loc) · 1.03 KB
/
reguser.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
<?
$log = trim(htmlspecialchars(stripslashes($_POST['log'])));
$pass = trim(htmlspecialchars(stripslashes($_POST['pass'])));
$name = trim(htmlspecialchars(stripslashes($_POST['name'])));
$id_user = trim(htmlspecialchars(stripslashes($_POST['id_user'])));
if ( ($log != '') and ($pass != '') and ($name != '') and ($id_user=='') )
{
include ("bd.php");
$sql = "INSERT INTO user (login,pass,name_user) VALUES('$log','$pass','$name')";
$query = mysql_query($sql);
if (!$query)
{
die('updating error: '. mysql_error());
} else
{
echo 'user created sucsessful';
}
} else
{
if (($log != '') and ($pass != '') and ($name != '') and ($id_user!=''))
{
include ("bd.php");
$sql = "UPDATE user SET login='$log', pass='$pass', name_user='$name' WHERE id_user='$id_user'";
$query = mysql_query($sql);
if (!$query)
{
die('updating error: '. mysql_error());
} else
{
echo 'user updating sucsessful';
}
}
}
echo "<html><head><meta http-equiv='Refresh' content='0; URL=index.php'></head></html>";
?>