mirror of
https://github.com/cuga-rajal/hgauth.git
synced 2026-08-14 09:02:03 +00:00
Check for existing DB record before creating
This commit is contained in:
+7
-3
@@ -53,10 +53,14 @@ if(($nametest == "@") && (mysqli_num_rows($data)>0)) {
|
||||
}
|
||||
|
||||
if(($nametest == "@") && (mysqli_num_rows($data)==0)) {
|
||||
$token = substr(hash("sha1", $avatarname, false),0,7);
|
||||
$query = "INSERT INTO $tablename (`token`) VALUES ('". $token . "')";
|
||||
$data = mysqli_query($dbc, $query);
|
||||
$token = substr(hash("sha1", $avatarname, false),0,7);
|
||||
|
||||
$query2 = "SELECT * FROM $tablename WHERE token='$token' AND avatarname=''";
|
||||
$data2 = mysqli_query($dbc, $query2);
|
||||
if(mysqli_num_rows($data2)==0) {
|
||||
$query3 = "INSERT INTO $tablename (`token`) VALUES ('" . $token . "')";
|
||||
$data3 = mysqli_query($dbc, $query3);
|
||||
}
|
||||
$getstring = base64_url_encode("fn=" . $firstname . "&ln=" . $lastname);
|
||||
$authlink2 = $authlink . "?token=" . $getstring;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// This file is expected to be used to present an authorization from on a web browser
|
||||
// to a user who has attempted to HG teleport to an Opensim region.
|
||||
//
|
||||
// Make sure your date.timezone is set in php-ini
|
||||
// Make sure your date.timezone is set in php.ini
|
||||
|
||||
$tokenerror = "You have accessed this page differently than intended. Please use the link provided from your Opensim Viewer.";
|
||||
$alreadyreg = "It appears that your avatar is already authorized with the system. You may now HG teleport.";
|
||||
|
||||
Reference in New Issue
Block a user