Server IP : 51.89.169.208 / Your IP : 3.135.190.163 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 : |
<?php $path = $_SERVER['DOCUMENT_ROOT']; include_once $path.'/connect_db.php'; include 'accesscontrol.php'; include_once('plural.php'); $adid=addslashes($_GET['adid']); // check if advert beleongs to members if(advert_check($adid,$memberid)===false){header('Location: index.html');exit();} $example_list=array('e.g. Free Delivery','e.g. Special Occasions','e.g. Curry','e.g. Sea Food','e.g. Deserts'); if(isset($_POST['submit'])){ //-- singular $categories=($_POST['category']); $categories=array_filter($categories); // compiling category if($categories!=''){ $category=''; foreach($categories as $key=>$cat){ if (strpos($cat,'e.g') !== false) {}else{ if($cat==$example_list[$key]){ $category.=''; }else{ $category.= $cat; $category_plural.= $cat.' '; } if($key != (count($categories) - 1)){ $category .= " || "; } } } } $category_plural = singplural($category_plural); $connect->query("UPDATE ads SET products='{$category}', products_plural='{$category_plural}' WHERE `adid` = '$adid' AND `memberid` = '{$memberid}'"); $success=TRUE; ?><script>location.href='editbusiness6.html?adid=<?=$adid?>'</script><?php } $add_que_sql = $connect->query("SELECT * FROM ads WHERE memberid ='{$memberid}' AND adid ='{$adid}'"); $add_row = $add_que_sql->fetch_array(); //-- singular word cats $categories=explode(" || ",$add_row['products']); // removing first array field from categories //if(count($categories)>0){unset($categories[0]);} if(count($categories)>0){ $cat_id=1; $cat_id_limit=10; $example_list_count=0; foreach($categories as $category){ //if($example_list_count<count($example_list)){ //$category=$example_list[$example_list_count]; //$eg_style='style="color:#888; font-size: 10pt;"'; //$eg_blur='if(this.value==\'\'||this.value==\''.$example_list[$example_list_count].'\'){this.value=\''.$example_list[$example_list_count].'\';this.style.color=\'#888\'};'; //$eg_onclick='onclick="if(this.value==\'\'||this.value==\''.$example_list[$example_list_count].'\'){this.value=\'\';this.style.color=\'#000\';}"'; //}else{ //$eg_style='style="color:#000; font-size: 10pt;"'; //$eg_blur=''; //$eg_onclick=''; //} //if($cat_id>3){$rem_txt='remove';} $ajaxHtml="onkeyup=\"showUser(this.value,'".$cat_id."',event);\""; $dropHtml="onkeydown=\"return displayunicode(event,".$cat_id.");\""; $categoryHtml.=' <div class="category"> <input type="text" value="'.$category.'" onblur="'.$eg_blur.'setTimeout(\'document.getElementById(\\\'category_box_'.$cat_id.'\\\').style.display=\\\'none\\\'\',10);" name="category[]" id="category_'.$cat_id.'" size="35" '.$eg_onclick.' '.$dropHtml.' '.$ajaxHtml.' '.$eg_style.' class="form-control" > <a href="javascript:" onclick="delete_category(this)" class="delete" > Remove</a> </div>'; $cat_id++; $cat_id_limit--; $example_list_count++; } }else{ foreach($example_list as $prod) { $categoryHtml.=' <div > <input type="text" placeholder="'.$prod.'" name="category[]" class="form-control" > <a onclick="delete_category(this)" href="javascript:" class="delete" > Remove</a> </div>'; } for($i=1; $i<=5;$i++) { $categoryHtml.=' <div class="category"> <input type="text" name="category[]" class="form-control" > <a onclick="delete_category(this)" href="javascript:" class="delete" > Remove</a> </div>'; } } ?> <!DOCTYPE html> <html lang="en"> <head> <title>YellowLeaf - Homepage</title> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="/header-footer/global.css"> <link rel="stylesheet" href="submit-advert.css"> <script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script> <style> .error { color: #ff0000f7;} </style> </head> <?php include_once $path.'/header-footer/header.html'; ?> <section> <div class="container"> <div class="advert-wrapper"> <div class="advert-menu"> <div class="advert-menu-wrapper"> <a href="#">Manage Advert</a> <a href="postbusiness1.html" class="active">Submit Advert</a> <a href="#">My Account</a> <a href="/support">Help & Support</a> <a href="#">Logout</a> </div> </div> <div class="advert-main"> <div class="advert-main-title">Submit Advert</div> <div class="submit-advert-tab"> <span >1</span> <span >2</span> <span>3</span> <span>4</span> <span class="active">5</span> <span>6</span> </div> <form class="submit-advert-form" action="" method="POST" enctype="multipart/form-data"> <?=$postbusiness_error?> <div class="submit-advert-form-group"> <label for="name">Products & Services:</label> <p class="submit-advert-label-description ">Please enter a minimum of 3 products or services your business sells or offers to your customers.</p> <?= $categoryHtml?> </div> <button class="btn btn-yellow" type="button" onclick="addCategory()">Add another product or service >></button> <br> <br> <button type="submit" name="submit" class="btn btn-yellow">Next</button> </form> </div> </div> </div> </section> <?php include_once $path.'/header-footer/footer.html'; ?> <script> function delete_category(delete_category) { delete_category.parentElement.remove(); } function addCategory() { var ind = document.getElementsByClassName("category").length-1; var res = '<div class="category"><input type="text" name="category[]" class="form-control" ><a onclick="delete_category(this)" href="javascript:" class="delete" > Remove</a></div>'; document.getElementsByClassName("category")[ind].insertAdjacentHTML('afterend', res); } </script>