forked from disc0nnctd/CCC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.php
51 lines (45 loc) · 1.26 KB
/
update.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
<?php
if(isset($_POST["update"]))
{
$name = $_POST["username"];
$email = $_POST["email"];
$ccname = $_POST["ccname"];
$cfname = $_POST["cfname"];
$ach = $_POST["ach"];
$pwd = $_POST["ccpwd"];
function OpenCon()
{
// $dbhost = "sql6.freesqldatabase.com";
// $dbuser = "sql6400897";
// $dbpass = "gcysFbCvd9";
// $db = "sql6400897";
// $conn = new mysqli($dbhost, $dbuser, $dbpass,$db);
// return $conn;
$conn = pg_connect($_ENV['DATABASE_URL']);
return $conn;
}
function CloseCon($conn)
{
pg_close($conn);
// $conn -> close();
}
$conn = OpenCon();
if($conn === false){
die("ERROR: Could not connect." . pg_last_error($conn));
echo "<br>";
}
$sql = "UPDATE persons SET email='$email', ccname='$ccname', cfname='$cfname', achievements='$ach', password='$pwd' WHERE username='$name'";
error_log($sql);
if(pg_query($conn, $sql) === true){
// echo $ccname;
// echo $cfname;
// echo $pwd;
// echo $name;
// echo $email;
// echo $ach;
header('Location: index.php');
exit;
}
CloseCon($conn);
}
?>