mai 1707 (în urmă cu 318 ani)
include "header_top.php";
include "header_general.php";
include 'config.php';
$link = mysql_connect( $citatepedia_serv, $citatepedia_user, $citatepedia_pass );
if ( ! $link )
die( "Couldn't connect to MySQL" );
else
{
mysql_select_db( $citatepedia_data,$link ) or die ( "Couldn't open database: ".mysql_error() );
// parametri pentru url pagina 1
$sel='';
if ($da<>"") $sel.="&da=".urlencode($da);
if ($dl<>"") $sel.="&dl=".urlencode($dl);
if ($dz<>"") $sel.="&dz=".urlencode($dz);
if ($a<>"") $sel.="&a=".urlencode($a);
if ($m<>"") $sel.="&m=".urlencode($m);
if ($e<>"") $sel.="&e=".urlencode($e);
if ($cc<>"") $sel.="&cc=".urlencode($cc);
if ($ct<>"") $sel.="&ct=".urlencode($ct);
if ($cp<>"") $sel.="&cp=".urlencode($cp);
if ($ce<>"") $sel.="&ce=".urlencode($ce);
if ($lt<>"") $sel.="<=".urlencode($lt);
if ($lr<>"") $sel.="&lr=".urlencode($lr);
if ($ll<>"") $sel.="&ll=".urlencode($ll);
if ($li<>"") $sel.="&li=".urlencode($li);
// scot & de la început
if ($sel<>'') $sel=substr($sel,5);
if ($title<>"") echo '
'.stripslashes($title).'
';
if ($a<>"") include 'meniu_autor.php';
include "../header_content.php";
if ($id<>"") echo '
Date similare
';
elseif ($q<>"") echo '
'.urldecode($q).'
';
elseif ($p==1 and $title=="") echo '
Date recent adăugate
';
if ($id<>"")
{
$result = mysql_query( "SELECT * FROM citatepedia WHERE id=".$id, $link ) or die ( "Couldn't select: ".mysql_error() );
$row = mysql_fetch_array( $result );
$ql=$row['definitie'];
$result = mysql_query( "SELECT * FROM citatepedia WHERE MATCH (definitie,autor,sursa) AGAINST ('".mysql_real_escape_string($ql)."') LIMIT 20", $link ) or die ( "Couldn't select: ".mysql_error() );
include 'show_access.php';
include 'show_list.php';
include 'module_ad3.php';
}
elseif ($q<>"")
{
$q = trim($q);
$ql= strtolower($q);
if (strlen($ql)<=2)
{
$cond = 'definitie LIKE "'.mysql_real_escape_string('% '.$ql.' %').'"';
$order = 'ORDER BY lungime';
}
elseif (strpos($ql,"%")===FALSE AND strpos($ql,"_")===FALSE)
{
if (substr($q,-1)=='?' or substr($q,-1)=='_')
{
$smod=' WITH QUERY EXPANSION';
$q=substr($q,0,-1);
}
elseif (strpos($q,'+')===false and strpos($q,'-')===false and strpos($q,'<')===false and strpos($q,'>')===false and strpos($q,'(')===false and strpos($q,')')===false and strpos($q,'"')===false and strpos($q,'~')===false and strpos($q,'*')===false)
{
$smod='';
}
else
{
$smod=' IN BOOLEAN MODE';
}
$cond = "MATCH (definitie,autor,sursa) AGAINST ('".$q."'".$smod.")";
$order = '';
}
else
{
$cond = 'definitie LIKE "'.mysql_real_escape_string($ql).'"';
$order = 'ORDER BY lungime';
}
if (strlen($q)<=30 AND strlen($q)>2) mysql_query( "INSERT INTO citatepedia_caut (cautare,sectiune) VALUES ('".$q."','".$r."')", $link ) or die ( "Couldn't insert: ".mysql_error() );
if ($r=='a') $result = mysql_query( "SELECT * FROM citatepedia WHERE ".$cond." AND autor<>'' ".$order." LIMIT ".(($p-1)*$perpage).','.$perpage, $link ) or die ( "Couldn't select: ".mysql_error() );
elseif ($r=='z') $result = mysql_query( "SELECT * FROM citatepedia WHERE ".$cond." AND tip='p' ".$order." LIMIT ".(($p-1)*$perpage).','.$perpage, $link ) or die ( "Couldn't select: ".mysql_error() );
elseif ($r=='s') $result = mysql_query( "SELECT * FROM citatepedia WHERE ".$cond." AND lungime<=160 ".$order." LIMIT ".(($p-1)*$perpage).','.$perpage, $link ) or die ( "Couldn't select: ".mysql_error() );
else $result = mysql_query( "SELECT * FROM citatepedia WHERE ".$cond." ".$order." LIMIT ".(($p-1)*$perpage).','.$perpage, $link ) or die ( "Couldn't select: ".mysql_error() );
// $items = mysql_affected_rows($link);
include 'show_access.php';
include 'show_list.php';
include 'module_ad3.php';
include "navig.php";
}
else
{
$items=10*$perpage;
$sort='dataora DESC';
$cond='';
if ($da<>'') $cond.=' AND anul="'.mysql_real_escape_string($da).'"';
if ($dl<>'') $cond.=' AND luna="'.mysql_real_escape_string($dl).'"';
if ($dz<>'') $cond.=' AND ziua="'.mysql_real_escape_string($dz).'"';
if ($a<>'') $cond.=' AND (autor="'.mysql_real_escape_string($a).'" OR participant="'.mysql_real_escape_string($a).'")';
if ($m<>'') $cond.=' AND manifestare="'.mysql_real_escape_string($m).'"';
if ($e<>'') $cond.=' AND ((tip="%" OR tip="$") AND (eveniment="'.mysql_real_escape_string($e).'" OR eveniment_ro="'.mysql_real_escape_string($e).'"))';
if ($cc<>'') $cond.=' AND (ciclu="'.mysql_real_escape_string($cc).'" OR ciclu_ro="'.mysql_real_escape_string($cc).'")';
if ($ct<>'') $cond.=' AND (titlu="'.mysql_real_escape_string($ct).'" OR titlu_ro="'.mysql_real_escape_string($ct).'")';
if ($cp<>'') $cond.=' AND (parte="'.mysql_real_escape_string($cp).'" OR parte_ro="'.mysql_real_escape_string($cp).'")';
if ($ce<>'') $cond.=' AND (episod="'.mysql_real_escape_string($ce).'" OR episod_ro="'.mysql_real_escape_string($ce).'")';
if ($lt<>'') $cond.=' AND tara="'.mysql_real_escape_string($lt).'"';
if ($lr<>'') $cond.=' AND regiune="'.mysql_real_escape_string($lr).'"';
if ($ll<>'') $cond.=' AND localitate="'.mysql_real_escape_string($ll).'"';
if ($li<>'') $cond.=' AND loc="'.mysql_real_escape_string($li).'"';
if ($cond<>'')
{
$cond='WHERE '.substr($cond,5);
$sort='anul,luna,ziua,autor,tip,titlu';
$result = mysql_query( 'SELECT COUNT(*) AS _items FROM citatepedia_date '.$cond, $link ) or die ( "Couldn't select: ".mysql_error() );
$row = mysql_fetch_array( $result );
$items = $row['_items'];
}
$result = mysql_query( 'SELECT * FROM citatepedia_date '.$cond.' ORDER BY '.$sort.' LIMIT '.(($p-1)*$perpage).','.$perpage, $link ) or die ( "Couldn't select: ".mysql_error() );
include 'show_access.php';
include "show_list.php";
include 'module_ad3.php';
include "navig.php";
if ($ct<>'') include "youtube2.php";
}
include "sidebar.php";
mysql_close( $link );
}
include "footer_general.php";
?>