File: /home/awaldron/www/archive/blueliner/lib/quote3.php
<?php
session_start();
$level = "Quote";
$pagename = "quote3.php";
$title = "Win a Free Website or Other Significant Discounts!";
$splash = "smart.jpg";
$promo = "_featproj.php";
$promo_head = "Featured Project";
include("_header.php");
if ($t != "test") {
$db = mysql_connect("localhost", "blueline", "miff0609");
if (!$db) { echo "Error: Could not connect to DB.<br>" . mysql_error(); exit; }
mysql_select_db("blueline_admin");
}
echo "<div class=\"sub-header\">Step 3 : Claim Your Prize!</div>\n";
$valid = 0;
if ($vstr > 0) {
if ($t != "test") {
$query = "SELECT name, email, validstr FROM tbl_quotes WHERE validstr = " . $vstr;
$result = mysql_query($query);
if (mysql_num_rows($result) == 1) {
$valid = 1;
$row = mysql_fetch_array($result);
$email = $row["email"];
$name = $row["name"];
}
}
if (($valid == 1) || ($t == "test")) {
for ($i=0; $i < 5000; $i++) {
if ($i <= 2499) { $lotto[$i] = 5; }
else if (($i >= 2500) && ($i <= 3749)) { $lotto[$i] = 10; }
else if (($i >= 3750) && ($i <= 4474)) { $lotto[$i] = 15; }
else if (($i >= 4475) && ($i <= 4839)) { $lotto[$i] = 20; }
else if (($i >= 4840) && ($i <= 4939)) { $lotto[$i] = 25; }
else if (($i >= 4940) && ($i <= 4989)) { $lotto[$i] = 35; }
else if (($i >= 4990) && ($i <= 4998)) { $lotto[$i] = 50; }
else { $lotto[$i] = 100; }
}
shuffle($lotto);
srand(time());
$random = (rand()%5000);
$discount = $lotto[$random];
if ($t != "test") {
$query2 = "UPDATE tbl_quotes SET discount = " . $discount . " WHERE validstr = " . $vstr;
$result2 = mysql_query($query2);
$query3 = "UPDATE tbl_quotes SET validstr = 1 WHERE validstr = " . $vstr;
$result3 = mysql_query($query3);
$mail_it = 1;
include("_discount_mail.php");
}
echo "<P><b>Congratulations!</b> You've just won the following discount off of your final rate on a website from Blueliner:\n";
echo "<P><center><span style=\"font:bold 36px verdana,helvetica,arial;color:#184C95\">" . $discount . " %</span></center>\n";
echo "<P>Your discount information has been stored in our database along with the rest of the information that you've provided.\n";
echo "<P>We encourage you to <a href=\"contact.php\" class=\"text\">contact Blueliner</a> at this time so that you can take advantage of the discount you've just won. This discount is only valid if used within 30 days.";
echo "<P>We thank you for your interest in Blueliner, and hope that we will be speaking with you soon about how we can make your business a success on the web!\n";
echo "<br><br><br><center><a href=\"#\" class=\"text\" onclick=\"MM_openBrWindow('odds.php','odds','scrollbars=yes,resizable=yes,width=500,height=350')\">How was this discount generated?</a></center>\n";
} else {
echo "<P>Error: This is not a correct validation key.\n";
echo "<P><a href=\"quote.php\" class=\"text\">Please start from the beginning of the process.</a>\n";
}
} else {
echo "<P>Error: This page must be accessed by a link from an email containing a validation key.\n";
echo "<P><a href=\"quote.php\" class=\"text\">Please start from the beginning of the process.</a>\n";
}
include("_footer.php");
include("_blustats.php");
?>