Location: PHPKode > scripts > TrovaLavoro > trovalavoro/index.php
<?php
include("db/db.php");
$limit = 10; 
$query = "SELECT COUNT(*) as num FROM `offerta` WHERE `ap`='1'";
$totp = mysql_fetch_array(mysql_query($query));
$totp = @$totp[num];
$stages = 3;
if(empty($_GET['page']))
{
$_GET['page'] = 0;	
}
$page = mysql_real_escape_string($_GET['page']);
if($page){
$start = ($page - 1) * $limit; 
}else{
$start = 0;	
}	
$query1 = "SELECT * FROM `offerta` WHERE `ap`='1' ORDER BY id DESC LIMIT $start, $limit";
$ap = mysql_query($query1);
if ($page == 0){$page = 1;}
$prev = $page - 1;	
$next = $page + 1;							
$lastpage = ceil($totp/$limit);		
$LastPagem1 = $lastpage - 1;					
$page_nav = '';
if($lastpage > 1)
{	
$page_nav .= "";
if ($page > 1){
$page_nav.= "<a href='".$uu["url"]."page/$prev/'>&#171; Previous</a>";
}else{
$page_nav.= "<span id='current'>&#171; Previous</span>";	}
if ($lastpage < 7 + ($stages * 2))
{	
for ($counter = 1; $counter <= $lastpage; $counter++)
{
if ($counter == $page){
$page_nav.= "<span id='current'>$counter</span>";
}
else
{
$page_nav.= "<a href='".$uu["url"]."page/$counter/'>$counter</a>";}					
}
}
elseif($lastpage > 5 + ($stages * 2))
{
if($page < 1 + ($stages * 2))		
{
for ($counter = 1; $counter < 4 + ($stages * 2); $counter++)
{
if($counter == $page){
$page_nav.= "<span id='current'>$counter</span>";
}else{
$page_nav.= "<a href='".$uu["url"]."page/$counter/'>$counter</a>";}					
}
$page_nav.= "...";
$page_nav.= "<a href='".$uu["url"]."page/$LastPagem1/'>$LastPagem1</a>";
$page_nav.= "<a href='".$uu["url"]."page/$lastpage/'>$lastpage</a>";		
}
elseif($lastpage - ($stages * 2) > $page && $page > ($stages * 2))
{
$page_nav.= "<a href='".$uu["url"]."page/1/'>1</a>";
$page_nav.= "<a href='".$uu["url"]."page/2/'>2</a>";
$page_nav.= "...";
for ($counter = $page - $stages; $counter <= $page + $stages; $counter++)
{
if($counter == $page){
$page_nav.= "<span id='current'>$counter</span>";
}else{
$page_nav.= "<a href='".$uu["url"]."page/$counter/'>$counter</a>";}					
}
$page_nav.= "...";
$page_nav.= "<a href='".$uu["url"]."page/$LastPagem1/'>$LastPagem1</a>";
$page_nav.= "<a href='".$uu["url"]."page/$lastpage/'>$lastpage</a>";		
}
else
{
$page_nav.= "<a href='".$uu["url"]."page/1/'>1</a>";
$page_nav.= "<a href='".$uu["url"]."page/2/'>2</a>";
$page_nav.= "...";
for ($counter = $lastpage - (2 + ($stages * 2)); $counter <= $lastpage; $counter++)
{
if ($counter == $page){
$page_nav.= "<span id='current'>$counter</span>";
}else{
$page_nav.= "<a href='".$uu["url"]."page/$counter/'>$counter</a>";
}					
}
}
}
if ($page < $counter - 1){ 
$page_nav.= "<a href='".$uu["url"]."page/$next/'>Next &#187;</a>";
}else{
$page_nav.= "<span id='current'>Next &#187;</span>";
}
$page_nav.= "";			
}
$nav_d = mysql_num_rows($ap);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script language="javascript">
$(document).ready(function(){
$('#del').click(function(){
window.location.reload()
});
$("#buj_l").click(function(){
$("#buj_l").css({visibility: "hidden",position:"absolute"});
$("#buj_r").css({visibility: "hidden",position:"absolute"});
$("#buji").css({opacity: 0, visibility: "visible",position:"relative"}).animate({opacity: 1.0},1000);
});
$("#button").click(function(){
$("#button").css({opacity: 0.5}).animate({opacity: 1.0},1000);
en = $("#box_input_a2").val();
es = $("#box_input_b2").val();
ep = $("#box_input_c").val();
id = $('#o').text();
$.post("<?php echo $uu["url"]; ?>up.php",{"nome":en,"tel":es,"text":ep,"idi":id},function(data){
if(data == 1)
{
$("span").text("Per favore, compila tutti i campi!").css({color:"#900",opacity: 0.5}).animate({opacity: 1.0},1000);
}
else
{
$("span").text("La sua risposta e stata inviata con successo!").css({color:"#036",opacity: 0.5}).animate({opacity: 1.0},1000);
$("#form")[0].reset();	
}
});
});
$("#offertb").click(function(){
$("#offertb").css({opacity: 0, visibility: "visible",position:"relative"}).animate({opacity: 1.0},1000);
en = $("#settore").find(":selected").text();
es = $("#telefono").val();
ep = $("#titolo").val();
bo = $('#box_in').find(":selected").text();
off = $('#offertext').val();
$.post("up.php",{"nom":en,"telefono":es,"titolo":ep,"select":bo,"desc":off},function(data){
if(data == 1)
{
$("#offertb").val("Compila tutti i campi!").css({opacity: 0.5}).animate({opacity: 1.0},2000,function(){
$("#offertb").val("Invia un'offerta di lavoro").css({opacity: 0.5}).animate({opacity: 1.0},1000);	
});
}
else
{
$("#offerta")[0].reset();
$("#offertb").val("L'offerta e stata inviata!").css({opacity: 0.5}).animate({opacity: 1.0},2000,function(){
$("#offertb").val("Invia un'offerta di lavoro").css({opacity: 0.5}).animate({opacity: 1.0},1000);
});	
}
});
});
$("#box_input_b").keyup(function(){
bo = $('#box_input_a').find(":selected").text();
$('#del').css({visibility:"visible"});
if(bo == "Seleziona la regione")
{
a = $("#box_input_b").val();
$.post("<?php echo $uu["url"]; ?>up.php?last=0",{"sea":a},function(data){
$("#post").empty();
$("#post").append(data);
});
}
else
{
a = $("#box_input_b").val();
$.post("<?php echo $uu["url"]; ?>up.php?last=0",{"sea":a,"re":bo},function(data){
$("#post").empty();
$("#post").append(data);
});
}
});
});
function p(l)
{
a = $("#box_input_b").val();
bo = $('#box_input_a').find(":selected").text();
if(bo == "Seleziona la regione")
{
$.post("<?php echo $uu["url"]; ?>up.php?last="+l,{"sea":a},function(data){
$("#post").html("");
$("#post").append(data);
});	
}
else
{
$.post("<?php echo $uu["url"]; ?>up.php?last="+l,{"sea":a,"re":bo},function(data){
$("#post").html("");
$("#post").append(data);
});
}
}
</script>
<title><?php echo $uu["nome"]; ?></title>
<link href='http://fonts.googleapis.com/css?family=Average+Sans' rel='stylesheet' type='text/css'>
<script src="//use.edgefonts.net/neuton-cursive.js"></script>
<link rel="stylesheet" href="<?php echo $uu["url"]; ?>css/style.css" media="all" />
</head>
<body>
<div id="body">
<div id="top">
<div id="top_mid">
<div id="logo"><a href="<?php echo $uu["url"]; ?>"><?php echo $uu["nome"]; ?></a></div>
<div id="menu">
<ul>
<li><a href="<?php echo $uu["url"]; ?>">Offerte di Lavoro</a></li>
<li><a href="<?php echo $uu["url"]; ?>cercolavoro.php">Cerco Lavoro</a></li>
<li><a href="<?php echo $uu["url"]; ?>cosaoffriamo.php">I Nostri Servizi</a></li>
</ul>
</div>
</div>
</div>
<div id="bod">
<div id="bod_left">
<div id="bod_search">
<div id="box_input">
<select id="box_input_a">
<option selected="selected">Seleziona la regione</option>
<option>Abruzzo</option>
<option>Basilicata</option>
<option>Calabria</option>
<option>Campania</option>
<option>Emilia Romagna</option>
<option>Friuli Venezia Giulia</option>
<option>Lazio</option>
<option>Liguria</option>
<option>Lombardia</option>
<option>Marche</option>
<option>Molise</option>
<option>Piemonte</option>
<option>Puglia</option>
<option>Sardegna</option>
<option>Sicilia</option>
<option>Toscana</option>
<option>Trentino Alto Adige</option>
<option>Umbria</option>
<option>Valle d&#39;Aosta</option>
<option>Veneto</option>
</select>
<input type="text" id="box_input_b" placeholder="Cerca offerte di lavoro" />
<img src="<?php echo $uu["url"]; ?>images/delete.png" id="del" width="16" height="16" /></div>
</div>
<div id="last">
</div>
<div id="post">
<?php 
$d = 0;
if($nav_d < 1)
{
?>
<p align="center">Nessun offerta trovata!</p>
<?php
}
while($d < $nav_d)
{
$id = mysql_result($ap,$d,"id");
$nome = mysql_result($ap,$d,"nome");
$titolo = mysql_result($ap,$d,"titolo");
$text = mysql_result($ap,$d,"text");
$regione = mysql_result($ap,$d,"regione");
$text = strip_tags($text);
$date = mysql_result($ap,$d,"date");
$fr = explode("-",$date);
if($d & 1)
{
?>
<div id="posts2">
<div id="posts_l">
<h3><a href="<?php echo $uu["url"]; ?>offerta/<?php echo $id; ?>/"><?php echo $titolo; ?></a></h3>
<p><?php echo cutsrr($text,60); ?> ...</p>
</div>
<div id="posts_l2"><h3><?php echo $nome; ?></h3>
<p>Italia, <?php echo $regione; ?></p></div>
<div id="posts_l3" align="right"><h3><?php echo $fr[0]." ".$fr[1]; ?></h3>
<p><?php echo $fr[2]; ?></p></div>
</div>
<?php 
}
else
{
?>
<div id="posts">
<div id="posts_l">
<h3><a href="<?php echo $uu["url"]; ?>offerta/<?php echo $id; ?>/"><?php echo $titolo; ?></a></h3>
<p><?php echo cutsrr($text,60); ?> ...</p>
</div>
<div id="posts_l2"><h3><?php echo $nome; ?></h3>
<p>Italia, <?php echo $regione; ?></p></div>
<div id="posts_l3" align="right"><h3><?php echo $fr[0]." ".$fr[1]; ?></h3>
<p><?php echo $fr[2]; ?></p></div>
</div>
<?php	
}
$d++;
}
?>
<div id="pagination" align="center"><?php echo $page_nav; ?></div>
</div>
</div>
<?php
include("db/right.php");
include("db/text.php");
?>
</div>
</div>
</div>
</body>
</html>
Return current item: TrovaLavoro