Unrealircd (Support Bot) (Quiz)

By j1sp on Dec 29, 2010

This script is old however I re-posted it for archive reasons, also I may update it soon with a new version.

[index.php]
<title>Support Quiz</title>
<form action="check.php" method="post">
<h1>Operating System</h1>
<select name="os">
<option value="win">Windows</option>
<option value="mac">Mac</option>
<option value="linux">Linux</option>
</select>
<h1>Need Support?</h1>
<select name="ns">
<option value="y">yes</option>
<option value="n">no</option>
</select><input value="Get Code" type="submit" />
</form>

[check.php]
<?
$a=$_POST['os'];
$b=$_POST['ns'];
echo "/msg [mircbotname] !v ";
if ( $a == "win" && $b == "y" ) {
echo "codeone";
}
if ( $a == "win" && $b == "n" ) {
echo "codefour";
}
if ( $a == "linux" && $b == "y" ) {
echo "codethree";
}
if ( $a == "linux" && $b == "n" ) {
echo "code6";
}
if ( $a == "mac" && $b == "y" ) {
echo "codetwo";
}
if ( $a == "mac" && $b == "n" ) {
echo "codefive";
}
?>

Comments

Sign in to comment.
sean   -  Feb 10, 2011

I was also wonder how many people would fill out a support form stating "No, I don't need help" lol

More
 Respond  
edgy   -  Feb 10, 2011

A flaw with this is that people will be able to share the support code that they need to enter.

A better way would be to make a unique hash for each user with a timestamp and username (for example) and have the bot decode it. That way codes specified will expire after a certain length of time.

More
 Respond  
sean   -  Dec 30, 2010

you can very easily combine this into one file.

<?php
extract($_POST);
if ( !empty($os) ) {
  switch($os) {
    case 'win':
      $r = ( ($ns == 'y') ? 'codeone' : 'codefour' );
    break;

    case 'linux':
      $r = ( ($ns == 'y') ? 'codethree' : 'code6' );
    break;

    case 'mac':
      $r = ( ($ns == 'y') ? 'codetwo' : 'codefive' );
    break;
  }
  if ( isset($r) ) die('/msg [mircbotname] !v '. $r);
}
?>
<title>Support Quiz</title>
<form action="<?php print($_SERVER['PHP_SELF']); ?>" method="post">
<h1>Operating System</h1>
<select name="os">
<option value="win">Windows</option>
<option value="mac">Mac</option>
<option value="linux">Linux</option>
</select>
<h1>Need Support?</h1>
<select name="ns">
<option value="y">yes</option>
<option value="n">no</option>
</select>
<br /><input value="Get Code" type="submit" />
</form>
More
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.