axel 10065
| Posté : 29-09-2004 23:15
bon, pour ceux que ca interesse :
<?
/************************************************************** **********/
/* SFORM Extender for NPDS V Contact Example & nbsp; */
/* =========================== &nbs p;   ; */
/* &nb sp; &nbs p;   ; & nbsp; */
/* 2002 - 2003 &nb sp; &nbs p;   ; */
/* &nb sp; &nbs p;   ; & nbsp; */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/
br />/* Dont modify this file is you dont know what you make &nb sp; */
/************************************************************************/
br />
global $ModPath, $ModStart;
$sform_path="modules/sform/";
!include!_once($sform_path."sform.php");
global $m;
$m=new form_handler();
//********************
$m->add_form_title("suscribe");
$m->add_form_method("post");
$m->add_form_check("true");
$m->add_mess(" * désigne un champ obligatoire < /font>");
$m->add_submit_value("ok");
$m->add_!url(!"modules.php");
$m->add_field("ModStart","",$ModStart,'hidden',false);
$m->add_field("ModPath","",$ModPath,'hidden',false);
/************************************************/
!include!($sform_path."suscribe/formulaire.php");
/************************************************/
// Manage the form
switch($ok) {
case 'Soumettre votre demande':
$m->make_response();
// Chargement de la photo
!include!_once("modules/upload/upload.conf.php");
global $avatar_size;
if (!$avatar_size) {$avatar_size="80*100";}
$avatar_limit=explode("*",$avatar_size);
// On récupère le nom et le prénom du membre dans SFORM
$uname=str_replace("","",$m->answer[$m->interro_fields("nom")]);
$uname=str_replace("","",$uname);
$uname=str_replace("","",$uname);
$uname=str_replace("","",$uname);
$uname=trim($uname);
if ($DOCUMENTROOT!="") {
$rep=$DOCUMENTROOT;
} else {
global $DOCUMENT_ROOT;
if ($DOCUMENT_ROOT) {
$rep=$DOCUMENT_ROOT;
} else {
$rep=$_SERVER['DOCUMENT_ROOT'];
}
}
if ($B1!="none") {
global $language;
!include!_once("modules/upload/upload.lang-$language.php");
!include!_once("modules/upload/clsUpload.php");
$upload = new Upload();
$upload->maxupload_size=$MAX_FILE_SIZE;
$field1_filename = trim($upload->getFileName("B1"));
$suffix = strtoLower(substr(strrchr($field1_filename,'.'),1));
if (($suffix=="gif") or ($suffix=="jpg") or ($suffix=="png")) {
$field1_filename=removeHack(eregi_replace ("[/\\\\:\*\?\"<>|']", "", rawurldecode($field1_filename)));
$field1_filename=eregi_replace("/etc","",$field1_filename);
$field1_filename=eregi_replace("\.\.","",$field1_filename);
$field1_filename=eregi_replace("config.php","",$field1_filename);
if ($field1_filename) {
if ($autorise_upload_p) {
$user_dir=$racine."/users_private/".$uname."/";
if (!is_dir($rep.$user_dir)) {
@umask("0000");
if (@mkdir($rep.$user_dir,0777)) {
$fp = fopen($rep.$user_dir."index.html", 'w');
fclose($fp);
} else {
$user_dir=$racine."/users_private/";
}
}
} else {
$user_dir=$racine."/users_private/";
}
if ($upload->saveAs($uname.".".$suffix ,$rep.$user_dir, "B1",true)) {
$user_avatar=$user_dir.$uname.".".$suffix;
$img_size = @getimagesize($rep.$user_avatar);
if (($img_size[0]>$avatar_limit[0]) or ($img_size[1]>$avatar_limit[1])) {
$user_avatar="";
}
}
}
}
}
case 'Soumettre':
if (!$sformret) {
$m->make_response();
$message=$m->aff_response("white","not_echo","");
global $notify_ema il;
$message="<html><body>".$message."</body></html>";
send_email($notify_emai l, $m->title,$message,"","","html");
opentable();
echo "<center>Votre demande est prise en&nb sp;compte. Nous y répondrons au plus vite</cen ter>";
closetable();
break;
} else {
$ok="";
}
default:
echo $m->print_form("white");
break;
}
?>
==> ds ./modules/sform/nom_sform/nom/sform.php
http://www.medalgame.fr/modules.php?ModPath=suscribe&ModStart=suscribe
y'a pas un champ a rajouter ds le sform aqui s'affiche pour uploader une image ??
on c'est gourré quelque part ?
quelqu'un a une idée pour que chevass puisse uploader une image [qui n'est pas l'avatar) quelque part ?
|