
Joshua
Members-
Posts
1,271 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Everything posted by Joshua
-
Spaces in front of <?php cause that noob! hehehe ;-)
-
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /data/users/jsmigle/mobslife.net/mobslife.net/public/druglab.php:2) in /data/users/jsmigle/mobslife.net/mobslife.net/public/globals.php on line 20 are you converting it to V1? usually that's a double globals.php call >,<
-
Looking to purchase a more advanced drug mod
Joshua replied to Lotan Kane's topic in Requests & In Production
Decided to release for free (: [mccode v2.x] New Drug Mod -
forgot the drug addiction cron Open Cron_Fivemins.php Find $query3="UPDATE users SET will=will+10 WHERE will<maxwill"; $query4="UPDATE users SET will=maxwill WHERE will>maxwill"; $db->query($query); $db->query($query5); $db->query($query2); $db->query($query3); $db->query($query4); above this add $addiction = $db->query("SELECT `addiction` FROM `users`"); while($sad=$db->fetch_row($addiction)) { if($sad['addiction'] > 9 AND $sad['addiction'] < 20) { $query3="UPDATE users SET will=will+8 WHERE will<maxwill"; $query4="UPDATE users SET will=maxwill WHERE will>maxwill"; $db->query($query3); $db->query($query4); } elseif($sad['addiction'] >20) { $query3="UPDATE users SET will=will+5 WHERE will<maxwill"; $query4="UPDATE users SET will=maxwill WHERE will>maxwill"; $db->query($query3); $db->query($query4); } else { $query3="UPDATE users SET will=will+10 WHERE will<maxwill"; $query4="UPDATE users SET will=maxwill WHERE will>maxwill"; $db->query($query3); $db->query($query4); } Now you want to remove $query3="UPDATE users SET will=will+10 WHERE will<maxwill"; $query4="UPDATE users SET will=maxwill WHERE will>maxwill"; and $db->query($query3); $db->query($query4);
-
screenshots Screen 1 Screen 2 Screen 3 Screen 4 Screen 5
-
function question6() { global $db,$h; $already = $db->query("SELECT `tuserid`,`uSCORE`,`qID`,`questions` FROM `userstesting` WHERE `tuserid`=".$_SESSION['userid'].""); $bleep = $db->fetch_row($already); $string = $bleep['qID']; $pieces = explode(",", $string); if($bleep['questions'] != 5) { echo "You have already taken this section of the quiz. Click the link below to move on to the next one! [url='drugtest.php?action=question7'][b]Next Question[/b][/url]"; $h->endpage(); exit; } if ($_SESSION['questionid']) { $testq = $db->query("SELECT `qID`,`qQUESTION`,`qANSWER1`,`qANSWER2`,`qANSWER3`,`qCORRECT` FROM `tests` WHERE `qID`='" . $_SESSION['questionid'] . "'"); $tt = $db->fetch_row($testq); } else { $testq = $db->query("SELECT `qID`,`qQUESTION`,`qANSWER1`,`qANSWER2`,`qANSWER3`,`qCORRECT` FROM `tests` WHERE `qID`!='$pieces[0]' AND `qID`!='$pieces[1]' AND `qID`!='$pieces[2]' AND `qID`!='$pieces[3]' AND `qID`!='$pieces[4]' ORDER BY RAND()"); $tt = $db->fetch_row($testq); $_SESSION['questionid'] = $tt['qID']; } $dbinsert = $bleep['qID'] . ',' . $tt['qID']; if($_POST['a']) { if($_POST['a'] != $tt['qCORRECT']) { $db->query("UPDATE `userstesting` SET `qID`='{$dbinsert}',`questions`=`questions`+1 WHERE `tuserid`=".$_SESSION['userid'].""); echo "Incorrect Answer. Press [url='drugtest.php?action=question7'][b]Here[/b][/url] To continue to the next question."; unset($_SESSION['questionid']); } else { $db->query("UPDATE `userstesting` SET `uSCORE`=`uSCORE`+10,`qID`='$dbinsert',`questions`=`questions`+1 WHERE `tuserid`=".$_SESSION['userid'].""); echo "Correct Answer! Click [url='drugtest.php?action=question7'][b]Here[/b][/url]To proceed."; unset($_SESSION['questionid']); } } else { echo " <form method='post' action='drugtest.php?action=question6'> [b]".$tt['qQUESTION']." [/b] <input type='radio' name='a' value='".$tt['qANSWER1']."'>".$tt['qANSWER1']." <input type='radio' name='a' value='".$tt['qANSWER2']."'>".$tt['qANSWER2']." <input type='radio' name='a' value='".$tt['qANSWER3']."'>".$tt['qANSWER3']." <input type='submit' value='Submit Answer!' > </form>"; } } function question7() { global $db,$h; $already = $db->query("SELECT `tuserid`,`uSCORE`,`qID`,`questions` FROM `userstesting` WHERE `tuserid`=".$_SESSION['userid'].""); $bleep = $db->fetch_row($already); $string = $bleep['qID']; $pieces = explode(",", $string); if($bleep['questions'] != 6) { echo "You have already taken this section of the quiz. Click the link below to move on to the next one! [url='drugtest.php?action=question8'][b]Next Question[/b][/url]"; $h->endpage(); exit; } if ($_SESSION['questionid']) { $testq = $db->query("SELECT `qID`,`qQUESTION`,`qANSWER1`,`qANSWER2`,`qANSWER3`,`qCORRECT` FROM `tests` WHERE `qID`='" . $_SESSION['questionid'] . "'"); $tt = $db->fetch_row($testq); } else { $testq = $db->query("SELECT `qID`,`qQUESTION`,`qANSWER1`,`qANSWER2`,`qANSWER3`,`qCORRECT` FROM `tests` WHERE `qID`!='$pieces[0]' AND `qID`!='$pieces[1]' AND `qID`!='$pieces[2]' AND `qID`!='$pieces[3]' AND `qID`!='$pieces[4]' AND `qID`!='$pieces[5]' ORDER BY RAND()"); $tt = $db->fetch_row($testq); $_SESSION['questionid'] = $tt['qID']; } $dbinsert = $bleep['qID'] . ',' . $tt['qID']; if($_POST['a']) { if($_POST['a'] != $tt['qCORRECT']) { $db->query("UPDATE `userstesting` SET `qID`='{$dbinsert}',`questions`=`questions`+1 WHERE `tuserid`=".$_SESSION['userid'].""); echo "Incorrect Answer. Press [url='drugtest.php?action=question8'][b]Here[/b][/url] To continue to the next question."; unset($_SESSION['questionid']); } else { $db->query("UPDATE `userstesting` SET `uSCORE`=`uSCORE`+10,`qID`='$dbinsert',`questions`=`questions`+1 WHERE `tuserid`=".$_SESSION['userid'].""); echo "Correct Answer! Click [url='drugtest.php?action=question8'][b]Here[/b][/url]To proceed."; unset($_SESSION['questionid']); } } else { echo " <form method='post' action='drugtest.php?action=question7'> [b]".$tt['qQUESTION']." [/b] <input type='radio' name='a' value='".$tt['qANSWER1']."'>".$tt['qANSWER1']." <input type='radio' name='a' value='".$tt['qANSWER2']."'>".$tt['qANSWER2']." <input type='radio' name='a' value='".$tt['qANSWER3']."'>".$tt['qANSWER3']." <input type='submit' value='Submit Answer!' > </form>"; } } function question8() { global $db,$h; $already = $db->query("SELECT `tuserid`,`uSCORE`,`qID`,`questions` FROM `userstesting` WHERE `tuserid`=".$_SESSION['userid'].""); $bleep = $db->fetch_row($already); $string = $bleep['qID']; $pieces = explode(",", $string); if($bleep['questions'] != 7) { echo "You have already taken this section of the quiz. Click the link below to move on to the next one! [url='drugtest.php?action=question9'][b]Next Question[/b][/url]"; $h->endpage(); exit; } if ($_SESSION['questionid']) { $testq = $db->query("SELECT `qID`,`qQUESTION`,`qANSWER1`,`qANSWER2`,`qANSWER3`,`qCORRECT` FROM `tests` WHERE `qID`='" . $_SESSION['questionid'] . "'"); $tt = $db->fetch_row($testq); } else { $testq = $db->query("SELECT `qID`,`qQUESTION`,`qANSWER1`,`qANSWER2`,`qANSWER3`,`qCORRECT` FROM `tests` WHERE `qID`!='$pieces[0]' AND `qID`!='$pieces[1]' AND `qID`!='$pieces[2]' AND `qID`!='$pieces[3]' AND `qID`!='$pieces[4]' AND `qID`!='$pieces[5]' AND `qID`!='$pieces[6]' ORDER BY RAND()"); $tt = $db->fetch_row($testq); $_SESSION['questionid'] = $tt['qID']; } $dbinsert = $bleep['qID'] . ',' . $tt['qID']; if($_POST['a']) { if($_POST['a'] != $tt['qCORRECT']) { $db->query("UPDATE `userstesting` SET `qID`='{$dbinsert}',`questions`=`questions`+1 WHERE `tuserid`=".$_SESSION['userid'].""); echo "Incorrect Answer. Press [url='drugtest.php?action=question9'][b]Here[/b][/url] To continue to the next question."; unset($_SESSION['questionid']); } else { $db->query("UPDATE `userstesting` SET `uSCORE`=`uSCORE`+10,`qID`='$dbinsert',`questions`=`questions`+1 WHERE `tuserid`=".$_SESSION['userid'].""); echo "Correct Answer! Click [url='drugtest.php?action=question9'][b]Here[/b][/url]To proceed."; unset($_SESSION['questionid']); } } else { echo " <form method='post' action='drugtest.php?action=question8'> [b]".$tt['qQUESTION']." [/b] <input type='radio' name='a' value='".$tt['qANSWER1']."'>".$tt['qANSWER1']." <input type='radio' name='a' value='".$tt['qANSWER2']."'>".$tt['qANSWER2']." <input type='radio' name='a' value='".$tt['qANSWER3']."'>".$tt['qANSWER3']." <input type='submit' value='Submit Answer!' > </form>"; } } function question9() { global $db,$h; $already = $db->query("SELECT `tuserid`,`uSCORE`,`qID`,`questions` FROM `userstesting` WHERE `tuserid`=".$_SESSION['userid'].""); $bleep = $db->fetch_row($already); $string = $bleep['qID']; $pieces = explode(",", $string); if($bleep['questions'] != 8) { echo "You have already taken this section of the quiz. Click the link below to move on to the next one! [url='drugtest.php?action=question10'][b]Next Question[/b][/url]"; $h->endpage(); exit; } if ($_SESSION['questionid']) { $testq = $db->query("SELECT `qID`,`qQUESTION`,`qANSWER1`,`qANSWER2`,`qANSWER3`,`qCORRECT` FROM `tests` WHERE `qID`='" . $_SESSION['questionid'] . "'"); $tt = $db->fetch_row($testq); } else { $testq = $db->query("SELECT `qID`,`qQUESTION`,`qANSWER1`,`qANSWER2`,`qANSWER3`,`qCORRECT` FROM `tests` WHERE `qID`!='$pieces[0]' AND `qID`!='$pieces[1]' AND `qID`!='$pieces[2]' AND `qID`!='$pieces[3]' AND `qID`!='$pieces[4]' AND `qID`!='$pieces[5]' AND `qID`!='$pieces[6]' AND `qID`!='$pieces[7]' ORDER BY RAND()"); $tt = $db->fetch_row($testq); $_SESSION['questionid'] = $tt['qID']; } $dbinsert = $bleep['qID'] . ',' . $tt['qID']; if($_POST['a']) { if($_POST['a'] != $tt['qCORRECT']) { $db->query("UPDATE `userstesting` SET `qID`='{$dbinsert}',`questions`=`questions`+1 WHERE `tuserid`=".$_SESSION['userid'].""); echo "Incorrect Answer. Press [url='drugtest.php?action=question10'][b]Here[/b][/url] To continue to the next question."; unset($_SESSION['questionid']); } else { $db->query("UPDATE `userstesting` SET `uSCORE`=`uSCORE`+10,`qID`='$dbinsert',`questions`=`questions`+1 WHERE `tuserid`=".$_SESSION['userid'].""); echo "Correct Answer! Click [url='drugtest.php?action=question10'][b]Here[/b][/url]To proceed."; unset($_SESSION['questionid']); } } else { echo " <form method='post' action='drugtest.php?action=question9'> [b]".$tt['qQUESTION']." [/b] <input type='radio' name='a' value='".$tt['qANSWER1']."'>".$tt['qANSWER1']." <input type='radio' name='a' value='".$tt['qANSWER2']."'>".$tt['qANSWER2']." <input type='radio' name='a' value='".$tt['qANSWER3']."'>".$tt['qANSWER3']." <input type='submit' value='Submit Answer!' > </form>"; } } function question10() { global $db,$h; $already = $db->query("SELECT `tuserid`,`uSCORE`,`qID`,`questions` FROM `userstesting` WHERE `tuserid`=".$_SESSION['userid'].""); $bleep = $db->fetch_row($already); $string = $bleep['qID']; $pieces = explode(",", $string); if($bleep['questions'] != 9) { echo "You have already completed this course for the day! [url='drugtest.php'][b]Back[/b][/url]"; $h->endpage(); exit; } if ($_SESSION['questionid']) { $testq = $db->query("SELECT `qID`,`qQUESTION`,`qANSWER1`,`qANSWER2`,`qANSWER3`,`qCORRECT` FROM `tests` WHERE `qID`='" . $_SESSION['questionid'] . "'"); $tt = $db->fetch_row($testq); } else { $testq = $db->query("SELECT `qID`,`qQUESTION`,`qANSWER1`,`qANSWER2`,`qANSWER3`,`qCORRECT` FROM `tests` WHERE `qID`!='$pieces[0]' AND `qID`!='$pieces[1]' AND `qID`!='$pieces[2]' AND `qID`!='$pieces[3]' AND `qID`!='$pieces[4]' AND `qID`!='$pieces[5]' AND `qID`!='$pieces[6]' AND `qID`!='$pieces[7]' AND `qID`!='$pieces[8]' ORDER BY RAND()"); $tt = $db->fetch_row($testq); $_SESSION['questionid'] = $tt['qID']; } $dbinsert = $bleep['qID'] . ',' . $tt['qID']; if($_POST['a']) { if($_POST['a'] != $tt['qCORRECT']) { $db->query("UPDATE `userstesting` SET `qID`='{$dbinsert}',`questions`=`questions`+1 WHERE `tuserid`=".$_SESSION['userid'].""); echo "Incorrect Answer. Press [url='drugtest.php?action=score'][b]Here[/b][/url] To continue to your score."; unset($_SESSION['questionid']); } else { $db->query("UPDATE `userstesting` SET `uSCORE`=`uSCORE`+10,`qID`='$dbinsert',`questions`=`questions`+1 WHERE `tuserid`=".$_SESSION['userid'].""); echo "Correct Answer! Click [url='drugtest.php?action=score'][b]Here[/b][/url]To proceed to your score."; unset($_SESSION['questionid']); } } else { echo " <form method='post' action='drugtest.php?action=question10'> [b]".$tt['qQUESTION']." [/b] <input type='radio' name='a' value='".$tt['qANSWER1']."'>".$tt['qANSWER1']." <input type='radio' name='a' value='".$tt['qANSWER2']."'>".$tt['qANSWER2']." <input type='radio' name='a' value='".$tt['qANSWER3']."'>".$tt['qANSWER3']." <input type='submit' value='Submit Answer!' > </form>"; } } function score() { global $db,$h; $test = $db->query("SELECT `uSCORE` FROM `userstesting` WHERE `tuserid`=".$_SESSION['userid'].""); $the = $db->fetch_row($test); if(!$db->num_rows($test)) { echo "You do not belong here yet."; $h->endpage(); exit; } if($the['uSCORE'] > 70) { echo "Congratulations! You successfully passed the Rehabilitation Test with a score of ".$the['uSCORE']." out of a possible 100. You have been granted a plaque which will appear on your profile page beneath your mentors name. We wish you all the best in your future endeavors. If you have selected a Mentor, you are now able to check out of Rehab [url='rehab.php']Here[/url]"; $db->query("UPDATE `rehab` SET `test`=1 WHERE `rUSERID`=".$_SESSION['userid'].""); } else { echo "We are sorry. Due to a score of ".$the['uSCORE']." out of a possible 100, we cannot in good conscience allow you to leave our facility with a clean bill of health. Should you wish, you will be able to take this test again tomorrow. So study hard! [url='index.php'][b]Back[/b][/url]"; } } ?>
-
drugtest.php Divided in half due to size. <?php require_once("globals.php"); $_POST['a'] = isset($_POST['a']) && is_string($_POST['a']) ? strtolower(trim($_POST['a'])) : false; $_GET['action'] = isset($_GET['action']) && is_string($_GET['action']) ? strtolower(trim($_GET['action'])) : false; $_SESSION['questionid'] = isset($_SESSION['questionid']) && ctype_digit($_SESSION['questionid']) ? abs((int) $_SESSION['questionid']) : false; switch($_GET['action']) { case "index":index();break; case 'question1': question1(); break; case 'question2': question2(); break; case 'question3': question3(); break; case 'question4': question4(); break; case 'question5': question5(); break; case 'question6': question6(); break; case 'question7': question7(); break; case 'question8': question8(); break; case 'question9': question9(); break; case 'question10': question10(); break; case 'score': score(); break; default:index();break; } function index() { global $h,$db; $already = $db->query("SELECT `tuserid`,`uSCORE`,`qID`,`questions` FROM `userstesting` WHERE `tuserid`=".$_SESSION['userid'].""); if($db->num_rows($already)) { echo "You have already taken your test for the day. Please return tomorrow if you did not meet the required score to try again. [url='index.php'][b]Back[/b][/url]"; $h->endpage(); exit; } echo "<center><h2>Welcome to your Rehab Release Quiz</h2></center> Here you will be tested to determine whether or not you are ready to be granted a clean bill of health. You will be given 10 questions. You must score at least an 8 out of 10 to pass. If you fail you will have to wait a full day to take this test again. Should you choose to continue, you can start by pressing the confirm link below. [url='drugtest.php?action=question1'][b]Confirm[/b][/url] "; $h->endpage(); exit; } function question1() { global $db,$h; $already = $db->query("SELECT `tuserid`,`uSCORE`,`qID`,`questions` FROM `userstesting` WHERE `tuserid`=".$_SESSION['userid'].""); $bleep = $db->fetch_row($already); if($bleep['questions'] != 0) { echo "You have already taken this section of the quiz. Click the link below to move on to the next one! [url='drugtest.php?action=question2'][b]Next Question[/b][/url]"; $h->endpage(); exit; } if ($_SESSION['questionid']) { $testq = $db->query("SELECT `qID`,`qQUESTION`,`qANSWER1`,`qANSWER2`,`qANSWER3`,`qCORRECT` FROM `tests` WHERE `qID`='" . $_SESSION['questionid'] . "'"); $tt = $db->fetch_row($testq); } else { $testq = $db->query("SELECT `qID`,`qQUESTION`,`qANSWER1`,`qANSWER2`,`qANSWER3`,`qCORRECT` FROM `tests` ORDER BY RAND()"); $tt = $db->fetch_row($testq); $_SESSION['questionid'] = $tt['qID']; } if($_POST['a']) { if($_POST['a'] != $tt['qCORRECT']) { $db->query("INSERT INTO `userstesting` VALUES(".$_SESSION['userid'].",0,".$tt['qID'].",1)"); echo "Incorrect Answer. Press [url='drugtest.php?action=question2'][b]Here[/b][/url] To continue to the next question."; unset($_SESSION['questionid']); } else { $db->query("INSERT INTO `userstesting` VALUES(".$_SESSION['userid'].",10,".$tt['qID'].",1)"); echo "Correct Answer! Click [url='drugtest.php?action=question2'][b]Here[/b][/url]To proceed."; unset($_SESSION['questionid']); } } else { echo " <form method='post' action='drugtest.php?action=question1'> [b]".$tt['qQUESTION']." [/b] <input type='radio' name='a' value='".$tt['qANSWER1']."'>".$tt['qANSWER1']." <input type='radio' name='a' value='".$tt['qANSWER2']."'>".$tt['qANSWER2']." <input type='radio' name='a' value='".$tt['qANSWER3']."'>".$tt['qANSWER3']." <input type='submit' value='Submit Answer!' > </form>"; } } function question2() { global $db,$h; $already = $db->query("SELECT `tuserid`,`uSCORE`,`qID`,`questions` FROM `userstesting` WHERE `tuserid`=".$_SESSION['userid'].""); $bleep = $db->fetch_row($already); $string = $bleep['qID']; $pieces = explode(",", $string); if($bleep['questions'] != 1) { echo "You have already taken this section of the quiz. Click the link below to move on to the next one! [url='drugtest.php?action=question3'][b]Next Question[/b][/url]"; $h->endpage(); exit; } if ($_SESSION['questionid']) { $testq = $db->query("SELECT `qID`,`qQUESTION`,`qANSWER1`,`qANSWER2`,`qANSWER3`,`qCORRECT` FROM `tests` WHERE `qID`='" . $_SESSION['questionid'] . "'"); $tt = $db->fetch_row($testq); } else { $testq = $db->query("SELECT `qID`,`qQUESTION`,`qANSWER1`,`qANSWER2`,`qANSWER3`,`qCORRECT` FROM `tests` WHERE `qID`!='$pieces[0]' ORDER BY RAND()"); $tt = $db->fetch_row($testq); $_SESSION['questionid'] = $tt['qID']; } $dbinsert = $bleep['qID'] . ',' . $tt['qID']; if($_POST['a']) { if($_POST['a'] != $tt['qCORRECT']) { $db->query("UPDATE `userstesting` SET `qID`='{$dbinsert}',`questions`=`questions`+1 WHERE `tuserid`=".$_SESSION['userid'].""); echo "Incorrect Answer. Press [url='drugtest.php?action=question3'][b]Here[/b][/url] To continue to the next question."; unset($_SESSION['questionid']); } else { $db->query("UPDATE `userstesting` SET `uSCORE`=`uSCORE`+10,`qID`='{$dbinsert}',`questions`=`questions`+1 WHERE `tuserid`=".$_SESSION['userid'].""); echo "Correct Answer! Click [url='drugtest.php?action=question3'][b]Here[/b][/url]To proceed."; unset($_SESSION['questionid']); } } else { echo " <form method='post' action='drugtest.php?action=question2'> [b]".$tt['qQUESTION']." [/b] <input type='radio' name='a' value='".$tt['qANSWER1']."'>".$tt['qANSWER1']." <input type='radio' name='a' value='".$tt['qANSWER2']."'>".$tt['qANSWER2']." <input type='radio' name='a' value='".$tt['qANSWER3']."'>".$tt['qANSWER3']." <input type='submit' value='Submit Answer!' > </form>"; } } function question3() { global $db,$h; $already = $db->query("SELECT `tuserid`,`uSCORE`,`qID`,`questions` FROM `userstesting` WHERE `tuserid`=".$_SESSION['userid'].""); $bleep = $db->fetch_row($already); $string = $bleep['qID']; $pieces = explode(",", $string); if($bleep['questions'] != 2) { echo "You have already taken this section of the quiz. Click the link below to move on to the next one! [url='drugtest.php?action=question4'][b]Next Question[/b][/url]"; $h->endpage(); exit; } if ($_SESSION['questionid']) { $testq = $db->query("SELECT `qID`,`qQUESTION`,`qANSWER1`,`qANSWER2`,`qANSWER3`,`qCORRECT` FROM `tests` WHERE `qID`='" . $_SESSION['questionid'] . "'"); $tt = $db->fetch_row($testq); } else { $testq = $db->query("SELECT `qID`,`qQUESTION`,`qANSWER1`,`qANSWER2`,`qANSWER3`,`qCORRECT` FROM `tests` WHERE `qID`!='$pieces[0]' AND `qID`!='$pieces[1]' ORDER BY RAND()"); $tt = $db->fetch_row($testq); $_SESSION['questionid'] = $tt['qID']; } $dbinsert = $bleep['qID'] . ',' . $tt['qID']; if($_POST['a']) { if($_POST['a'] != $tt['qCORRECT']) { $db->query("UPDATE `userstesting` SET `qID`='{$dbinsert}',`questions`=`questions`+1 WHERE `tuserid`=".$_SESSION['userid'].""); echo "Incorrect Answer. Press [url='drugtest.php?action=question4'][b]Here[/b][/url] To continue to the next question."; unset($_SESSION['questionid']); } else { $db->query("UPDATE `userstesting` SET `uSCORE`=`uSCORE`+10,`qID`='$dbinsert',`questions`=`questions`+1 WHERE `tuserid`=".$_SESSION['userid'].""); echo "Correct Answer! Click [url='drugtest.php?action=question4'][b]Here[/b][/url]To proceed."; unset($_SESSION['questionid']); } } else { echo " <form method='post' action='drugtest.php?action=question3'> [b]".$tt['qQUESTION']." [/b] <input type='radio' name='a' value='".$tt['qANSWER1']."'>".$tt['qANSWER1']." <input type='radio' name='a' value='".$tt['qANSWER2']."'>".$tt['qANSWER2']." <input type='radio' name='a' value='".$tt['qANSWER3']."'>".$tt['qANSWER3']." <input type='submit' value='Submit Answer!' > </form>"; } } function question4() { global $db,$h; $already = $db->query("SELECT `tuserid`,`uSCORE`,`qID`,`questions` FROM `userstesting` WHERE `tuserid`=".$_SESSION['userid'].""); $bleep = $db->fetch_row($already); $string = $bleep['qID']; $pieces = explode(",", $string); if($bleep['questions'] != 3) { echo "You have already taken this section of the quiz. Click the link below to move on to the next one! [url='drugtest.php?action=question5'][b]Next Question[/b][/url]"; $h->endpage(); exit; } if ($_SESSION['questionid']) { $testq = $db->query("SELECT `qID`,`qQUESTION`,`qANSWER1`,`qANSWER2`,`qANSWER3`,`qCORRECT` FROM `tests` WHERE `qID`='" . $_SESSION['questionid'] . "'"); $tt = $db->fetch_row($testq); } else { $testq = $db->query("SELECT `qID`,`qQUESTION`,`qANSWER1`,`qANSWER2`,`qANSWER3`,`qCORRECT` FROM `tests` WHERE `qID`!='$pieces[0]' AND `qID`!='$pieces[1]' AND `qID`!='$pieces[2]' ORDER BY RAND()"); $tt = $db->fetch_row($testq); $_SESSION['questionid'] = $tt['qID']; } $dbinsert = $bleep['qID'] . ',' . $tt['qID']; if($_POST['a']) { if($_POST['a'] != $tt['qCORRECT']) { $db->query("UPDATE `userstesting` SET `qID`='{$dbinsert}',`questions`=`questions`+1 WHERE `tuserid`=".$_SESSION['userid'].""); echo "Incorrect Answer. Press [url='drugtest.php?action=question5'][b]Here[/b][/url] To continue to the next question."; unset($_SESSION['questionid']); } else { $db->query("UPDATE `userstesting` SET `uSCORE`=`uSCORE`+10,`qID`='$dbinsert',`questions`=`questions`+1 WHERE `tuserid`=".$_SESSION['userid'].""); echo "Correct Answer! Click [url='drugtest.php?action=question5'][b]Here[/b][/url]To proceed."; unset($_SESSION['questionid']); } } else { echo " <form method='post' action='drugtest.php?action=question4'> [b]".$tt['qQUESTION']." [/b] <input type='radio' name='a' value='".$tt['qANSWER1']."'>".$tt['qANSWER1']." <input type='radio' name='a' value='".$tt['qANSWER2']."'>".$tt['qANSWER2']." <input type='radio' name='a' value='".$tt['qANSWER3']."'>".$tt['qANSWER3']." <input type='submit' value='Submit Answer!' > </form>"; } } function question5() { global $db,$h; $already = $db->query("SELECT `tuserid`,`uSCORE`,`qID`,`questions` FROM `userstesting` WHERE `tuserid`=".$_SESSION['userid'].""); $bleep = $db->fetch_row($already); $string = $bleep['qID']; $pieces = explode(",", $string); if($bleep['questions'] != 4) { echo "You have already taken this section of the quiz. Click the link below to move on to the next one! [url='drugtest.php?action=question6'][b]Next Question[/b][/url]"; $h->endpage(); exit; } if ($_SESSION['questionid']) { $testq = $db->query("SELECT `qID`,`qQUESTION`,`qANSWER1`,`qANSWER2`,`qANSWER3`,`qCORRECT` FROM `tests` WHERE `qID`='" . $_SESSION['questionid'] . "'"); $tt = $db->fetch_row($testq); } else { $testq = $db->query("SELECT `qID`,`qQUESTION`,`qANSWER1`,`qANSWER2`,`qANSWER3`,`qCORRECT` FROM `tests` WHERE `qID`!='$pieces[0]' AND `qID`!='$pieces[1]' AND `qID`!='$pieces[2]' AND `qID`!='$pieces[3]' ORDER BY RAND()"); $tt = $db->fetch_row($testq); $_SESSION['questionid'] = $tt['qID']; } $dbinsert = $bleep['qID'] . ',' . $tt['qID']; if($_POST['a']) { if($_POST['a'] != $tt['qCORRECT']) { $db->query("UPDATE `userstesting` SET `qID`='{$dbinsert}',`questions`=`questions`+1 WHERE `tuserid`=".$_SESSION['userid'].""); echo "Incorrect Answer. Press [url='drugtest.php?action=question6'][b]Here[/b][/url] To continue to the next question."; unset($_SESSION['questionid']); } else { $db->query("UPDATE `userstesting` SET `uSCORE`=`uSCORE`+10,`qID`='$dbinsert',`questions`=`questions`+1 WHERE `tuserid`=".$_SESSION['userid'].""); echo "Correct Answer! Click [url='drugtest.php?action=question6'][b]Here[/b][/url]To proceed."; unset($_SESSION['questionid']); } } else { echo " <form method='post' action='drugtest.php?action=question5'> [b]".$tt['qQUESTION']." [/b] <input type='radio' name='a' value='".$tt['qANSWER1']."'>".$tt['qANSWER1']." <input type='radio' name='a' value='".$tt['qANSWER2']."'>".$tt['qANSWER2']." <input type='radio' name='a' value='".$tt['qANSWER3']."'>".$tt['qANSWER3']." <input type='submit' value='Submit Answer!' > </form>"; } }
-
title this rehab.php <?php require_once("globals.php"); $_GET['action'] = isset($_GET['action']) && is_string($_GET['action']) ? strtolower(trim($_GET['action'])) : false; $_GET['ID'] = isset($_GET['ID']) && ctype_digit($_GET['ID']) ? abs((int) $_GET['ID']) : false; switch($_GET['action']) { case "reception":reception();break; case 'rehablist': rehablist(); break; case 'checkin': checkin(); break; case 'confirm': confirm(); break; case 'checkout': checkout(); break; default:reception();break; } function reception() { global $db,$h; echo "<center>[b]<h2>Welcome to the Rehab Center</h2>[/b]</center> Please Select an option below on on what you wish to do while you are here. <table width=80% class=ttable><tr> <th colspan=4><center>Reception Desk</center></th> </tr> <tr> <td>[url='rehab.php?action=rehablist']<u>Rehab List</u>[/url]</td> <td>[url='rehab.php?action=checkin']<u>Check-In</u>[/url]</td> </tr> <tr> <td>[url='drugtest.php']Take Drug Test[/url]</td> <td>[url='rehab.php?action=checkout']<u>Check-Out</u>[/url]</td> </tr>"; } function rehablist() { global $db,$h; $userstuff = $db->query("SELECT rh.`rID`,rh.`rUSERID`,rh.`rTIME`,rh.`rBILL`,u.`username` FROM `rehab` rh LEFT JOIN `users` u ON rh.`rUSERID`=u.`userid` ORDER BY rh.`rTIME` ASC"); echo "<center>[b]<h2>Users in Rehab</h2>[/b]</center> <table width=100% class=ttable> <tr> <th>UserName</th> <th>Time Remaining</th> <th>Users Bill</th> </tr>"; while($dx = $db->fetch_row($userstuff)) { echo "<tr> <td>[url='viewuser.php?u=".$dx[']".$dx['username']."[/url]</td> <td>".$dx['rTIME']." Minutes</td> <td>".$dx['rBILL']." cash</td> </tr>"; } } function checkin() { global $db,$h; $addicted = $db->query("SELECT `addiction` FROM `users` WHERE `userid`=".$_SESSION['userid']." && (`addiction` > 0)"); $xid = $db->fetch_row($addicted); if(!$db->num_rows($addicted)) { echo "Being as you are not addicted to any drugs at this moment, There is no reason to check yourself in! [url='index.php'][b]Back[/b][/url]"; $h->endpage(); exit; } $inyet = $db->query("SELECT `rUSERID` FROM `rehab` WHERE (`rUSERID`=".$_SESSION['userid'].")"); if($db->num_rows($inyet)) { echo "You are already checked into rehab. [b][url='index.php']Back[/url][/b]"; $h->endpage(); exit; } $time = $xid['addiction']*2; //Change This to determine the Length of Time they are set for Rehab.--IT. $bill = $xid['addiction']*2000; //Change This To determine the Cost of their Check-Out Bill.--IT. echo "You are about to Check-In to the Rehabilitation Facility The Cost for your stay adds up to the sum of : ".number_format($bill)." cash. The Length of Your stay will be : ".number_format($time)." minutes. If you accept these terms click[url='rehab.php?action=confirm'][b]<u>Here Now</u>[/b][/url]to confirm. Please Note. If you cannot afford the Bill, you will not be released until it is paid. Be sure of your decision."; } function confirm() { global $db,$h; $addict = $db->query("SELECT `addiction` FROM `users` WHERE `userid`=".$_SESSION['userid']." && (`addiction` > 0)"); $xit = $db->fetch_row($addict); if(!$db->num_rows($addict)) { echo "You are not suffering from an addiction, lets leave the help center to those who need it! [url='index.php'][b]<u>Back</u>[/b][/url]"; $h->endpage(); exit; } $alreadyin = $db->query("SELECT `rUSERID` FROM `rehab` WHERE `rUSERID`=".$_SESSION['userid'].""); if($db->num_rows($alreadyin)) { echo "You are already checked in. [url='index.php'][b]<u>Back</u>[/b][/url]"; $h->endpage(); exit; } $time = $xit['addiction']*2; //Change This to determine the Length of Time they are set for Rehab.--IT. $bill = $xit['addiction']*2000; //Change This To determine the Cost of their Check-Out Bill.--IT. echo "You have successfully checked yourself into the Rehab Center. Your remaining time to be granted a clean bill of health is: ".number_format($time)." minutes. To finish your rehabilitation your total bill will be : ".number_format($bill)." cash. Once your time is up you can head to the reception desk to pay your bill. You will not be fully released until this bill is paid. [url='rehab.php'][b]<u>Back</u>[/b][/url]"; $db->query("INSERT INTO `rehab` VALUES('',".$_SESSION['userid'].",$time,$bill)"); } function checkout() { global $db,$h; $status = $db->query("SELECT t.`uSCORE`,u.`money`,u.`addiction`,r.`rUSERID`,r.`rTIME` FROM `userstesting` t LEFT JOIN `users` u ON t.`tuserid`=u.`userid` LEFT JOIN `rehab` r ON u.`userid`=r.`rUSERID` WHERE `userid`=".$_SESSION['userid'].""); if(!$db->num_rows($status)) { echo "You either A. Must pass the drug test still. Or B. You have not checked in to rehab. [url='drugtest.php'][b]Drug Test[/b][/url]"; $h->endpage(); exit; } $dscore = $db->fetch_row($status); if($dscore['uSCORE'] < 80) { echo "You unfortunately did not pass the exam. Please wait until the next day to take the test again. You must score at least an 80 to pass the exams. Your score sadly was ".number_format($dscore['uSCORE'])." out of a possible 100. [url='rehab.php'][b]Back[/b][/url]"; $h->endpage(); exit; } if($dscore['rTIME'] !=0) { echo "You must serve all your time asked in rehab to be granted a clean bill of health. [url='index.php'][b]Back[/b][/url]"; $h->endpage(); exit; } $bill = $dscore['addiction']*2000; //Change This To determine the Cost of their Check-Out Bill.--IT. if(!$dscore['money'] || $dscore['money'] < $bill) { echo "You do not have enough money to afford the bill at this time.[url='index.php'][b]Back[/b][/url]"; $h->endpage(); exit; } echo "You successfully completed your rehab course! All stats and stat gains will return back to normal and you will be released from the center. Try not to come back! Drugs are bad! [url='index.php'][b]Mmkay?[/b][/url]"; $db->query("UPDATE `users` SET `money`=`money`-".$bill.",`addiction`=0 WHERE `userid`=".$_SESSION['userid'].""); $db->query("DELETE FROM `rehab` WHERE `rUSERID`=".$_SESSION['userid'].""); $db->query("DELETE FROM `userstesting` WHERE `tuserid`=".$_SESSION['userid'].""); $h->endpage(); exit; } ?>
-
Add-On to this mod. Drug Rehab and Drug Addiction with Drug tests ! Users will now have an addiction level. The addiction level will determine on how fast your will rises. The normal rate for will increase is 10 per 5 minutes. Each time you use a drug your addiction level goes up. Once it reaches 10, your will will only go up 8 points. If it reaches 20 or above your will only increases 5 points. To make this go away you must check yourself into a rehab center. There is a Bill to pay, a timer to sit out, and once both of these are done the user must take a multiple choice drug questionaire. There are only 11 questions right now, feel free to google / make up some more and drop them into php my admin until i set up a staff function for it. the test is only 10 questions long, questions are chosen at random and the user will not get the same question twice. User must score at LEAST an 80 on the test to pass 80/100. If they fail they have to wait another day to retry the test. i'd suggest making about 50 questions so it's dificult to know the answers to all easily :-) SQLS -- -------------------------------------------------------- -- -- Table structure for table `userstesting` -- CREATE TABLE IF NOT EXISTS `userstesting` ( `tuserid` int(11) NOT NULL, `uSCORE` int(11) NOT NULL, `qID` varchar(255) NOT NULL, `questions` int(11) NOT NULL, PRIMARY KEY (`tuserid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- Table structure for table `tests` -- CREATE TABLE IF NOT EXISTS `tests` ( `qID` int(11) NOT NULL auto_increment, `qQUESTION` longtext NOT NULL, `qANSWER1` varchar(255) NOT NULL, `qANSWER2` varchar(255) NOT NULL, `qANSWER3` varchar(255) NOT NULL, `qCORRECT` varchar(255) NOT NULL, PRIMARY KEY (`qID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=12 ; -- -- Dumping data for table `tests` -- INSERT INTO `tests` (`qID`, `qQUESTION`, `qANSWER1`, `qANSWER2`, `qANSWER3`, `qCORRECT`) VALUES (1, 'Does marijuana affect the human reproductive system?', 'most studies have proven this true', 'most studies have proven this false', 'most studies are undecided', 'most studies have proven this true'), (2, 'Can marijuana cause cancer?', 'in laboratory test, the tars from marijuana smoke have yet to produce tumors when applied to animal skin.', 'marijuana smoke has been found to contain more cancer-causing agents than is found in tobacco smoke', 'marijuana smoke has been found to contain less cancer-causing agents than is found in tobacco smoke', 'marijuana smoke has been found to contain more cancer-causing agents than is found in tobacco smoke'), (3, 'Which of the following is not a common known street name for the drug PCP', 'angel dust', 'shermans', 'powder', 'powder'), (4, 'Due to the possible sedative effects of PCP, if the drug is taken with other depressants, such as alcohol or benzodiazepines, it can cause__________', 'a heart attack', 'a stroke', 'a coma', 'a coma'), (5, 'Which of the following is NOT a long term side effect from using PCP', 'weight gain', 'memory loss', 'depression', 'weight gain'), (6, 'Cocaine is an extraction of the leaves of the following plant\r\n\r\n,', 'etherlynon coca bush', 'erythroxylon coca bush', 'coca bush', 'erythroxylon coca bush'), (7, 'cocaine is the second most commonly used illicit drug in the United States. What is the First?', 'pcp', 'marijuana', 'loretabs', 'marijuana'), (8, 'The famous nineteenth-century literary character Sherlock Holmes was a frequent user of this drug', 'pcp', 'marijuana', 'cocaine', 'cocaine'), (9, 'Psychoanalyst Sigmund Freud is one of the more famous proponents of _______. After trying the drug for the first time in 1884, he recommended it as a useful treatment for depression, alcoholism, and morphine addiction', 'pcp', 'marijuana', 'cocaine', 'cocaine'), (10, 'This drug appeared in the mid 1980s and became an instant hit among poor and young users, due to its relatively inexpensive street price and quick euphoric effects.', 'crack', 'pcp', 'marijuana', 'crack'), (11, 'There is just as much exposure to cancer-causing chemicals from smoking one marijuana joint as smoking ______ tobacco cigarettes.', 'one', 'three', 'five', 'five'); -- -------------------------------------------------------- -- -- Table structure for table `rehab` -- CREATE TABLE IF NOT EXISTS `rehab` ( `rID` int(11) NOT NULL auto_increment, `rUSERID` int(11) NOT NULL, `rTIME` int(11) NOT NULL, `rBILL` int(11) NOT NULL, `test` int(11) NOT NULL, PRIMARY KEY (`rID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ; ALTER TABLE `users` ADD `addiction` int(11) NOT NULL; open up druglab.php find $db->query("UPDATE `users` SET `expire`=$expires WHERE `userid`=".$_SESSION['userid'].""); change to $db->query("UPDATE `users` SET `addiction`,=`addiction`+1,`expire`=$expires WHERE `userid`=".$_SESSION['userid'].""); open up cron_minute.php add $db->query("UPDATE `rehab` SET `rTIME`=`rTIME`-1 WHERE `rTIME`>0"); open up cron_day.php $db->query("UPDATE `rehab` SET `test`=0 WHERE `test`!=0"); $db->query("TRUNCATE TABLE `userstesting`"); More coming....
-
for whatever reason people still use this ... $count = 3; $x = -1; while($x < $count) { $places_to_be_secured = array("ID","viewforum","viewtopic"); $x++; $_GET[$places_to_be_secured[$x]] = abs(@intval($_GET[$places_to_be_secured[$x]])); } it is messing up the security in the scripts themselves if you remove $_GET['ID'] = isset($_GET['ID']) && ctype_digit($_GET['ID']) ? abs((int) $_GET['ID']) : false; that line ^ the script will run fine, but only remove that line if you have GET ['ID'] secured in header or globals (which i dont recommend)
-
just told him that on msn :p didnt look at that script first ><
-
For one you have nothing defining $ir in loggedin.php no include globals, no db query no nothing :p
-
I havent encountered this error personally, i'd like to know if anyone else is the error is in the sql as it's not fetching the $_GET['ID'] Variable. not 100% sure why it wouldnt as again, it works for me :\
-
Strange...It's working on my end, pm me a link to your site >,<
-
Did you import the entire SQL's above with drug names? :-)
-
Knock yourself out, i'm currently adding a rehab center where users will have to pay and take a 10 question quiz to be released. Done with it now just googling questions that are difficult :)
-
aye, i'm going with his session bit, it worked fine and the test is moving along, should be done in an hour once i research some hard to find questions/answers ><
-
Dont get me wrong, i'd love to do the session bit, but i'm at a loss on just "how" to do it. >,<
-
I've tried and failed miserable at that ><
-
No, you should contact the person you bought it from and get the votes table.
-
Ok, I'm trying to make a quiz for a mod i'm designing. The problem here is. Im trying to select a random question from the database that the user hasnt already had. Got that part done. The problem I'm running into now is, when the user clicks submit for the answer, since the $db->query is selecting a random statement, the page refreshes, so does the answer and the question, into a totally differant random one >,< How can I stop this? :P
-
Original script updated, the cron bit was incorrect (go figure)
-
Yawn, rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,rabble rabble rabble, rabble rabble rabble, rabble rabble rabble,
-
I'm pretty sure I did NOT code this.