Server IP : 51.89.169.208 / Your IP : 216.73.216.57 Web Server : Apache System : Linux ns3209505.ip-198-244-202.eu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Tue Nov 5 04:50:16 EST 2024 x86_64 User : yellowleaf ( 1019) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/yellowleaf/public_html/members/ |
Upload File : |
<? $path = $_SERVER['DOCUMENT_ROOT']; include_once $path.'/connect_db.php'; include 'accesscontrol.php'; $adid=$_GET['adid']; // check if advert beleongs to members if(advert_check($adid,$memberid)===false){header('Location: index.html');exit();} // css for menu $styleManage = 'color:#ff6131;background-color:#fff;border-top:1px solid #c9c9c9;font-weight:bold;'; if(isset($_POST['submit'])){ $prom_title=$_POST['prom_title']; $prom_desc=$_POST['prom_desc']; $prom_date=time(); $expiry_day=$_POST['expiry_day']; $expiry_month=$_POST['expiry_month']; $expiry_year=$_POST['expiry_year']; $valid_day=$_POST['valid_day']; $valid_month=$_POST['valid_month']; $valid_year=$_POST['valid_year']; // converting valid $val=$valid_month.'/'.$valid_day.'/'.$valid_year; $prom_valid=strtotime($val); // converting expiry $expiry_dmy=$expiry_month.'/'.$expiry_day.'/'.$expiry_year; $prom_expiry=strtotime($expiry_dmy); $q3 = "INSERT INTO promotions SET member_id = '$memberid', ad_id = '$adid', prom_title = '$prom_title', prom_desc = '$prom_desc', prom_date = '$prom_date', prom_valid = '$prom_valid', prom_expiry = '$prom_expiry'"; $r3 = $connect->query($q3) or die($connect->error); $r4 = $connect->query("UPDATE ads SET promo_date='$prom_expiry' WHERE adid ='{$adid}' AND memberid={$memberid}") or die($connect->error); } // for promotions $add_que = $connect->query("SELECT * FROM promotions WHERE ad_id ='{$adid}' AND member_id={$memberid} ORDER BY prom_id DESC"); $promo_numRow=$add_que->num_rows; if($promo_numRow==0){$showAdPromo='showPromo()';} ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>YellowLeaf UK</title> <link href="style.css" rel="stylesheet" type="text/css"> <script language="javascript"> <!-- function CheckRegister(){ if(document.RegForm.prom_title.value==""){ window.alert('Please enter the title of your business promotion.'); document.RegForm.prom_title.focus(); return false; } if(document.RegForm.prom_desc.value==""){ window.alert('Please enter the description of your promotion.'); document.RegForm.prom_desc.focus(); return false; } if(document.RegForm.valid_day.value==""){ window.alert('Please select the \'Day\' for the \'Valid From\' date.'); document.RegForm.valid_day.focus(); return false; } if(document.RegForm.valid_month.value==""){ window.alert('Please select the \'Month\' for the \'Valid From\' date.'); document.RegForm.valid_month.focus(); return false; } if(document.RegForm.valid_year.value==""){ window.alert('Please select the \'Year\' for the \'Valid From\' date.'); document.RegForm.valid_year.focus(); return false; } if(document.RegForm.expiry_day.value==""){ window.alert('Please select the\'Day\' for the \'Expiry\' date.'); document.RegForm.expiry_day.focus(); return false; } if(document.RegForm.expiry_month.value==""){ window.alert('Please select the \'Month\' for the \'Expiry\' date.'); document.RegForm.expiry_month.focus(); return false; } if(document.RegForm.expiry_year.value==""){ window.alert('Please select the\'Year\' for the \'Expiry\' date.'); document.RegForm.expiry_year.focus(); return false; } } function showPromo(){ document.getElementById("showPromo").style.display='none'; document.getElementById("addPromo").style.display=''; } function hidePromo(){ document.getElementById("showPromo").style.display=''; document.getElementById("addPromo").style.display='none'; } //--> </script> </head> <body onload="<?=$showAdPromo?>"> <? include 'header.php'; ?> <table class="tbwdth"> <tr> <td valign="top" style="width:210px;"><? include 'member_menu.php'; ?> </td> <td valign="top" class="cnGrad"> <? // business details $ad_sql = $connect->query("SELECT * FROM ads WHERE memberid ='{$memberid}' AND adid='{$adid}'"); $ad_row=$ad_sql->fetch_array(); ?> <a class="blueBtn fancyBtn" id="showPromo" style="color:#fff;" href="javascript:showPromo();">Add New Promotion</a> <div class="cnHead" style="margin-bottom:5px;">Manage Promotions and Deals</div> <div style="color:#555;font-size:14pt;margin-bottom:40px;"><?=$ad_row['companyname']?></div> <div id="addPromo" style="display:none;background:#fdfdfd;margin-bottom:40px;padding-bottom:20px"> <form name="RegForm" action="promo.html?adid=<?=$adid?>" method="POST" onsubmit="return CheckRegister();" autocomplete="off"> <table class="cnTbl" width="100%"> <tr> <td valign="top" colspan="2" style="background-color:#f3f3f3;padding:8px 15px 6px;border-bottom:1px solid #ccc;"><span class="subHead">Add New Promotion or Deal</span></td> </tr> <tr> <td valign="top" colspan="2"></td> </tr> <tr> <td class="cnWidth cnTitle" style="padding-left:25px" valign="top"> Promotion Title*:<br> <div class="cnTitleDesc">Please enter the title of your business promotion.</div> <input name="prom_title" type="text" class="txbox" size="40"></td> </tr> <tr> <td><hr noshade color="#C9C9C9" size="1"></td> </tr> <tr> <td class="cnWidth cnTitle" style="padding-left:25px" valign="top"> Promotion Description *:<br> <div class="cnTitleDesc">Please enter the description of your promotion.</div> <textarea name="prom_desc" rows="6" style="width:590px"></textarea></td> </tr> <tr> <td><hr noshade color="#C9C9C9" size="1"></td> </tr> <tr> <td class="cnWidth cnTitle" style="padding-left:25px" valign="top"> Promotion Valid From*:<br> <div class="cnTitleDesc">Please enter the date that your promotion is valid from.</div> <select name="valid_day"> <option value selected>Day</option> <? for($d=1; $d<=31; $d++){ echo '<option value="'.$d.'">'.$d.'</option>'; } ?> </select> <select name="valid_month"> <option value selected>Month</option> <option value="1">January</option> <option value="2">February</option> <option value="3">March</option> <option value="4">April</option> <option value="5">May</option> <option value="6">June</option> <option value="7">July</option> <option value="8">August</option> <option value="9">September</option> <option value="10">October</option> <option value="11">November</option> <option value="12">December</option> </select> <select name="valid_year"> <option value selected>Year</option> <? $y=date('Y'); for($i=1; $i<=50; $i++){ echo '<option value="'.$y.'">'.$y.'</option>'; $y++; } ?> </select> </td> </tr> <tr> <td><hr noshade color="#C9C9C9" size="1"></td> </tr> <tr> <td class="cnWidth cnTitle" style="padding-left:25px" valign="top"> Promotion Expiry*:<br> <div class="cnTitleDesc">Please enter the expiry date of your promotion.</div> <select name="expiry_day"> <option value selected>Day</option> <? for($d2=1; $d2<=31; $d2++){ echo '<option value="'.$d2.'">'.$d2.'</option>'; } ?> </select> <select name="expiry_month"> <option value selected>Month</option> <option value="1">January</option> <option value="2">February</option> <option value="3">March</option> <option value="4">April</option> <option value="5">May</option> <option value="6">June</option> <option value="7">July</option> <option value="8">August</option> <option value="9">September</option> <option value="10">October</option> <option value="11">November</option> <option value="12">December</option> </select> <select name="expiry_year"> <option value selected>Year</option> <? $y=date('Y'); for($i=1; $i<=50; $i++){ echo '<option value="'.$y.'">'.$y.'</option>'; $y++; } ?> </select> </td> </tr> <tr> <td><hr noshade color="#C9C9C9" size="1"></td> </tr> <tr> <td> <span style="font-size:9pt;color:#666;padding-left:20px">* mandatory fields that must be filled in.</span> </td> </tr> </table> <input class="blueBtn fancyBtn" style="border:0px;float:none;margin-top:20px;margin-left:20px;" type="submit" value="Add Promotion >" name="submit"> <input class="redBtn fancyBtn" style="border:0px;float:none;margin-top:20px" type="button" onclick="hidePromo();" value="Hide"> </form> </div> <? /////////////// /// current promotions /////////////// if($promo_numRow>0){ ?> <table class="cnTbl" width="100%"> <tr> <td valign="top" colspan="2" style="background-color:#f3f3f3;padding:8px 15px 6px;border-bottom:1px solid #ccc;"><span class="subHead">Your Current Promotion(s) or Deal(s)</span></td> </tr> <tr> <td valign="top" colspan="2"></td> </tr> <? while($add_que_sql = $add_que->fetch_array()){ echo '<tr><td style="padding-left:25px" style="padding-left:25px;" valign="top">'; echo '<div style="font-size:17pt;">'.$add_que_sql['prom_title'].'</div>'; echo '<div style="font-size:11pt;" class="cnTitleDesc">'.$add_que_sql['prom_desc'].'</div>'; echo '<div style="float:left;margin-top:15px;color:#666;"><b>Valid From </b><br>'.date('d/m/Y',$add_que_sql['prom_valid']).'</div>'; echo '<div style="float:left;margin-left:20px;margin-top:15px;color:#666;"><b>Expiry Date </b><br>'.date('d/m/Y',$add_que_sql['prom_expiry']).'</div>'; echo '</td><td width="150" valign="top" style="padding:10px;"><b>Promotion Added: </b>'.date('d/m/Y', $add_que_sql['prom_date']).'<br><br>'; echo '<a href="promo_edit.html?adid='.$adid.'&pid='.$add_que_sql['prom_id'].'">Edit this Promotion</a><br>'; echo '<a href="promo_delete.html?adid='.$adid.'&pid='.$add_que_sql['prom_id'].'" onclick="return confirm(\'Are you sure that you want to delete this promotion.\');">Delete this Promotion</a></td>'; echo '</tr><tr><td colspan="2"><hr noshade color="#C9C9C9" size="1"></td></tr>'; } ?> </table> <?}else{ echo '<div style="border-top:1px solid #ddd;padding-top:25px;font-weight:bold;text-align:center;color:#888;">You have no promotions or deals added.</div>'; }?> <br><a class="blueBtn fancyBtn" id="showPromo" style="color:#fff;float:none;" href="javascript:showPromo();">Add New Promotion</a> </td> </tr> </table> <? include 'footer.php'; ?> </body> </html>