sex/sex.php

97 lines
3.3 KiB
PHP

<!-- Copyright 2008 Neil Edelman, distributed under the terms of the
GNU General Public License, see copying.txt -->
<?php
$sex = array(
"68" =>array("68", 0),
"69" =>array("69", 0),
"acrobat" =>array("Acrobat", 0),
"bukkake" =>array("Bukkake", 0),
"circle-jerk" =>array("Circle-Jerk", 0),
"cowboy" =>array("Cowboy", 0),
"cowgirl" =>array("Cowgirl", 0),
"daisy-chain" =>array("Daisy-Chain", 0),
"doggy-style" =>array("Doggy Style", 0),
"double-penetration"=>array("Double Penetration", 0),
"fff-threesome" =>array("FFF Threesome", 0),
"ffm-daisy" =>array("FFM Daisy-Chain", 0),
"frot" =>array("MM Frot", 0),
"horse" =>array("Bestiality", 0),
"kneeling" =>array("MF Kneeling", 0),
"lipstick-director" =>array("Lipstick Director", 0),
"lotus" =>array("Lotus", 0),
"missionary" =>array("Missionary", 0),
"mm-topping" =>array("MM Topping", 0),
"reverse-cowgirl" =>array("Reverse Cowgirl", 0),
"reverse-missionary"=>array("Reverse Missionary", 0),
"sandwich" =>array("Sandwich", 0),
"suspended-congress"=>array("Suspended Congress", 0),
"toy" =>array("FF Toy", 0),
"vibrator" =>array("Vibrator", 0),
"victory" =>array("Victory", 0),
"wheelbarrow" =>array("Wheelbarrow", 0)
);
// load from sex file
function SexLoad() {
global $sex;
$contents = file_get_contents("sex") or die("Error with sex.");
$lines = split("\n", $contents);
foreach($lines as $line) {
if(!strcmp($line, '')) break;
list($n, $v) = split("\t", $line);
if(!isset($n) or !isset($v) or !isset($sex[$n]) or !is_numeric($v)) continue;
$sex[$n][1] = $v;
}
}
// overwrite the sex file with the values currently in sex
function SexSave() {
global $sex;
$fp = fopen("sex", "w");
foreach($sex as $key => $s) fwrite($fp, $key."\t".$s[1]."\n");
fclose($fp);
}
// change old to new positions
function SexChange($old, $new) {
global $sex;
if(isset($sex[$old]) and $sex[$old][1] > 0) $sex[$old][1]--;
if(isset($sex[$new])) $sex[$new][1]++;
}
// display the question
function SexInterface() {
global $sex;
echo '<form action = "index.php" method = "post">';
echo '<select name = "update">';
foreach($sex as $key => $s) {
echo '<option value = "'.$key.'">'.$s[0].'</option>';
}
echo '</select>';
echo '<input type = "submit" value = "Update" class = "inputsubmit">';
echo '</form>';
}
// display the stats
function SexDisplay() {
global $sex;
$max = 1; foreach($sex as $s) if($s[1] > $max) $max = $s[1];
echo '<table style = "text-align: center;">';
foreach($sex as $s) {
$rel = round(($s[1] * 255.0) / $max);
echo '<tr><td>'.$s[0].'</td><td>'.$s[1].'</td><td>';
echo '<img src = "http://www.cs.mcgill.ca/~nedelm/sex/gifbar/';
echo 'gifbar.cgi?'.$rel.'" alt = "'.$rel.'" width = 256 height = 8></td></tr>';
}
echo '</table>';
}
// extracts image name from the html, a real hack
function SexExtract($html) {
$name = substr(strstr($html, '<img src = "http://www.cs.mcgill.ca/~nedelm/sex/stuff/'), 54);
if(!isset($name) or ($a = strpos($name, ".jpg")) === false) return null;
$name = substr($name, 0, $a);
return $name;
}
?>