Hello everybody,
I am back with another dumb question:
if ($submit) {
if ($points_forwarded<$nn) { //Let's not be negative
} elseif ($points_forwarded>$nn) {
echo " You can't go negative!";
include ("footer.inc.php");
exit;
}
Source: http://www.php.net/manual/en/control-structures.elseif.php
Am I using this wrong? It still allows the user to run up a negative amount in "points_forwarded". The only reason I am using elseif is because it will still allow my other else down on the verify form. In case it could help, I will paste the whole thing.
<?
$today = date("F j, Y, g:i a");
include ("login.php");
if(isset($uid)) {
$result = mysql_query("select
custid, last_name, first_name, middle_name, addr1, addr2, City, state, zip, WorkPhone_ac, WorkPhone, HomePhone_ac, HomePhone, fax_ac, fax, pager, point_total_ytd, dollar_total_ytd, point_total_mtd, dollar_total_mtd, point_total_lifetime, dollar_total_lifetime, points_forwarded, points_redeemed, dob, SSNO, cellno, Occupation, employer, date_activated, sex, email, income_level, children, mstatus, groupid from
vipcustomer where custid = '$uid' AND SSNO='$pwd'", $conn);
list($custid, $last_name, $first_name, $middle_name, $addr1, $addr2, $City, $state, $zip, $WorkPhone_ac, $WorkPhone, $HomePhone_ac, $HomePhone, $fax_ac, $fax, $pager, $point_total_ytd, $dollar_total_ytd, $point_total_mtd, $dollar_total_mtd, $point_total_lifetime, $dollar_total_lifetime, $m, $points_redeemed, $dob, $SSNO, $cellno, $Occupation, $employer, $date_activated, $sex, $email, $income_level, $children, $mstatus, $groupid
) =
mysql_fetch_row($result);
include ("header_cash.inc.php");
if ($groupid != $custid) {
echo "<p align=\"center\">$font1<b>You are not authorized to make a redemption against this<br>
account. <a href=\"contact.php\" class=\"db\">Please contact</a> VIP Rewards
for more information.</b></font><br>$backout</p>";
include ("footer.inc.php");
exit;
}
$vb = "400";
$nn = $cash_amount*$vb;
$op = $m-$nn;
$op2 = "$op";
$nn2 = "$nn";
$cashr = round($m / 400100)/100;
$ffmr = round($m / 10);
$certr = round($m / 250100)/100;
$cash = number_format($cashr, 2);
$ffm = number_format($ffmr);
$cert = number_format($certr, 2);
$dollar_total_mtd = number_format($dollar_total_mtd, 2);
$dollar_total_ytd = number_format($dollar_total_ytd, 2);
$dollar_total_lifetime = number_format($dollar_total_lifetime, 2);
$point_total_mtd = number_format($point_total_mtd);
$point_total_ytd = number_format($point_total_ytd);
$point_total_lifetime = number_format($point_total_lifetime);
$op2 = number_format($op2);
$nn2 = number_format($nn2);
$points_redeemed = number_format($points_redeemed);
if ($submit) {
$sql = "UPDATE vipcustomer SET points_forwarded='$points_forwarded' WHERE custid=$uid";
$result = mysql_query($sql);
$message = "$first_name $last_name has a request for a Cash Redemption!";
$message2 = "Merchant = $merch\nCertificate Amount = $cash_amountc\nTime and Date of Request $today";
MAIL("ron@iconguam.com","$first_name $last_name - $uid Has has a Redemption Request","$message\n\n$message2","From: $first_name $last_name <$email>\nReply-To: $email\nX-Priority: 2");
echo "<center> $font1<b>Thank You for your Redemption request!</b><br>$font1 You will be contacted by one of our representatives shortly<br>$backout <a href=\"process.php\" class=\"db\">Process Another Redemption</center>";
include ("footer.inc.php");
exit;
}
if ($request) {
if ($points_forwarded<$nn) { //Let's not be negative
} elseif ($points_forwarded>$nn) {
echo " You can't go negative!";
include ("footer.inc.php");
exit; }
?>
<form action="cash.php" method="post">
<input type="hidden" name="points_forwarded" value="<? echo $op; ?>">
<div align="center">
<table border="0" width="445" bgcolor="#000000" cellspacing="1" cellpadding="0">
<tr>
<td width="100%">
<table border="0" width="445" bgcolor="#FFFFFF" cellspacing="1" cellpadding="2">
<tr>
<td width="431" bgcolor="#DDDDCC" colspan="2">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="66%" align="left"><font face="Arial" size="2"><b><i>Confirm
Redemption<i></b></font></i></i></td>
<td width="34%" align="right"><? echo $backout; ?></td>
</tr>
</table>
</td>
<center>
</tr>
<tr>
<td width="431" colspan="2"><font size="2" face="Arial">Please make certain that information is correct</font></td>
</tr>
<tr>
<td width="98"><font size="2" face="Arial"><i>VIP Card No.</i></font></td>
<td width="333"><input type="text" disabled name="disabled" value="<? echo $custid; ?>" size="9"></td>
</tr>
<tr>
<td width="98"><font size="2" face="Arial"><i>First Name</i></font></td>
<td width="333"><input type="text" disabled name="disabled" value="<? echo $first_name; ?>" size="20"></td>
</tr>
<tr>
<td width="98"><font size="2" face="Arial"><i>Last Name</i></font></td>
<td width="333"><input type="Text" disabled name="disabled" value="<? echo $last_name; ?>" size="20"></td>
</tr>
<tr>
<td width="161">
<font size="2" face="Arial">Cash Amount?</font>
</td>
<td width="276">
$<input type="Text" name="cash_amountc" value="<? echo $cash_amount; ?>" size="7" maxlength="7" onKeyPress="return(currencyFormat(this,'','',event))">
</td>
</tr>
<tr>
<td width="437" colspan="2">
<p align="center">
<input type="Submit" name="submit" value="Confirm Request"> </form>
<? echo "$font1 Choosing \"Confirm Request\" Will Subtract $nn2 From your total points<br>Leaving you with $op2 points left<br>"; ?>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<?
} else {
?>
<form action="cash.php" method="post">
<div align="center">
<table border="0" width="445" bgcolor="#000000" cellspacing="1" cellpadding="0">
<tr>
<td width="100%">
<table border="0" width="445" bgcolor="#FFFFFF" cellspacing="1" cellpadding="2">
<tr>
<td width="431" bgcolor="#DDDDCC" colspan="2">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="66%" align="left"><font face="Arial" size="2"><b>Cash Redemption </b></font></td>
<td width="34%" align="right"><? echo $backout; ?></td>
</tr>
</table>
</td>
<center>
</tr>
<tr>
<td width="431" colspan="2"><font size="2" face="Arial">You may redeem up to
<b>$<? echo $cash; ?></b> </font></td>
</tr>
<tr>
<td width="98"><font size="2" face="Arial"><i>VIP Card No.</i></font></td>
<td width="333"><input type="text" disabled name="disabled" value="<? echo $custid; ?>" size="9"></td>
</tr>
<tr>
<td width="98"><font size="2" face="Arial"><i>First Name</i></font></td>
<td width="333"><input type="text" disabled name="disabled" value="<? echo $first_name; ?>" size="20"></td>
</tr>
<tr>
<td width="98"><font size="2" face="Arial"><i>Last Name</i></font></td>
<td width="333"><input type="Text" disabled name="disabled" value="<? echo $last_name; ?>" size="20"></td>
</tr>
<tr>
<td width="161">
<font size="2" face="Arial">Cash Amount?</font>
</td>
<td width="276">
$<input type="Text" name="cash_amount" value="" size="7" maxlength="7" onKeyPress="return(currencyFormat(this,'','',event))">
</td>
</tr>
<tr>
<td width="437" colspan="2">
<p align="center">
<input type="Submit" name="request" value="Submit Request"> </form><br>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<?
}
include ("footer.inc.php");
}
?>