X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=web%2Fapproval.php;fp=web%2Fapproval.php;h=dc99ca7d69e685059b5b77a7e64c022ecb4bc427;hp=0000000000000000000000000000000000000000;hb=d2c982b37f3c4373e99e7c60c19d048de02b5919;hpb=2e0ef31d8963eb146337093252d6ae28d2b18813 diff --git a/web/approval.php b/web/approval.php new file mode 100644 index 00000000..dc99ca7d --- /dev/null +++ b/web/approval.php @@ -0,0 +1,134 @@ +You donot have a rite to approve users"; + exit(); + } + + //extracting user information + $query = "SELECT * FROM users where username=\"$accountid\""; + $result = sqlite3_query($handle, $query) or die("Error in query: ".sqlite3_error($handle)); + if (($row = sqlite3_fetch_array($result)) == '') { + echo "
Not a valid account id
"; + exit(); + } + + $name = $row["name"]; + $email = $row["email"]; + $website = $row["website"]; + $desc = $row["description"]; + + if($row["approved"] == "true") { + $query = "SELECT * FROM approval where approved=\"$accountid\""; + $result = sqlite3_query($handle, $query) or die("Error in query: ".sqlite3_error($handle)); + $row = sqlite3_fetch_array($result); + echo "
Already $accountid is approved by ".$row["approvedby"]."...
"; + exit(); + } +?> +

Approval

+
+ + + + + + + + + + + + + + + + + + + + + + + +

Full name:

Account id:

Email:

+

Description:

Web Site:

Admin rites (check this if you want this user to be admin)
+

+ + + Successfully approved $accountid..."; +} + +//if approval is canceled +else if (isset($_POST['cancel'])) { +//delete user +$handle = sqlite3_open($db) or die("Could not open database"); +$query = "delete from users where username=\"$accountid\""; +$result = sqlite3_exec($handle, $query) or die("Error in query: ".sqlite3_error($handle)); +echo "
Successfully cancelled $accountid...
"; +} + +function generate_passwd($length = 16) { + static $chars = '!@#$%^&*abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ23456789'; + $chars_len = strlen($chars); + for ($i = 0; $i < $length; $i++) + $password .= $chars[mt_rand(0, $chars_len - 1)]; + return $password; +} +?> \ No newline at end of file