PageRenderTime 50ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/actions.php

https://github.com/xiongchiamiov/IMathAS
PHP | 446 lines | 443 code | 0 blank | 3 comment | 19 complexity | 77c08745c2b1d57dbf260c6ff9dfeffc MD5 | raw file
  1. <?php
  2. //IMathAS: Basic Actions
  3. //(c) 20006 David Lippman
  4. if (isset($_GET['greybox'])) {
  5. $isgb = true;
  6. $gb = '&greybox=true';
  7. } else {
  8. $isgb = false;
  9. $gb = '';
  10. }
  11. if ($_GET['action']=="newuser") {
  12. require_once("config.php");
  13. if (isset($studentTOS) && !isset($_POST['agree'])) {
  14. echo "<html><body>\n";
  15. echo "<p>You must agree to the Terms and Conditions to set up an account</p>";
  16. echo "<p><a href=\"forms.php?action=newuser$gb\">Try Again</a></p>\n";
  17. echo "</html></body>\n";
  18. exit;
  19. }
  20. $_POST['SID'] = trim($_POST['SID']);
  21. if ($loginformat!='' && !preg_match($loginformat,$_POST['SID'])) {
  22. echo "<html><body>\n";
  23. echo "$loginprompt is invalid. <a href=\"forms.php?action=newuser$gb\">Try Again</a>\n";
  24. echo "</html></body>\n";
  25. exit;
  26. }
  27. $query = "SELECT id FROM imas_users WHERE SID='{$_POST['SID']}'";
  28. $result = mysql_query($query) or die("Query failed : " . mysql_error());
  29. if (mysql_num_rows($result)>0) {
  30. echo "<html><body>\n";
  31. echo "$loginprompt '{$_POST['SID']}' is used. <a href=\"forms.php?action=newuser$gb\">Try Again</a>\n";
  32. echo "</html></body>\n";
  33. exit;
  34. }
  35. //
  36. if (!preg_match('/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/',$_POST['email'])) {
  37. echo "<html><body>\n";
  38. echo "Invalid email address. <a href=\"forms.php?action=newuser$gb\">Try Again</a>\n";
  39. echo "</html></body>\n";
  40. exit;
  41. }
  42. if ($_POST['pw1'] != $_POST['pw2']) {
  43. echo "<html><body>\n";
  44. echo "Passwords don't match. <a href=\"forms.php?action=newuser$gb\">Try Again</a>\n";
  45. echo "</html></body>\n";
  46. exit;
  47. }
  48. if ($_POST['SID']=="" || $_POST['firstname']=="" || $_POST['lastname']=="" || $_POST['email']=="" || $_POST['pw1']=="") {
  49. echo "<html><body>\n";
  50. echo "Please include all information. <a href=\"forms.php?action=newuser$gb\">Try Again</a>\n";
  51. echo "</html></body>\n";
  52. exit;
  53. }
  54. $md5pw = md5($_POST['pw1']);
  55. if ($emailconfirmation) {$initialrights = 0;} else {$initialrights = 10;}
  56. if (isset($_POST['msgnot'])) {
  57. $msgnot = 1;
  58. } else {
  59. $msgnot = 0;
  60. }
  61. if (isset($CFG['GEN']['homelayout'])) {
  62. $homelayout = $CFG['GEN']['homelayout'];
  63. } else {
  64. $homelayout = '|0,1,2||0,1';
  65. }
  66. if (!isset($_GET['confirmed'])) {
  67. $query = "SELECT SID FROM imas_users WHERE email='{$_POST['email']}'";
  68. $result = mysql_query($query) or die("Query failed : " . mysql_error());
  69. if (mysql_num_rows($result)>0) {
  70. require("header.php");
  71. echo '<form method="post" action="actions.php?action=newuser&amp;confirmed=true'.$gb.'">';
  72. echo '<input type="hidden" name="SID" value="'.stripslashes($_POST['SID']).'" />';
  73. echo '<input type="hidden" name="firstname" value="'.stripslashes($_POST['firstname']).'" />';
  74. echo '<input type="hidden" name="lastname" value="'.stripslashes($_POST['lastname']).'" />';
  75. echo '<input type="hidden" name="email" value="'.stripslashes($_POST['email']).'" />';
  76. echo '<input type="hidden" name="pw1" value="'.stripslashes($_POST['pw1']).'" />';
  77. echo '<input type="hidden" name="pw2" value="'.stripslashes($_POST['pw2']).'" />';
  78. echo '<input type="hidden" name="courseid" value="'.stripslashes($_POST['courseid']).'" />';
  79. echo '<input type="hidden" name="ekey" value="'.stripslashes($_POST['ekey']).'" />';
  80. if (isset($_POST['agree'])) {
  81. echo '<input type="hidden" name="agree" value="1" />';
  82. }
  83. echo '<p> </p>';
  84. echo '<p>It appears an account already exists with the same email address you just entered. ';
  85. echo 'If you are creating an account because you forgot your username, you can ';
  86. echo '<a href="forms.php?action=lookupusername">look up your username</a> instead.</p>';
  87. echo '<input type="submit" value="Create new account anyways"/>';
  88. echo '</form>';
  89. require("footer.php");
  90. exit;
  91. }
  92. }
  93. $query = "INSERT INTO imas_users (SID, password, rights, FirstName, LastName, email, msgnotify, homelayout) ";
  94. $query .= "VALUES ('{$_POST['SID']}','$md5pw',$initialrights,'{$_POST['firstname']}','{$_POST['lastname']}','{$_POST['email']}',$msgnot,'$homelayout');";
  95. mysql_query($query) or die("Query failed : " . mysql_error());
  96. $newuserid = mysql_insert_id();
  97. if ($emailconfirmation) {
  98. $id = mysql_insert_id();
  99. $headers = 'MIME-Version: 1.0' . "\r\n";
  100. $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  101. $headers .= "From: $sendfrom\r\n";
  102. $message = "<h4>This is an automated message from $installname. Do not respond to this email</h4>\r\n";
  103. $message .= "<p>To complete your $installname registration, please click on the following link, or copy ";
  104. $message .= "and paste it into your webbrowser:</p>\r\n";
  105. $message .= "<a href=\"http://" . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . "/actions.php?action=confirm&id=$id\">";
  106. $message .= "http://" . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . "/actions.php?action=confirm&id=$id</a>\r\n";
  107. mail($_POST['email'],'IMathAS Confirmation',$message,$headers);
  108. echo "<html><body>\n";
  109. echo "Registration recorded. You should shortly receive an email with confirmation instructions.";
  110. echo "<a href=\"$imasroot/index.php\">Back to main login page</a>\n";
  111. echo "</body></html>\n";
  112. exit;
  113. } else {
  114. echo "<html><body>\n";
  115. echo "<p>Your account with username <b>{$_POST['SID']}</b> has been created. If you forget your password, you can ask your ";
  116. echo "instructor to reset your password or use the forgotten password link on the login page.</p>\n";
  117. if (trim($_POST['courseid'])!='') {
  118. $error = '';
  119. if (!is_numeric($_POST['courseid'])) {
  120. $error = 'Invalid course id';
  121. } else {
  122. $query = "SELECT enrollkey,allowunenroll FROM imas_courses WHERE id = '{$_POST['courseid']}'";
  123. $result = mysql_query($query) or die("Query failed : " . mysql_error());
  124. $line = mysql_fetch_array($result, MYSQL_ASSOC);
  125. if ($line==null) {
  126. $error = 'Course not found';
  127. } else if (($line['allowunenroll']&2)==2) {
  128. $error = 'Course is closed for self enrollment';
  129. } else if ($_POST['ekey']=="" && $line['enrollkey'] != '') {
  130. $error = 'No enrollment key provided';
  131. } else if ($line['enrollkey'] != $_POST['ekey']) {
  132. $error = 'Incorrect enrollment key';
  133. } else {
  134. $query = "INSERT INTO imas_students (userid,courseid) VALUES ('$newuserid','{$_POST['courseid']}');";
  135. mysql_query($query) or die("Query failed : " . mysql_error());
  136. echo '<p>You have been enrolled in course ID '.$_POST['courseid'].'</p>';
  137. }
  138. }
  139. if ($error != '') {
  140. echo "<p>$error, so we were not able to enroll you in your course. After you log in, you can ";
  141. echo 'try enrolling again. You do <b>not</b> need to create another account</p>';
  142. }
  143. }
  144. echo "You can now <a href=\"http://";
  145. echo $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . "/index.php";
  146. echo "\">return to the login page</a> and login with your new username and password</p>";
  147. echo "</body></html>";
  148. }
  149. //header("Location: http://" . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . "/index.php");
  150. exit;
  151. } else if ($_GET['action']=="confirm") {
  152. require_once("config.php");
  153. $query = "UPDATE imas_users SET rights=10 WHERE id='{$_GET['id']}' AND rights=0";
  154. mysql_query($query) or die("Query failed : " . mysql_error());
  155. if (mysql_affected_rows()>0) {
  156. echo "<html><body>\n";
  157. echo "Confirmed. Please <a href=\"index.php\">Log In</a>\n";
  158. echo "</html></body>\n";
  159. exit;
  160. } else {
  161. echo "<html><body>\n";
  162. echo "Error.\n";
  163. echo "</html></body>\n";
  164. }
  165. } else if ($_GET['action']=="resetpw") {
  166. require_once("config.php");
  167. if (isset($_POST['username'])) {
  168. $query = "SELECT password,id,email FROM imas_users WHERE SID='{$_POST['username']}'";
  169. $result = mysql_query($query) or die("Query failed : " . mysql_error());
  170. if (mysql_num_rows($result)>0) {
  171. $code = mysql_result($result,0,0);
  172. $id = mysql_result($result,0,1);
  173. $headers = 'MIME-Version: 1.0' . "\r\n";
  174. $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  175. $headers .= "From: $sendfrom\r\n";
  176. $message = "<h4>This is an automated message from $installname. Do not respond to this email</h4>\r\n";
  177. $message .= "<p>Your username was entered in the Reset Password page. If you did not do this, you may ignore and delete this message. ";
  178. $message .= "If you did request a password reset, click the link below, or copy and paste it into your browser's address bar. Your ";
  179. $message .= "password will then be reset to: password.</p>";
  180. $message .= "<a href=\"http://" . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . "/actions.php?action=resetpw&id=$id&code=$code\">";
  181. $message .= "http://" . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . "/actions.php?action=resetpw&id=$id&code=$code</a>\r\n";
  182. mail(mysql_result($result,0,2),'Password Reset Request',$message,$headers);
  183. } else {
  184. echo "Invalid Username. <a href=\"index.php$gb\">Try again</a>";
  185. exit;
  186. }
  187. header("Location: http://" . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . "/index.php");
  188. } else if (isset($_GET['code'])) {
  189. $query = "SELECT password FROM imas_users WHERE id='{$_GET['id']}'";
  190. $result = mysql_query($query) or die("Query failed : " . mysql_error());
  191. if (mysql_num_rows($result)>0 && $_GET['code']===mysql_result($result,0,0)) {
  192. $newpw = md5("password");
  193. $query = "UPDATE imas_users SET password='$newpw' WHERE id='{$_GET['id']}' LIMIT 1";
  194. mysql_query($query) or die("Query failed : " . mysql_error());
  195. echo "Password Reset. ";
  196. echo "<a href=\"index.php\">Login with password: password</a>";
  197. echo "<p>After logging in, select Change User Info to change your password</p>";
  198. exit;
  199. }
  200. }
  201. } else if ($_GET['action']=="lookupusername") {
  202. require_once("config.php");
  203. $query = "SELECT SID,lastaccess FROM imas_users WHERE email='{$_POST['email']}'";
  204. $result = mysql_query($query) or die("Query failed : " . mysql_error());
  205. if (mysql_num_rows($result)>0) {
  206. echo mysql_num_rows($result);
  207. echo " usernames match this email address and were emailed. <a href=\"index.php\">Return to login page</a>";
  208. $headers = 'MIME-Version: 1.0' . "\r\n";
  209. $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  210. $headers .= "From: $sendfrom\r\n";
  211. $message = "<h4>This is an automated message from $installname. Do not respond to this email</h4>\r\n";
  212. $message .= "<p>Your email was entered in the Username Lookup page on $installname. If you did not do this, you may ignore and delete this message. ";
  213. $message .= "All usernames using this email address are listed below</p><p>";
  214. while ($row = mysql_fetch_row($result)) {
  215. if ($row[1]==0) {
  216. $lastlogin = "Never";
  217. } else {
  218. $lastlogin = date("n/j/y g:ia",$row[1]);
  219. }
  220. $message .= "Username: <b>{$row[0]}</b>. Last logged in: $lastlogin<br/>";
  221. }
  222. $message .= "</p><p>If you forgot your password, use the Lost Password link at the login page.</p>";
  223. mail($_POST['email'],"$installname Username Request",$message,$headers);
  224. exit;
  225. } else {
  226. echo "No usernames match this email address. <a href=\"index.php\">Return to login page</a>";
  227. exit;
  228. }
  229. }
  230. require("validate.php");
  231. if ($_GET['action']=="logout") {
  232. $sessionid = session_id();
  233. $query = "DELETE FROM imas_sessions WHERE sessionid='$sessionid'";
  234. mysql_query($query) or die("Query failed : " . mysql_error());
  235. $_SESSION = array();
  236. if (isset($_COOKIE[session_name()])) {
  237. setcookie(session_name(), '', time()-42000, '/');
  238. }
  239. session_destroy();
  240. } else if ($_GET['action']=="chgpwd") {
  241. $query = "SELECT password FROM imas_users WHERE id = '$userid'";
  242. $result = mysql_query($query) or die("Query failed : " . mysql_error());
  243. $line = mysql_fetch_array($result, MYSQL_ASSOC);
  244. if ((md5($_POST['oldpw'])==$line['password']) && ($_POST['newpw1'] == $_POST['newpw2']) && $myrights>5) {
  245. $md5pw =md5($_POST['newpw1']);
  246. $query = "UPDATE imas_users SET password='$md5pw' WHERE id='$userid'";
  247. mysql_query($query) or die("Query failed : " . mysql_error());
  248. } else {
  249. echo "<html><body>Password change failed. <A HREF=\"forms.php?action=chgpwd$gb\">Try Again</a>\n";
  250. echo "</body></html>\n";
  251. exit;
  252. }
  253. } else if ($_GET['action']=="enroll") {
  254. if ($myrights < 6) {
  255. echo "<html><body>\nError: Guests can't enroll in courses</body></html";
  256. exit;
  257. }
  258. if ($_POST['cid']=="" || !is_numeric($_POST['cid'])) {
  259. echo "<html><body>\n";
  260. echo "Please include Course ID. <a href=\"forms.php?action=enroll$gb\">Try Again</a>\n";
  261. echo "</html></body>\n";
  262. exit;
  263. }
  264. $query = "SELECT enrollkey,allowunenroll FROM imas_courses WHERE id = '{$_POST['cid']}'";
  265. $result = mysql_query($query) or die("Query failed : " . mysql_error());
  266. $line = mysql_fetch_array($result, MYSQL_ASSOC);
  267. if ($line == null) {
  268. echo "<html><body>\n";
  269. echo "Course not found. <a href=\"forms.php?action=enroll$gb\">Try Again</a>\n";
  270. echo "</html></body>\n";
  271. exit;
  272. } else if (($line['allowunenroll']&2)==2) {
  273. echo "<html><body>\n";
  274. echo "Course is closed for self enrollment. Contact your instructor for access. <a href=\"index.php\">Return to home page.</a>\n";
  275. echo "</html></body>\n";
  276. exit;
  277. } else if ($_POST['ekey']=="" && $line['enrollkey'] != '') {
  278. echo "<html><body>\n";
  279. echo "Please include Enrollment Key. <a href=\"forms.php?action=enroll$gb\">Try Again</a>\n";
  280. echo "</html></body>\n";
  281. exit;
  282. } else if ($line['enrollkey'] != $_POST['ekey']) {
  283. echo "<html><body>\n";
  284. echo "Incorrect Enrollment Key. <a href=\"forms.php?action=enroll$gb\">Try Again</a>\n";
  285. echo "</html></body>\n";
  286. exit;
  287. } else {
  288. $query = "SELECT * FROM imas_teachers WHERE userid='$userid' AND courseid='{$_POST['cid']}'";
  289. $result = mysql_query($query) or die("Query failed : " . mysql_error());
  290. if (mysql_num_rows($result)>0) {
  291. echo "<html><body>\n";
  292. echo "You are a teacher for this course, and can't enroll as a student. Use Student View to see ";
  293. echo "the class from a student's perspective, or create a dummy student account. ";
  294. echo "Click on the course name on the <a href=\"index.php\">main page</a> to access the course\n";
  295. echo "</html></body>\n";
  296. exit;
  297. }
  298. $query = "SELECT * FROM imas_students WHERE userid='$userid' AND courseid='{$_POST['cid']}'";
  299. $result = mysql_query($query) or die("Query failed : " . mysql_error());
  300. if (mysql_num_rows($result)>0) {
  301. echo "<html><body>\n";
  302. echo "You are already enrolled in the course. Click on the course name on the <a href=\"index.php\">main page</a> to access the course\n";
  303. echo "</html></body>\n";
  304. exit;
  305. } else {
  306. $query = "INSERT INTO imas_students (userid,courseid) VALUES ('$userid','{$_POST['cid']}');";
  307. mysql_query($query) or die("Query failed : " . mysql_error());
  308. }
  309. }
  310. } else if ($_GET['action']=="unenroll") {
  311. if ($myrights < 6) {
  312. echo "<html><body>\nError: Guests can't unenroll from courses</body></html";
  313. exit;
  314. }
  315. if (!isset($_GET['cid'])) {
  316. echo "<html><body>\n";
  317. echo "Course ID not specified. <a href=\"index.php\">Try Again</a>\n";
  318. echo "</html></body>\n";
  319. exit;
  320. }
  321. $cid = $_GET['cid'];
  322. $query = "DELETE FROM imas_students WHERE userid='$userid' AND courseid='$cid'";
  323. mysql_query($query) or die("Query failed : " . mysql_error());
  324. $query = "SELECT id FROM imas_assessments WHERE courseid='$cid'";
  325. $result = mysql_query($query) or die("Query failed : " . mysql_error());
  326. while ($row = mysql_fetch_row($result)) {
  327. $query = "DELETE FROM imas_assessment_sessions WHERE assessmentid='{$row[0]}' AND userid='$userid'";
  328. mysql_query($query) or die("Query failed : " . mysql_error());
  329. $query = "DELETE FROM imas_exceptions WHERE assessmentid='{$row[0]}' AND userid='$userid'";
  330. mysql_query($query) or die("Query failed : " . mysql_error());
  331. }
  332. $query = "SELECT id FROM imas_gbitems WHERE courseid='$cid'";
  333. $result = mysql_query($query) or die("Query failed : " . mysql_error());
  334. while ($row = mysql_fetch_row($result)) {
  335. $query = "DELETE FROM imas_grades WHERE gbitemid='{$row[0]}' AND userid='$userid'";
  336. mysql_query($query) or die("Query failed : " . mysql_error());
  337. }
  338. $query = "SELECT id FROM imas_forums WHERE courseid='$cid'";
  339. $result = mysql_query($query) or die("Query failed : " . mysql_error());
  340. while ($row = mysql_fetch_row($result)) {
  341. $q2 = "SELECT threadid FROM imas_forum_posts WHERE forumid='{$row[0]}'";
  342. $r2 = mysql_query($q2) or die("Query failed : " . mysql_error());
  343. while ($rw2 = mysql_fetch_row($r2)) {
  344. $query = "DELETE FROM imas_forum_views WHERE threadid='{$rw2[0]}' AND userid='$userid'";
  345. mysql_query($query) or die("Query failed : " . mysql_error());
  346. }
  347. }
  348. } else if ($_GET['action']=="chguserinfo") {
  349. require('includes/userpics.php');
  350. if (isset($_POST['msgnot'])) {
  351. $msgnot = 1;
  352. } else {
  353. $msgnot = 0;
  354. }
  355. if (isset($_POST['qrd']) || $myrights<20) {
  356. $qrightsdef = 0;
  357. } else {
  358. $qrightsdef = 2;
  359. }
  360. if (isset($_POST['usedeflib'])) {
  361. $usedeflib = 1;
  362. } else {
  363. $usedeflib = 0;
  364. }
  365. if ($myrights<20) {
  366. $deflib = 0;
  367. } else {
  368. $deflib = $_POST['libs'];
  369. }
  370. $homelayout[0] = array();
  371. $homelayout[1] = array(0,1,2);
  372. $homelayout[2] = array();
  373. if (isset($_POST['homelayout10'])) {
  374. $homelayout[2][] = 10;
  375. }
  376. if (isset($_POST['homelayout11'])) {
  377. $homelayout[2][] = 11;
  378. }
  379. $homelayout[3] = array();
  380. if (isset($_POST['homelayout3-0'])) {
  381. $homelayout[3][] = 0;
  382. }
  383. if (isset($_POST['homelayout3-1'])) {
  384. $homelayout[3][] = 1;
  385. }
  386. foreach ($homelayout as $k=>$v) {
  387. $homelayout[$k] = implode(',',$v);
  388. }
  389. $perpage = intval($_POST['perpage']);
  390. if (isset($CFG['GEN']['fixedhomelayout']) && $CFG['GEN']['homelayout']) {
  391. $deflayout = explode('|',$CFG['GEN']['homelayout']);
  392. foreach ($CFG['GEN']['fixedhomelayout'] as $k) {
  393. $homelayout[$k] = $deflayout[$k];
  394. }
  395. }
  396. $layoutstr = implode('|',$homelayout);
  397. $query = "UPDATE imas_users SET FirstName='{$_POST['firstname']}',LastName='{$_POST['lastname']}',email='{$_POST['email']}',msgnotify=$msgnot,qrightsdef=$qrightsdef,deflib='$deflib',usedeflib='$usedeflib',homelayout='$layoutstr',listperpage='$perpage' ";
  398. $query .= "WHERE id='$userid'";
  399. mysql_query($query) or die("Query failed : " . mysql_error());
  400. if (is_uploaded_file($_FILES['stupic']['tmp_name'])) {
  401. processImage($_FILES['stupic'],$userid,200,200);
  402. processImage($_FILES['stupic'],'sm'.$userid,40,40);
  403. } else if (isset($_POST['removepic'])) {
  404. $curdir = rtrim(dirname(__FILE__), '/\\');
  405. $galleryPath = "$curdir/course/files/";
  406. if (file_exists($galleryPath.'userimg_'.$userid.'.jpg')) {
  407. unlink($galleryPath.'userimg_'.$userid.'.jpg');
  408. unlink($galleryPath.'userimg_sm'.$userid.'.jpg');
  409. }
  410. }
  411. if (isset($_POST['dochgpw'])) {
  412. $query = "SELECT password FROM imas_users WHERE id = '$userid'";
  413. $result = mysql_query($query) or die("Query failed : " . mysql_error());
  414. $line = mysql_fetch_array($result, MYSQL_ASSOC);
  415. if ((md5($_POST['oldpw'])==$line['password']) && ($_POST['newpw1'] == $_POST['newpw2']) && $myrights>5) {
  416. $md5pw =md5($_POST['newpw1']);
  417. $query = "UPDATE imas_users SET password='$md5pw' WHERE id='$userid'";
  418. mysql_query($query) or die("Query failed : " . mysql_error());
  419. } else {
  420. echo "<html><body>Password change failed. <A HREF=\"forms.php?action=chguserinfo$gb\">Try Again</a>\n";
  421. echo "</body></html>\n";
  422. exit;
  423. }
  424. }
  425. } else if ($_GET['action']=="googlegadget") {
  426. if (isset($_GET['clear'])) {
  427. $query = "UPDATE imas_users SET remoteaccess='' WHERE id='$userid'";
  428. mysql_query($query) or die("Query failed : " . mysql_error());
  429. }
  430. }
  431. if ($isgb) {
  432. echo '<html><body>Changes Recorded. <input type="button" onclick="top.GB_hide()" value="Done" /></body></html>';
  433. } else {
  434. header("Location: http://" . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . "/index.php");
  435. }
  436. ?>