Server IP : 51.89.169.208 / Your IP : 3.148.107.92 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/advert/ |
Upload File : |
<?php $path = $_SERVER['DOCUMENT_ROOT']; include_once $path.'/connect_db.php'; include_once($path.'/staff/advert/plural.php'); $id=$_GET['id']; $example_list=array('e.g. Restaurant','e.g. Indian Food','e.g. Curry House'); $example_false=array('eg','eg','eg'); if(addslashes($_GET['approve'])==1) { $connect->query("UPDATE ads SET active = 1 , decline = 0 WHERE adid = '$id' ") or die($connect->error); $mg = '<div id="mg" class="alert alert-success">Advert approved successfully.</div>'; } if(addslashes($_GET['decline'])==1) { $connect->query("UPDATE ads SET active = 0 , decline = 1 WHERE adid = '$id' ") or die($connect->error); $mg = '<div id="mg" class="alert alert-error">Advert declined successfully.</div>'; } if(isset($_POST['submit'])){ $vaild = true; $companyname=addslashes($_POST['companyname']); $address1=addslashes($_POST['address1']); $address2=addslashes($_POST['address2']); $countys=addslashes($_POST['county']); $countyDetails= explode("||",$countys); $county=$countyDetails[0]; $county_name=$countyDetails[2]; $town = addslashes($_POST['town']); $townDetails = explode("|", $town); $longitude=$townDetails[0]; $latitude=$townDetails[1]; $town_name=$townDetails[2]; $postcode=addslashes($_POST['postcode']); $telephone=str_replace(' ','',addslashes($_POST['telephone'])); $btype=addslashes($_POST['btype']); $bcategory=addslashes($_POST['bcat']); $fax=addslashes($_POST['fax']); $email=addslashes($_POST['email']); $url=str_replace("http://","",addslashes($_POST['url'])); $time = time(); // if website url is "http://" only make field blank if($url=="http://"){$url=str_replace("http://","",$url);} if(!$companyname) { $vaild = false; $errorcompanyname = 'error-message'; } if(!$address1) { $vaild = false; $erroraddress1 = 'error-message'; } if(!$countys) { $vaild = false; $errorcounty = 'error-message'; } if(!$town) { $vaild = false; $errortown = 'error-message'; } if(!$postcode) { $vaild = false; $errorpostcode = 'error-message'; } if(!$telephone) { $vaild = false; $errortelephone = 'error-message'; } if(!$email) { $vaild = false; $erroremail = 'error-message'; } if(!$btype) { $vaild = false; $errorbtype = 'error-message'; } $description=$_POST['description']; $services=$_POST['services']; $refund=$_POST['refund']; $establishment=$_POST['establishment']; $areas_cover=$_POST['areas_cover']; if(!$description) { $vaild = false; $errordescription = 'error'; } $fieldname = 'image_upload_box'; if(is_uploaded_file($_FILES[$fieldname]['tmp_name'])){ $fieldname = 'image_upload_box'; $image_temp = $_FILES[$fieldname]["tmp_name"]; $allowed_ext = array('jpeg','jpg','png','gif'); $image_ext = strtolower(end(explode('.', $_FILES[$fieldname]['name']))); $destination = '/members/uploads/logo/'; $image_file = $id.'.'.$image_ext; if (in_array($image_ext, $allowed_ext) === false) { $vaild = false; $errorimage = '<span class="error">- Your photo must be either a JPG, PNG or GIF file format. Other file types are not allowed.</span>'; } if($_FILES[$fieldname]["size"] > 4000000){ $vaild = false; $errorimage='<span class="error">- Image file size must be less than 4 MB.</span>'; } if(empty($errorimage)){ include "img_upload.class.php"; $image = new UploadImage(); $image->load($image_temp); $image->resizeToWidthMaxHeight(300,150); $image->save($destination.$image_file); $imageExist=", image = '{$image_file}'"; } } $monday=addslashes($_POST['monday']); $tuesday=addslashes($_POST['tuesday']); $wednesday=addslashes($_POST['wednesday']); $thursday=addslashes($_POST['thursday']); $friday=addslashes($_POST['friday']); $saturday=addslashes($_POST['saturday']); $sunday=addslashes($_POST['sunday']); $serv1 = array_filter(array_map('trim',addslashes($_POST['serv']))); $serv=implode(" || ", $serv1); $promotion=$_POST['promotion']; $urlPattern='#^http[s]?://+#i'; $facebook=preg_replace($urlPattern,"",addslashes($_POST['facebook'])); $twitter=preg_replace($urlPattern,"",addslashes($_POST['twitter'])); $google=preg_replace($urlPattern,"",addslashes($_POST['googleplus'])); $youtube=preg_replace($urlPattern,"",addslashes($_POST['youtube'])); $linkedin=preg_replace($urlPattern,"",addslashes($_POST['linkedin'])); $categories=addslashes($_POST['category']); $q3 = "UPDATE `opening_hours` SET `monday` = '$monday', `tuesday` = '$tuesday', `wednesday` = '$wednesday', `thursday` = '$thursday', `friday` = '$friday', `saturday` = '$saturday', `sunday` = '$sunday' WHERE opadid = '$id' "; $r3 = $connect->query($q3) or die($connect->error); $q6 = "UPDATE social_links SET facebook = '$facebook', googleplus = '$google', twitter = '$twitter', youtube = '$youtube', linkedin = '$linkedin' WHERE so_ad_id = '$id' "; $r6 = $connect->query($q6) or die($connect->error); foreach(addslashes($_POST['product']) as $k=>$prod) { if($prod){ if($k>0){ $product.="||".$prod; }else{ $product.=$prod; } } } foreach(addslashes($_POST['category']) as $k=>$cat) { if($prod){ if($k>0){ $category.="||".$cat; }else{ $category.=$cat; } } } $imageExist="image = '{$fname}',"; $q3 = "UPDATE ads SET companyname = '$companyname', street1 = '$address1', street2 = '$address2', county_name = '$county_name', town_name = '$town_name', postcode = '$postcode', tel = '$telephone', fax = '$fax', email = '$email', url = '$url', business_type = '$btype', mcategory = '$bcategory', postdate = '$time', longitude = '$longitude', latitude = '$latitude', description='$description' , `services_offered`= '$serv', `products`= '$product', {$imageExist} `promotion` = '$promotion', category='{$category}', category_plural='{$category_plural}', seo_title='' WHERE adid = '$id' "; $r3 = $connect->query($q3) or die($connect->error); $success=TRUE; } $add_que_sql = $connect->query("SELECT * FROM ads WHERE adid ='{$id}'"); $add_row = $add_que_sql->fetch_array(); foreach($add_row as $k=>$val){ $$k=$val; } $adcounty_name = $add_row['county_name']; $serv = explode('||',$services_offered); $category_data = explode('||',$category); $time_slot = $connect->query("SELECT * FROM opening_hours WHERE opadid ='{$id}'"); $time_slot_data = $time_slot->fetch_array(); $social_link = $connect->query("SELECT * FROM social_links WHERE so_ad_id ='{$id}'"); $social_data = $social_link->fetch_array(); $categoriess=explode("||",$add_row['products']); for($i=0; $i<=4;$i++) { $ctt = $categoriess[$i]; $categoryHtml.=' <div class="category"> <input value="'.$ctt.'" type="text" name="product[]" class="form-control" > </div><br>'; } ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>YellowLeaf UK</title> <link rel="stylesheet" href="/header-footer/global.css"> <link rel="stylesheet" href="/staff/style_staff.css"> </head> <body> <!-- start: Top Bar --> <?php include_once($path.'/staff/staff_header.php'); ?> <!-- end: Top Bar --> <!-- start: Table --> <div class="table-section"> <div class="container lg"> <form class="submit-advert-form" action="" method="POST" enctype="multipart/form-data"> <?=$mg?> <div class="submit-advert-form-group"> <label for="name">Business Name:</label> <p class="submit-advert-label-description <?=$errorcompanyname?>">Please enter your business name.</p> <input value="<?=$companyname?>" type="text" name="companyname" id="companyname" class="form-control"> </div> <div class="submit-advert-form-group"> <label for="county">Business County:</label> <p class="submit-advert-label-description <?=$errorcounty?>">Please select the county of where your business is located.</p> <select id="county" name="county" class="form-control" onchange="get_town_drop(this.value,'')"> <option value="" selected="">Select a County</option> <? $get=$connect->query("SELECT * FROM `county` WHERE `county_id`!='999' ORDER BY divide_country ASC, county_name ASC"); while ($row_county = $get->fetch_assoc()) { foreach($row_county AS $key => $val){ $$key = stripslashes(strip_tags($val)); } if ($county_name == "Bedfordshire") { if ($newcat) { $county.='</optgroup>'; } $county.='<optgroup label="England">'; $newcat=1; } if ($county_name == "County Antrim") { if ($newcat) { $county.='</optgroup>'; } $county.='<optgroup label="Northern Ireland">'; $newcat=1; } if ($county_name == "Aberdeen") { if ($newcat) { $county.='</optgroup>'; } $county.='<optgroup label="Scotland">'; $newcat=1; } if ($county_name == "Blaenau Gwent") { if ($newcat) { $county.='</optgroup>'; } $county.='<optgroup label="Wales">'; $newcat=1; } if ($county_name == "Channel Islands") { if ($newcat) { $county.='</optgroup>'; } $county.='<optgroup label="Channel Islands">'; $newcat=1; } $sel = $county_name== $add_row['county_name'] ? 'selected' : '' ; $county.='<option '.$sel.' value="'.$county_id.'||'.$divide_country.'||'.$county_name.'">'.$county_name.'</option>'; } echo $county; ?> </select> </div> <div class="submit-advert-form-group"> <label for="county">Business Town / Area:</label> <p class="submit-advert-label-description <?=$errortown?>">Please select the town of where your business is located.</p> <select id="town" name="town" class="form-control"> <option value="" selected="">Select a Town</option> </select> </div> <div class="submit-advert-form-group"> <label for="address">Business Address:</label> <p class="submit-advert-label-description <?=$erroraddress1?>">Please enter the address of your business.</p> <textarea id="address1" name="address1" cols="30" rows="5" class="form-control"><?=$street1?></textarea> </div> <div class="submit-advert-form-group"> <label for="postcode">Postcode:</label> <p class="submit-advert-label-description <?=$errorpostcode?>">Please enter your business postcode.</p> <input value="<?=$postcode?>" name="postcode" type="text" id="postcode" class="form-control"> </div> <div class="submit-advert-form-group"> <label for="phone">Telephone:</label> <p class="submit-advert-label-description <?=$errortelephone?>">Please enter your business telephone number.</p> <input value="<?=$tel?>" name="telephone" type="tel" id="phone" class="form-control"> </div> <div class="submit-advert-form-group"> <label for="fax">FAX (optional):</label> <p class="submit-advert-label-description">Please enter your business FAX number.</p> <input value="<?=$fax?>" type="text" name="fax" id="fax" class="form-control"> </div> <div class="submit-advert-form-group"> <label for="email">Email:</label> <p class="submit-advert-label-description <?=$erroremail?>">Please enter your business email address. This will be kept confidential.</p> <input value="<?=$email?>" type="email" id="email" name="email" class="form-control"> </div> <div class="submit-advert-form-group"> <label for="website">Website URL (optional):</label> <p class="submit-advert-label-description">Please enter your business website URL.</p> <input value="<?=$url?>" type="url" id="url" name="url" class="form-control"> </div> <div class="submit-advert-form-group"> <label for="type">Type of Business:</label> <p class="submit-advert-label-description <?=$errorbtype?>">Please choose a type of business. </p> <select class="form-control" size="1" id="btype" name="btype"> <option value="" selected="">Please select</option> <option <?=$business_type=='Offering Services' ? 'selected' : '' ?> value="Offering Services">Offering Services</option> <option <?=$business_type=='Selling Products' ? 'selected' : '' ?> value="Selling Products">Selling Products</option> </select> </div> <div class="submit-advert-form-group"> <label for="category">Please select a category for your business</label> <p class="submit-advert-label-description">PLEASE NOTE: You can only choose one relevant category</p> <div class="form-control-autocomplete"> <input type="hidden" id="category-id" name="bcat"> <input type="text" class="form-control" id="category" name="bcat"> </div> <?php $get=$connect->query("SELECT * FROM `main_cats` ORDER BY `main_cats` ASC LIMIT 100"); $cats = array(); while ($row = $get->fetch_assoc()) { foreach($row AS $key => $val){ $$key = stripslashes(strip_tags($val)); } // $display = preg_replace('/(' . $value . ')/i', '<b class="ls_hghlight">\1</b>', $main_cats); // $sel = $bcategory == $main_cats_id ? 'selected' : ''; $cats[] = ['keyword'=> $main_cats, 'value'=> $main_cats_id, 'html'=>'<li data-keyword="'.$main_cats.'" data-value="'.$main_cats_id.'">'.$main_cats.'</li>']; } $jsonCats = json_encode($cats); ?> </div> <div class="submit-advert-form-group"> <label for="name">Upload logo (optional):</label> <p class="submit-advert-label-description ">Please upload the logo of your business.</p> <div><img id="logo" style="border-radius: 10px;" height="100px" width="200px" src="/members/uploads/logo/<?=$id?>.jpg"></div> <input name="image_upload_box" class="form-control" type="file"> <?=$errorimage?> </div> <div class="submit-advert-form-group"> <label for="address">Description For Your Business:</label> <p class="submit-advert-label-description <?=$errordescription?>">Please enter a brief description about your business.</p> <textarea id="description" name="description" cols="30" rows="5" class="form-control"><?=$description?></textarea> </div> <div class="submit-advert-form-group"> <label for="name">Products, Services or Facilities:</label> <p class="submit-advert-label-description <?=$errorcompanyname?>">Please enter products, services or facilities that your business offers.</p> <?php for($i=0;$i<4;$i++) { ?> <input value="<?=$serv[$i]?>" type="text" name="serv[]" placeholder="Products, services or facilities <?=$i+1?>" class="form-control"><br> <?php } ?> </div> <div class="submit-advert-form-group"> <label for="name">Opening Times:</label> <p class="submit-advert-label-description <?=$errorcompanyname?>">Please enter products, services or facilities that your business offers.</p> <?php $days = [ 'monday','tuesday','wednesday','thursday','friday','saturday','sunday' ]; foreach($days as $day) { ?> <input value="<?=$time_slot_data[$day]; ?>" placeholder="<?=ucfirst($day)?>" type="text" name="<?=$day?>" class="form-control"> <br> <?php } ?> </div> <div class="submit-advert-form-group"> <label for="facebook">Your Social Links (optional):</label> <p class="submit-advert-label-description <?=$errorpostcode?>">Please provide the links to your social pages</p> <?php $socails = [ 'facebook','googleplus','twitter','youtube','linkedin' ]; foreach($socails as $socail) { ?> <input value="<?=$social_data[$socail]?>" placeholder="<?=ucfirst($socail)?>" type="text" name="<?=$socail?>" class="form-control"> <br> <?php } ?> </div> <?php $get=$connect->query("SELECT * FROM `main_cats` ORDER BY `main_cats` ASC LIMIT 100"); while ($row = $get->fetch_assoc()) { $categorys[] = $row; } ?> <div class="submit-advert-form-group"> <label for="name">Categories & Tags:</label> <p class="submit-advert-label-description <?=$errorcompanyname?>">Please enter a minimum of 3 categories or tags that is related to your business.</p> <select class="form-control" name="category[]"> <option value="" selected="">Please category</option> <?php foreach($categorys as $row) { foreach($row AS $key => $val){ $$key = stripslashes(strip_tags($val)); } $display = preg_replace('/(' . $value . ')/i', '<b class="ls_hghlight">\1</b>', $main_cats); $sel = $bcategory == $main_cats_id ? 'selected' : ''; $cats.='<option '.$sel.' value="'.$main_cats_id.'">'.$display.'</option>'; } echo $cats; ?> </select> <br> <select class="form-control" name="category[]"> <option value="" selected="">Please category</option> <?php foreach($categorys as $row) { foreach($row AS $key => $val){ $$key = stripslashes(strip_tags($val)); } $display = preg_replace('/(' . $value . ')/i', '<b class="ls_hghlight">\1</b>', $main_cats); $sel = $bcategory == $main_cats_id ? 'selected' : ''; $cats.='<option '.$sel.' value="'.$main_cats_id.'">'.$display.'</option>'; } echo $cats; ?> </select> <br> <select class="form-control" name="category[]"> <option value="" selected="">Please category</option> <?php foreach($categorys as $row) { foreach($row AS $key => $val){ $$key = stripslashes(strip_tags($val)); } $display = preg_replace('/(' . $value . ')/i', '<b class="ls_hghlight">\1</b>', $main_cats); $sel = $bcategory == $main_cats_id ? 'selected' : ''; $cats.='<option '.$sel.' value="'.$main_cats_id.'">'.$display.'</option>'; } echo $cats; ?> </select> </div> <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> <div class="submit-advert-form-group"> <button type="submit" name="submit" class="btn btn-yellow">Update</button> <a href="/staff/advert/?id=<?=$_GET['id']?>&approve=1" class="btn btn-yellow">Approve</a> <a href="/staff/advert/?id=<?=$_GET['id']?>&decline=1" class="btn btn-red">Decline</a> </div> </form> </div> </div> <!-- end: Table --> <script> const params = new URLSearchParams(window.location.search); if(params.has('decline') || params.has('approve')) { window.history.pushState('page2', 'Title', '/staff/advert/?id=<?=$id?>'); } var mg = document.getElementById('mg'); if(mg){ setTimeout(function(){ mg.remove(); }, 5000) } var categoryStringify = JSON.stringify(<?= $jsonCats ?>) var jsonCategory = JSON.parse(categoryStringify) var country = '<?=$adcounty_name?>'; var town = '<?=$town_name?>'; var categoryInputEl = document.getElementById('category') var categoryIdEl = document.getElementById('category-id') get_town_drop(country, town); autocompleteCategory(categoryInputEl, jsonCategory, categoryIdEl) function get_town_drop(value, town) { var xmlhttp = false; var xmlhttp = (window.XMLHttpRequest) ? xmlhttp = new XMLHttpRequest() : xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { document.getElementById("town").innerHTML = xmlhttp.responseText; return true; } } xmlhttp.open("GET", "ajax/get_town.ajax.php?value=" + value + '&town=' + town, true); xmlhttp.send(); } function autocompleteCategory(inp, arr, inpValue) { /*the autocomplete function takes two arguments, the text field element and an array of possible autocompleted values:*/ var currentFocus; /*execute a function when someone writes in the text field:*/ inp.addEventListener("input", function (e) { var a, b, i, val = this.value; var isEmpty = true /*close any already open lists of autocompleted values*/ closeAllLists(); if (!val) { return false; } currentFocus = -1; /*create a DIV element that will contain the items (values):*/ a = document.createElement("ul"); a.setAttribute("class", "form-control-autocomplete-list"); /*append the DIV element as a child of the autocomplete container:*/ this.parentNode.appendChild(a); /*for each item in the array...*/ for (i = 0; i < 5; i++) { /*check if the item starts with the same letters as the text field value:*/ if (arr[i].keyword.substr(0, val.length).toUpperCase() == val.toUpperCase()) { isEmpty = false /*create a DIV element for each matching element:*/ b = document.createElement("li"); /*make the matching letters bold:*/ b.dataset.value = arr[i].value b.dataset.keyword = arr[i].keyword b.innerHTML = "<strong>" + arr[i].keyword.substr(0, val.length) + "</strong>"; b.innerHTML += arr[i].keyword.substr(val.length); /*insert a input field that will hold the current array item's value:*/ // b.innerHTML += "<input type='hidden' value='" + arr[i] + "'>"; /*execute a function when someone clicks on the item value (DIV element):*/ b.addEventListener("click", function (e) { /*insert the value for the autocomplete text field:*/ inp.value = this.dataset.keyword; inpValue.value = this.dataset.value; /*close the list of autocompleted values, (or any other open lists of autocompleted values:*/ closeAllLists(); }); a.appendChild(b); } } if(isEmpty) { b = document.createElement("li"); b.setAttribute("class", "no-event"); b.innerHTML = 'No matching categories found' a.appendChild(b); } }); /*execute a function presses a key on the keyboard:*/ inp.addEventListener("keydown", function (e) { var x = inp.nextElementSibling; if (x) x = x.getElementsByTagName("li"); if (e.keyCode == 40) { /*If the arrow DOWN key is pressed, increase the currentFocus variable:*/ currentFocus++; /*and and make the current item more visible:*/ addActive(x); } else if (e.keyCode == 38) { //up /*If the arrow UP key is pressed, decrease the currentFocus variable:*/ currentFocus--; /*and and make the current item more visible:*/ addActive(x); } else if (e.keyCode == 13) { /*If the ENTER key is pressed, prevent the form from being submitted,*/ e.preventDefault(); if (currentFocus > -1) { /*and simulate a click on the "active" item:*/ if (x) x[currentFocus].click(); } } }); function addActive(x) { /*a function to classify an item as "active":*/ if (!x) return false; /*start by removing the "active" class on all items:*/ removeActive(x); if (currentFocus >= x.length) currentFocus = 0; if (currentFocus < 0) currentFocus = (x.length - 1); /*add class "autocomplete-active":*/ x[currentFocus].classList.add("active"); } function removeActive(x) { /*a function to remove the "active" class from all autocomplete items:*/ for (var i = 0; i < x.length; i++) { x[i].classList.remove("active"); } } function closeAllLists(elmnt) { /*close all autocomplete lists in the document, except the one passed as an argument:*/ var x = document.getElementsByClassName("form-control-autocomplete-list"); for (var i = 0; i < x.length; i++) { if (elmnt != x[i] && elmnt != inp) { x[i].parentNode.removeChild(x[i]); } } } /*execute a function when someone clicks in the document:*/ document.addEventListener("click", function (e) { closeAllLists(e.target); }); } </script> </html>