403Webshell
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/yellowleaf/public_html/members//category.php
<? 
$path  = $_SERVER['DOCUMENT_ROOT'];
include_once $path.'/connect_db.php';
include 'accesscontrol.php';
include_once('plural.php'); 
// css for menu
$styleManage = 'color:#ff6131;background-color:#fff;border-top:1px solid #c9c9c9;font-weight:bold;';
$adid=$_GET['adid'];
// check if advert beleongs to members
if(advert_check($adid,$memberid)===false){header('Location: index.html');exit();}

$example_list=array('e.g. Restaurant','e.g. Indian Food','e.g. Curry House');
$example_false=array('eg','eg','eg');

$add_que_sql = $connect->query("SELECT * FROM ads WHERE memberid ='{$memberid}' AND adid ='{$adid}'");
$add_row = $add_que_sql->fetch_array();

if(isset($_POST['submit'])){
	//-- singular
	$categories=$_POST['category'];
	$types=$_POST['type'];
	$categories=array_filter($categories);
	
	// compiling category singular
	if($categories!=''){
	$category=' || ';
		foreach($categories as $cat){
			if (strpos($cat,'e.g') !== false) {
			}else{
				if(str_word_count($cat)>5){
					$errors[]='Please enter less than 5 words.';
				}else if(strpos($cat,' '.$add_row['town_name']) !== false){
					$errors[]='Please do not use your town name in your tags.';
				}
				$category.= $cat.' || '; $category_plural.= $cat.' ';
			}
		}
	}
	
	// to see if any red flags appear, [categories that has not been selected from drop down]
	if (in_array("false", $types)) {
		$errors[]='Please ensure that you have selected a category from the drop down list.';
	}
	
	if(empty($errors)){
		$category_plural = singplural($category_plural);
		$connect->query("UPDATE ads SET category='{$category}',category_plural='{$category_plural}',seo_title='' WHERE `adid` = '{$adid}' AND `memberid` = '{$memberid}'");
		$success=TRUE;
		
		$add_que_sql = $connect->query("SELECT * FROM ads WHERE memberid ='{$memberid}' AND adid ='{$adid}'");
		$add_row = $add_que_sql->fetch_array();
	}else{
		foreach($errors as $efound){
			$error_car.='- '.$efound.'<br>';
		}
	}    
}
// checking if $category exists from _POST
$category_a=($category ? $category : $add_row['category']);
//-- singular word cats
$categories=array_filter(explode(" || ",substr_replace($category_a,'',-4)));


// removing first array field from categories
// value made 1 for edit

$cat_id=1;
$cat_id_limit=10;
$example_list_count=0;

// if types not empty combine types - which comes from submission not database
if($types){$categories = array_combine($categories,$types);
}else if(count($categories)>1){$categories = array_combine($categories,$categories);
}else{$categories = array_combine($example_list,$example_false);}

//echo "<pre>",print_r($categories),"</pre>";

$cat_inp.='<table id="cats_tbl">';
foreach($categories as $category=>$type){

	if($type=="eg"){
		$category=$example_list[$example_list_count];
		$eg_style='color:#888;';
		$eg_blur='onblur="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='color:#000; font-size: 10pt;';
		$eg_blur='';
		$eg_onclick='';
	}

	if($type=="false"){
		$type_v="false";
		$type_color=="red";
	}else if($type=="eg"){
		$type_v="false";
		$type_color=="";
	}else{
		$type_v="true";
		$type_color=="green";
	}
	
	if($cat_id>3){$rem_txt='<div class="rem">remove</div>';}
	
	$cat_inp.='
	<tr class="tr_cn">
		<td>
			<input type="text" value="'.$category.'" class="inp_cat" name="category[]" style="box-sizing:border-box;margin:0px;'.$eg_style.'" '.$eg_blur.' '.$eg_onclick.' id="category_'.$cat_id.'">
			<input type="hidden" class="type" name="type[]" value="'.$type_v.'">
			<div class="cat_list_cn" style="position:relative">
				<div class="cat_list ajBx curv3" style="position:absolute;top:5px;left:0px;">a</div>
			</div>
		</td>
		<td class="td">
			<div class="sign '.$type_color.'"></div>
		</td>
		<td>
			'.$rem_txt.'
		</td>
	</tr>';
	$cat_id++;
	$cat_id_limit--;
	$example_list_count++;
}
$cat_inp.='</table>';
?>
<!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 src="js/add_category.js"></script>
<script src="js/drop_menu.js"></script>
<script src="js/ajax_cat.js"></script>
<style>
#category_cn div{margin-bottom:5px;}
.cat_list{background:#fff;display:none;width:100%;z-index: 999;}
.rem{color:blue;}
.rem:hover{text-decoration:underline;cursor:pointer;}

.ajBx {border: 1px solid #ffc600;max-height: 500px;z-index: 999;overflow: auto;margin-top: -3px;-moz-box-shadow: 0px 2px 5px 0px #ccc;-webkit-box-shadow: 0px 2px 5px 0px #ccc;box-shadow: 0px 2px 5px 0px #ccc;}
.ajBx div{padding:2px 4px;}
.selected,.ajBx div:hover{background-color:#4169e1;color: #fff;}
.sign{height:24px;width:24px;}
.red{background:url('/img/block.png') no-repeat;}
.green{background:url('/img/accept.png') no-repeat;}
.red_inp{border: 1px solid #E05050 !important;-webkit-box-shadow: 0 0 4px 0 rgba(255, 0, 0, 1) !important;box-shadow: 0 0 5px 0 rgba(255, 0, 0, 1) !important;}
</style>
</head>

<body>

<? include 'header.php'; ?>
<table class="tbwdth">
	<tr>
		<td valign="top" style="width:210px;"><? include 'member_menu.php'; ?>
		</td>
		<td valign="top" class="cnGrad cnTbl" style="padding-left:25px">
		<form name="RegForm" action="category.html?adid=<?=$adid?>" method="POST" onsubmit="return validate();" onkeypress="return check_return(event)" autocomplete="off">
		<?
		// business details
		$ad_sql = $connect->query("SELECT * FROM ads WHERE memberid ='{$memberid}' AND adid='{$adid}'");
		$ad_row=$ad_sql->fetch_array();
		?>
		<div class="cnHead" style="color:#444;margin-bottom:3px;">Categories & Tags</div>
		<div style="color:#666;font-size:11pt;">Please enter a minimum of 3 categories or tags that is related to your business.</div>
		<?if($success==TRUE){?>
		<div class="successDvBx">
		Update Successful. Your categories have been saved. <br><a href="index.html">Click here to return Manage Advert ></a>
		</div>
		<?}?>
		
		<?if(!empty($errors)){?>
		<div class="curv5" style="background:#fff;border:2px solid #D60000;color:red;line-height: 21px;margin: 30px 10px;padding: 13px 25px;">
		<b style="color:#AD0000;font-size:11pt;">Error has been found</b><br><?=$error_car?>
		</div>
		<?}?>
		<table style="margin-top:15px;" width="100%">
			<tr>
				<td colspan="2">
					<div style="color:#666;font-size:11pt;font-weight:bold;margin-bottom:3px;">Choose your categories or tags...</div>
					<div style="margin-bottom:30px;">Enter a category or tag and select from the drop-down menu.</div>					
				</td>
			</tr>
			<tr>
				<td valign="top">
					<?=$cat_inp;?>
										
					<div style="margin:25px 0 15px;"><button class="button blue add_tr" type="button" style="float:none;">Add another category >></button></div>
					<b>OR</b>
					<div style="margin:15px 0;overflow: hidden;"><input class="button blue" style="border:0px;float:left;padding:7px 12px;" type="submit" value="Update >" name="submit"></div>
					
					<table border="0" style="margin-top: 30px;width:100%;">
						<tr>
							<td colspan="2" style="border-bottom:1px dashed #D3D3D3;color:#444;font-weight:bold;">Legend</td>
						</tr>
						<tr>
							<td style="padding-right:5px;width:24px"><img src="/img/accept.png"></td>
							<td style="font-weight:bold;color:green;">Valid category selected</td>
						</tr>
						<tr>
							<td><img src="/img/block.png"></td>
							<td style="font-weight:bold;color:#dd4b39;">Invalid category selected</td>
						</tr>
					</table>
				</td>
				<td valign="top" style="padding-left:30px;font-size:10pt;color:#444;width:315px;">					
				<div class="curv7" style="border:1px solid #fcca00;background:#fffdf6;padding:20px;">
					<div style="font-size:12pt;font-weight:bold;margin-bottom:10px;color:#cc1c1b;">IMPORTANT !</div>
					
					<b style="color:#cc1c1b;">NOTE:</b> Please do not include any areas and locations as this will invalidate search results.<br><br>
					Please ensure that when you enter your category, you must select a category from the drop list. Please use the legend to recognise whether you have selected a valid category.
					<br><br>
					<div style="font-size:11pt;font-weight:bold;margin-bottom:3px;">Why categories & tags are important..</div>
					Selecting the right category or entering the right keyword(s) for your business can help you show your advert to the right customers, as they search for specific terms on YellowLeaf. It is important that the keywords you choose should match the terms that your potential customers would enter to find your business.
					<? 
					/*
					<br><br>
					<div style="font-size:11pt;font-weight:bold;margin-bottom:3px;">Google Suggestion Tool..</div>
					The best free tool for keyword research is Google itself, especially with all of the features it uses to help searchers find exactly what they are looking for. 
					<br><br>
					Google Suggest, as you may know is a feature which drops down a list of common and popular suggestions from the search box as soon as you start typing. So for example, you aim to type in �business transfer agents� and once you start typing in the word �business�, the text box might drop down with a list of suggestions such as �business link�, �business for sale�, �business cards" and �business plan�.
					<br><br>Therefore, we <b><i>strongly recommend</i></b> you to choose the correct keywords and phrases which are recommended by Google, so that you can aim to attract your specific customers.
					<br><br>
					<a href="http://www.google.co.uk/" target="_blank" rel="nofollow"><b>CLICK HERE TO VISIT GOOGLE UK >></b></a>
					*/
					?>
				</div>
				</td>
			</tr>
		</table>
		</form>
		</td>
	</tr>
</table>
<? include 'footer.php'; ?>
<script type="text/javascript">
function getScript(e,t){var n=document.createElement("script");n.src=e;var r=document.getElementsByTagName("head")[0],i=false;n.onload=n.onreadystatechange=function(){if(!i&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){t();n.onload=n.onreadystatechange=null;r.removeChild(n)}};r.appendChild(n)}

function validate(){
	var f=0;
	$(".type").each(function() {if($(this).val()=="false"){f++;}});
	
	if(f>0){alert("Please ensure that you have selected a valid category from the drop down list.");return false;}
	
	var msg='Please enter a minimum of 3 category of your business.';
	if($('#category_1').val()==""){alert(msg);$('#category_1').focus();return false;}
	if($('#category_2').val()==""){alert(msg);$('#category_2').focus();return false;}
	if($('#category_3').val()==""){alert(msg);$('#category_3').focus();return false;}
}

function check_return(e) {
	var t = e.keyCode;
	if (t == 13 && $(".inp_cat").val() != "") {
		return true;
	} else if (t == 13) {
		cl();
		return false;
	}
}

var next = 0;
var curr = 0;
var prev = 0;
getScript('http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js',function(){
	
	// ajax
	$(document).on('keyup','.inp_cat',function (e) {
		var n = e.keyCode;
        if (n == 40 || n == 39 || n == 38 || n == 37 || n == 13) {} else {
			// going back to red
			$(this).parent().siblings('.td').children('.sign').attr('class','sign red');
			$(this).attr('class','inp_cat red_inp');
			$(this).siblings('.type').val("false");
			
			var container = $(this).siblings('.cat_list_cn').children('.cat_list');
			var val = $(this).val();
			var request = $.ajax({
			  url: "http://www.yellowleaf.co.uk/members/ajax/ajax_cat_list.php",
			  type: "GET",
			  data: { hint:val }
			});
			 
			// if ajax succesfull
			request.done(function( msg ) {
				container.html( msg );
				container.slideDown(200);
			});
			
			// if ajax failed
			request.fail(function( jqXHR, textStatus ) {
			  alert( "Request failed: " + textStatus );
			});
		}
	});

	// if item clicked
	$(document).on('click', '.cdiv', function() {
		$(this).parent().parent().siblings('.inp_cat').val($(this).text());
		$(this).parent().parent().siblings('.inp_cat').attr('class','inp_cat');
		$(this).parent().parent().siblings('.type').val("true");
		$(this).parent().parent().parent().siblings('.td').children('.sign').attr('class','sign green');
		$(this).parent().slideUp(200);
	});

	// remove row
	$(document).on('click', '.rem', function() {
		$(this).parent().parent().remove();
	});

	// close drop
	function cl() {
        $(".cat_list").slideUp(200);next = 0;prev = 0;curr = 0;
    }
	
	// if clicked outside of drop
	$(document).mouseup(function (e){
		var container = $(".tr_cn");
		if (!container.is(e.target)&& container.has(e.target).length === 0){cl();}
	});
	
	// when hovered over item
	$(document).on('hover', '.cdiv', function () {
		$(".dp_item").removeClass("selected");
        $(this).addClass("selected");
		var e = parseInt($(this).attr("id").match(/([0-9]+)/));
		if (next == 0 && prev == 0 && curr == 0) {curr = e;}
		next = e;
		prev = e - 1;
		curr = e;
	});
	
	// key navigation on drop
	$(document).on('keydown', '.inp_cat', function (e) {
		var t = e.keyCode;
		var n = $(this);
		var r = $(this).siblings(".cat_list_cn").children(".cat_list");
		var p = $(this).parent().siblings(".td").children(".sign");
		var i = r.children("div").length;
		var s = $(this).siblings(".type");
	
		if (t == 27 || t == 13) {
			next = 0;
			prev = 0;
			curr = 0;
			if ($(".inp_cat").val() != "") {
				return true
			}
			if (r.css("display") != "none") {
				cl();
				return false
			}
		}
		$(".cat_list").not(r).slideUp(200);
		if (t == 40 && next != i) {
			next++;
			curr++;
			prev = next - 1;
			s.val("true");
			$(this).val(r.children(".j_" + curr).text());
			$(".cdiv").removeClass("selected");
			r.children(".j_" + next).addClass("selected");
			p.attr('class','sign green');
			n.attr('class','inp_cat');
		} else if (t == 38 && prev != 0) {
			$(".cdiv").removeClass("selected");
			r.children(".j_" + prev).addClass("selected");
			prev--;
			next--;
			curr--;
			p.attr('class','sign green');
			n.attr('class','inp_cat');
			s.val("true");
			$(this).val(r.children(".j_" + curr).text());
		}
	});
	
	// add new fields
	$(".add_tr").click(function (e){
		var cc='<tr class="tr_cn"><td><input type="text" value="" class="inp_cat" name="category[]" style="box-sizing:border-box;margin:0px;"><input type="hidden" class="type" name="type[]"><div class="cat_list_cn" style="position:relative"><div class="cat_list ajBx curv3" style="position:absolute;top:5px;left:0px;"></div></div></td><td class="td"><div class="sign"></div></td><td><div class="rem">remove</div></td></tr>';	
		$('#cats_tbl tr:last').after(cc);
	});
});
</script>
</body>

</html>

Youez - 2016 - github.com/yon3zu
LinuXploit