i have a basic script i want to use to make a points store in an online rpg. i have no real knowledge on how php works and i am trying to learn. i would appreciate any help i can get . please IM me on aim
distentstormz@aol.com or msn
nicknacsnmore@hotmail.com or on yahoo
daredevil407@yahoo.com .
<?php
if (!eregi("modules.php", $_SERVER['PHP_SELF'])) {
die ("You can't access this file directly...");
}
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
function Main() {
global $module_name, $user, $cookie, $db;
cookiedecode($user);
$uid = $cookie[0];
include("header.php");
title("Earn Free Points");
OpenTable();
echo "<center>\n";
echo "<span style='color: #FF0000'>\n";
echo "<b>WARNING: If you are caught giving out any of the answers or complete offers with invalid information (name, email, etc.), your account will be deleted with no notice at all. Only complete the offers if you are seriously interested in the product shown. By clicking the offer, you agree on viewing the website for its product or service, NOT the points being awarded. Points are awarded only as a bonus. By using 'Earn free points', you agree to these terms. Thanks.</b>\n";
echo "</span>\n";
echo "<span style='color: #FF0000'>\n";
echo "<BR><BR><B>WARNING: We monitor the free point submissions,
If you
input the wrong answer five (5) times you will be banned for 24 hours,
if your continue to do this you will be banned forever</b>";
echo "</span>\n";
echo "<span style='color: blue'>\n";
echo "<BR><BR><B> If you have run out of free point offers
please email
<a
href=mailto:cobra@paintballthegame.com>cobra@paint ballthegame.com</a>
<BR>
We will have more free offers for you within a few hours";
echo "</span>\n";
echo "<br><br>\n";
echo "
<script type=\"text/javascript\">
function checkBox(fName) {
var box =top.document.forms[0].elements[fName];
box.checked =(!box.checked)? true : false;
box.disabled =(!box.disabled)? true : false;
};
</script>
";
$result = $db->sql_query("SELECT earn_id, earn_title, earn_text, earn_link, earn_points FROM ".COLLEGE_EARN_POINTS_TABLE." ORDER BY earn_id DESC");
while (list($earn_id, $earn_title, $earn_text, $earn_link, $earn_points) = $db->sql_fetchrow($result)) {
if ($db->sql_numrows($db->sql_query("SELECT * FROM ".COLLEGE_EARN_POINTS_LOGS_TABLE." WHERE (user_id = '$uid') AND (earn_id = '$earn_id')")) == 0) {
echo "<table width='100%' border='1' bordercolor='#406878' cellspacing='0' cellpadding='2'>\n";
echo " <tr>\n";
echo " <td width='20%'><a href='$earn_link$uid' target=_blank>$earn_title</a><br><b>".number_format($earn_points)." Points</b></td>\n";
// echo " <TD width=20% > <a href='#self' onclick=\"top.checkBo'earn".$earn_id.")\">hererere rerer</A></td>\n";
echo " <td width='45%'>$earn_text</td>\n";
echo " <form action='modules.php?name=$module_name&file=earn_po ints&op=earn' method='post'>\n";
echo " <td width='25%' align='center'><input
type='text' NAME='earn_answer' value=\"\" size='15' maxlength='80' > <input
type='hidden' name='id' value='$earn_id'><input type='hidden'
name='earn' value='Submit'><input type='submit' name='earn".$earn_id."'
value='Submit'></td>\n";
echo " </tr>";
echo " </form>";
echo "</table>\n";
echo "<br>\n";
}
}
echo "No More Offers Available at this Current time\n";
echo "</center>";
CloseTable();
include("footer.php");
}
function Earn($user_earn_answer) {
global $id, $user, $cookie, $db;
cookiedecode($user);
$uid = $cookie[0];
$result = $db->sql_query("SELECT earn_points, earn_answer FROM ".COLLEGE_EARN_POINTS_TABLE." WHERE (earn_id = '$id')");
list($earn_points, $earn_answer) = $db->sql_fetchrow($result);
if ($db->sql_numrows($result) == 0) $stop = "Invalid offer Id.";
if (strtolower($earn_answer) != strtolower($user_earn_answer)) {
$stop = "Answer is Invalid.";
mail('cobra@paintballthegame.com',"invalid point answer from $uid on
$id", "invalid answer ".$user_earn_answer." and the real answer is
".$earn_answer."");
}
if ($db->sql_numrows($db->sql_query("SELECT * FROM ".COLLEGE_EARN_POINTS_LOGS_TABLE." WHERE (user_id = '$uid') AND (earn_id = '$id')")) > 0) $stop = "You have already completed this offer.";
if (isset($stop)) {
include("header.php");
title("Error");
OpenTable();
echo "<center>$stop</center>";
CloseTable();
include("footer.php");
die();
}
$time = time();
$server_time = date("H:i");
$server_date = date("d/m/Y");
$db->sql_query("UPDATE ".COLLEGE_USERS_TABLE." SET user_free_points = user_free_points + '$earn_points' WHERE (user_id = '$uid')");
$db->sql_query("INSERT INTO ".COLLEGE_EARN_POINTS_LOGS_TABLE." (earn_id, user_id, earn_date, earn_time) VALUES ('$id', '$uid', '$server_time $server_date', '$time')");
include("header.php");
title("Points Earned");
OpenTable();
echo "<center>Success! You recieved ".number_format($earn_points)." earn points.</center>";
CloseTable();
include("footer.php");
}
function EarnLink() {
global $id, $db, $uid;
$result = $db->sql_query("SELECT earn_link FROM ".COLLEGE_EARN_POINTS_TABLE." WHERE (earn_id = '$id')");
list($earn_link) = $db->sql_fetchrow($result);
if ($db->sql_numrows($result) == 0) $stop = "Invalid offer ID.";
if (isset($stop)) {
include("header.php");
title("Error");
OpenTable();
echo "<center>$stop</center>";
CloseTable();
include("footer.php");
die();
}
Header("Location: $earn_link");
}
switch ($op) {
default:
Main();
break;
case "earn":
if (isset($HTTP_POST_VARS["earn"])) Earn($HTTP_POST_VARS["earn_answer"]);
else Main();
break;
case "link":
EarnLink();
break;
}
?>
all i want this to do is have a place for a link and have a place that says "enter the last word on page 3" with a place for the anwser and a submit button.
i think thats whats already there but i dont know what to do with it to make it work with my site. i have learnd the basics of html , but with that you can do something in it and see it in the browser and know about where you went wrong . php is alot more complicated for me to understand.