le 30/11/2009 à 01:01
akira92
bonjour
j'ai une erreur sur un script a la dernière ligne (365)
j'ai une erreur sur un script a la dernière ligne (365)
<?php
/*********************************************************************************
* Filename: index.php
* Generated with CodeCharge 2.0.5
* PHP 4.0 & Templates build 11/30/2001
*********************************************************************************/
//-------------------------------
// index CustomIncludes begin
include_once ("./common.php");
include ("./header_all.php");
include ("./footer.php");
// index CustomIncludes end
//-------------------------------
//session_start();
//===============================
// Save Page and File Name available into variables
//-------------------------------
$filename = "index.php";
$template_filename = "1index.html";
$header_filename="header_all.html";
$footer_filename="footer.html";
//===============================
//===============================
// index PageSecurity begin
// index PageSecurity end
//===============================
//===============================
// index Open Event begin
// index Open Event end
//===============================
//===============================
// index OpenAnyPage Event start
// index OpenAnyPage Event end
//===============================
//===============================
//Save the name of the form and type of action into the variables
//-------------------------------
$sAction = get_param("FormAction");
$sForm = get_param("FormName");
//===============================
// index Show begin
//===============================
// Display page
//-------------------------------
// Load HTML template for this page
//-------------------------------
$tpl = new Template($app_path);
$tpl->load_file($template_filename, "main");
//-------------------------------
// Load HTML template of Header and Footer
//-------------------------------
$tpl->load_file($header_filename, "Header");
$tpl->load_file($footer_filename, "Footer");
//-------------------------------
$tpl->set_var("FileName", $filename);
//-------------------------------
// Set variables with search parameters
//-------------------------------
$send = strip(get_param("send"));
$sender_email = strip(get_param("sender_email"));
//-------------------------------
// Search Show begin
//-------------------------------
$error="";
if ($send=='ok')
{
if ($sender_email == '' || !ereg('^([a-z0-9_]|\\-|\\.)+'.'@'.'(([a-z0-9]|\\-)+\\.)+'.'[a-z]{2,4}$',$sender_email))
$error .= "Your E-Mail is incorrect.<br>";
if ($error=='')
{
$db->query("select count(*) as col from subscription where email='".trim($sender_email)."'");
$db->next_record();
if ($db->f("col")==0)
{
$db->query("insert into subscription (email,date_s,gender) values ('".trim($sender_email)."',now(),'$gender')");
$mail_subject = $site_name." dispatch";
$iam=($gender=='w')?'woman':'man';
$sql = "select u.id, u.login, u.descr_short, (year(now())-year(u.birthday)) as age, u.ideal_short, ".
"c.name as country, l.name as lang, ".
"if(p.id>0,1,0) as pic, ".
"p.picture ".
"from users u, countries c left join langs l on (u.n_lang=l.id) ".
"left join pictures p on (u.id=p.user_id and p.show_p=1) ".
"where u.country = c.code and u.security<>0 and u.iam='$iam'".
" group by u.id order by u.dates desc limit 5";
$db->query($sql);
$tpl1 = new Template(".");
$tpl1->load_file("mail/subscription.html", "mail");
$tpl1->load_file("images/site.css", "Style");
$tpl1->set_var("email", trim($sender_email));
while($db->next_record())
{
$fldid = $db->f("id");
$fldpicture = $db->f("picture");
$fldlogin = $db->f("login");
$flddescr = $db->f("descr_short");
$fldage = $db->f("age");
$fldideal = $db->f("ideal_short");
$fldcountry = $db->f("country");
$fldlang = $db->f("lang");
$tpl1->set_var("id", tohtml($fldid));
if ($fldpicture=='')
$pic = "nophoto.gif";
else
$pic = $fldpicture;
$tpl1->set_var("picture", $pic);
$tpl1->set_var("username", $fldlogin);
$tpl1->set_var("descr", $flddescr);
$tpl1->set_var("age", $fldage);
$tpl1->set_var("ideal", $fldideal);
$tpl1->set_var("country", $fldcountry);
$tpl1->set_var("lang", $fldlang);
$tpl1->set_var("url_path", $url_path);
$tpl1->parse("DListusers", false);
$sBuff.=$tpl1->ParsedBlocks["DListusers"];
}
$tpl1->set_var("DListusers",$sBuff);
$tpl1->parse("mail", false);
$message = $tpl1->ParsedBlocks["mail"];
if ($message<>'')
@mail(trim($sender_email),$mail_subject,$message,"From: $dontreply \nContent-Type: text/html; X-Mailer Version 6.9");
}
?>
<SCRIPT language="javascript">
alert("Thanks for subscribing");
</SCRIPT>
<?
}
}
//-------------------------------
// Step through each form
//-------------------------------
header_form_show();footer_form_show();Search_show();form_show();
//-------------------------------
// Process page templates
//-------------------------------
$tpl->parse("Header", false);
$tpl->parse("Footer", false);
//-------------------------------
// Output the page to the browser
//-------------------------------
$tpl->pparse("main", false);
// index Show end
//===============================
// index Close Event begin
// index Close Event end
//===============================
//********************************************************************************
//===============================
// Display Menu Form
//-------------------------------
function form_show()
{
global $tpl;
global $db;
global $error;
global $message, $sender, $sender_email, $friend_name, $friend_email;
$sFormTitle = "form";
//-------------------------------
// form Open Event begin
// form Open Event end
//-------------------------------
//-------------------------------
// Set URLs
//-------------------------------
//-------------------------------
// form Show begin
//-------------------------------
$tpl->set_var("FormTitle", $sFormTitle);
$tpl->set_var("error", $error);
if ($error=='')
{
$message="I have found this site. Look at it.";
$tpl->set_var("message", $message);
}
else
{
$tpl->set_var("message", $message);
$tpl->set_var("sender", $sender);
$tpl->set_var("sender_email", $sender_email);
$tpl->set_var("friend_name", $friend_name);
$tpl->set_var("friend_email", $friend_email);
}
//-------------------------------
// form BeforeShow Event begin
// form BeforeShow Event end
//-------------------------------
//-------------------------------
// Show fields
//-------------------------------
$tpl->parse("Formform", false);
//-------------------------------
// form Show end
//-------------------------------
}
//===============================
//===============================
// Display Search Form
//-------------------------------
function Search_show()
{
global $db;
global $tpl;
global $sForm;
$sFormTitle = "Search:";
$sActionFileName = "search.php";
//-------------------------------
// Search Open Event begin
// Search Open Event end
//-------------------------------
$tpl->set_var("FormTitle", $sFormTitle);
$tpl->set_var("ActionPage", $sActionFileName);
//-------------------------------
// Set variables with search parameters
//-------------------------------
$flds_seek = strip(get_param("seek"));
$flds_country = strip(get_param("country"));
$flds_age_from = strip(get_param("age_from"));
$flds_age_to = strip(get_param("age_to"));
$flds_gallery = get_param("gallery");
//-------------------------------
// Search Show begin
//-------------------------------
//-------------------------------
// Search Show Event begin
// Search Show Event end
//-------------------------------
if ($flds_gallery=='on')
$tpl->set_var("g_checked", "CHECKED" );
else
$tpl->set_var("g_checked", "" );
$tpl->set_var("SearchLBseek", "");
$db->query("select * from searches");
while ($db->next_record())
{
$lookup_seek[$db->f("var")] = $db->f("value");
}
if(is_array($lookup_seek))
{
reset($lookup_seek);
while(list($key, $value) = each($lookup_seek))
{
$tpl->set_var("ID", $key);
$tpl->set_var("Value", $value);
if($key == $flds_seek)
$tpl->set_var("Selected", "SELECTED" );
else
$tpl->set_var("Selected", "");
$tpl->parse("SearchLBseek", true);
}
}
$tpl->set_var("SearchLBcountry", "");
$db->query("select * from countries");
while ($db->next_record())
{
$lookup_country[$db->f("code")] = $db->f("name");
}
if(is_array($lookup_country))
{
reset($lookup_country);
while(list($key, $value) = each($lookup_country))
{
$tpl->set_var("ID", $key);
$tpl->set_var("Value", $value);
if($key == $flds_country)
$tpl->set_var("Selected", "SELECTED" );
else
$tpl->set_var("Selected", "");
$tpl->parse("SearchLBcountry", true);
}
}
for ($i=14;$i<=74;$i++)
{
$lookup_age[$i]=$i;
}
if(is_array($lookup_age))
{
reset($lookup_age);
while(list($key, $value) = each($lookup_age))
{
$tpl->set_var("ID", $key);
$tpl->set_var("Value", $value);
if($key == $flds_age_from)
$tpl->set_var("Selected", "SELECTED" );
else
$tpl->set_var("Selected", "");
$tpl->parse("SearchLBage_from", true);
}
}
if(is_array($lookup_age))
{
reset($lookup_age);
while(list($key, $value) = each($lookup_age))
{
$tpl->set_var("ID", $key);
$tpl->set_var("Value", $value);
if(($key == $flds_age_to) or (($flds_age_to=='') and ($key==70)))
$tpl->set_var("Selected", "SELECTED" );
else
$tpl->set_var("Selected", "");
$tpl->parse("SearchLBage_to", true);
}
}
//-------------------------------
// Search Show end
//-------------------------------
//-------------------------------
// Search Close Event begin
// Search Close Event end
//-------------------------------
$tpl->parse("FormSearch", false);
//===============================
}
?>