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.php'); 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='https://unpkg.com/boxicons@2.0.9/css/boxicons.min.css' rel='stylesheet'> <link rel="stylesheet" href="/header-footer/global.css"> <link rel="stylesheet" href="index.css"> <style> .form-group { display: block; } .form-group input { border-radius: 4px; padding: 0 16px; } .form-group textarea { border-radius: 4px; padding: 12px 16px; } .main-box-title { font-size: 24px; font-weight: 600; margin-bottom: 24px; } .promotion { padding: 20px 0; border-top: 1px solid var(--gray-200); display: grid; grid-template-columns: 1fr 200px; gap: 20px; } .promotion-title { font-size: 20px; font-weight: 500; margin-bottom: 8px; } .promotion-description { color: var(--gray-500); margin-bottom: 24px; height: 72px; overflow: hidden; } .promotion-info { margin-bottom: 16px; } .promotion-info-title { font-size: 14px; color: var(--gray-500); } .promotion-info-date { font-weight: 500; } .promotion-info-box-mobile { display: none; } .button-add-promo { margin-top: 16px; } @media screen and (max-width: 767px) { .promotion { grid-template-columns: 1fr; } .promotion-info-box { display: flex; flex-wrap: wrap; } .promotion-info { margin-right: 16px; } .promotion-info-box-mobile { margin-bottom: 16px; } .promotion-info-box-desktop { display: none; } } </style> </head> <body onload="<?= $showAdPromo ?>"> <? include 'member_menu.php'; ?> <!-- NAVBAR --> <section id="content"> <!-- NAVBAR --> <nav> <i class='bx bx-menu toggle-sidebar'></i> <a href="/members/logout.html" class="logout"> <i class='bx bx-log-out'></i> Logout </a> </nav> <!-- NAVBAR --> <!-- MAIN --> <main> <div class="container"> <? // business details $ad_sql = $connect->query("SELECT * FROM ads WHERE memberid ='{$memberid}' AND adid='{$adid}'"); $ad_row = $ad_sql->fetch_array(); ?> <h1 class="title">Manage Promotions and Deals</h1> <p><?= $ad_row['companyname'] ?></p> <button type="button" id="add-promo" class="button button-yellow button-add-promo">Add New Promotion</button> <!-- <ul class="breadcrumbs"> <li><a href="#">Home</a></li> <li class="divider">/</li> <li><a href="#" class="active">Dashboard</a></li> </ul> --> <div class="main-content"> <div class="main-box" id="main-box-add-promo"> <form name="RegForm" action="promo.php?adid=<?= $adid ?>" method="POST" onsubmit="return CheckRegister();" autocomplete="off"> <div class="form-box"> <div class="form-description">Please enter the title of your business promotion.</div> <div class="form-group"> <input name="prom_title" type="text" class="txbox" size="40"> </div> </div> <div class="form-box"> <div class="form-description">Please enter the description of your promotion.</div> <div class="form-group"> <textarea name="prom_desc" rows="6"></textarea> </div> </div> <div class="form-box"> <div class="form-description">Please enter the date that your promotion is valid from.</div> <div class="form-group"> <div class="form-box"> <select name="valid_day"> <option value selected>Day</option> <? for ($d = 1; $d <= 31; $d++) { echo '<option value="' . $d . '">' . $d . '</option>'; } ?> </select> </div> <div class="form-box"> <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> </div> <div class="form-box"> <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> </div> </div> </div> <div class="form-box"> <div class="form-description">Please enter the expiry date of your promotion.</div> <div class="form-group"> <div class="form-box"> <select name="expiry_day"> <option value selected>Day</option> <? for ($d2 = 1; $d2 <= 31; $d2++) { echo '<option value="' . $d2 . '">' . $d2 . '</option>'; } ?> </select> </div> <div class="form-box"> <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> </div> <div class="form-box"> <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> </div> </div> </div> <button type="submit" name="submit" class="button button-yellow">Add Promotion</button> <button type="button" onclick="hidePromo();" id="hide-promo" class="button button-outline-yellow">Hide</button> </form> </div> <? /////////////// /// current promotions /////////////// // 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.php?adid=' . $adid . '&pid=' . $add_que_sql['prom_id'] . '">Edit this Promotion</a><br>'; // echo '<a href="promo_delete.php?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>'; if ($promo_numRow > 0) { ?> <div class="main-box"> <h2 class="main-box-title">Your Current Promotion(s) or Deal(s)</h2> <div class="promotions-wrapper"> <?php while ($add_que_sql = $add_que->fetch_array()) { ?> <?php $edit_promotion = 'promo_edit.php?adid=' . $adid . '&pid=' . $add_que_sql['prom_id']; $delete_promotion = 'promo_delete.php?adid=' . $adid . '&pid=' . $add_que_sql['prom_id']; ?> <div class="promotion"> <div> <div class="promotion-title"><?= $add_que_sql['prom_title']; ?></div> <p class="promotion-description"><?= $add_que_sql['prom_desc']; ?></p> <div class="promotion-info-box promotion-info-box-mobile"> <div class="promotion-info"> <div class="promotion-info-title">Promotion Added:</div> <div class="promotion-info-date"><?= date('d/m/Y', $add_que_sql['prom_date']); ?></div> </div> <div class="promotion-info"> <div class="promotion-info-title">Valid From:</div> <div class="promotion-info-date"><?= date('d/m/Y', $add_que_sql['prom_valid']); ?></div> </div> <div class="promotion-info"> <div class="promotion-info-title">Expiry Date:</div> <div class="promotion-info-date"><?= date('d/m/Y', $add_que_sql['prom_expiry']); ?></div> </div> </div> <div class="promotion-actions"> <a href="<?= $edit_promotion; ?>" class="button button-yellow">Edit this promotions</a> <a href="<?= $delete_promotion; ?>" class="button button-outline-yellow">Delete this promotions</a> </div> </div> <div class="promotion-info-box promotion-info-box-desktop"> <div class="promotion-info"> <div class="promotion-info-title">Promotion Added:</div> <div class="promotion-info-date"><?= date('d/m/Y', $add_que_sql['prom_date']); ?></div> </div> <div class="promotion-info"> <div class="promotion-info-title">Valid From:</div> <div class="promotion-info-date"><?= date('d/m/Y', $add_que_sql['prom_valid']); ?></div> </div> <div class="promotion-info"> <div class="promotion-info-title">Expiry Date:</div> <div class="promotion-info-date"><?= date('d/m/Y', $add_que_sql['prom_expiry']); ?></div> </div> </div> </div> <?php } ?> </div> </div> <? } 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>'; } ?> </div> </div> </main> <!-- MAIN --> </section> <!-- NAVBAR --> <!-- <table class="tbwdth"> <tr> <td valign="top" style="width:210px;"> </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.php?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.php?adid=' . $adid . '&pid=' . $add_que_sql['prom_id'] . '">Edit this Promotion</a><br>'; echo '<a href="promo_delete.php?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> --> <script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script> <script> 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() { $('#add-promo').hide() $('#hide-promo').show() $('#main-box-add-promo').show() } function hidePromo() { $('#add-promo').show() $('#hide-promo').hide() $('#main-box-add-promo').hide() } $('#add-promo').click(showPromo) $('#hide-promo').click(hidePromo) hidePromo() </script> <script src="script.js"></script> </body> </html>