-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloadSpecificUser.php
More file actions
50 lines (39 loc) · 1.22 KB
/
Copy pathloadSpecificUser.php
File metadata and controls
50 lines (39 loc) · 1.22 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
require_once(__DIR__ . '/BettingWebsite/basicErrorHandling.php');
require_once(__DIR__ . '/BettingWebsite/connDB.php');
?>
<html>
<head>
<title></title>
</head>
<body>
<?php
$salt = substr(hash("sha256",rand()), 0, 20);
$dbh=db_connect();
// Insert Plain text data below;
$info['fname'] = 'Tester';
$info['lname'] = 'McTest';
$info['username'] = 'testydude';
$info['password'] = 'badpassword';
try
{
$sth = $dbh->prepare("INSERT INTO Users(FName, LName, Username, Passwd, Salt) VALUES (:fname,:lname,:user,:pass,:salt)");
$hashedPW = crypt($info['password'] . $salt, '$2y$07$8d88bb4a9916b302c1c68c$');
$sth->bindValue(":fname",$info['fname']);
$sth->bindValue(":lname",$info['lname']);
$sth->bindValue(":user",$info['username']);
$sth->bindValue(":pass",$hashedPW);
$sth->bindValue(":salt",$salt);
$sth->execute();
}
catch (PDOException $e)
{
printf ("The statement failed.\n");
printf ("getCode: ". $e->getCode () . "\n");
printf ("getMessage: ". $e->getMessage () . "\n");
}
print "User " . $info['fname'] ." added<br>";
db_close($dbh);
?>
</body>
</html>