DAN ZEN EXPO - CODE EXHIBIT -
RICH DECK
///////////////////////////////
// TITLES
///////////////////////////////
<?
$titles = array (
"MOON MANSION",
"LUNAR LUXURY CONDO",
"AZTEC SUN TEMPLE CHAMBER",
"SCIENCE SQUAD",
"PLANETARIUM OFFICE",
"CENTRAL LEMONADE CO",
"SOLAR FARM",
"BULLETPROOF GLASS CAR",
"CLIFFSIDE CONDOMINIUM",
"ISLAND CONDO RESORT",
"OASIS",
"PINE FOREST",
"RUNNING COURIER FLEET",
"BAT CAVE",
"PERSONAL COPTER",
"ERGONE CHAMBER",
"ENVIRONMENTAL SOUND",
"LASER HAIR CHAIR",
"FRESH AIR",
"SOLAR LAGOON BATH");
$companytitles = array ("MOON MANSION", "LUNAR RESORT", "AZTEC SUN TEMPLE", "SCIENCE SQUAD", "PLANETARIUM OFFICE", "CENTRAL LEMONADE CO", "SOLAR FARM", "GLASS CAR COMPANY", "CLIFFSIDE CONDOMINIUMS", "ISLAND WITH RESORT", "OASIS", "10,000 ACRE PINE FOREST", "RUNNING COURIER CO", "BAT CAVE", "PERSONAL COPTER", "ERGONE CHAMBER", "ENVIRONMENTAL SOUND", "LASER HAIR CHAIR CO", "FRESH AIR CO", "SOLAR LAGOON BATH");
?>
///////////////////////////////
// SIGNUP
///////////////////////////////
<?
$error = "error=2&";
if (isset($_POST['player'])) {
$player = $_POST['player'];
$player = preg_replace("/[^ \w-]/", "", $player);
$player = strtoupper($player);
$player2 = strtolower($player);
} else {
echo $error;
return;
}
if (isset($_POST['email'])) {
$email = $_POST['email'];
$email = strtolower($email);
} else {
echo $error;
return;
}
$variables = array ("telepathy2", "motto", "age2", "gender2", "location");
foreach($variables as $v) {
$$v = ""; if (isset($_POST["$v"])) $$v = $_POST["$v"];
}
$sql = "SELECT * FROM zd_reg WHERE zd_id='$player'";
$result = mysql_query($sql,$db);
if ($result) {
while ($myrow = mysql_fetch_row($result)) {
$error = "error=1";
echo $error;
return;
}
}
//clear to add
$regdate = date("Y-m-d");
srand((double)microtime()*1000000);
$confirm = rand();
$query = "INSERT INTO zd_reg (id, zd_id, email, telepathy, motto, age, gender, location, regdate, confirm, confirmed) VALUES ('','$player','$email','$telepathy2', '$motto', '$age2', '$gender2', '$location', '$regdate', '$confirm', '0')";
$result = mysql_query($query,$db);
if (!$result) {
echo $error;
return;
}
// e-mail confirmation letter
$message = "
Welcome to RichDeck!
To activate your account and get $10,000,000 Deck Dollars simply click here:
http://www.danzen.com/richdeck/activate.php?n=".urlencode($player2)."&i=".$confirm."
RichDeck is the game where you buy crazy companies and fantastical franchises
and turn your millions into billions! Have fun.
Dan Zen
http://www.danzen.com
mad inventor
meets Internet
finds peace
";
mail($email, "Rich Deck Activation", "$message", "From: richdeck@danzen.com", "-f richdeck@danzen.com");
echo "error=0&email=".urlencode($email);
?>
///////////////////////////////
// ACCEPT
///////////////////////////////
<?
// brings in ID from send letter
// checks to see if activated already
// if not:
// load Flash stub to check if recipient is registered
// if registered, send set accept field = 1 and give out money
// if not registered then redirect to form
// form will have to send to PHP which goes through the same thing but keeps track of send ID
if (isset($_GET['p'])) {
$p = $_GET['p'];
} else {
gonext(22); //problem accepting ID
}
$sql = "SELECT * FROM rd_sends WHERE s_random = '$p'";
$result = mysql_query($sql,$db);
if ($result) {
while ($myrow = mysql_fetch_row($result)) {
$status = $myrow[6];
if ($myrow[4] != "" && $myrow[4] != null) {
$franchisees = $myrow[4];
}
break;
}
} else {
gonext(22);
}
if ($status == 0) {
echo "<br>
<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"
codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\"
WIDTH=\"761\" HEIGHT=\"410\" id=\"zendeck\" ALIGN=\"\">
<PARAM NAME=movie VALUE=\"stub.swf?$p\"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED src=\"stub.swf?$p\" quality=high bgcolor=#FFFFFF WIDTH=\"761\" HEIGHT=\"410\" NAME=\"zendeck\" ALIGN=\"\"
TYPE=\"application/x-shockwave-flash\" PLUGINSPAGE=\"http://www.macromedia.com/go/getflashplayer\"></EMBED>
</OBJECT>
";
exit();
} else {
gonext(23); // already confirmed
}
function gonext($m) {
echo "
<HTML>
<HEAD>
<meta http-equiv=Content-Type content=\"text/html; charset=ISO-8859-1\">
<TITLE>Dan Zen | ZenDeck | RichDeck</TITLE>
</HEAD>
<BODY bgcolor=\"#FFFFFF\" onload=\"this.focus();\">
<center>
<br>
<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"
codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\"
WIDTH=\"761\" HEIGHT=\"410\" id=\"zendeck\" ALIGN=\"\">
<PARAM NAME=movie VALUE=\"richdeck.swf?$m\"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED src=\"richdeck.swf?$m\" quality=high bgcolor=#FFFFFF WIDTH=\"761\" HEIGHT=\"410\" NAME=\"zendeck\" ALIGN=\"\"
TYPE=\"application/x-shockwave-flash\" PLUGINSPAGE=\"http://www.macromedia.com/go/getflashplayer\"></EMBED>
</OBJECT>
<p> <a target=\"RichDeckChat\" onclick=\"window.name='RichDeck';\" href=http://www.danzen.com/cgi-bin/dens?den=RichDeck><font face=verdana size=2 color=4D3818>Click here to talk about RichDeck</font></a></center>
<img src=/cgi-bin/traffic_plus?company=danzen&page=richdeck width=1 height=1>
</BODY>
</HTML>
";
exit();
}
?>
///////////////////////////////
// ACTIVATE
///////////////////////////////
<?
if (isset($_GET['n'])) { // coming from confirmation letter
$player = $_GET['n'];
$player = strtoupper($player);
$player2 = strtolower($player);
if (isset($_GET['i'])) {
$confirm = $_GET['i'];
} else {
$message = "5"; // invalid confirmation ID
gonext($message);
}
if (isset($_GET['p'])) { // already registered but accepting product
$product = $_POST['p'];
} else {
$sql = "SELECT * FROM zd_reg WHERE zd_id='$player' AND confirm='$confirm'";
$result = mysql_query($sql,$db);
if ($result) {
$myrow = mysql_fetch_assoc($result);
$mynum = mysql_num_rows($result);
if ($mynum > 0) {
$rd_id = $myrow["rd_id"];
$motto = $myrow["motto"];
$email = $myrow["email"];
$telepathy = $myrow["telepathy"];
$confirm = $myrow["confirm"];
if ($myrow["confirmed"] == 1) {
$message = "12&".urlencode($player)."&".urlencode($confirm); // player already confirmed
gonext($message);
}
} else {
$message = "13"; // cannot confirm
gonext($message);
}
} else {
$message = "13"; // cannot confirm
gonext($message);
}
if ($telepathy == 1) {
$filename = 'secret';
$handle = fopen($filename, 'a');
fwrite($handle, $email."\n");
fclose($handle);
}
$sql = "UPDATE zd_reg SET confirmed='1' WHERE zd_id='$player'";
$result = mysql_query($sql,$db);
if ($result) {
$thisdate = date("Y-m-d");
$motto = preg_replace("/'/","\\'",$motto);
$sql = "INSERT INTO `rd_player` (`id`, `rd_id`, `signupdate`, `worth`, `companies`, `franchises`, `login`, `motto`) VALUES ('', '$player', '$thisdate', '10000000', '', '', '$thisdate', '$motto')";
$log = "Received $10,000,000 dd from Bank of ZenDeck";
include("writelog.php");
writelog($player, $log);
$result = mysql_query($sql,$db);
if ($result) {
$message = "1&".urlencode($player)."&".urlencode($confirm); // confirmed
gonext($message);
} else {
$message = "13"; // cannot confirm
gonext($message);
}
} else {
$message = "13"; // cannot confirm
gonext($message);
}
}
} else { // coming from accepting product
return;
$error = "error=2&";
if (isset($_POST['player'])) {
$player = $_POST['player'];
$player = strtoupper($player);
$player2 = strtolower($player);
} else {
echo $error;
return;
}
if (isset($_POST['email'])) {
$email = $_POST['email'];
$email = strtolower($email);
} else {
echo $error;
return;
}
$variables = array ("telepathy2", "motto", "age2", "gender2", "location");
foreach($variables as $v) {
$$v = ""; if (isset($_POST["$v"])) $$v = $_POST["$v"];
};
$sql = "SELECT * FROM zd_reg WHERE zd_id='$player'";
$result = mysql_query($sql,$db);
if ($result) {
while ($myrow = mysql_fetch_row($result)) {
$error = "error=1";
echo $error;
return;
}
}
//clear to add
$regdate = date("Y-m-d");
srand((double)microtime()*1000000);
$confirm = rand();
$motto = preg_replace("/'/","\\'",$motto);
$query = "INSERT INTO zd_reg (id, zd_id, email, telepathy, motto, age, gender, location, regdate, confirm, confirmed) VALUES ('','$player','$email','$telepathy2', '$motto', '$age2', '$gender2', '$location', '$regdate', '$confirm', '0')";
$result = mysql_query($query,$db);
if (!$result) {
echo $error;
return;
}
echo "error=0&email=".urlencode($email);
}
function gonext($m) {
echo "<br>
<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"
codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\"
WIDTH=\"761\" HEIGHT=\"410\" id=\"zendeck\" ALIGN=\"\">
<PARAM NAME=movie VALUE=\"richdeck.swf?$m\"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED src=\"richdeck.swf?$m\" quality=high bgcolor=#FFFFFF WIDTH=\"761\" HEIGHT=\"410\" NAME=\"zendeck\" ALIGN=\"\"
TYPE=\"application/x-shockwave-flash\" PLUGINSPAGE=\"http://www.macromedia.com/go/getflashplayer\"></EMBED>
</OBJECT>
";
exit();
}
?>
///////////////////////////////
// ACCOUNT
///////////////////////////////
<?
if (isset($_POST['player'])) {
$player = $_POST['player'];
} else {
echo "accountlog=".urlencode("Sorry, there is no account information at this time");
return;
}
include("titles.php");
include("startprice.php");
//$player = "DAN YEN";
$sql = "SELECT * FROM rd_player WHERE rd_id='$player'";
$result = mysql_query($sql,$db);
$companies = $franchises = "";
$output = "PLAYER: $player\n";
if ($result) {
while ($myrow = mysql_fetch_row($result)) {
$output .= "MOTTO: ".$myrow[6]."\n\n";
$worth = $myrow[2];
$output .= "WORTH: ".makemoney($worth);
if ($myrow[3] != null && $myrow[3] != "") {
$companies = $myrow[3];
}
if ($myrow[4] != null && $myrow[4] != "") {
$franchises = $myrow[4];
}
break;
}
}
$companycost = 0;
$franchisecost = 0;
$sql = "SELECT * FROM rd_owners WHERE owners = '$player'";
$result = mysql_query($sql,$db);
if ($result) {
while ($myrow = mysql_fetch_row($result)) {
if ($myrow[3] > 0) {
$companycost += $myrow[3] - $startprice[$myrow[0]-1] / 100;
}
}
}
$sql = "SELECT * FROM rd_owners";
$result = mysql_query($sql,$db);
if ($result) {
while ($myrow = mysql_fetch_row($result)) {
if ($myrow[4] != "" && $myrow[4] != null) {
$templist = preg_split("/,/", $myrow[4]);
foreach($templist as $a) {
if ($a == $player) {
$franchisecost += $startprice[$myrow[0]-1] / 10;
continue;
}
}
}
}
}
$cash = $worth * 1;
$cash -= $companycost * 1;
$cash -= $franchisecost * 1;
$output .= " CASH: ".makemoney($cash)."\n";
if ($companies != "") {
$output .= "COMPANIES: ";
$temp = preg_split("/,/", $companies);
$temp2 = array();
foreach($temp as $a) {
array_push($temp2, $companytitles[$lookup[$a]-1]);
}
$temp3 = join(", ", $temp2);
$output .= $temp3."\n";
} else {
$output .= "COMPANIES: NONE\n";
}
if ($franchises != "") {
$output .= "FRANCHISES: ";
$temp = preg_split("/,/", $franchises);
$temp2 = array();
foreach($temp as $a) {
array_push($temp2, $companytitles[$lookup[$a]-1]);
}
$temp3 = join(", ", $temp2);
$output .= $temp3."\n";
} else {
$output .= "FRANCHISES: NONE\n";
}
$output .= "\n";
echo "account=".urlencode($output)."&";
$player = preg_replace("/ /", "+", $player);
$file = "secret/$player";
if (file_exists($file)) {
$content = join ('', array_reverse(file ($file)));
for ($i=19; $i>=0; $i--) {
$content = preg_replace("/c~$i/",$companytitles[$i],$content);
}
//$content = preg_replace("/2003-/","",$content);
//$content = preg_replace("/: /","\n",$content);
//$content = preg_replace("/2003-.*: /","",$content);
echo "accountlog=".urlencode($content);
} else {
echo "accountlog=".urlencode("There is no account information at this time");
return;
}
function makemoney($mmm) {
$mmm = $mmm."";
$yyy = "";
$ccc = 0;
for ($jjj=strlen($mmm)-1; $jjj>=0; $jjj--) {
$ccc++;
$yyy = $mmm[$jjj].$yyy;
if ($ccc%3 == 0 && $jjj !=0) {
$yyy = ",".$yyy;
}
}
return "$".$yyy." dd";
}
?>
///////////////////////////////
// BUY
///////////////////////////////
<?
include("startprice.php");
include("titles.php");
if (isset($_POST['player'])) {
$player = $_POST['player'];
$player = strtoupper($player);
} else {
//$player = "GORDON GOO";
echo "error=3";
return;
}
if (isset($_POST['card'])) {
$cardnumber = $_POST['card'];
} else {
//$cardnumber = "1";
echo "error=3";
return;
}
if (isset($_POST['buytype'])) {
$buytype = $_POST['buytype'];
} else {
//$buytype = "franchise";
echo "error=3";
return;
}
$cardnumber = $cardnumber+1;
$buydate = date("Y-m-d");
$sql = "SELECT * FROM rd_player WHERE rd_id='$player'";
$result = mysql_query($sql,$db);
$companies = $franchises = "";
if ($result) {
while ($myrow = mysql_fetch_row($result)) {
$worth = $myrow[2];
if ($myrow[3] != null && $myrow[3] != "") {
$companies = $myrow[3];
}
if ($myrow[4] != null && $myrow[4] != "") {
$franchises = $myrow[4];
}
$motto = $myrow[6];
break;
}
} else {
echo "error=3";
return;
}
$owner = $price = $franchisees = "";
$sql = "SELECT * FROM rd_owners WHERE own_id = $cardnumber";
$result = mysql_query($sql,$db);
if ($result) {
while ($myrow = mysql_fetch_row($result)) {
$card = $myrow[1];
if ($myrow[2] != "" && $myrow[2] != null) {
$owner = $myrow[2];
}
if ($myrow[3] > 0) {
$price = $myrow[3];
}
if ($myrow[4] != "" && $myrow[4] != null) {
$franchisees = $myrow[4];
}
break;
}
} else {
echo "error=3";
return;
}
if ($price == "") {
$price = $startprice[$cardnumber-1];
}
$lastprice = $price;
$newprice = $price + $startprice[$cardnumber-1] / 100;
if ($buytype == "company" && $player == $owner) {
echo "error=2";
return;
}
if ($buytype == "franchise") {
if ($player == $owner) {
echo "error=22";
return;
}
$templist = preg_split("/,/", $franchisees);
foreach($templist as $a) {
if ($a == $player) {
echo "error=2";
return;
}
}
}
$companycost = 0;
$franchisecost = 0;
$sql = "SELECT * FROM rd_owners WHERE owners = '$player'";
$result = mysql_query($sql,$db);
if ($result) {
while ($myrow = mysql_fetch_row($result)) {
if ($myrow[3] > 0) {
$companycost += $myrow[3] - $startprice[$myrow[0]-1] / 100;
}
}
} else {
echo "error=3";
return;
}
$sql = "SELECT * FROM rd_owners";
$result = mysql_query($sql,$db);
if ($result) {
while ($myrow = mysql_fetch_row($result)) {
if ($myrow[4] != "" && $myrow[4] != null) {
$templist = preg_split("/,/", $myrow[4]);
foreach($templist as $a) {
if ($a == $player) {
$franchisecost += $startprice[$myrow[0]-1] / 10;
continue;
}
}
}
}
} else {
echo "error=3";
return;
}
$cash = $worth;
$cash -= $companycost;
$cash -= $franchisecost;
if ($buytype == "company") {
if ($cash < $price) {
echo "error=1";
return;
}
$motto = preg_replace("/'/","\\'",$motto);
$sql = "UPDATE rd_owners SET owners='$player',price='$newprice',motto='$motto' WHERE own_id=$cardnumber";
//add company to player but leave their worth the same
if ($companies == "") {
$com = $card;
} else {
$com = $companies.",".$card;
}
$sql2 = "UPDATE rd_player SET companies='$com' WHERE rd_id='$player'";
include("writelog.php");
$cn = $cardnumber - 1;
if ($owner != "" && $owner != null) {
$log = "Bought company, c~$cn, from $owner for ".makemoney($lastprice);
} else {
$log = "Bought company, c~$cn, from BANK OF ZENDECK for ".makemoney($lastprice);
}
writelog($player, $log);
//take away company from other player and increase their worth 1% start price
if ($owner != "" && $owner != null) {
$sql_temp = "SELECT * FROM rd_player WHERE rd_id='$owner'";
$result = mysql_query($sql_temp,$db);
$companies2 = "";
if ($result) {
while ($myrow = mysql_fetch_row($result)) {
$worth2 = $myrow[2];
if ($myrow[3] != null && $myrow[3] != "") {
$companies2 = $myrow[3];
}
break;
}
} else {
echo "error=3";
return;
}
$worth2 += $startprice[$cardnumber-1] / 100;
if ($companies2 != "" && $companies2 != null) {
$temp = preg_split("/,/",$companies2);
$temp2 = Array();
foreach ($temp as $cc) {
if ($cc != $card) {
array_push($temp2,$cc);
}
}
$companies2 = join(",",$temp2);
}
// Send e-mail to owner to tell them their company has been bought
$sql_temp = "SELECT * FROM zd_reg WHERE zd_id='$owner'";
$result = mysql_query($sql_temp,$db);
if ($result) {
while ($myrow = mysql_fetch_row($result)) {
$email = $myrow[2];
break;
}
}
//convert money to string with ,
$x = $lastprice."";
$y = "";
$ii = 0;
for ($j=strlen($x)-1; $j>=0; $j--) {
$ii++;
$y = $x[$j].$y;
if ($ii%3 == 0 && $j !=0) {
$y = ",".$y;
}
}
$cardname = $companytitles[$cardnumber-1];
$message = "
$owner,
Your RichDeck company, $cardname, has been bought by $player.
You have received $y Deck Dollars.
http://www.danzen.com/richdeck
Yours truly,
Bank of ZenDeck
";
mail($email, "Your RichDeck Company", "$message", "From: richdeck@danzen.com");
$log = "Received ".makemoney($startprice[$cardnumber-1] / 100)." profit from $player buying company, c~$cn";
writelog($owner, $log);
}
$sql3 = "UPDATE rd_player SET worth='$worth2',companies='$companies2' WHERE rd_id='$owner'";
} else if ($buytype == "franchise") {
if ($cash < $startprice[$cardnumber-1] / 10) {
echo "error=1";
return;
}
if ($franchisees == "") {
$fra = $player;
} else {
$fra = $franchisees.",".$player;
}
$sql = "UPDATE rd_owners SET franchisees='$fra' WHERE own_id=$cardnumber";
if ($franchises == "") {
$fra = $card;
} else {
$fra = $franchises.",".$card;
}
$sql2 = "UPDATE rd_player SET franchises='$fra' WHERE rd_id='$player'";
$sql3 = "INSERT INTO rd_franchises (f_id, f_player, f_name, f_date) VALUES ('','$player','$card','$buydate')";
include("writelog.php");
$cn = $cardnumber - 1;
if ($owner != "" && $owner != null) {
$log = "Bought franchise, c~$cn, from $owner for ".makemoney($startprice[$cardnumber-1] / 10);
} else {
$log = "Bought franchise, c~$cn, from BANK OF ZENDECK for ".makemoney($startprice[$cardnumber-1] / 10);
}
writelog($player, $log);
// pay owner if there is one
if ($owner != "" && $owner != null) {
$sql_temp = "SELECT * FROM rd_player WHERE rd_id='$owner'";
$result = mysql_query($sql_temp,$db);
$worth2 = "";
if ($result) {
while ($myrow = mysql_fetch_row($result)) {
$worth2 = $myrow[2];
break;
}
} else {
echo "error=3";
return;
}
$worth2 += $startprice[$cardnumber-1] / 10;
$sql_temp = "UPDATE rd_player SET worth='$worth2' WHERE rd_id='$owner'";
$result = mysql_query($sql_temp,$db);
if (!$result) {
echo "error=3";
mail("bleep", "Rich Deck Problem", "** $sql_temp\n\n$sql\n\n$sql2\n\n$sql3", "From: richdeck@danzen.com");
return;
}
}
$log = "Received ".makemoney($startprice[$cardnumber-1] / 10)." from $player buying franchise, c~$cn";
writelog($owner, $log);
// add bonus stuff here
$thisbonus = $bonuslookup["$card"];
if ($thisbonus == "2") {
$time = time();
$bonus = "INSERT INTO rd_health (id, id_owner, franchise, time, paid) VALUES ('','$player','$card','$time',0)";
$result = mysql_query($bonus,$db);
if (!$result) {
mail("bleep", "Rich Deck Bonus Problem", "$bonus", "From: richdeck@danzen.com");
}
} else if ($thisbonus == "3") {
$people = file ('people.txt');
$people = $people[0];
$bonus = "INSERT INTO rd_env (id, id_owner, franchise, people, sets) VALUES ('','$player','$card','$people',0)";
$result = mysql_query($bonus,$db);
if (!$result) {
mail("bleep", "Rich Deck Bonus Problem", "$bonus", "From: richdeck@danzen.com");
}
} else if ($thisbonus == "4") {
$bonus = "INSERT INTO rd_time (id, id_owner, franchise, date) VALUES ('','$player','$card','$buydate')";
$result = mysql_query($bonus,$db);
if (!$result) {
mail("bleep", "Rich Deck Bonus Problem", "$bonus", "From: richdeck@danzen.com");
}
}
} else {
echo "error=3";
return;
}
// okay to buy
$result = mysql_query($sql,$db);
if (!$result) {
echo "error=3";
mail("bleep", "Rich Deck Problem", "** $sql\n\n$sql2\n\n$sql3", "From: richdeck@danzen.com");
return;
}
$result = mysql_query($sql2,$db);
if (!$result) {
echo "error=3";
mail("bleep", "Rich Deck Problem", "$sql\n\n** $sql2\n\n$sql3", "From: richdeck@danzen.com");
return;
}
$result = mysql_query($sql3,$db);
if (!$result) {
echo "error=3";
mail("bleep", "Rich Deck Problem", "$sql\n\n$sql2\n\n** $sql3", "From: richdeck@danzen.com");
return;
}
echo "&buytype=$buytype&error=0";
?>
///////////////////////////////
// SELL
///////////////////////////////
<?
$player = $firsttime = "";
if (isset($_POST['player'])) {
$player = $_POST['player'];
$player = strtoupper($player);
}
if (isset($_POST['firsttime'])) {
$firsttime = $_POST['firsttime'];
}
//$player = "GROTTO";
//$firsttime = 1;
$sql = "SELECT * FROM rd_player WHERE rd_id='$player'";
$result = mysql_query($sql,$db);
$output = "";
$total = array ();
if ($result) {
while ($myrow = mysql_fetch_row($result)) {
$output = "worth=".$myrow[2]."&";
if ($myrow[3] != null && $myrow[3] != "") {
$temp = preg_split("/,/",$myrow[3]);
$tally = 0;
foreach ($temp as $i) {
$output .= "myC_".$tally."=".$i."&";
$tally++;
$total[$i] = 1;
}
}
if ($myrow[4] != null && $myrow[4] != "") {
$temp = preg_split("/,/",$myrow[4]);
$tally = 0;
foreach ($temp as $i) {
$output .= "myF_".$tally."=".$i."&";
$tally++;
$total[$i] = 1;
}
}
break;
}
} else {
$output = "error=not+logged+in&";
}
$tally = 0;
foreach(array_keys($total) as $i) {
$output.= "myO_".$tally."=".$i."&";
$tally++;
}
$sql = "SELECT * FROM rd_owners";
$result = mysql_query($sql,$db);
if ($result) {
while ($myrow = mysql_fetch_row($result)) {
if ($myrow[2] != "" && $myrow[2] != null) {
$output .= $myrow[1]."_o=".urlencode($myrow[2])."&";
}
if ($myrow[3] > 0) {
$output .= $myrow[1]."_p=".$myrow[3]."&";
}
if ($myrow[4] != "" && $myrow[4] != null) {
$output .= $myrow[1]."_f=".urlencode($myrow[4])."&";
}
if ($myrow[5] != "" && $myrow[5] != null) {
$output .= $myrow[1]."_m=".urlencode($myrow[5])."&";
}
}
}
$sql = "SELECT * FROM rd_player ORDER BY worth DESC LIMIT 10";
$result = mysql_query($sql,$db);
$tally = 0;
if ($result) {
while ($myrow = mysql_fetch_row($result)) {
$output .= "t_".$tally."=".urlencode($myrow[1]."`".$myrow[2]."`".$myrow[3]."`".$myrow[4]."`".$myrow[6])."&";
$tally++;
}
}
if ($firsttime == 1) {
$date = date("Y-m-d");
include("startprice.php");
// increase player number
$filename = 'peopleflag.txt';
$tally = 0;
while (file_exists($filename)) {
sleep(1);
$tally++;
if ($tally > 10) {
unlink($filename);
break;
}
}
$file = fopen($filename, "w");
fwrite($file, time());
fclose($file);
$filename2 = 'people.txt';
$people = file ($filename2);
$people = $people[0];
$people++;
$file2 = fopen($filename2, "w");
fwrite($file2, $people);
fclose($file2);
unlink($filename);
// apply bonuses
include("writelog.php");
//rd_cool
$sql = "SELECT * FROM rd_cool WHERE id_friend='$player' AND date != '$date'";
$result = mysql_query($sql,$db);
while ($myrow = mysql_fetch_row($result)) {
$which = $myrow[0];
$owner = $myrow[2];
$franchise = $myrow[3];
$cardnumber = $lookup["$franchise"];
$price = $startprice[$cardnumber-1] / 1000;
$sql2 = "SELECT * FROM rd_player WHERE rd_id='$owner'";
$result2 = mysql_query($sql2,$db);
$myrow2 = mysql_fetch_row($result2);
$worth = $myrow2[2] + $price;
$sql3 = "UPDATE rd_player SET worth='$worth' WHERE rd_id='$owner'";
$result3 = mysql_query($sql3,$db);
if (!$result3) {
mail("bleep", "Rich Deck Apply Cool Problem", "$sql\n\n$sql2\n\n** $sql3", "From: richdeck@danzen.com");
}
$sql4 = "UPDATE rd_cool SET date='$date' WHERE id='$which'";
$result4 = mysql_query($sql4,$db);
if (!$result4) {
mail("bleep", "Rich Deck Date Cool Problem", "$sql\n\n$sql2\n\n$sql3\n\n** $sql4", "From: richdeck@danzen.com");
}
$cn = $cardnumber - 1;
$log = "Received ".makemoney($price)." COOL bonus on c~$cn for $player signin";
writelog($owner, $log);
}
//rd_health
$sql = "SELECT * FROM rd_health WHERE id_owner='$player'";
$result = mysql_query($sql,$db);
while ($myrow = mysql_fetch_row($result)) {
$which = $myrow[0];
$franchise = $myrow[2];
$time = $myrow[3];
$paid = $myrow[4];
$x = floor((time() - $time) / 7 / 24 / 60 / 60);
$cardnumber = $lookup["$franchise"];
$price = $startprice[$cardnumber-1] / 1000;
$pay = ($x - $paid) * $price;
if ($pay == 0) {continue;}
$sql2 = "SELECT * FROM rd_player WHERE rd_id='$player'";
$result2 = mysql_query($sql2,$db);
$myrow2 = mysql_fetch_row($result2);
$worth = $myrow2[2] + $pay;
$sql3 = "UPDATE rd_player SET worth='$worth' WHERE rd_id='$player'";
$result3 = mysql_query($sql3,$db);
if (!$result3) {
mail("bleep", "Rich Deck Apply Health Problem", "$sql\n\n$sql2\n\n** $sql3", "From: richdeck@danzen.com");
}
$sql4 = "UPDATE rd_health SET paid='$x' WHERE id='$which'";
$result4 = mysql_query($sql4,$db);
if (!$result4) {
mail("bleep", "Rich Deck Date Health Problem", "$sql\n\n$sql2\n\n$sql3\n\n** $sql4", "From: richdeck@danzen.com");
}
$weeks = $x - $paid;
if ($weeks == 1) {
$added = "week";
} else {
$added = "weeks";
}
$cn = $cardnumber - 1;
$log = "Received ".makemoney($pay)." HEALTH bonus on c~$cn for $weeks $added";
writelog($player, $log);
}
//rd_time
$sql = "SELECT * FROM rd_time WHERE id_owner='$player' AND date != '$date'";
$result = mysql_query($sql,$db);
while ($myrow = mysql_fetch_row($result)) {
$which = $myrow[0];
$franchise = $myrow[2];
$lastdate = $myrow[3];
$cardnumber = $lookup["$franchise"];
$price = $startprice[$cardnumber-1] / 1000;
$sql2 = "SELECT * FROM rd_player WHERE rd_id='$player'";
$result2 = mysql_query($sql2,$db);
$myrow2 = mysql_fetch_row($result2);
$worth = $myrow2[2] + $price;
$sql3 = "UPDATE rd_player SET worth='$worth' WHERE rd_id='$player'";
$result3 = mysql_query($sql3,$db);
if (!$result3) {
mail("bleep", "Rich Deck Apply Time Problem", "$sql\n\n$sql2\n\n** $sql3", "From: richdeck@danzen.com");
}
$sql4 = "UPDATE rd_time SET date='$date' WHERE id='$which'";
$result4 = mysql_query($sql4,$db);
if (!$result4) {
mail("bleep", "Rich Deck Date Time Problem", "$sql\n\n$sql2\n\n$sql3\n\n** $sql4", "From: richdeck@danzen.com");
}
$cn = $cardnumber - 1;
$log = "Received ".makemoney($price)." TIME bonus on c~$cn for signin";
writelog($player, $log);
}
//rd_env
$sql = "SELECT * FROM rd_env WHERE id_owner='$player'";
$result = mysql_query($sql,$db);
while ($myrow = mysql_fetch_row($result)) {
$which = $myrow[0];
$franchise = $myrow[2];
$p = $myrow[3];
$s = $myrow[4];
$x = floor(($people - $p) / 100);
$cardnumber = $lookup["$franchise"];
$price = $startprice[$cardnumber-1] / 1000;
$pay = ($x - $s) * $price;
if ($pay == 0) {continue;}
$sql2 = "SELECT * FROM rd_player WHERE rd_id='$player'";
$result2 = mysql_query($sql2,$db);
$myrow2 = mysql_fetch_row($result2);
$worth = $myrow2[2] + $pay;
$sql3 = "UPDATE rd_player SET worth='$worth' WHERE rd_id='$player'";
$result3 = mysql_query($sql3,$db);
if (!$result3) {
mail("bleep", "Rich Deck Apply Env Problem", "$sql\n\n$sql2\n\n** $sql3", "From: richdeck@danzen.com");
}
$sql4 = "UPDATE rd_env SET sets='$x' WHERE id='$which'";
$result4 = mysql_query($sql4,$db);
if (!$result4) {
mail("bleep", "Rich Deck Date Env Problem", "$sql\n\n$sql2\n\n$sql3\n\n** $sql4", "From: richdeck@danzen.com");
}
$hundreds = ($x - $s) * 100;
$cn = $cardnumber - 1;
$log = "Received ".makemoney($pay)." ENVIRONMENT bonus on c~$cn for $hundreds signins";
writelog($player, $log);
}
}
echo $output;
?>
///////////////////////////////
// GETDATA
///////////////////////////////
<?
include("startprice.php");
if (isset($_POST['player'])) {
$player = $_POST['player'];
$player = strtoupper($player);
} else {
echo "error=3";
return;
}
if (isset($_POST['card'])) {
$cardnumber = $_POST['card'];
} else {
echo "error=3";
return;
}
if (isset($_POST['selltype'])) {
$selltype = $_POST['selltype'];
} else {
echo "error=3";
return;
}
$cardnumber = $cardnumber+1;
$selldate = date("Y-m-d");
$sql = "SELECT * FROM rd_player WHERE rd_id='$player'";
$result = mysql_query($sql,$db);
$companies = $franchises = "";
if ($result) {
while ($myrow = mysql_fetch_row($result)) {
$worth = $myrow[2];
if ($myrow[3] != null && $myrow[3] != "") {
$companies = $myrow[3];
}
if ($myrow[4] != null && $myrow[4] != "") {
$franchises = $myrow[4];
}
$motto = $myrow[6];
break;
}
} else {
echo "error=3";
return;
}
$owner = $price = $franchisees = "";
$sql = "SELECT * FROM rd_owners WHERE own_id = $cardnumber";
$result = mysql_query($sql,$db);
if ($result) {
while ($myrow = mysql_fetch_row($result)) {
$card = $myrow[1];
if ($myrow[2] != "" && $myrow[2] != null) {
$owner = $myrow[2];
}
if ($myrow[3] > 0) {
$price = $myrow[3];
}
if ($myrow[4] != "" && $myrow[4] != null) {
$franchisees = $myrow[4];
}
break;
}
} else {
echo "error=3";
return;
}
$newprice = $price - $startprice[$cardnumber-1] / 100;
if ($selltype == "company") {
if ($player != $owner) {
echo "error=2";
return;
}
// take owner off rd_owners remove motto.
$sql = "UPDATE rd_owners SET owners='',price='$newprice',motto='' WHERE own_id=$cardnumber";
// take company off rd_players
$temp = preg_split("/,/",$companies);
$temp2 = Array();
foreach ($temp as $cc) {
if ($cc != $card) {
array_push($temp2,$cc);
}
}
$companies = join(",",$temp2);
$sql2 = "UPDATE rd_player SET companies='$companies' WHERE rd_id='$player'";
$result = mysql_query($sql,$db);
if (!$result) {
echo "error=3";
mail("bleep", "Rich Deck Sell Company Problem", "** $sql\n\n$sql2", "From: richdeck@danzen.com");
return;
}
$result = mysql_query($sql2,$db);
if (!$result) {
echo "error=3";
mail("bleep", "Rich Deck Sell Company Problem", "$sql\n\n** $sql2", "From: richdeck@danzen.com");
return;
}
include("writelog.php");
$cn = $cardnumber - 1;
$log = "Received ".makemoney($newprice)." for selling company, c~$cn, to BANK OF ZENDECK";
writelog($player, $log);
}
if ($selltype == "franchise") {
$templist = preg_split("/,/", $franchisees);
$franchiseowncheck = 0;
foreach($templist as $a) {
if ($a == $player) {
$franchiseowncheck = 1;
continue;
}
}
if ($franchiseowncheck != 1) {
echo "error=2";
return;
}
//check to see if older than 4 weeks
$sql = "SELECT * FROM rd_franchises WHERE f_player='$player' AND f_name='$card'";
$result = mysql_query($sql,$db);
if ($result) {
while ($myrow = mysql_fetch_row($result)) {
$fdate = $myrow[3];
continue;
}
} else {
echo "error=3";
return;
}
$selldate = strtotime($selldate);
$fdate = strtotime($fdate);
$days = (date("Y", $selldate)*366 + date("z",$selldate)) - (date("Y",$fdate)*366 + date("z",$fdate));
if ($days<7) {
$daysleft = 7 - $days;
echo "error=1&days=$daysleft&";
return;
}
include("writelog.php");
$cn = $cardnumber - 1;
$log = "Received ".makemoney($startprice[$cardnumber-1] / 10)." for selling franchise, c~$cn, to BANK OF ZENDECK";
writelog($player, $log);
// take owner off rd_owners
$temp = preg_split("/,/",$franchisees);
$temp2 = Array();
foreach ($temp as $cc) {
if ($cc != $player) {
array_push($temp2,$cc);
}
}
$franchisees = join(",",$temp2);
$sql = "UPDATE rd_owners SET franchisees='$franchisees' WHERE own_id=$cardnumber";
// take franchise off rd_players
$temp = preg_split("/,/",$franchises);
$temp2 = Array();
foreach ($temp as $cc) {
if ($cc != $card) {
array_push($temp2,$cc);
}
}
$franchises = join(",",$temp2);
$sql2 = "UPDATE rd_player SET franchises='$franchises' WHERE rd_id='$player'";
//remove purchase date
$sql3 = "DELETE FROM rd_franchises WHERE f_player='$player' AND f_name='$card'";
$result = mysql_query($sql,$db);
if (!$result) {
echo "error=3";
mail("bleep", "Rich Deck Sell Franchise Problem", "** $sql\n\n$sql2\n\n$sql3", "From: richdeck@danzen.com");
return;
}
$result = mysql_query($sql2,$db);
if (!$result) {
echo "error=3";
mail("bleep", "Rich Deck Sell Franchise Problem", "$sql\n\n** $sql2\n\n$sql3", "From: richdeck@danzen.com");
return;
}
$result = mysql_query($sql3,$db);
if (!$result) {
echo "error=3";
mail("bleep", "Rich Deck Sell Franchise Problem", "$sql\n\n$sql2\n\n** $sql3", "From: richdeck@danzen.com");
return;
}
//update any bonus stuff
$thisbonus = $bonuslookup["$card"];
if ($thisbonus == "1") {
$bonus = "DELETE FROM rd_cool WHERE id_owner='$player' AND franchise='$card'";
} else if ($thisbonus == "2") {
$bonus = "DELETE FROM rd_health WHERE id_owner='$player' AND franchise='$card'";
} else if ($thisbonus == "3") {
$bonus = "DELETE FROM rd_env WHERE id_owner='$player' AND franchise='$card'";
} else if ($thisbonus == "4") {
$bonus = "DELETE FROM rd_time WHERE id_owner='$player' AND franchise='$card'";
}
$result = mysql_query($bonus,$db);
}
echo "selltype=$selltype&error=0";
?>
///////////////////////////////
// SEND
///////////////////////////////
<?
// checks to see if card is being sent by franchise owner
// checks that e-mail has not already been sent for this card and owner
// adds random id for card / owner / e-mail
// sends out letter with ID
if (isset($_POST['player'])) {
$player = $_POST['player'];
$player = strtoupper($player);
} else {
echo "error=3";
return;
}
if (isset($_POST['card'])) {
$card = $_POST['card'];
} else {
echo "error=3";
return;
}
$variables = array ("email1", "email2", "email3", "email4", "email5", "email6");
foreach($variables as $v) {
$$v = ""; if (isset($_POST["$v"])) $$v = $_POST["$v"];
}
function sendmessage($e,$r,$p,$c,$reply) {
$c--;
include("startprice.php");
include("titles.php");
$products = array (
"a <b>MOON MANSION",
"a <b>LUNAR LUXURY CONDO",
"an <b>AZTEC SUN TEMPLE CHAMBER",
"a <b>SCIENCE SQUAD",
"a <b>PLANETARIUM OFFICE",
"a <b>CENTRAL LEMONADE LICENCE",
"a <b>SOLAR FARM",
"a <b>BULLETPROOF GLASS CAR",
"a <b>CLIFFSIDE CONDOMINIUM",
"an <b>ISLAND CONDO RESORT",
"an <b>OASIS",
"a <b>10 ACRE PINE FOREST",
"a <b>RUNNING COURRIER FLEET",
"a <b>BAT CAVE",
"a <b>PERSONAL COPTER",
"an <b>ERGONE CHAMBER",
"an <b>ENVIRONMENTAL SOUND INSTALLATION",
"a <b>LASER HAIR CHAIR",
"a <b>FRESH AIR INSTALLATION",
"a <b>SOLAR LAGOON BATH");
$graphics = array ("moonmansion", "moonresort", "aztec", "chemists", "planetarium", "lemonade", "solarfarm", "car", "cliffs", "islandresort", "oasis", "forest", "foot", "batcave", "copter", "ergone", "sound", "hair", "freshair", "lagoon");
$descriptions = array ("Yours for a year! The ultimate in luxury with low and reg grav rooms. No need for stairs and a fantastic view of Earth through glass dome roof. Five floors underground including a rec room trampoline cavern and moon buggy garage.",
"Yours for a year! Luxurious lunar condo with tower glass restaurant domes looking over Earth and the resort below. Play low gravity sports including pools and 18 hole golf course. Traverse the inner and outer dome with suction cup bungies. Plus, all the best entertainment acts perform on the Moon.",
"Your own temple party chamber set amongst treasure rooms, indoor outdoor labyrinth with sun-tanning terraces bordering hundreds of miles of beautiful jungle, river and mountain trail and is only ten miles from a most popular ancient artist run tourist town.",
"A selection of scintillating scientists using the latest lab luxuries! Put them to work inventing or point them in any direction of your choosing. They are at your command for a year! Experts in the oscillating ogtrangulator, carbolic cliptrometer calibration, tubeless viscosity verification, electroplasmi infinity induction, cro-magnum carbon copying, nanonoodle modelling, googlistic genogiggling, and the ultra advanced field of telepixonality psiborganarianismistical plantation.",
"Yours for a year! The largest monitor on the block - and a very big block at that! Complete with SG180 Hemisphere Galaxy drivers good for everything from video games to power business layouts and completely new mediums like astral manipulation.",
"A ten block licence for the coolest property around... lemonade from your taps! Central Lemonade flows the most refreshing Lemonade for the exact same price as a water bill - what a sweet deal!",
"A lifetime of energy is yours! Finally, environmental energy makes its way to you from a farm made of used auto headlights as Swiss gearboxes convert sand weight into rotational calibrated sun-tracking motion. ",
"Top sport car designers competed to create a perfect bulletproof glass car. Features include bulletproof outer flex shell with digital glass inner layer programmed to display digital output ala computer monitor controlled locally or over the Internet. The car has a melt proof ceramoglass 4 cylinder hydro solar engine but what makes it move 0-60 in 4 seconds is its polyethylene spring wound capacitor accelerator wheels with clear rubber tires. The springs store ratcheted energy while braking and release one heck of a lot of torque during what can only be described as a take off!",
"Yours for a year! A breathtaking view every time you turn around. Elevator and bridge access including fast, quiet freight right to your floors. Sunken pool, tennis and squash courts. Minutes from town with no sound but the wind and water. Fly with the free.",
"Condo for a year! This tropical once-deserted volcanic island featuring five star resort, private huts and rain forest tree houses. Think Ewok village right on the peach sand beach. That's right. Lava seems to have cooled red and has been sun and salt bleached to peach. Take catamaran trips to seven neighboring islands with their own Tahitian-like culture. They love to come back with you to experience the world's largest water slide through a natural spring grotto inside the volcano shell. Partake in the monthly ten kilometer volcano whirl mountain bike race up the outside of the volcano and back.",
"Yours for a year! Sun-soaked, dune-cooled, palm-shaded pools of pure water said to unveil visions of dancing harems and sultry sultans on the moonlit shore as the day's heat drifts to sleep.",
"Ten acres of pure Pine rivaled in number only by the birds, butterfly, deer, rabbit and chipmunks. Soft scented needled floor crevasses to curled streams. A woodland haven that you can share with anyone anytime.",
"Ten block licence. Through downtown mall and office tower traffic, the surest, safest and often fastest way is running by foot. Take control of the best of decathlon athletes to ensure a successful delivery exact to your instructions.",
"Yours for a year! Complete with pole to cliff-top, fake mouth, tap into live city demographics and statistics, mobile distress light, and untraceable ultraviolet cell signal. Choose from a number of cliffs in your region.",
"The name says it all. Range on one tank of natural gas is 200 miles. Glass bottom floor and v-look-out 360 bubble design. Top speed of 200 Kilometers per hour at which point you are virtually horizontal like a plane. To steer, you just point the gyro remote control in the direction you want to go and press a button and the wheels act as rudders. Press the up and down buttons to adjust speed. Your last command sets auto pilot while you rest in a vertical hammock with the full safety of anti-crash retro whirl.",
"Modern recreation of Burrough's concept creation. Collects positive energy and beams it while you relax inside. Actually a combination of multiple alternative health remedies from magnetic to herbal - from aroma to light enhancing - from soundscapes to upgradeable full video cave. Seconds as a radiation bomb shelter with modular extendible basement tub storage.",
"360 degree soundsphere with macrophone telescopic recording wand. Position the wand in the woods, in the city, at the beach, at a party, and completely relive the aural experience. Download sounds from around the world close your eyes, transplant yourself and relax.",
"The perfect hairdo designed by masters of the craft customizable to your click. Includes vacuum hair dome, laser field and touch pad control panel. The panel lets you cycle through cuts, vary the length, combine styles and even add degrees of randomness for that surprise haircut feeling.",
"Convection tubes cycle air from the protopolution zone through your house and back out. Swaysafe PVC Reflective intube and absorbent outtube are virtually invisible aside from beacon light.",
"Solar panel heats and operates wall filters. Just change water every few months. Underwater passageways, deep and shallow, warm and cool pools surrounded by plants makes this the ultimate in personal or party bathing.");
//check e-mail
if (!preg_match("/^[^ <>()@¡-ÿ]+@[^ <>()@¡-ÿ]+\.[a-zA-Z]{2,4}$/", $e)) {
return 0;
}
//get player e-mail for reply
$email = $reply;
//convert money to string with ,
$x = $startprice[$c] / 100;
$x = $x."";
$y = "";
$ii = 0;
for ($j=strlen($x)-1; $j>=0; $j--) {
$ii++;
$y = $x[$j].$y;
if ($ii%3 == 0 && $j !=0) {
$y = ",".$y;
}
}
//send e-mail
$from_name = "";
$from_email = $email;
$to_name = "";
$to_email = $e;
$subject = "RichDeck Card - $titles[$c]";
$text = "
Greedings ;-)
I am playing a game called RichDeck and have just given you a card for $products[$c].
It would be great if you would click here to accept the card - read below:
http://danzen.com/richdeck/accept.php?p=$r
$titles[$c]
$descriptions[$c]
Two good things will happen if you accept. Both you and I will get $y Deck Dollars
and if it is your first time at RichDeck then you will also get 10,000,000 Deck Dollars
with lots of crazy things to spend it on!
RichDeck was made by this mad inventor named Dan Zen who has made lots of games and gadgets.
Thanks,
$p
";
$html = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
<HTML><BODY>
<center><table width=520><tr><td><font face=\"verdana\" size=\"2\">
Greedings ;-)<p>
I am playing a game called RichDeck and have just given you a card for $products[$c]</b>. It would be great if you would click here to accept the card - read below:<p>
<a href=\"http://danzen.com/richdeck/accept.php?p=$r\"><font face=\"verdana\" size=\"2\" color=\"cc0000\">http://danzen.com/richdeck/accept.php?p=$r</font></a><br><br><br>
<table cellpadding=0 cellspacing=0 border=0><tr><td valign=top><a href=\"http://www.danzen.com/richdeck/accept.php?p=$r\"><img border=0 src=\"http://www.danzen.com/richdeck/graphics/$graphics[$c]".".gif\"></a></td><td> </td><td valign=top><font face=\"verdana\" size=\"2\" color=\"#666666\"><b>$titles[$c]</b><br><i>$descriptions[$c]</i></font></p></td></tr></table><p>
Two good things will happen if you accept. Both you and I will get $y Deck Dollars and if it is your first time at RichDeck then you will also get 10,000,000 Deck Dollars with lots of crazy things to spend it on!<p>
RichDeck was made by this mad inventor named <a href=\"http://www.danzen.com\"><font face=\"verdana\" size=\"2\" color=\"black\">Dan Zen</font></a> who has made lots of games and gadgets.<br><br>Thanks,<br><br>
$p
</font></td></tr></table></center>
</BODY></HTML>
";
//echo $html;
//return;
// headers need to be in the correct order...
$headers = "From: $from_name<$from_email>\n";
$headers .= "Reply-To: <$from_email>\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "X-Sender: $from_name<$from_email>\n";
$headers .= "X-Mailer: PHP4\n";
$headers .= "X-Priority: 3\n"; //1 UrgentMessage, 3 Normal
$headers .= "Return-Path: <$from_email>\n";
$headers .= "Content-Type: multipart/alternative; boundary=\"myBoundary\"\n";
//plaintext section begins
$message = "--myBoundary\n";
$message .= "Content-Type: text/plain; charset=us-ascii\n\n";
$message .= $text."\n\n";
// html section begins
$message .= "--myBoundary\n";
$message .= "Content-Type: text/html; charset=us-ascii\n\n";
$message .= $html."\n\n";
// this ends the message part
$message .= "--myBoundary--\n\n";
mail($to_email, $subject, $message, $headers, "-f $from_email");
return 1;
}
$card = $card+1;
$sdate = date("Y-m-d");
$owner = $price = $franchisees = "";
$sql = "SELECT * FROM rd_owners WHERE own_id = '$card'";
$result = mysql_query($sql,$db);
if ($result) {
while ($myrow = mysql_fetch_row($result)) {
$cardname = $myrow[1];
if ($myrow[4] != "" && $myrow[4] != null) {
$franchisees = $myrow[4];
}
break;
}
} else {
echo "error=3";
return;
}
$sql = "SELECT * FROM zd_reg WHERE zd_id = '$player'";
$result = mysql_query($sql,$db);
if ($result) {
while ($myrow = mysql_fetch_row($result)) {
$email = $myrow[2];
break;
}
} else {
echo "error=3";
return;
}
$templist = preg_split("/,/", $franchisees);
$check = 0;
foreach($templist as $a) {
if ($a == $player) {
$check = 1;
break;
}
}
if ($check == 0) {
echo "error=2"; // does not own franchise
return;
}
$num = 0;
srand((double)microtime()*1000000);
for ($i=1; $i<=6; $i++) {
eval("\$e = \$email".$i.";");
$check = 0;
$sql = "SELECT * FROM rd_sends WHERE s_card = '$cardname' AND s_player = '$player' AND s_email = '$e'";
$result = mysql_query($sql,$db);
if ($result) {
while ($myrow = mysql_fetch_row($result)) {
$check = 1;
break;
}
} else {
echo "error=3";
return;
}
if ($check == 0) {
if ($e != "") {
$random = rand();
$random_check = 0;
while ($random_check == 0) {
$sql = "SELECT * FROM rd_sends WHERE s_random = $random";
$result = mysql_query($sql,$db);
$random_check2 = 0;
if ($result) {
while ($myrow = mysql_fetch_row($result)) {
$random_check2 = 1; break;
}
} else {
echo "error=3";
return;
}
if ($random_check2 == 0) {
$random_check = 1;
}
}
$sql = "INSERT INTO rd_sends (s_id, s_random, s_card, s_player, s_date, s_email, s_status) VALUES ('', '$random', '$cardname', '$player', '$sdate', '$e', '0')";
$result = mysql_query($sql,$db);
if ($result) {
$num += sendmessage($e,$random,$player,$card,$email);
}
}
}
}
echo "error=0&num=$num";
?>