Created
April 29, 2015 09:40
-
-
Save anonymous/0ff6b49e01a890fc8cc0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start ( ) ; | |
require ( "inc.login_check.php" ) ; | |
require_once ( "inc.admin_data.php" ) ; | |
if ( intval ( $_SESSION["admin_rights"]["r_coupon"] ) == 0 ) | |
{ | |
header ( "location:home.php" ) ; | |
exit(); | |
} | |
$form_data = array ( ) ; | |
if ( intval ( $_GET["id"] ) > 0 ) | |
{ | |
$dataArray = $data->select ( "Coupon" , "*" , array ( "CouponID" => intval ( $_GET["id"] ) ) ) ; | |
$form_data = $dataArray[0] ; | |
} | |
else if ( intval ( $_GET["webid"] ) < 1 ) | |
{ | |
header ( "location:selectweb.php" ) ; | |
exit(); | |
} | |
$webid = intval ( $_GET["webid"] ) > 0 ? intval ( $_GET["webid"] ) : intval ( $form_data["WebsiteID"] ) ; | |
$webdetail = $data->select ( "Website" , "*" , array ( "WebsiteID" => $webid ) ) ; | |
if ( ! empty ( $webdetail ) ) | |
$webdetail = $webdetail[0] ; | |
if ( $_POST ) | |
{ | |
$postArray = $_POST ; | |
if ( intval ( $postArray["CouponID"] > 0 ) ) | |
{ | |
$dataValues = array ( ) ; | |
foreach ( $postArray as $field => $value ) | |
{ | |
if ( strchr ( $field , "_Setting_" ) ) | |
{ | |
$fName = str_replace ( "_Setting_" , "" , $field ) ; | |
$dataValues[$fName] = stripslashes($value) ; | |
} | |
} | |
$data->update ( "Coupon" , $dataValues , array ( "CouponID" => $postArray["CouponID"] ) ) ; | |
$_SESSION["str_system_message"] = "Coupon modified successfully." ; | |
header ( "location:couponlisting.php" ) ; | |
exit ( ) ; | |
} | |
else | |
{ | |
$dataValues = array ( ) ; | |
foreach ( $postArray as $field => $value ) | |
{ | |
if ( strchr ( $field , "_Setting_" ) && $value != "" ) | |
{ | |
$fName = str_replace ( "_Setting_" , "" , $field ) ; | |
$dataValues[$fName] = stripslashes($value) ; | |
} | |
} | |
$id = $data->insert ( "Coupon" , $dataValues ) ; | |
if ( intval ( $id ) > 0 ) | |
{ | |
$_SESSION["str_system_message"] = "Coupon added successfully." ; | |
} | |
header ( "location:couponlisting.php" ) ; | |
exit ( ) ; | |
} | |
} | |
$siteSettings = null ; | |
date_default_timezone_set('Asia/Manila'); | |
?> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<?php include ( "inc.meta.php" ) ; ?> | |
</head> | |
<body class="oneColElsCtrHdr"> | |
<div id="container"> | |
<?php include ( "inc.header.php" ) ; ?> | |
<div id="mainContent"> | |
<h3> Coupon </h3> | |
<div align="center"> | |
<form class="application_form" action="" method="post" enctype="multipart/form-data" onsubmit="return validateForm ( ) ;"> | |
<table cellpadding="2" cellspacing="1" width="70%" > | |
<?php | |
if ( ! empty ( $webdetail ) ) | |
{ | |
?> | |
<tr> | |
<td colspan="10"> | |
<div style="padding:10px; border-bottom:#000099 solid 1px; font-size:14px"> | |
<table> | |
<tr> | |
<td valign="top"> | |
<img src="../media/<?php echo $webdetail["WebsiteID"] ?>.jpg" border="0" /> | |
</td> | |
<td valign="top"> | |
<?php | |
echo $webdetail["WebsiteTitle"]."<br>" ; | |
echo "<span style='font-weight:normal; font-size:11px;'>".$webdetail["Description"]."</span>" ; | |
?> | |
</td> | |
</tr> | |
</table> | |
</div> | |
</td> | |
</tr> | |
<?php | |
} | |
?> | |
<tr> | |
<td width="24%" valign="top" class="form_title" >Coupon Code:</td> | |
<td width="76%" valign="top"><input type="text" name="CouponCode_Setting_" size="50" maxlength="100" class="form_text" value="<?php echo $form_data["CouponCode"] ?>" required sch_req="1" sch_msg="Coupon Code" /> | |
<img src="images/icons/help.png" onclick="showHelp(this)" style="cursor:pointer" /> | |
<div class="div_help"> The coupon code to display on the website. </div></td> | |
</tr> | |
<tr> | |
<td width="24%" valign="top" class="form_title" >Discount / Description:</td> | |
<td width="76%" valign="top"><textarea type="text" name="_Setting_Description" class="form_textarea" rows="4" cols="50" ><?php echo $form_data["Description"] ?></textarea> | |
<img src="images/icons/help.png" onclick="showHelp(this)" style="cursor:pointer" /> | |
<div class="div_help"> Description on what the coupon code does, it's requirements and expiration. </div></td> | |
</tr> | |
<td width="17%" class="form_title">Current Affiliate Network</td> | |
<td width="83%"><?php echo $webdetail["AffiliateNetwork"] ?></td> | |
</tr> | |
<tr> | |
<td width="24%" valign="top" class="form_title" >Coupon URL:</td> | |
<td width="76%" valign="top"><input type="text" name="CouponURL_Setting_" size="50" maxlength="500" class="form_text" value="<?php echo $form_data["CouponURL"] ?>" sch_req="0" sch_msg="Coupon URL" /> | |
<img src="images/icons/help.png" onclick="showHelp(this)" style="cursor:pointer" /> | |
<div class="div_help"> Is there a special link where this coupon should point to? </div></td> | |
</tr> | |
<!-- | |
<tr> | |
<td width="24%" valign="top" class="form_title" >Posted on:</td> | |
<td width="76%" valign="top"><input type "text" readonly="readonly" name="DatePosted" size="25" maxlength="25" value="<?php echo date ( "F j, Y - g:i:s A" , strtotime ( $form_data["DateAdded"] ) ) ?>" /> | |
</td> | |
</tr> | |
--> | |
<tr> | |
<td width="24%" valign="top" class="form_title" >Number of YES Votes:</td> | |
<td width="76%" valign="top"><input type="text" name="CountSuccess_Setting_" size="5" maxlength="5" class="form_text" value="<?php echo $form_data["CountSuccess"] ?>" sch_req="1" sch_msg="Yes Votes" /> | |
<img src="images/icons/help.png" onclick="showHelp(this)" style="cursor:pointer" /> | |
<div class="div_help"> Number of YES votes. </div></td> | |
</tr> | |
<tr> | |
<td width="24%" valign="top" class="form_title" >Number of NO Votes:</td> | |
<td width="76%" valign="top"><input type="text" name="CountFail_Setting_" size="5" maxlength="5" class="form_text" value="<?php echo $form_data["CountFail"] ?>" sch_req="1" sch_msg="No Votes" /> | |
<img src="images/icons/help.png" onclick="showHelp(this)" style="cursor:pointer" /> | |
<div class="div_help"> Number of NO votes. </div></td> | |
</tr> | |
<tr> | |
<td width="24%" valign="top" class="form_title" >Date Confirmed Working:</td> | |
<td width="76%" valign="top"><input type="text" name="DateTested_Setting_" size="10" maxlength="10" class="form_text" value="<?php echo $form_data["DateTested"] ?>" /> Format: YYYY-MM-DD | |
<img src="images/icons/help.png" onclick="showHelp(this)" style="cursor:pointer" /> | |
<div class="div_help"> Date in which the coupon is last tested and confirmed working. </div></td> | |
</tr> | |
<tr> | |
<td width="24%" valign="top" class="form_title" >Date Last Modified or Updated:</td> | |
<td width="76%" valign="top"><input type "text" readonly="readonly" name="DateModifiedDisplay" size="20" maxlength="19" value="<?php echo $form_data["DateModified"] ?>" /> | |
</td> | |
</tr> | |
<tr> | |
<td width="24%" valign="top" class="form_title" >Current Date and Time:</td> | |
<td width="76%" valign="top"><input type="text" readonly="readonly" name="DateModified_Setting_" size="20" maxlength="19" class="form_text" value="<?php echo date( "Y-m-d H:i:s" ) ?>" /> YYYY-MM-DD Hr:Min:Sec | |
<img src="images/icons/help.png" onclick="showHelp(this)" style="cursor:pointer" /> | |
<div class="div_help"> Date in which this coupon was last modified or updated. </div></td> | |
</tr> | |
<!--<tr> | |
<td width="24%" valign="top" class="form_title" >Expiry </td> | |
<td width="76%" valign="top"><input type="text" name="_Setting_Expiry" class="form_text" rows="4" cols="50" <?php echo $form_data["Expiry"] ?> /> Days | |
<img src="images/icons/help.png" onclick="showHelp(this)" style="cursor:pointer" /> | |
<div class="div_help"> | |
Number of days the coupon to be expired automaticaly. ZERO or empty for no expiry. | |
</div></td> | |
</tr> --> | |
<tr> | |
<td colspan="10" class="form_title" align="right" > | |
<input type="hidden" name="Website_Setting_ID" value="<?php echo $webid ?>" /> | |
<input type="hidden" name="CouponID" value="<?php echo $form_data["CouponID"] ?>" /> | |
<input type="hidden" name="CouponURL" value="<?php echo $form_data["CouponURL"] ?>" /> | |
<input type="hidden" name="CountSuccess" value="<?php echo $form_data["CountSuccess"] ?>" /> | |
<input type="hidden" name="CountFail" value="<?php echo $form_data["CountFail"] ?>" /> | |
<input type="hidden" name="DateTested" value="<?php echo $form_data["DateTested"] ?>" /> | |
<input type="submit" value="Save Coupon" class="submit_button" /> | |
</td> | |
</tr> | |
</table> | |
</form> | |
</div> | |
</div> | |
<?php include ( "inc.footer.php" ) ; ?> | |
<!-- end #container --> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment