-
script classifieds
ciao raga,ho bisogno di un aiuto da un vero esperto in php.
Dunque o scaricato uno script classifieds,di facile installazione per inserire annunci con foto e fin qui nessun problema,il fatto è che io vorrei personalizzarlo,ad esempio vorrei che alcuni dati del form vadano sul sito,tipo foto,descrizione,nome e altri tipo telefono e altre info solo al mio indirizzo,si puo' fare?
-
Se ci fai vedere questo programma e ci dici come funzia possiamo darti una mano....
Ciaooo!!!!!
-
dunque quello sotto è il file config.php
ecco come funziona lo script :classifieds
<?
# Setting up Classified Ads options:
# MySQL settings
# database name:
$db_name="my_spettacoliefeste
";
# host name:
$host_name="localhost";
# user's name:
$db_user="spettacoliefeste";
# user's password:
$db_password="password";
# name of database table for ads:
$table_ads="almfree"; <------qua' che gli metto?
comunque non so che file.php postarvi riguardo al cambio del form
vi posto forms.php
<?
include("funcs2.php");
function forgotpassw()
{
global $ct;
$message="
<form action='index.php?ct=$ct&md=sendpassw' method='post'>
Input your contact e-mail: <input type='text' name='ps_email'>
<input type='hidden' name='ct' value='$ct'>
<input type='submit' value='Send Password'>
</form>
";
output_message($message);
exit;
}
function edit_form()
{
global $fields_val, $ed_id, $edit_delete, $ed_passw, $rightform_html,
$html_edit_form, $adm_passw, $admcookpassw, $cat_fields, $ct, $categories,
$fields_sets, $ads_fields;
if($ed_id==""){$ed_id="0";}
$fields_val=get_edit_info($ed_id);
if ($fields_val['idnum']=="") edit_login("No ads with ID# $ed_id");
if(($ed_passw==$fields_val['passw']) or ($ed_passw==$adm_passw)
or ($admcookpassw == $adm_passw))
{
if ($edit_delete=="delete")
{delete_ad($ed_id);}
else{
$rightform_html=$html_edit_form;
$cat_fields="";
$ct=$fields_val['catname'];
$a1=$categories[$ct][1];
$a2=$fields_sets[$a1];
foreach ($a2 as $a2_value)
{
$cat_fields[$a2_value]=$ads_fields[$a2_value];
if ($cat_fields[$a2_value][4]=="checkbox")
{
$aa5=split('<option>',$cat_fields[$a2_value][7]);
$i_aa5=0;
foreach ($aa5 as $value1)
{
$i_aa5++;
$namechbx=$a2_value.$i_aa5;
if (($value1!="") and (ereg($value1,$fields_val[$a2_value])))
{$fields_val[$namechbx]="checked";}
}
}
}
ad_form("edit");
}
}
else {
edit_login("Login password incorrect");
}
}
function print_add_form()
{
global $html_add_form, $rightform_html;
$rightform_html=$html_add_form;
ad_form("submitad");
}
function ad_form($ed_add)
{
global $html_header, $html_footer, $cat_fields, $fields_val, $ct,
$photos_count, $ed_id, $ed_passw, $exp_period, $rightform_html,
$select_text, $categories, $phptomaxsize, $incl_prevphoto, $prviewphotomax,
$prphotolimits, $pr_lim_height, $pr_lim_width, $incl_mtmdfile, $multim_link,
$multim_ext, $mtmdfile_maxs, $ad_ind_width;
if ($ed_add=="edit")
{
$time1=$fields_val['time'];
$date_posted=get_date($time1);
$time2=$time1+$exp_period*86400;
$expire_date=get_date($time2);
}
else{
$time1=time();
$date_posted=get_date($time1);
$time2=$time1+$exp_period*86400;
$expire_date=get_date($time2);
}
if ($ed_add=="submitad") { $title_inf="Place New Ad";}
if ($ed_add=="edit") { $title_inf="Edit Ad ( ID# ".$fields_val['idnum'].") ";}
echo $html_header;
$tbl_col='#ffffff';
$td_height='10';
echo "
<p>
<center>
<table ><tr><td valign='top'>
<font FACE='ARIAL, HELVETICA' COLOR='BLACK'> <font size=-1>
<b><a href='index.php'>Top:</a></b></font>
<font FACE='ARIAL, HELVETICA' COLOR='#000099' size='-1'>
<b> <font size='+1'>
<a href='index.php?ct=$ct'>".$categories[$ct][0]."
</b></a>
</font> </font>
<hr size='1'>
<font FACE='ARIAL, HELVETICA' COLOR='#000099'> <b> $title_inf </b> </font>
<form action='index.php?ct=$ct&md=$ed_add' method='post' ENCTYPE='multipart/form-data'>
<table width='550' border=0 bgcolor='#ffcccc' cellspacing=1 cellpadding=0>
<tr><td>
<font FACE='ARIAL, HELVETICA' COLOR='#000099' size='-1'>
<b> Fill out the following form below:</b>
</font>
<table width='100%' border=0 cellspacing=1 cellpadding=1>
<tr>
<td bgcolor='$tbl_col' height='$td_height' width='30%' >
<font FACE='ARIAL, HELVETICA' COLOR='#000099' size='-1'>
Date Posted:
</font>
</td><td bgcolor='$tbl_col' width='70%'>
<font FACE='ARIAL, HELVETICA' COLOR='#000099' size='-1'>
$date_posted
</font>
</td></tr>
<tr>
<td height='$td_height' bgcolor='$tbl_col' >
<font FACE='ARIAL, HELVETICA' COLOR='#000099' size='-1'>
Expire Date:
</font>
</td><td bgcolor='$tbl_col'>
<font FACE='ARIAL, HELVETICA' COLOR='#000099' size='-1'>
$expire_date
</font>
</td></tr>
";
foreach ($cat_fields as $key => $value )
{
if (ereg ('url',$key))
{
if ($fields_val[$key]==""){$fields_val[$key]="http://";}
}
if ($cat_fields[$key][5] == '1')
{$cat_fields[$key][0]=$cat_fields[$key][0]."<font color='#cc0000'>* </font>";}
if ($cat_fields[$key][4] == 'select')
{
$aa4=split(':',$cat_fields[$key][3]);
$t_size=$aa4[0];
$t_max=$aa4[1];
if ($fields_val[$key]!=""){$select_text1=$fields_val[$key];}
else {$select_text1=$select_text;}
echo "
<tr>
<td height='$td_height' bgcolor='$tbl_col' >
<font FACE='ARIAL, HELVETICA' COLOR='#000099' size='-1'>
".$cat_fields[$key][0].":
</font>
</td><td bgcolor='$tbl_col'>
<select name='$key' size='$t_size'>
<option>$select_text1<checked>
".$cat_fields[$key][7]."</select></td></tr>
";
}
if ($cat_fields[$key][4] == 'checkbox')
{
$aa5=split('<option>',$cat_fields[$key][7]);
echo "
<tr>
<td height='$td_height' bgcolor='$tbl_col' >
<font FACE='ARIAL, HELVETICA' COLOR='#000099' size='-1'>
".$cat_fields[$key][0].":
</font>
</td><td bgcolor='$tbl_col'>
";
$i_aa5=0;
foreach ($aa5 as $value1)
{
$i_aa5++;
if ($value1!=""){
$namechbx=$key.$i_aa5;
echo "
<input type='checkbox' name='$namechbx' value='$value1' $fields_val[$namechbx]>
<font FACE='ARIAL, HELVETICA' COLOR='#000099' size='-1'> $value1 </font> <br>
";
}
}
echo "</select></td></tr>";
}
if ($cat_fields[$key][4] == 'text'){
$aa4=split(':',$cat_fields[$key][3]);
$t_size=$aa4[0];
$t_max=$aa4[1];
echo "
<tr>
<td height='$td_height' bgcolor='$tbl_col' >
<font FACE='ARIAL, HELVETICA' COLOR='#000099' size='-1'>
".$cat_fields[$key][0].":
</font>
</td><td bgcolor='$tbl_col'>
";
echo "
<input type='text' name='$key' size='$t_size' value='".$fields_val[$key]."' maxlength='$t_max'>
</td></tr>
";
}
if ($cat_fields[$key][4] == 'textarea'){
$aa4=split(':',$cat_fields[$key][3]);
$t_rows=$aa4[1];
$t_cols=$aa4[0];
$t_max=$aa4[2];
echo "
<tr>
<td height='$td_height' bgcolor='$tbl_col' >
<font FACE='ARIAL, HELVETICA' COLOR='#000099' size='-1'>
".$cat_fields[$key][0].":
<br><font size='-2' color='#aaaaaa'> Not more then $t_max chars</font>
</font>
</td><td bgcolor='$tbl_col'>
";
if (($cat_fields[$key][7]!="") and ($ed_add=='submitad'))
{
echo "
<b>
<font FACE='ARIAL, HELVETICA' COLOR='#000099' size='-2'>
Delete unnecessary options and/or add yours:<br>
</b>
</font>
";
$fields_val[$key]=$cat_fields[$key][7];
}
echo "
<textarea name='$key' rows='$t_rows' cols='$t_cols' maxsize='$t_max'>".$fields_val[$key]."</textarea>
</td></tr>
";
}
}
echo "
</td></tr>
</table></td></tr>
</table>
<font FACE='ARIAL, HELVETICA' color='#000000' size='-2'>
<b>All fields marked by <font color='#cc0000'> * </font> should be filled out
</b></font>
<br>
";
if($photos_count > 0) {
$phptomaxsize1=$phptomaxsize/1000;
echo "
<p>
<table width='550' border=0 bgcolor='#ffcccc' cellspacing=1 cellpadding=0>
<tr><td>
<font FACE='ARIAL, HELVETICA' COLOR='#000099' size='-1'>
<b> Submit photos:</b>
</font>
<table width='100%' border=0 cellspacing=1 cellpadding=1>
<tr><td bgcolor='#ffffff'>
<font FACE='ARIAL, HELVETICA' COLOR='#000099' size='-1'>
<font size='-2'><b> Photo size < $phptomaxsize1 Kbyte </b> </font>
<center>
";
for ($i=1; $i<=$photos_count; $i++)
{
echo "
<br>Photo $i: <input type='file' name='userfile[]'>
";
}
echo "
</center>
</td></tr></table></td></tr></table>
</b><p>
";
}
if ($incl_prevphoto=='yes')
{
$prviewphotomax1=$prviewphotomax/1000;
echo "
<p>
<table width='550' border=0 bgcolor='#ffcccc' cellspacing=1 cellpadding=0>
<tr><td>
<font FACE='ARIAL, HELVETICA' COLOR='#000099' size='-1'>
<b> Submit preview photo:</b>
</font>
<table width='100%' border=0 cellspacing=1 cellpadding=1>
<tr><td bgcolor='#ffffff'>
<font FACE='ARIAL, HELVETICA' COLOR='#000099' size='-1'>
<font size='-2'><b> Photo size < $prviewphotomax1 Kbyte; $pr_lim_width x $pr_lim_height pixels .<br>
</b> </font>
<center>
<br>Preview Photo: <input type='file' name='userfile[]' >
</center>
</td></tr></table></td></tr></table>
</b><p>
";
}
if ($incl_mtmdfile=='yes')
{
$mtmdfile_maxs1=$mtmdfile_maxs/1000;
echo "
<p>
<table width='550' border=0 bgcolor='#ffcccc' cellspacing=1 cellpadding=0>
<tr><td>
<font FACE='ARIAL, HELVETICA' COLOR='#000099' size='-1'>
<b> Submit $multim_link ($multim_ext file):</b>
</font>
<table width='100%' border=0 cellspacing=1 cellpadding=1>
<tr><td bgcolor='#ffffff'>
<font FACE='ARIAL, HELVETICA' COLOR='#000099' size='-1'>
<font size='-2'><b> size < $mtmdfile_maxs1 Kbyte </b> </font>
<center>
<input type='file' name='userfile[]' >
</center>
</td></tr></table></td></tr></table>
</b><p>
";
}
if ($ed_add=='edit')
{
if ($incl_mtmdfile=='yes') $mtmtm1= "or multimedia";
echo "
<table width='550' border=0 bgcolor='#eeeeee' cellspacing=1 cellpadding=0>
<tr><td>
<font FACE='ARIAL, HELVETICA' COLOR='#000099' size='-2'>
<b>
If you need to delete old photo $mtmtm1 file, write char 'd' in the field;
if you do not need to change old file nothing input in the field;
if you need to replace old file, input path to your new file.
</b>
</font>
</td></tr></table>
<p>
";
}
echo "
<input type='submit' value='submit'>
<hr size='1'>
<input type='hidden' name='ed_id' value='$ed_id'>
<input type='hidden' name='ed_passw' value='$ed_passw'>
</form>
</td><td valign='top'>
$rightform_html
</td></tr></table> </center>
$html_footer
";
}
?>
-
-
-
AZZ! una cosa facile! :O
Per la var $table_ads devi mettere il nome della tabella che usi per questo programma.
Posta il file funcs2.php, vediamo se da lì riusciamo a capirci qualcosa...
Ciaooo!!!!
-
sei un amico ecco il funcs 2.php :
<?
function output_message($message)
{
global $cat_fields, $photos_count, $html_header, $html_footer, $id,
$ct, $categories, $ad_second_width, $left_width_sp, $exp_period;
echo $html_header;
echo "
<center><table width='600'><tr><td>
<font FACE='ARIAL, HELVETICA' COLOR='BLACK'> <font size=-1>
<b><a href='index.php'>Top:</a></b></font>
<font FACE='ARIAL, HELVETICA' COLOR='#000099'>
<b>
<a href='index.php?ct=$ct'>".$categories[$ct][0]."
</b></a>
</font>
<hr size='1'><p>
$message
<p><hr size='1'>
</tr></td></table>
</center>
";
echo $html_footer;
exit;
}
function getuseradsnum($searchemail)
{
global $table_ads;
$sql_query="select count(idnum) from $table_ads where email='$searchemail' and visible=1";
$sql_res=mysql_query("$sql_query");
$row = mysql_fetch_row($sql_res);
$mcount=$row[0];
return $mcount;
}
function getmbadsnum($mb1_login)
{
global $table_ads;
$sql_query="select count(idnum) from $table_ads where login='$mb1_login' and visible=1";
$sql_res=mysql_query("$sql_query");
$row = mysql_fetch_row($sql_res);
$mcount=$row[0];
return $mcount;
}
function check_email($email)
{
$email=ereg_replace(' ', '', $email);
$a1=split('@', $email);
$a2=split('\.',$email);
if (($a1[0] == "") or ($a1[1] == "") or ($a2[0] == "") or ($a2[1] == ""))
{
$message="
<font FACE='ARIAL, HELVETICA' COLOR='#000000' >
<b> E-mail <font color='#AA0000'> $email</font> has
incorrect format </b>
<font size='-1' color='#000088'>
<p> Please use your browser's <b> back button </b> to return to the form
and fill in these fields.
</font></font>
";
output_message($message);
exit;
}
return $email;
}
function sendpassw($ps_email)
{
global $cat_fields, $table_ads,$adm_email, $ct;
$ps_email=check_email($ps_email);
$sql_query="select idnum, passw, title from $table_ads where email='$ps_email'";
$sql_res=mysql_query("$sql_query");
$kll221="0";
while ($row = mysql_fetch_array ($sql_res))
{
$kll221="1";
$p_message="
Title: ".$row['title'].";
Ad id# ".$row['idnum'].";
Edit/delete password: ".$row['passw'].";
";
$p_subject="Your password";
sndmail($ps_email, $p_subject, $p_message, $adm_email);
}
if ($kll221=="0")
{
$info_message="
E-mail <b> $ps_email </b> does not found in the database
";
output_message($info_message);
exit;
}
$info_message="
login/password info has been sent to your e-mail account
";
output_message($info_message);
exit;
}
function send_mail($idnum)
{
global $pm_message, $pm_email, $pm_subject,
$sendcopytoadm, $redirtoadm, $adm_email, $categories, $cook_login;
$fields_val=get_edit_info($idnum);
$id_email=$fields_val['email'];
$id_num1=$fields_val['idnum'];
$id_title1=$fields_val['title'];
$id_cat1=$fields_val['catname'];
$id_categor1=$categories[$id_cat1][0];
if ($cook_login!='')
{
$mb_login_inf="
This message has been sent by member '$cook_login'
";
}
if (($redirtoadm=='yes') or ($sendcopytoadm=='yes'))
{
$mail_message="
This message from $pm_email to $id_email .
Category:$id_categor1; id#$id_num1; Title:$id_title1
$pm_message
$mb_login_inf
";
sndmail($adm_email, $pm_subject, $mail_message, $pm_email);
}
if ($redirtoadm!='yes') {
$mail_message="
For your ad:
Category:$id_categor1; id#$id_num1; Title:$id_title1
the following message was sent:
$pm_message
$mb_login_inf
For more details please contact with admin ( e-mail: $adm_email)
";
sndmail($id_email, $pm_subject, $mail_message, $pm_email);
}
$info_message="
<FONT FACE='Verdana,Geneva,Arial' SIZE='+1' color='#000099'>
<b> Your message has been sent successfully </b>
</font>
";
output_message($info_message);
exit;
}
function sndmail_bak ($email, $subject, $message, $emailfrom)
{
echo "
<p>mail= $email
<br>subject=$subject
<br>message=$message
<br>From: $emailfrom
";
}
function sndmail ($email, $subject, $message, $emailfrom)
{
mail($email, $subject, $message,"From: $emailfrom");
}
function delete_expired_ads()
{
global $cat_fields, $table_ads, $exp_period ;
$time1=time() - $exp_period*86400;
$sql_query="select idnum from $table_ads where time < $time1";
$sql_res=mysql_query("$sql_query");
while ($row = mysql_fetch_array ($sql_res))
{
$del_id=$row['idnum'];
$sql_query="delete from $table_ads where idnum=$del_id";
mysql_query("$sql_query");
delete_photos($del_id);
}
}
function delete_photos($id)
{
global $photo_path, $multimedia_path, $previewphoto_path, $photos_count;
get_jpg_path($id);
for ($i=1; $i<=$photos_count; $i++)
{
if (file_exists($photo_path[$i])) {unlink($photo_path[$i]);}
}
if (file_exists($previewphoto_path)) {unlink($previewphoto_path);}
if (file_exists($multimedia_path)) {unlink($multimedia_path);}
}
function get_date($time1)
{
$d=getdate($time1);
$date_string=$d['month']." ".$d['mday'].", ".$d['year'];
return $date_string;
}
function get_ad_details($id)
{
global $cat_fields, $table_ads;
$sql_query="select * from $table_ads where idnum=$id";
$sql_res=mysql_query("$sql_query");
$row = mysql_fetch_array ($sql_res);
if ($row['idnum']==""){
$message="
<font FACE='ARIAL, HELVETICA' COLOR='#880000' >
<b>
No Ad with ID# $id
</b>
</font>
";
output_message($message);
exit;
}
if ($row['visible']!=1){
$message="
<font FACE='ARIAL, HELVETICA' COLOR='#880000' >
<b><center>
This ad is inaccessible at present time <br> and will apear
in the index after approving by admin.
</center></b>
</font>
";
output_message($message);
exit;
}
return $row;
}
function get_edit_info($ed_id)
{
global $cat_fields, $table_ads;
$sql_query="select * from $table_ads where idnum=$ed_id";
$sql_res=mysql_query("$sql_query");
$row = mysql_fetch_array ($sql_res);
if ($row['idnum']!=""){
foreach ($row as $key => $value)
{
$row[$key]=ereg_replace("'", "'", $row[$key]);
}
}
return $row;
}
function delete_ad($ed_id)
{
global $table_ads;
$sql_query="delete from $table_ads where idnum=$ed_id";
mysql_query("$sql_query");
delete_photos($ed_id);
$message="
<font FACE='ARIAL, HELVETICA' COLOR='BLACK'>
<b> Your ad has been deleted ! </b>
</font>
";
output_message($message);
exit;
}
function get_cat_count($ct)
{
global $cat_fields, $table_ads, $page, $adsonpage;
$sql_query="select count(idnum) from $table_ads where
catname='$ct' and visible=1";
$sql_res=mysql_query("$sql_query");
$row=mysql_fetch_row($sql_res);
$count=$row[0];
return $count;
}
function get_date_update($ct)
{
global $cat_fields, $table_ads, $page, $adsonpage;
$sql_query="select time from $table_ads where
catname='$ct' and visible=1 order by time desc ";
$sql_res=mysql_query("$sql_query");
$row=mysql_fetch_row($sql_res);
$time1=$row[0];
$date_update=get_short_date($time1);
if ($time1==0) {$date_update="";}
return $date_update;
}
?>
-
quando creo la tabella,che numero nei campi devo mettere?
-