All pastes #536179 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-06-04 09:20 UTC
rendered paste body
function fwr ($q) {
$msg=$q . "\r\n";
$filename = "pitanja.txt";
$f = fopen($filename, 'a');
fwrite($f, $msg, strlen($msg));
fclose($f);
}



//-------------

if (isset($_GET['question'])) {
	$ima=0;
	if (empty($_GET['question'])) { 
		echo "<h3>You should write a question. That's for sure</h3>";
		echo "<div class=\"red\">Huh?!!</div><img src=\"tron.gif\" alt=\"\" /><br />";
		echo "<a href=\"".$_SERVER['PHP_SELF']."\">Try again</a>";
	} else {

		echo "<h1>Should I ...</h1>";
		$q = strip_tags($_GET['question']);
		$prc = rtrim($q,'?');
		echo "<span class=\"big2\">$prc?</span>";
		$i = $_SESSION['count'];
			for ($z=1; $z <= $i; $z++) {
				if ($prc == $_SESSION['question'][$z]) {
				$ima = "1";
				$answ = $_SESSION['answer'][$z];
				}
			}
		if ($ima == "1") {
		echo "<div class='red'>".$answ."</div><img src='tron.gif' alt=\"\" /><br /><a href=\"index.php\">Type another question</a>";
		}else {
			$i = $_SESSION['count'];
		
			$r=mt_rand(0,100000);
			if ($r>50000) $answer= "Yes";
			else $answer="No";
			$_SESSION['question'][$i] = $prc;	
			$_SESSION['answer'][$i] = $answer;
			$_SESSION['count']++;				
			echo "<div class='red'>".$answer."</div><img src='tron.gif' alt=\"\" /><br /><a href=\"index.php\">Type another question</a>";
			fwr($q);
		}
	
	}
}