From 433efccd36add54061868af33d1ebf1d61dae554 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 28 Sep 2008 21:53:20 +0000 Subject: Central: Continued to remove UI Also removed unnecessary things. Refs #63 --- central/trunk/includes/instadisc.php | 108 +---------------------------------- 1 file changed, 3 insertions(+), 105 deletions(-) (limited to 'central/trunk/includes/instadisc.php') diff --git a/central/trunk/includes/instadisc.php b/central/trunk/includes/instadisc.php index 1f40b7a..320ff80 100644 --- a/central/trunk/includes/instadisc.php +++ b/central/trunk/includes/instadisc.php @@ -3,7 +3,6 @@ /* InstaDisc Server - A Four Island Project */ include_once('includes/db.php'); -include_once('includes/class.phpmailer.php'); function instaDisc_checkVerification($username, $verification, $verificationID, $table, $nameField, $passField) { @@ -99,111 +98,10 @@ function instaDisc_addItem($username, $subscription, $title, $author, $url, $sem } } -function instaDisc_phpMailer() +function instaDisc_createUser($username, $password, $email) { - $mail = new PHPMailer(); - $mail->IsSMTP(); - $mail->From = 'instadisc@' . instaDisc_getConfig('mailDomain'); - $mail->FromName = 'InstaDisc'; - $mail->Host = instaDisc_getConfig('smtpHost'); - if (instaDisc_getConfig('smtpAuth') == 'true') - { - $mail->SMTPAuth = true; - $mail->Username = instaDisc_getConfig('smtpUser'); - $mail->Password = instaDisc_getConfig('smtpPass'); - } - $mail->Helo = $_SERVER['SERVER_NAME']; - $mail->ClearAddresses(); - - return $mail; -} - -function instaDisc_sendActivationEmail($username, $password, $email) -{ - $penKey = md5(rand(1,2147483647)); - - $inspending = "INSERT INTO pending (username, password, email, code) VALUES (\"" . mysql_real_escape_string($username) . "\", \"" . mysql_real_escape_string(md5($password)) . "\", \"" . mysql_real_escape_string($email) . "\", \"" . mysql_real_escape_string($penKey) . "\")"; - $inspending2 = mysql_query($inspending); - - $mail = instaDisc_phpMailer(); - $mail->AddAddress($email, $username); - $mail->Subject = 'InstaDisc Account Verification'; - $mail->Body = "Hello, someone has recently registered an account at " . $_SERVER['SERVER_NAME'] . " with your email address. If that was you, and your chosen username IS " . $username . ", then copy the account verification code below to our Account Verification page, enter your username and press Activate!\r\n\r\n" . $penKey . "\r\n\r\nIf that was not you, copy the above code to our Account Verification page, enter the above username, and click Delete."; - $mail->Send(); - - return ($mail->IsError() ? $mail->ErrorInfo : true); -} - -function instaDisc_activateAccount($username, $penKey) -{ - $getuser = "SELECT * FROM pending WHERE username = \"" . mysql_real_escape_string($username) . "\" AND code = \"" . mysql_real_escape_string($penKey) . "\""; - $getuser2 = mysql_query($getuser); - $getuser3 = mysql_fetch_array($getuser2); - if ($getuser3['username'] == $username) - { - $insuser = "INSERT INTO users (username, password, email) VALUES (\"" . mysql_real_escape_string($username) . "\", \"" . mysql_real_escape_string($getuser3['password']) . "\", \"" . mysql_real_escape_string($getuser3['email']) . "\")"; - $insuser2 = mysql_query($insuser); - - $delpending = "DELETE FROM pending WHERE username = \"" . mysql_real_escape_string($username) . "\""; - $delpending2 = mysql_query($delpending); - - $mail = instaDisc_phpMailer(); - $mail->AddAddress($getuser3['email'], $username); - $mail->Subject = 'Welcome to InstaDisc!'; - $mail->Body = "Welcome to InstaDisc! Thank you for registering at " . instaDisc_getConfig('siteName') . " Central Server, we hope you enjoy our service! Now, when you download an InstaDisc Client, it will ask you for the following information which you will need to enter into it for it to work:\r\n\r\nUsername: " . $username . "\r\nPassword: (you should know this, it's not displayed here for security reasons)\r\nCentral Server URL: " . instaDisc_getConfig("xmlrpcURL") . "\r\n\r\nOnce again, thank you for choosing " . instaDisc_getConfig("siteName") . "!"; - $mail->Send(); - - return ($mail->IsError() ? $mail->ErrorInfo : true); - } else { - return false; - } -} - -function instaDisc_deactivateAccount($username, $penKey) -{ - $getuser = "SELECT * FROM pending WHERE username = \"" . mysql_real_escape_string($username) . "\" AND code = \"" . mysql_real_escape_string($penKey) . "\""; - $getuser2 = mysql_query($getuser); - $getuser3 = mysql_fetch_array($getuser2); - if ($getuser3['username'] == $username) - { - $delpending = "DELETE FROM pending WHERE username = \"" . mysql_real_escape_string($username) . "\""; - $delpending2 = mysql_query($delpending); - - return true; - } else { - return false; - } -} - -function instaDisc_verifyUser($username, $password) -{ - $getuser = "SELECT * FROM users WHERE username = \"" . mysql_real_escape_string($username). "\" AND password = \"" . mysql_real_escape_string(md5($password)) . "\""; - $getuser2 = mysql_query($getuser); - $getuser3 = mysql_fetch_array($getuser2); - - return ($getuser3['username'] == $username); -} - -function instaDisc_deleteAccount($username) -{ - $getuser = "SELECT * FROM users WHERE username = \"" . mysql_real_escape_string($username) . "\""; - $getuser2 = mysql_query($getuser); - $getuser3 = mysql_fetch_array($getuser2); - if ($getuser3['username'] == $username) - { - $deluser = "DELETE FROM users WHERE username = \"" . mysql_real_escape_string($username) . "\""; - $deluser2 = mysql_query($deluser); - - $delsubs = "DELETE FROM subscriptions WHERE username = \"" . mysql_real_escape_string($username) . "\""; - $delsubs2 = mysql_query($delsubs); - - $delitems = "DELETE FROM inbox WHERE username = \"" . mysql_real_escape_string($username) . "\""; - $delitems2 = mysql_query($delitems); - - return true; - } - - return false; + $insuser = "INSERT INTO users (username, password, email) VALUES (\"" . mysql_real_escape_string($username) . "\", \"" . mysql_real_escape_string($password) . "\", \"" . mysql_real_escape_string($email) . "\")"; + $insuser2 = mysql_query($insuser); } function instaDisc_getConfig($key) -- cgit 1.4.1