%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
encore une petite erreur lors de la consultation "administration ->
base de données"
Warning: mysql_connect(): Access denied for user
'root'@'localhost' (using password: NO)
in /var/www/human07/admin/administration/backup.php on line 26
je pense que cette ligne n'y est pas étrangère... depuis quand on se
connecte en root sans mot de passe ;)
$conn = mysql_connect("localhost","root","") or die(mysql_error());
il est sûrement possible de passer les paramètres... je pense que
l'ancienne était mieux
$conn = mysql_connect($dbhost,$dbuser,$dbpass) or die(mysql_error());
et tout de suite cela marche beaucoup mieux ;)
Yann
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Donc voici les corrections concernant la partie "database" de la partie
admin en fichiers attachés
Au fait elle existe la fonction javascript 'restore'... je ne l'ai pas
trouvée
en fait, des petits bugs qui bloquaient la sauvegarde.
notamment l'oubli de global $dbname dans les fonctions get_content et
get_def, j'en ai profité pour les passer en paramètres
ensuite les liens qui ne marchait pas, cela venait de la mauvaise
syntaxe dans la création des liens href. Attention aux \" et ' "
imbriqués
en fait j'ai comparé avec le fichier de la version 7 qui marchait
par contre la restauration n'a pas l'air de fonctionner
Enfin attention, j'ai des fichiers au formats MS Windows (des ^M en fin
de ligne) et d'autres au formats Unix
Yann
fichier backup.php
<?
@session_start();
require_once("../conf.php");
// number of backups to keep
$backups = 5;
// hours between backups
$interval = 24;
// 1 only with ZLib support, else change value to 0
$compression = 0;
// full path to phpMyBackup
$path=ROOT_DIR_PATH."archive/backup";
// mySQL - variables
$dbhost=SQL_SERVEUR;
$dbuser=SQL_USER;
$dbpass=SQL_PASSWD;
$dbname=SQL_BDD;
// DO NOT CHANGE THE LINES BELOW
$version = "0.4 beta";
// flush();
//$conn = mysql_connect("localhost","root","") or die(mysql_error());
//$conn = mysql_connect(SQL_SERVER,SQL_USER,SQL_PASSWD) or die(mysql_error());
$conn = mysql_connect($dbhost,$dbuser,$dbpass) or die(mysql_error());
$path = $path . "/";
function get_def($table,$conn,$dbname) {
// global $conn;
// global $dbname;
$def = "";
$def .= "DROP TABLE IF EXISTS $table;#%%\n";
$def .= "CREATE TABLE $table (\n";
// $result = mysql_db_query(SQL_BDD, "SHOW FIELDS FROM $table",$conn);
$result = mysql_db_query($dbname, "SHOW FIELDS FROM $table",$conn);
while($row = mysql_fetch_array($result)) {
$def .= " $row[Field] $row[Type]";
if ($row["Default"] != "") $def .= " DEFAULT '$row[Default]'";
if ($row["Null"] != "YES") $def .= " NOT NULL";
if ($row[Extra] != "") $def .= " $row[Extra]";
$def .= ",\n";
}
$def = ereg_replace(",\n$","", $def);
$result = mysql_db_query($dbname, "SHOW KEYS FROM $table",$conn);
//$result = mysql_db_query(SQL_BDD, "SHOW KEYS FROM $table",$conn);
while($row = mysql_fetch_array($result)) {
$kname=$row[Key_name];
if(($kname != "PRIMARY") && ($row[Non_unique] == 0)) $kname="UNIQUE|$kname";
if(!isset($index[$kname])) $index[$kname] = array();
$index[$kname][] = $row[Column_name];
}
while(list($x, $columns) = @each($index)) {
$def .= ",\n";
if($x == "PRIMARY") $def .= " PRIMARY KEY (" . implode($columns, ", ") . ")";
else if (substr($x,0,6) == "UNIQUE") $def .= " UNIQUE ".substr($x,7)." (" . implode($columns, ", ") . ")";
else $def .= " KEY $x (" . implode($columns, ", ") . ")";
}
$def .= "\n);#%%";
return (stripslashes($def));
}
function get_content($table,$conn,$dbname) {
// global $conn;
// global $dbname;
$content="";
// $result = mysql_db_query(SQL_BDD, "SELECT * FROM $table",$conn);
$result = mysql_db_query($dbname, "SELECT * FROM $table",$conn);
while($row = mysql_fetch_row($result)) {
$insert = "INSERT INTO $table VALUES (";
for($j=0; $j<mysql_num_fields($result);$j++) {
if(!isset($row[$j])) $insert .= "NULL,";
else if($row[$j] != "") $insert .= "'".addslashes($row[$j])."',";
else $insert .= "'',";
}
$insert = ereg_replace(",$","",$insert);
$insert .= ");#%%\n";
$content .= $insert;
}
return $content;
}
if ($compression==1) $filetype = "sql.gz";
else $filetype = "sql";
if ((@filemtime($path . "0.$filetype") < time() - $interval * 3600)||$_GET['save']==TRUE) {
for ($i = $backups-1; $i > 0; $i--) {
$oldname = $i-1 . ".$filetype";
$newname = $i . ".$filetype";
@rename($path.$oldname,$path.$newname);
}
$cur_time=date("Y-m-d H:i");
$newfile="# Dump created with 'phpMyBackup v.$version' on $cur_time\r\n";
// $newfile .= "$dbuser $dbhost $path $dbname".'SQL_BDD SQL_USER \n\n';
// $tables = mysql_list_tables(SQL_BDD,$conn);
$tables = mysql_list_tables($dbname,$conn);
$num_tables = @mysql_num_rows($tables);
// $newfile .= "$tables $num_tables\n";
$i = 0;
while($i < $num_tables) {
$table = mysql_tablename($tables, $i);
$newfile .= "\n# ----------------------------------------------------------\n#\n";
$newfile .= "# structure for table '$table'\n#\n";
$newfile .= get_def($table,$conn,$dbname);
$newfile .= "\n\n";
$newfile .= "#\n# data for table '$table'\n#\n";
$newfile .= get_content($table,$conn,$dbname);
$newfile .= "\n\n";
$i++;
}
if ($compression==1) {
$fp = gzopen($path."0.$filetype","w9");
gzwrite ($fp,$newfile);
gzclose ($fp);
} else {
$fp = fopen ($path."0.$filetype","w+");
fwrite ($fp,$newfile);
fclose ($fp);
}
}
?>
fichier database.inc.php
<?
/******* Security *************/
include_once("./../conf.php");
$requiredUserLevel = array(1);
require(ROOT_DIR_PATH."/common/phpSecurePages/secure.php");
/******************************/
if(isset($_SESSION['language']))
require_once(ROOT_DIR_PATH."/common/lang/".$_SESSION['language']);
include "backup.php";
?>
<table cellspacing="1" cellpadding="2" border="0" bgcolor="#354463" width="798">
<tr>
<td bgcolor="#BFC4CB" class="medium_black">
<table cellpadding="2" cellspacing="5" border="0">
<tr>
<td align="center" valign="top">
<table cellspacing="0" cellpadding="0" border="0" bgcolor="#BFC4CB" valign="top">
<tr>
<td class="medium_black">
<table cellspacing="0" cellpadding="4" border="0" bgcolor="#9CA4B1" width="550" valign="top">
<tr>
<td bgcolor="#9CA4B1" width="5" align="center">:.</td>
<td bgcolor="#BFC4CB"><b><font color="#333333">phpMyBackup v.<? echo $version;?></font></b></td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#BFC4CB" width="798" valign="top" height="250">
<p>
<font color="#333333">
A database backup is automatically made every day.
<br>
<a href=index.php?page=AdminDatabase&save=TRUE" class="main">dump</a>
<?
if ($file!="") {
$filename = $file;
set_time_limit(180);
if ($compression ==1) $file=gzread(gzopen($path.$file, "r"), 10485760);
else $file=fread(fopen($path.$file, "r"), 10485760);
$query=explode(";#%%\n",$file);
for ($i=0;$i < count($query)-1;$i++) {
mysql_db_query(SQL_BDD,$query[$i],$conn) or die(mysql_error());
}
echo "<b>$filename successfully restored!</b>";
}
?>
<table border="0" cellpadding="4">
<tr align="center">
<td class="medium_black"><u><i>File</i></u></td>
<td class="medium_black"><u><i>Date</i></u></td>
</tr>
<?
//echo "$path";
$dir=opendir($path);
while ($file = readdir ($dir)) {
if ($file != "." && $file != ".." && eregi("\.sql",$file)) {
echo "<tr><td class='medium_black'>$file </td>
<td class='medium_black'> " . date("Y-m-d H:i",filemtime($path.$file)) . "</td>
<td class='medium_black'> <a href=\"javascript:restore('$file')\" class='main'><b>Restore</b></a> </td>
<td class='medium_black'> <a href=\"../archive/backup/$file\" class='main'>View/Download</a></td> </tr>";
}
}
closedir($dir);
?>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?
if($mailSend>0)
echo"
<script language='javascript'>
alert('$mailSend email(s) send');
</script>";
?>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Bonjour,
Lors de l'ajout d'un nouvel utilisateur le mot de passe generé
if(!isset($pass))
$pass=str_replace(".","",crypt($nom."$CLE".$prenom,$CLE));
(common/mail/send_mail.inc.php)
n'etait pas stocké dans la table personne.
J'ai du ajouter
Service::updateMessage("personne","passe_personne",$pass,"id_personne",$reviewer[id_personne]);
afin de le stocker sinon la personne recevant le mail ne pouvait pas remplir ses informations (acces non autorisé).
Si cette info peut aider qqu,
Nicolas VOLLMER
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
J'ai remarqué un truc chez moi, l'envoi de mail par l'intermédiaire de
email->envoi ne fonctionne pas.
Comme cela est placé sur un serveur Debian stable, la version de php
est trop ancienne et il ne connait pas la fonction de file_get_contents
j'ai donc remplacé par
<?
$lines= file(ROOT_DIR_PATH."variable/file/copy.txt");
foreach ($lines as $line) { $file_copy .= $line; }
$lines = file(ROOT_DIR_PATH."variable/file/from.txt");
foreach ($lines as $line) { $file_from .= $line; }
// $file_copy
=file_get_contents(ROOT_DIR_PATH."variable/file/copy.txt"); //
$file_from
=file_get_contents(ROOT_DIR_PATH."variable/file/from.txt"); ?>
et la j'ai le bien l'interface, par contre les mails ne partent pas
malgrè la boite de dialogue qui dit que tout est ok
Une idée ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
corection de bugs
dans user/article.php
/********* record data **********/
//On remplace les espaces par des _
//$file_name=ereg_replace ("_", " ", $name);
$file_name=ereg_replace (" ", "_", $name);
inversion, on commence par rechercher puis ensuite on remplace
ereg_replace -- Remplacement par expression rationnelle
Description
string ereg_replace ( string pattern, string replacement, string
string )
puis plus loin ya encore une inversion entre répertoire et nom de
fichier
ceci empêche l'upload de fichier
// echo "post
file !".$_FILES['file']['tmp_name']."/".$_FILES['file']['dir']; echo
"post file !".$_FILES['file']['dir']."/".$_FILES['file']['tmp_name'];
//if(!copy($_FILES['file']['tmp_name']."/".$_FILES['file']['dir'],ROOT_DIR_PATH."/variable/submission/$file_name"))
if(!copy($_FILES['file']['dir']."/".$_FILES['file']['tmp_name'],ROOT_DIR_PATH."/variable/submission/$file_name"))
Autre petite chose ya pas de sujet dans l'email de confirmation d'envoi
d'une soumission de papier !!!
Yann
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> Autre petite chose ya pas de sujet dans l'email de confirmation
> d'envoi d'une soumission de papier !!!
dans user/article.php
$file="validate_upload"; //ça sert à quoi
//à Rajouter
$subject="HuMaN07 Paper Submission"; //par exemple mais c'est pas
générique
peut être peut on ajouter un champs "paper submission" dans
email->option et avoir le fichier txt pour gérer ce sujet
Yann
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Bonjour,
Ajout d'un commentaire sur le papier lors de l'évaluation
dans paper_comment.php
Fatal error: Call to undefined function: now()
in /drbd/drbd1/www/human07/html/common/paper/paper_comment.php on line
82
remplacer now() par date("y-m-d")
if($_POST['validate']=="add")
{
$insert_comment =
Service::insert_cinq_quatre("comment","id_comment","date","id_article","id_sender","comment",date("y-m-d"),$_GET['id_article'],$ID,$_POST['comment']); //$insert_comment=mysql_db_query(SQL_BDD,"INSERT
INTO `comment` ( `id_comment` , `date` , `id_article` , `id_sender` ,
`comment` ) VALUES ('', now(), '".$_GET['id_article']."', '$ID',
'".$_POST['comment']."')",$db_link); }
hope this help
Yann
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
je pense qu'il faudra aussi changer dans
admin/participants/payment.php: $update_payment =
Service::update_Deux("registration","payment",now(),"id_registration",$_GET['id_registration']);
admin/participants/payment.php: $update_document =
Service::update_un_deux("registration_document","validate",now(),"id_registration",$_GET['id_registration'],"id_document",$_GET['id_document']);
puis dans common/service/service.php:
on peut aussi remplacer now() par "now()" c'est plus simple
yann
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Je ne trouve pas la fonction now() dans le manuel php
d'ou vient cette fonction?
J'ai trouvé c'est du mysql
mais visiblement elle ne marche pas dans tous les contextes... peut
être des caractères à déspécialiser !!!
et puis pourquoi mélanger la fonction date php et la fonction now()
mysql ...
yann
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Bonsoir à tous
Afin de faire marcher convenablement les statistiques (je n'avais pas
les graphs en images), j'ai modifié le
fichier /html/common/visiteurs/include/conf.inc.php car les variables de
connexion à la base n'étaient pas renseignéee, j'ai donc inclus le
fichier de conf général
include('../../conf.php');
//on peut aussi directement les fixer : moins pratique
//define("SQL_SERVEUR","localhost");
//define("SQL_USER","user");
//define("SQL_PASSWD","mot de passe");
//define("SQL_BDD","bdd");
par ailleurs la fonction connexion_error($lvm_connexion_error); dans le
fichier /html/common/visiteurs/image-vis.php ne semble pas exister sur
mon serveur ni dans les scripts présents
Hope this help
yann
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Petit correctif, si on met include('../../conf.php'); cela occasionne
une erreur lors de la visualisation de la racine du site
optez pour
define("SQL_SERVEUR","localhost");
define("SQL_USER","user");
define("SQL_PASSWD","mot de passe");
define("SQL_BDD","bdd");
moins pratique, mais cela fonctionne. Ya surement une meilleure manière
de faire... je vais chercher
Yann
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Pour avoir le nom de votre site dans les stats : modifier fichier /html/common/visiteurs/include/conf.inc.php
// your parameters (for graphs and titles)
$lvc_site_name = "human07.univ-metz.fr"; // like 'phpInfo.net' or 'My Web'
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Bonsoir
Chez moi l'envoi de mail par l'interface d'administration ne marchait.
J'ai modifié le code du fichier admin/mail/formmail_send.php comme
suit
avant
if(isset($query))
{
// Database link
$mailSend=0;
$mail_selection=Service::passageRequete($query);
while($mail=mysql_fetch_row($mail_selection))
{
$m= new Mail; // create the mail
if($_POST['from']!=""){
$m->From(trim($_POST['from']));}
if($_POST['to']!=""){
$m->From(trim($_POST['to']));}
$m->Subject($subject);
$m->Body( $message); // set the body
if ($_POST['copy'] != ""){
$m->Cc(trim($_POST['copy']));}
$m->Priority($_POST['priority']) ;
$m->Send();
$mailSend++;
}
}
else
{
$m= new Mail; // create the mail
if($_POST['from']!=""){
$m->From(trim($_POST['from']));}
if($_POST['to']!=""){
$m->From(trim($_POST['to']));}
$m->Subject($subject);
$m->Body($message); // set the body
if ($_POST['copy'] != ""){
$m->Cc(trim($_POST['copy']));}
$m->Priority($_POST['priority']);
$m->Send();
$mailSend=1;
}
après
if(isset($query))
{
// Database link
$mailSend=0;
$mail_selection=Service::passageRequete($query);
while($mail=mysql_fetch_row($mail_selection))
{
$m= new Mail; // create the mail
if($_POST['from']!=""){
$m->From(trim($_POST['from']));}
if($_POST['to']!=""){
$m->To($mail);}
$m->Subject($subject);
$m->Body( "$message", "iso-8859-1"); //
set the body if ($_POST['copy'] != ""){
$m->Cc(trim($_POST['copy']));}
//$m->Priority($_POST['priority']) ;
$m->Send();
$mailSend++;
}
}
else
{
$m= new Mail; // create the mail
//$venantde=trim($_POST['from']);
if($_POST['from']!=""){
$m->From(trim($_POST['from']));}
//$allanta=trim($_POST['email']);
if($_POST['email']!=""){
$m->To(trim($_POST['email']));}
$m->Subject($subject);
$m->Body("$message","iso-8859-1"); // set the body
if ($_POST['copy'] != ""){
$m->Cc(trim($_POST['copy']));}
//$m->Priority($_POST['priority']);
$m->Send();
$mailSend=1;
}
en fait il s'agissait d'erreur de copier-coller et du coup l'adresse de
destination était vide. De plus le nom des champs récupérés n'étaient
pas les bons.
Hope this help
Yann
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Bonjour, la modif d'hier soir n'était pas complète, en effet l'envoi
par les listes ne fonctionnait pas
voici les nouvelles modifications
> avant
>
> if(isset($query))
> {
> // Database link
>
>
> $mailSend=0;
>
> $mail_selection=Service::passageRequete($query);
> while($mail=mysql_fetch_row($mail_selection))
> {
>
> $m= new Mail; // create the mail
> if($_POST['from']!=""){
> $m->From(trim($_POST['from']));}
> if($_POST['to']!=""){
> $m->From(trim($_POST['to']));}
> $m->Subject($subject);
> $m->Body( $message); // set the body
> if ($_POST['copy'] != ""){
> $m->Cc(trim($_POST['copy']));}
> $m->Priority($_POST['priority']) ;
> $m->Send();
>
> $mailSend++;
> }
> }
> else
> {
> $m= new Mail; // create the mail
> if($_POST['from']!=""){
>
> $m->From(trim($_POST['from']));}
> if($_POST['to']!=""){
> $m->From(trim($_POST['to']));}
> $m->Subject($subject);
> $m->Body($message); // set the body
> if ($_POST['copy'] != ""){
> $m->Cc(trim($_POST['copy']));}
> $m->Priority($_POST['priority']);
> $m->Send();
> $mailSend=1;
> }
>
if(isset($query))
{
// Database link
$mailSend=0;
$mail_selection=Service::passageRequete($query);
while($mail=mysql_fetch_row($mail_selection))
{
//echo "<DEFANGED_script language=\"javascript\">alert(\" to $mail[0]
\");</script>"; $m= new Mail; // create the mail
if($_POST['from']!=""){
$venantde=trim($_POST['from']);
//echo "<DEFANGED_script language=\"javascript\">alert(\" from
$venantde\");</script>"; $m->From(trim($_POST['from']));}
if($mail[0]!=""){
//echo "<DEFANGED_script language=\"javascript\">alert(\" POST to $mail[0]
\");</script>"; $m->To($mail[0]);}
$m->Subject($subject);
//echo "<DEFANGED_script language=\"javascript\">alert(\"sujet
$subject\");</script>"; $m->Body( "$message", "iso-8859-1"); //
set the body if ($_POST['copy'] != ""){
$m->Cc(trim($_POST['copy']));}
$m->Priority($_POST['priority']) ;
$m->Send();
//$num_contact++;
$mailSend++;
}
}
else
{
$m= new Mail; // create the mail
//$venantde=trim($_POST['from']);
if($_POST['from']!=""){
$m->From(trim($_POST['from']));}
//$allanta=trim($_POST['email']);
if($_POST['email']!=""){
$m->To(trim($_POST['email']));}
$m->Subject($subject);
$m->Body("$message","iso-8859-1"); // set the body
if ($_POST['copy'] != ""){
$m->Cc(trim($_POST['copy']));}
//$m->Priority($_POST['priority']);
$m->Send();
$mailSend=1;
}
//echo "<DEFANGED_script
language=\"javascript\">alert(\"$subject\");</script>"; //echo "<DEFANGED_script
language=\"javascript\">alert(\"msg $msg\");</script>"; //echo "<DEFANGED_script
language=\"javascript\">alert(\"from $venantde\");</script>"; //echo
"<DEFANGED_script language=\"javascript\">alert(\"to
$allanta\");</script>"; // echo "<DEFANGED_script
language=\"javascript\">alert(\"$_POST\[\'to\'\]\");</script>"; echo
"<DEFANGED_SCRIPT language=\"JavaScript\">alert(\" mail send.\\nThank
you\")</SCRIPT>"; echo " <DEFANGED_script language='javascript'> <!--//
Hope this help
Yann
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Bonjour
Dans le fichier /html/admin/participants/summary.inc.php j'ai fait les
modifs suivantes afin de gérer le fait que le nb de place dans les
hotels n'est pas défini. Sinon lors de l'affichage, des warning de
"divide by zero", et oui comme il n'a rien -> 0 est stocké dans la base.
//Calcul des % si nb place définie
sinon c'est 0 qui est stocké dans la base if($max_place!=0)
{
$presence_unvalidate_p=($presence_unvalidate/$max_place)*100;
$presence_validate_p=($presence_validate/$max_place)*100;
$free_p=100-$presence_unvalidate_p-$presence_validate_p;
$free=$max_place-$presence_unvalidate-$presence_validate;
echo"
<td colspan=2 align=center
valign=center class='medium_black'> <DEFANGED_IMG src='graph/red.jpg'
width=$presence_validate_p height=6 alt='validate : $presence_validate
place(s) (".number_format($presence_validate_p,2)." %)'><DEFANGED_IMG
src='graph/orange.jpg' width=$presence_unvalidate_p height=6
alt='unvalidate : $presence_unvalidate place(s)
(".number_format($presence_unvalidate_p,2)." %)'><DEFANGED_IMG
src='graph/black.jpg' width=$free_p height=6 alt=\"free : $free
place(s) (".number_format($free_p,2)." %)\"> </td>
</tr>";
}
else
{
$presence_unvalidate_p=" NA ";
$presence_validate_p=" NA ";
$free_p=" NA ";
echo"
<td colspan=2 align=center
valign=center class='medium_black'> <DEFANGED_IMG src='graph/red.jpg'
width=$presence_validate_p height=6 alt='validate : $presence_validate
place(s) (".$presence_validate_p." %)'><DEFANGED_IMG src='graph/orange.jpg'
width=$presence_unvalidate_p height=6 alt='unvalidate :
$presence_unvalidate place(s) (".$presence_unvalidate_p." %)'><DEFANGED_IMG
src='graph/black.jpg' width=$free_p height=6 alt=\"free : $free
place(s) (".$free_p." %)\"> </td>
</tr>";
}
ensuite modification du traitement de la date pour que cela soit joli
$date_housing_temp=str_replace(" ","/",$housing[date]);
$date_housing=explode("|",$date_housing_temp);
puis plus loin
//on enlève les / de trop
$date_modifiee=rtrim(ltrim($date_housing[$j],"/"),"/");
echo"
<tr class='line$i'>
<td class='medium_black'> Le
$date_modifiee : </td>
";
A+
Yann
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Comme zéro est socké dans la base cela pose des pbs pour le formulaire
d'inscription. En effet comme il y a un test sur les places restantes
dans l'hotel... ces hotels s'affiche complet.
Un moyen simple de contourner cela est de mettre un grand nombre dans
Places disponibles: 9999 ( vide = aucune restriction )
et la tout va bien
Yann
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Bonjour,
Si vous avez plusieurs hôtels, lors de l'inscription le calcul du coût
est faux. Il prend toujours le prix du dernier hôtel.
Cela vient sûrement de la variable 'night_price' dont le nom est
identique d'un hôtel à l'autre (en fait le while($housing_categories)
n'est pas gérer correctement.)
En fait il faut faire la même chose que pour les "extra" qui sont eux
ben gérer.
Yann MORERE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Bonjour,
J'ai modifié assez profondément les fichiers registration.php
new_order.php et edit_order.php pour mon application
Quelques petits trucs boguent encore (selection d'une nuit dans
chaque hôtel par exemple)
Maintenant, ils prennent en compte plusieurs hébergement. La méthode
facturation a été corrigée.
voici les fichiers joints
SInon, voici quelques idées :
- Création de comptes de soumission de papier avec login mot de passe,
comme cela, il serait possible de mettre à jour le papier téléchargé et
les données des auteurs
- Vérification à l'inscription si la personne n'est pas déjà inscrite
-> j'ai pu m'inscrire plusieurs fois avec les mêmes données...
Cordialement
Yann
Voici la dernière modification du fichier edit_order.php
On peut maintenant choisir une a plusieurs nuits par hotel.
j'ai un autre soucis.
Le génération des bagdes et des étiquettes ne fonctionne pas du tout
J'obtient un fichier PDF vide !!!! enfin presque ya une ligne noir sur
la partie supérieur de la page.
Yann
fichier edit_order.php
<?
/*** Edit Order **
v 1.0
************/
session_start();
require_once("../../conf.php");
//********Language**************/
if(isset($_SESSION['language']))
require_once(ROOT_DIR_PATH."/common/lang/".$_SESSION['language']);
require(ROOT_DIR_PATH."/common/phpSecurePages/functions.inc.php");
$requiredUserLevel = array(1, 2);
require(ROOT_DIR_PATH."/common/phpSecurePages/secure.php");
//******Service********//
require_once(ROOT_DIR_PATH."common/service/service.php");
// Connexion à la base
//$db_link = mysql_connect(SQL_SERVEUR,SQL_USER,SQL_PASSWD);
/******** Amount Calculate ********/
$select_evenement = Service::SelectAll("evenement");
$evenement=mysql_fetch_array($select_evenement);
$select_registration = Service::select_where("registration","id_registration",$_GET['id_registration']);
$registration=mysql_fetch_array($select_registration);
if (isset($_POST['mod_fee']) and $_POST['mod_fee']) { // Le statut a ete modifie dans le formulaire
// On cherche un nouveau tarif
//$select_categories=mysql_db_query(SQL_BDD,"select prices from categories where id_categories = '".$_POST['id_categories']."'",$db_link);
$select_categories = Service::select_champ_where("prices","categories","id_categories",$_POST['id_categories']);
$categories=mysql_fetch_array($select_categories);
$amount=$categories[prices];
// Suppression les informations dependantes du statut
//$del_db = mysql_db_query(SQL_BDD,"delete from extra_registration where id_registration='".$_GET['id_registration']."'",$db_link);
$del_db = Service::delete("extra_registration","id_registration",$_GET['id_registration']);
//$del_db = mysql_db_query(SQL_BDD,"delete from registration_document where id_registration='".$_GET['id_registration']."'",$db_link);
$del_db = Service::delete("registration_document","id_registration",$_GET['id_registration']);
unset($_POST['mod_fee']);
}
if (! (isset($_POST['validate']) or isset($_POST['id_categories']))) {
$_POST['id_categories'] = $registration[id_categories];
$_POST['mr'] = $registration[mr];
$_POST['first_name'] = $registration[first_name];
$_POST['last_name'] = $registration[last_name];
$_POST['title'] = $registration[title];
$_POST['compagny'] = $registration[compagny];
$_POST['adress'] = $registration[adress];
$_POST['city'] = $registration[city];
$state = $registration[state];
$_POST['zip_code'] = $registration[zip_code];
$_POST['country'] = $registration[country];
$_POST['phone'] = $registration[phone];
$_POST['fax'] = $registration[fax];
$_POST['email'] = $registration[email];
$roomate = $registration[compagnon];
// $night_presence=explode("|",$registration[housing_presence]);
$night_presence2 = $registration[housing_presence];
// echo "$night_presence2<br>";
$night_presence1=explode("|",$registration[housing_presence]);
for ($i=0;$i<count($night_presence1);$i++)
{
$indic=$i+1;
$night_presence[$indic]=explode(":",$night_presence1[$i]);
}
// var_dump($night_presence1);
// var_dump($night_presence);
$_POST['online_information'] = $registration[online_information];
$day_presence = $registration[day_presence];
$_POST['tab_presence']=explode(" | ",$day_presence);
$document_req = $registration[document];
$payment = $registration[payment];
$_POST['amount'] = $registration[amount];
$_POST['comments'] = $registration[comments];
$date = $registration[date];
$select_extra_registration = Service::select_where("extra_registration","id_registration",$_GET['id_registration']);
$extra_tab = array();
while ($row = mysql_fetch_array($select_extra_registration)) {
$extra_tab[$row['id_extra']] = $row['number'];
}
foreach($extra_tab as $id_extra => $number)
{
$select_extra = Service::select_champ_where("price","extra","id_extra",$id_extra);
//$select_extra=mysql_db_query(SQL_BDD,"select price from extra where id_extra=$id_extra",$db_link);
$extra=mysql_fetch_array($select_extra);
$amount=$amount-($extra[price]*$number);
}
}
$select_categories = Service::select_where("categories","id_categories",$registration[id_categories]);
//$select_categories=mysql_db_query(SQL_BDD,"select * from categories where id_categories='".$registration[id_categories]."'",$db_link);
$categories=mysql_fetch_array($select_categories);
// include("../conf.php");
/******* FUNCTION *************/
$error=0;
require_once(ROOT_DIR_PATH."controle.php");
function ecriture_log($value)
{
// A compléter ou à charger
}
/*****************************/
?>
<HTML>
<head>
<title>Registration of participation</title>
<style type="text/css">
BODY{
font-family: verdana, arial, sans-serif;
font-size: x-small;
}
<!--
*{
font-size: x-small;
}
input, textarea, select {
background-color: #CCCCCC;
font-family: verdana, arial, sans-serif;
font-size: 10px;
color: #333333;
padding: 0px;
}
input.red, textarea.red, select.red {
background-color: #D89A8F;
font-family: verdana, arial, sans-serif;
font-size: 10px;
color: WHITE;
padding: 0px;
}
info {
text-align: left;
font: 10px sans-serif, tahoma, verdana, geneva, helvetica, arial;
color: #666666;
}
-->
</style>
<SCRIPT>
<!--
function Lien() {
i = document.registration.list_categories.selectedIndex;
if (i == 0) return;
statut = document.registration.list_categories.options[i].value;
// alert(statut);
document.forms.registration.id_categories.value = statut;
document.forms.registration.mod_fee.value = statut;
document.forms.registration.submit()
}
// -->
</SCRIPT>
</head>
<BODY>
<h1><center><font color="#0000FF">- Edition d'un enregistrement</font> / Editing registration data</center></h1>
<form name="registration" method="post" action="edit_order.php" >
<? if(isset($_GET['id_registration'])){
echo "<input type='hidden' name='id_registration' value=".$_GET['id_registration'].">";
}elseif(isset($_POST['id_registration'])){
echo "<input type='hidden' name='id_registration' value=".$_POST['id_registration'].">";}
?>
<input type="hidden" name="id_categories" value="<? echo $_POST['id_categories'];?>">
<input type="hidden" name="mod_fee" value="<? echo $_POST['mod_fee'];?>">
<h5>
<table width="95%" border="0">
<tr>
<td width="3%" height="20"> </td>
<td colspan=2 height="20" bgcolor="#CCCCCC"><b><font color="#0000FF">Informations personnelles</font><br>Personal data</b></td>
</tr>
<tr><td><? echo"id_registration en get ".$_GET[id_registration];?></td><td><? echo"id_registration en post ".$_POST[id_registration];?></td></tr>
<?
if($categories_id[document]!="")
echo"
<tr>
<td width='3%' height='40'> </td>
<td width='47%' height='40' valign=top>Documents requis :</td>
<td width='50%' height='40'>
<font color='#D89A8F' >$categories_id[document]</font>
</td>
</tr>";
if($categories_id[online_information]!="")
{
echo"
<tr>
<td width='3%' height='40'> </td>
<td width='47%' height='40' valign=top>$categories_id[online_information] :</td>
<td width='50%' height='40'>
<input type='textarea' name='online_information' size=50 value=";
modifie($_POST['online_information']);
echo" ></input>
</td>
</tr>";
}
if($categories_id[description]!="")
echo"
<tr>
<td width='3%' height='40'> </td>
<td width='47%' height='40' valign=top>Remarques :</td>
<td width='50%' height='40'>
$categories_id[description]
</td>
</tr>";
?>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40"> </td>
<td width="50%" height="40">
<input type=radio name=mr value="mrs" <?php echo ($_POST['mr'] == "mrs") ? 'checked': ''; ?>> Mme/Mrs.
<input type=radio name=mr value="mr" <?php echo ($_POST['mr'] == "mr") ? 'checked': ''; ?>> Mr.
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40"><font color="#0000FF">Prenom</font><br>Firstname</td>
<td width="50%" height="40">
<input type="textarea" name="first_name" size=50 <?
modifie($_POST['first_name'])
?>></input>
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40"><font color="#0000FF">Nom</font><br>Lastname</td>
<td width="50%" height="40">
<input type="textarea" name="last_name" size=50 <?
modifie($_POST['last_name'])
?>></input>
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40"><font color="#0000FF">Organisme</font><br>Affiliation</td>
<td width="50%" height="40">
<input type="textarea" name="compagny" size=50 <?
modifie($_POST['compagny'])
?>></input>
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40"><font color="#0000FF">Adresse postale</font><br>Regular mail</td>
<td width="50%" height="40">
<input type="textarea" name="adress" size=50 <?
modifie($_POST['adress'])
?>></input>
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40"><font color="#0000FF">Ville</font><br>City</td>
<td width="50%" height="40">
<input type="textarea" name="city" size=50 <?
modifie($_POST['city'])
?>></input>
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40"><font color="#0000FF">Code postal</font><br>Zip code</td>
<td width="50%" height="40">
<input type="textarea" name="zip_code" size=20 <?
modifie($_POST['zip_code']);
?>></input>
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40"><font color="#0000FF">Pays</font><br>Country</td>
<td width="50%" height="40">
<input type="textarea" name="country" size=20 value="<?
echo $_POST['country'];
?>"></input>
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40"><font color="#0000FF">Téléphone</font><br>Phone</td>
<td width="50%" height="40">
<input type="textarea" name="phone" size=20 value="<?
echo $_POST['phone'];
?>"></input>
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40">Fax :</td>
<td width="50%" height="40">
<input type="textarea" name="fax" size=20 value="<?
echo $_POST['fax'];
?>"></input>
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40">Email :</td>
<td width="50%" height="40">
<input type="textarea" name="email" size=50 <?
modifie($_POST['email']);
?>></input>
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40">Commentaires :</td>
<td width="50%" height="40">
<textarea name="comments" cols='50' rows='5'><?php echo $_POST['comments']; ?></textarea>
</td>
</tr>
<tr>
<td width="3%" height="20"> </td>
<td colspan=2 height="20" bgcolor="#CCCCCC"><b><font color="#0000FF">Informations sur l'inscription</font></b></td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40"><font color="#0000FF">Date de l'inscription</font></td>
<td width="50%" height="40">
<?
echo $date;
?></input>
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40"><font color="#0000FF">Date de paiement</font></td>
<td width="50%" height="40">
<?
echo $payment;
?></input>
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40">Choisissez votre statut : </td>
<td width="50%" height="40">
<?
$select_categories = Service::SelectAll("categories");
//$select_categories=mysql_db_query(SQL_BDD,"select * from categories",$db_link);
echo"
<select name='list_categories' onChange='Lien()' class='red'>
<option value=''></option>";
while($categories=mysql_fetch_array($select_categories))
{
if($categories['id_categories']==$_POST['id_categories']){
echo "<option value= ".$categories['id_categories']." selected>$categories[name]</option>";
}else{
echo "<option value=".$categories['id_categories'].">$categories[name]</option>";
}
}
echo"
</select>
";
if(isset($_POST['id_categories']))
{
$select_categories_id = Service::select_where("categories","id_categories",$_POST['id_categories']);
//$select_categories_id=mysql_db_query(SQL_BDD,"select * from categories where id_categories='".$_POST['id_categories']."'",$db_link);
$categories_id=mysql_fetch_array($select_categories_id);
}
?>
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40"><font color="#0000FF">Prix de l'inscription</font><br>Registration fee</td>
<td width="50%" height="40">
<?
$prices_cat = Service::select_champ_where("prices","categories","id_categories",$_POST['id_categories']);
$price_cat[] = mysql_fetch_array($prices_cat);
?>
<input type="textarea" name="amount" size=20 value="<?
echo $price_cat[0][0];
?>"></input>
</td>
</tr>
<?
if(isset($_POST['id_categories']))
{
$select_housing_categories = Service::select_where("housing_categories","id_categories",$_POST['id_categories']);
$j=0;
while($housing_categories=@mysql_fetch_array($select_housing_categories))
{
echo "
<tr>
<td width='3%' height='20'> </td>
<td colspan=2 height='20' bgcolor='#CCCCCC'><b>Logement</b></td>
</tr>
";
$select_used_places = Service::select_2where_2not("registration","id_categories",$_POST['id_categories'],"housing_presence","");
$used_places=mysql_num_rows($select_used_places);
$select_housing = Service::select_where("housing","id_housing",$housing_categories[id_housing]);
$housing=@mysql_fetch_array($select_housing);
if($used_places<$housing[max_place])
{
echo "
<tr>
<td width='3%' height='40'> </td>
<td width='47%' height='40'>Lieux :</td>
<td width='50%' height='40'>
$housing[name]
</td>
</tr>
<tr>
<td width='3%' height='40'> </td>
<td width='47%' height='40'>Prix par nuit :</td>
<td width='50%' height='40'>";
if($housing[price_registration]!="")
echo $housing[price_registration]." ".$evenement[currency];
echo"
<input type='hidden' name='housing_tab[$housing[id_housing]]' value=".$housing[price_registration].">
</td>
</tr>";
if($housing[description]!="")
{
echo"
<tr>
<td width='3%' height='40'> </td>
<td width='47%' height='40'>Remarques :</td>
<td width='50%' height='40'>
$housing[description]
</td>
</tr>";
}
if($housing[document]!="")
echo"
<tr>
<td width='3%' height='40'> </td>
<td width='47%' height='40' valign=top>Documents requis :</td>
<td width='50%' height='40'>
<font color='#D89A8F' >$housing[document]</font>
</td>
</tr>";
if($housing[remarque]!="")
echo"
<tr>
<td width='3%' height='40'> </td>
<td width='47%' height='40' valign=top>Remarque :</td>
<td width='50%' height='40'>
$housing[remarque]
</td>
</tr>";
/** DAY OF PRESENCE **/
echo"
<tr>
<td width='3%' height='40'> </td>
<td width='47%' height='40' valign='top'>Jours de présence :</td>
<td width='50%' height='40'>";
$tab_date=explode("|",$housing[date]);
echo $housing[date]."<br>";
$indice=$j+1;
$tab_pres=implode(":",$night_presence[$indice]);
echo $tab_pres."<br>";
//for($k=0;$k<count($night_presence[$indice]);$k++)
for($i=0;$i<=sizeof($tab_date)&&$tab_date[$i]!="";$i++)
{
$trouve=0;$k=0;
while(($trouve==0)&&($k<count($night_presence[$indice])))
{
//echo "date".$night_presence[$indice][$k]." ind i ".$i." ind j ".$indice." ind k ".$k."tab_date".$tab_date[$i]."<br>;";
if (strstr(trim($night_presence[$indice][$k]),trim($tab_date[$i]))) {
//echo " trouve <br>";
$trouve=1;
}else {
//echo " pas trouve <br>";
$trouve=0;
}
$k++;
}
if ($trouve==0)
{
echo " <input type='checkbox' name='presence[$indice][]' value='$tab_date[$i]' class='noborder'> $tab_date[$i]<BR>";
}
else
{
echo " <input type='checkbox' name='presence[$indice][]' value='$tab_date[$i]' class='noborder' checked> $tab_date[$i]<BR>";
}
}
$j++;
//hotel suivant
/**********************/
echo "
</td>
</tr>
";
}
else
{
echo"
<tr>
<td width='3%' height='40'> </td>
<td colspan=2> Plus de place disponible.</td>
</tr>";
}
}
}
?>
<tr>
<td width="3%" height="20"> </td>
<td colspan=2 height="20" bgcolor="#CCCCCC"><b><font color="#0000FF">Informations complémentaires</font></b></td>
</tr>
<?
/************ EXTRA ******************/
if(isset($_POST['id_categories']))
{
$select_extra_categories = Service::select_where("extra_categories","id_categories",$_POST['id_categories']);
while($extra_categories=mysql_fetch_array($select_extra_categories))
{
$select_extra = Service::select_2where_2not("extra","id_extra",$extra_categories[id_extra],"all_categories","all");
$extra=mysql_fetch_array($select_extra);
$extra_price[$extra[id_extra]]=$extra[price];
echo"
<tr>
<td width='3%' height='40'> </td>
<td width='47%' height='40'>$extra[name] ($extra[price] $evenement[currency]) :</td>
<td width='50%' height='40'>
<select name='extra_tab[$extra[id_extra]]'>";
foreach (array(0,1,2,3,4,5,6,7,8,9) as $num) {
echo "<option value='$num'";
if ($num == $extra_tab[$extra[id_extra]]) echo "selected";
echo ">$num</option>";
};
echo " </select>
</td>
</tr>";
}
//$select_extra=mysql_db_query(SQL_BDD,"select * from extra where all_categories='all' ",$db_link);
$select_extra = Service::select_where("extra","all_categories","all");
while($extra=mysql_fetch_array($select_extra))
{
$extra_price[$extra[id_extra]]=$extra[price];
echo"
<tr>
<td width='3% height='40'> </td>
<td width='47%' height='40'>$extra[name] ($extra[price] $evenement[currency]) :</td>
<td width='50%' height='40'>
<select name='extra_tab[$extra[id_extra]]'>";
foreach (array(0,1,2,3,4,5,6,7,8,9) as $num) {
echo "<option value='$num'";
if ($num == $extra_tab[$extra[id_extra]]) echo "selected";
echo ">$num</option>";
};
echo " </select>
</td>
</tr>";
if($extra[description]!="")
echo"
<tr class='info'>
<td width='3%' valign='top'><img src='information.gif'></td>
<td width='47%' colspan='2'>$extra[description] </td>
</tr>";
}
}
?>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40" valign="top"><font color="#0000FF"> <br>Présence aux repas de midi (inclus dans l'inscription)</font></td>
<td width="50%" height="40"> <br> <br> <br>
<?
/** DAY OF PRESENCE **/
$first_day = $evenement[date_debut];
list($year, $month, $day) = split('[-:\ ]', $first_day);
while("$year-$month-$day"<=$evenement[date_fin])
{
if (($_POST['tab_presence']) and in_array("$day-$month-$year",$_POST['tab_presence'])) {
echo " <input type='checkbox' name='tab_presence[]' value='$day-$month-$year' class='red' checked/> $day $month $year<br />";
} else {
echo " <input type='checkbox' name='tab_presence[]' value='$day-$month-$year' class='red' /> $day $month $year<br/ >";
}
$day++;
if(strlen($day)<2){
$day="0$day";}
if($day>=28){
if(!checkdate($month, $day, $year))
{
$day="01";
$month++;
}
}
if(strlen($month)<2){
$month="0$month";}
if($month>12)
{
$month=1;
$year++;
}
if(strlen($year)<2){
$year="0$year";}
}
/**********************/
?>
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="50%">
<input type="submit" name="validate" value="validate">
<input type="submit" name="retour" value="retour sans modification">
</td>
</tr>
</table>
</h5>
</form>
<?
/****** UPDATE *******/
if (isset($_POST['retour'])){
echo "<script language='javascript'> window.location.replace('../index.php?page=ParticipantPayment') </script>";}
if($error==0&&isset($_POST['validate']))
{
/**** ERROR CONTROL ****/
if($_POST['id_categories']=="")
{
echo "<script language='JavaScript'>alert('You must choose a status.')</script>";
exit;
}
/***********************/
/** Database update **/
if(isset($_POST['presence'])){
echo "post_presence : ".$_POST['presence']."var_dump(presence) : ".";<br>";var_dump($_POST['presence']);echo "<br>";
$nuit_presence=$_POST['presence'];
//il faut stocker les dates pour chaque hotel
//$night_presence=implode(" | ",$_POST['presence']); //contient nb_hotel tableau
// $night_presence1=implode(" | ",$nuit_presence[1]);
// $night_presence2=implode(" | ",$nuit_presence[2]);
// echo "les nuits d'hebergement réservées sont : ".$night_presence."<br>";
// echo "les nuits d'hebergement réservées sont : ".$night_presence1." ça fait".count($nuit_presence[1])."<br>";
// echo "les nuits d'hebergement réservées sont : ".$night_presence2." ça fait".count($nuit_presence[2])."<br>";
} //$night_presence=implode(" | ",$_POST['presence']);
if(isset($_POST['tab_presence']))
$day_presence=implode(" | ",$_POST['tab_presence']);
if($categories_id[document]==""&&$housing[document]=="")
$document_req="OK";
//echo "prix avant extra : ".$amount."<br>";
/***calcul du prix total***/
//calcul du prix des extras
// if(isset($extra_temp)){
// foreach($extra_temp as $id_extra => $number)
// {
// $amount=$amount+($extra_price[$id_extra]*$number);
// }
// }
//ajout du prix de l'inscription
// $amount = $amount+$_POST['amount'];
// echo "prix avant hotel : ".$amount."<br>";
//ajout du prix des chambres d'hotels
// if(isset($_POST['presence'])){
// $amount=$amount+($housing[price_registration]*sizeof($presence));}
/*** amount ***/
$extra_temp=$_POST['extra_tab'];
// var_dump($extra_temp);
// var_dump($extra_price);
$housing_temp=$_POST['housing_tab'];
// var_dump($housing_temp);
if(isset($extra_temp)){
foreach($extra_temp as $id_extra => $number)
{
//echo "prix : ".$extra_price[$id_extra]."*".$number."<br>";
$amount=$amount+($extra_price[$id_extra]*$number);
}
}
$nb_hotel=count($housing_temp);
// echo "Nombre hotel : ".$nb_hotel."<br>";
$prix_hotel=0;
for ($i = 1; $i <= $nb_hotel; $i++)
{
$nb_nuit=count($nuit_presence[$i]); //nb nuit pour chaque hotel
if ($nb_nuit!=0)
{
$tab_night_presence[$i]=implode(":",$nuit_presence[$i]); //pour la partie facturation (new_order.php)
}
else $tab_night_presence[$i]="";
$prix_hotel+=$nb_nuit*$housing_temp[$i];
}
$night_presence=implode(" | ",$tab_night_presence); //convertit tableau en chaine pour (new_order.php)
echo "night_presence : ".$night_presence."<br>";
// echo "post_night : ".$_POST['night_price']."<br>";
// echo "prix avant hotel : ".$amount."<br>";
// echo "jours depresence : ".sizeof($_POST['presence'])."<br>";
// echo "prix de l'hotel : ".$_POST['night_price']."<br>";
// if(isset($_POST['presence']))
// $amount=$amount+($_POST['night_price']*sizeof($_POST['presence']));
$amount=$amount+$prix_hotel;
// echo "prix apres hotel : ".$amount."<br>";
/**************/
if($amount==0)
$payment="OK";
echo "Mise à jour des données<br> identifiant : ".$_POST[id_registration]."<br>";
$insert_registration = Service::replace_registration($_POST['id_registration'],$_POST['id_categories'],$_POST['mr'],addslashes($_POST['first_name']),addslashes($_POST['last_name']),addslashes($_POST['title']),addslashes($_POST['compagny']),addslashes($_POST['adress']),addslashes($_POST['city']),addslashes($_POST['state']),$_POST['zip_code'],addslashes($_POST['country']),$_POST['phone'],$_POST['fax'],$_POST['email'],$night_presence,addslashes($_POST['online_information']),$day_presence,addslashes($_POST['document_req']),$amount,$payment);
//,addslashes($_POST['comments'])
if(isset($_POST['id_registration']))
$id_registration=$insert_registration;
if(isset($_POST['extra_tab'])){
foreach($_POST['extra_tab'] as $id_extra => $number)
{
// echo "<br>Passe par le foreach d'extra";
if($number>=0)
{
// echo "<br>Passe par le replace d'extra";
//$insert_registration=mysql_db_query(SQL_BDD,"replace into extra_registration (id_extra, id_registration,number) values ('$id_extra', '$id_registration', '$number')",$db_link);
$insert_registration = Service::replace_trois_trois("extra_registration","id_extra","id_registration","number",$id_extra,$id_registration,$number);
}
}
}
/********************************************************
$night_presence2 = $night_presence;
echo "$night_presence2<br>";
$night_presence1=explode("|",$registration[housing_presence]);
for ($i=0;$i<count($night_presence1);$i++)
{
$indic=$i+1;
$night_presence[$indic]=explode(":",$night_presence1[$i]);
}
***************************************************************/
// Log file
ecriture_log("Register : ".$first_name." ".$last_name);
echo "<script language='javascript'>
window.location.replace('../index.php?page=ParticipantPayment') //window.location.replace('new_order.php?id_registration='".$_POST['id_registration']."')
</script>
";
/*********************/
}
/*********************/
?>
</BODY>
</HTML>
fichier new_order.php
<?
/*** Order **
v 1.3
************/
/**Configuration de connexion**/
session_start();
require_once("../../conf.php");
//********Language**************/
if(isset($_SESSION['language']))
require_once(ROOT_DIR_PATH."/common/lang/".$_SESSION['language']);
$requiredUserLevel = array(1, 2);
require(ROOT_DIR_PATH."/common/phpSecurePages/secure.php");
require_once(ROOT_DIR_PATH."common/service/service.php");
// Connexion à la base
//$db_link = mysql_connect(SQL_SERVEUR,SQL_USER,SQL_PASSWD);
/******** Amount Calculate ********/
//$select_evenement=mysql_db_query(SQL_BDD,"select * from evenement",$db_link);
$select_evenement = Service::SelectAll("evenement");
$evenement=mysql_fetch_array($select_evenement);
//$select_registration=mysql_db_query(SQL_BDD,"select * from registration where id_registration='".$_GET['id_registration']."'",$db_link);
$select_registration = Service::select_where("registration","id_registration",$_GET['id_registration']);
$registration=mysql_fetch_array($select_registration);
//$select_categories=mysql_db_query(SQL_BDD,"select * from categories where id_categories='".$registration[id_categories]."'",$db_link);
$select_categories = Service::select_where("categories","id_categories",$registration[id_categories]);
$categories=mysql_fetch_array($select_categories);
/**********************************/
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Invoice</title>
<link rel="stylesheet" href="<? echo $ROOT_URL ?>admin/css.css" type="text/css">
<style type="text/css">
<!--
body {
margin: 10px 40px 0px 40px;
text-align: left;
font: 12px sans-serif, tahoma, verdana, geneva, helvetica, arial;
color: #666666;
}
.line1{
font-size : 12px;
font-family : Verdana, arial, helvetica, sans-serif;
background-color : #CCCCCC;
}
.line2{
font-size : 10px;
font-family : Verdana, arial, helvetica, sans-serif;
background-color : #DDDDDD;
}
.line3{
font-size : 10px;
font-family : Verdana, arial, helvetica, sans-serif;
background-color : white;
}
.line4 {
font-size : 12px;
font-family : Verdana, arial, helvetica, sans-serif;
color : #333333;
background-color : #c6c3bd;
}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000" class="main">
<table width="80%">
<tr>
<td><H2>FACTURE</h2></td>
<td>
<form action="new_order.php?id_registration=<? echo $_GET['id_registration'];?>" method="post">
<?
echo"<input type='submit' value='print' name='print'> ";
?>
</form>
</td>
<td align="right">
<form action="../index.php?page=ParticipantPayment" method="post">
<?
echo"<input type='submit' value='back to payment list' name='back to payment list'> ";
?>
</form>
</td>
</tr>
</table>
<hr width="90%" style="background-color: #000000" noshade>
<table>
<tr valign=top>
<td width="50%"><b>Ref :</b></td>
<td><?
echo"
# $registration[id_registration]
";
?>
</td>
</tr>
<tr valign=top>
<td><b>Customer :</b></td>
<td><?
echo"
$registration[mr] $registration[first_name] $registration[last_name]<br>
$registration[adress]<br>
$registration[zip_code] $registration[city]<br>
$registration[city] <br> 
";
?>
</td>
</tr>
<tr>
<td><b>Telephone :</b></td>
<td><?
echo"
$registration[phone]
";
?>
</td>
</tr>
<tr>
<td><b>E-Mail Address :</b></td>
<td><?
echo"
$registration[email]
";
?>
</td>
</tr>
</table>
<br>
<br>
Les pauses café et les repas de midi sont inclus dans le prix indiqué.
<br>
<br>
<br><br>
<table border="0" width="90%" cellspacing="0" cellpadding="2" border=0>
<tr class="line1">
<td width="10%">Qty.</td>
<td width="50%">Label</td>
<td width="20%">Price</td>
<td width="20%">Total</td>
</tr>
<?
// Registration
echo "prix de registration: ".$registration[amount];
$amount = $registration[amount];
//$select_extra_registration=mysql_db_query(SQL_BDD,"select * from extra_registration where id_registration='".$_GET['id_registration']."'",$db_link);
$select_extra_registration =Service::select_where("extra_registration","id_registration",$_GET['id_registration']);
echo "id_registration :".$_GET['id_registration'];
while ($row = mysql_fetch_array($select_extra_registration))
{
$extra_tab[$row['id_extra']] = $row['number'];
}
// echo "foreach extra_tab :".var_dump($extra_tab)."<br>";
if ($extra_tab!=NULL) //si pas d'extra à l'enregistrement
{
foreach($extra_tab as $id_extra => $number)
{
// echo "passe...";
// echo "number = ".$number." id extra = ".$id_extra;
//$select_extra=mysql_db_query(SQL_BDD,"select price from extra where id_extra=$id_extra",$db_link);
$select_extra = Service::select_champ_where("price","extra","id_extra",$id_extra);
$extra=mysql_fetch_array($select_extra);
$amount=$amount-($extra[price]*$number);
}
}
$amount=$categories[prices];
echo"
<tr class='line2'>
<td width='10%'>1</td>
<td width='50%'>$categories[name]</td>
<td width='20%'>$amount</td>
<td width='20%'>$amount</td>
</tr>
";
$amount=$categories[prices];
// echo "le prix est :".$amount=$categories[prices]."<br>";
//CSS
$line=2;
?>
<?
// Housing
if($registration[housing_presence]!="")
{
$select_housing_registration = Service::select_where("housing_categories","id_categories",$categories[id_categories]);
//pb avec ce qui est retourné dans $select_housing_registration
//$select_housing_registration=mysql_db_query(SQL_BDD,"select * from housing_categories where id_categories=$categories[id_categories]",$db_link);
$housing_registration=mysql_fetch_array($select_housing_registration);
$select_housing = Service::select_where("housing","id_housing",$housing_registration[id_housing]);
//$select_housing=mysql_db_query(SQL_BDD,"select * from housing where id_housing=$housing_registration[id_housing]",$db_link);
$housing=mysql_fetch_array($select_housing);
$night=explode("|",$registration[housing_presence]);
// echo "registration[housing_presence] : $registration[housing_presence]<br>";
// echo "night0 : $night[0]<br>";
// echo "night1 : $night[1]<br>";
// echo "night : ".count($night)."<br>";
for($i=0;$i<sizeof($night);$i++)
{
if($line==2)
$line=3;
else
$line=2;
// echo "nb_nuit : $night[$i]<br>";
if (trim($night[$i])!="")
{
$nb_nuit=count(explode(":",$night[$i]));
}
else
{
$nb_nuit=0;
}
// echo "nb_nuit : $nb_nuit<br>";
// $nb_nuit=trim($night[$i]);
$prix_nuits=$housing[price_registration]*$nb_nuit;
if($nb_nuit!=0) //n'affiche que les hotels fréquentés
{
echo"
<tr class='line$line'>
<td width='10%'>1</td>
<td width='50%'>$housing[name] (".$nb_nuit.")</td>
<td width='20%'>$housing[price_registration]</td>
<td width='20%'>$prix_nuits</td>
</tr>
";
}
$amount+=$housing[price_registration]*$nb_nuit;
$housing_registration=mysql_fetch_array($select_housing_registration);
if ($housing_registration!=NULL)
{
$select_housing = Service::select_where("housing","id_housing",$housing_registration[id_housing]);
$housing=mysql_fetch_array($select_housing);
// echo "housing : ".var_dump($housing)."<br>";
// $test2=implode(" | ",$housing);
//echo "$test2<br>";
}
}
}
?>
<?
// Extra
$select_extra_registration = Service::select_where("extra_registration","id_registration",$_GET['id_registration']);
//$select_extra_registration=mysql_db_query(SQL_BDD,"select * from extra_registration where id_registration='".$_GET['id_registration']."'",$db_link);
while($extra_registration=mysql_fetch_array($select_extra_registration))
{
if($line==2)
$line=3;
else
$line=2;
//$select_extra=mysql_db_query(SQL_BDD,"select * from extra where id_extra=$extra_registration[id_extra]",$db_link);
$select_extra = Service::select_where("extra","id_extra",$extra_registration[id_extra]);
$extra=mysql_fetch_array($select_extra);
$amount_temp=$extra[price]*$extra_registration[number];
if ($amount_temp!=0)
{
echo"
<tr class='line$line'>
<td width='10%'>$extra_registration[number]</td>
<td width='50%'>$extra[name]</td>
<td width='20%'>$extra[price]</td>
<td width='20%'>$amount_temp</td>
</tr>
";
$amount+=$amount_temp;
}
}
?>
<tr class="line3" align="right">
<td colspan=4> </td>
</tr>
<tr class="line1" align="right">
<td colspan=4><b>Total :</b> <? echo "$amount $evenement[currency]";?> </td>
</tr>
</table>
<BR>
<table border="0" width="90%" cellspacing="0" cellpadding="2" border=0>
<tr class="line4">
<td colspan="2">Required documents</td>
</tr>
<?
/***Required document***/
$select_required_document = Service::select_where("document_categories","id_categories",$registration[id_categories]);
//$select_required_document=mysql_db_query(SQL_BDD,"select * from document_categories where id_categories='".$registration[id_categories]."'",$db_link);
if(mysql_num_rows($select_required_document)==0 && ($registration[housing_presence]=="" || $housing[document]==""))
{
echo "
<tr colspan='2' class='line2'>
<td align='center'><i>Any documents</i></td>
</tr>
";
}
else
{
while($categories_document=mysql_fetch_array($select_required_document))
{
$select_document = Service::select_where("document","id_document",$categories_document[id_document]);
//$select_document=mysql_db_query(SQL_BDD,"select * from document where id_document=$categories_document[id_document]",$db_link);
$document=mysql_fetch_array($select_document);
if($line==2)
$line=3;
else
$line=2;
echo "
<tr class='line$line'>
<td>  <b>$document[name]</b> :</td>
<td>".nl2br($document[description])."</td>
</tr>
";
}
if($registration[housing_presence]!=""&&$housing[document]!="")
echo "
<tr class='line2'>
<td colspan='2'>  $housing[document]</td>
</tr>
";
}
?>
</table>
<BR>
<table border="0" width="90%" cellspacing="0" cellpadding="2" border=0>
<tr class="line4">
<td colspan=2>Please mail documents to :</td>
</tr>
<tr class="line2">
<td width="2%"></td>
<td>
<?
echo nl2br($evenement[mail_document]);
?>
</td>
</tr>
</table>
<br>
<table border="0" width="90%" cellspacing="0" cellpadding="2" border=0>
<tr class="line4">
<td colspan=3>Payment methods :</td>
</tr>
<?
$select_payment = Service::SelectAll("payment");
//$select_payment=mysql_db_query(SQL_BDD,"select * from payment",$db_link);
$line=2;
while($payment=mysql_fetch_array($select_payment))
{
if($line==2)
$line=3;
else
$line=2;
echo"
<tr class='line$line'>
<td width='2%'></td>
<td valign='top' width='20%'>";
echo "<b>".nl2br($payment[name])." :</b>";
echo"
</td>
<td width='70%'>";
echo nl2br($payment[description]);
echo"
</td>
</tr>";
}
?>
</table>
<br>
<?
if(isset($_POST['print']))
{
echo"
<script language='javascript'>
window.print();
</script>";
}
?>
</body>
</html>
fichier registration.php
<?
/****** Registratrion form *****
V 2.2
*******************************/
require_once("../conf.php");
//*********Service*************/
require_once(ROOT_DIR_PATH."common/service/service.php");
session_start();
// Link to database
$db_link = mysql_connect(SQL_SERVEUR,SQL_USER,SQL_PASSWD);
$select_evenement = Service::SelectAll("evenement");
$evenement=mysql_fetch_array($select_evenement);
include (ROOT_DIR_PATH."/archive/log/log.inc.php");
/******* FUNCTION *************/
$error=0;
require_once(ROOT_DIR_PATH."controle.php");
/*****************************/
?>
<HTML>
<head>
<title>Registration of participation</title>
<style type="text/css">
BODY{
font-family: verdana, arial, sans-serif;
font-size: x-small;
background-color: #f3e7b7;
}
<!--
*{
font-size: x-small;
}
input, textarea, select {
background-color: #CCCCCC;
font-family: verdana, arial, sans-serif;
font-size: 10px;
color: #333333;
padding: 0px;
}
input.red, textarea.red, select.red {
background-color: #D89A8F;
font-family: verdana, arial, sans-serif;
font-size: 10px;
color: WHITE;
padding: 0px;
}
info {
text-align: left;
font: 10px sans-serif, tahoma, verdana, geneva, helvetica, arial;
color: #666666;
}
-->
</style>
<SCRIPT>
<!--
function Lien() {
i = document.registration.list_categories.selectedIndex;
if (i == 0) return;
url = document.registration.list_categories.options[i].value;
window.location.href= url;
}
// -->
</SCRIPT>
</head>
<BODY>
<div id="Header" align="center"></div>
<h1><center><font color="#0000FF">Inscription à la conférence</font> - Conference registration</center></h1>
<?
/**** SUBMISSION OVER****/
$today = date("Y-m-d");
if($today>$evenement['registration_deadline'])
{
echo "<center><h1>REGISTRATION PHASE IS OVER</h1></center>";
exit;
}
/************************/
?>
<p><font color="#0000FF">Apres avoir valider votre inscription, vous serez redirigé automatiquement vers l'accueil du site.</font><br>
<p><font color="#0000FF">Vous receverez dans quelques secondes un mail de confirmation.</font><br>
<br><br>
<p><font color="#0000FF">Tous les champs marqués en <font color="#D89A8F">rouge</font> sont obligatoires.</font><br>
All the following fields marked in <font color="#D89A8F">red</font> are mandatory.</p>
<form name="registration" method="post" action="registration.php" >
<input type="hidden" name="id_categories" value="<? echo $_GET['id_categories'];?>">
<h5>
<table width="95%" border="0">
<tr>
<td width="3%" height="20"> </td>
<td colspan=2 height="20" bgcolor="#CCCCCC"><b><font color="#0000FF">Informations personnelles</font> - Personal data</b></td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40"><font color="#0000FF">Choisissez votre statut</font> - Your status</td>
<td width="50%" height="40">
<?
//$select_categories=mysql_db_query(SQL_BDD,"select * from categories",$db_link);
$select_categories = Service::SelectAll("categories");
echo"
<select name='list_categories' onChange='Lien()' class='red'>
<option value=\"\"></option>";
while($categories=mysql_fetch_array($select_categories))
{
if($categories['id_categories']==$_GET['id_categories']){
echo "<option value='registration.php?id_categories=".$categories['id_categories']."' selected>".$categories['name']."</option>";
}else{
echo "<option value='registration.php?id_categories=".$categories['id_categories']."'>".$categories['name']."</option>";
}
}
echo"
</select>
";
if(isset($_GET['id_categories']))
{
$select_categories_id = Service::select_where("categories","id_categories",$_GET['id_categories']);
//$select_categories_id=mysql_db_query(SQL_BDD,"select * from categories where id_categories='".$_GET['id_categories']."'",$db_link);
$categories_id=mysql_fetch_array($select_categories_id);
}
?>
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40"><font color="#0000FF">Prix de l'inscription</font> - Registration fee</td>
<td width="50%" height="40">
<?
if($categories_id['prices']!="")
echo $categories_id['prices']." ".$evenement['currency'];
$amount=$categories_id['prices'];
echo "<input type='hidden' name='amount' value='".$amount."'>";
?>
</td>
</tr>
<?
if($categories_id['document']!="")
echo"
<tr>
<td width='3%' height='40'> </td>
<td width='47%' height='40' valign=top>Documents requis :</td>
<td width='50%' height='40'>
<font color='#D89A8F' >".$categories_id['document']."</font>
</td>
</tr>";
if($categories_id['online_information']!="")
{
echo"
<tr>
<td width='3%' height='40'> </td>
<td width='47%' height='40' valign=top>Documents requis : </td>
<td width='50%' height='40'>
$categories_id[online_information]
</td>
</tr>";
}
if($categories_id['description']!="")
echo"
<tr>
<td width='3%' height='40'> </td>
<td width='47%' height='40' valign=top>Remarques :</td>
<td width='50%' height='40'>".
$categories_id['description']."
</td>
</tr>";
?>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40"> </td>
<td width="50%" height="40">
<input type=radio name=mr value="mrs."> Mrs.
<input type=radio name=mr value="mr"> Mr.
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40"><font color="#0000FF">Prenom</font> - Firstname</td>
<td width="50%" height="40">
<input type="textarea" name="first_name" size=50 <?
modifie($_POST['first_name'])
?>></input>
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40"><font color="#0000FF">Nom</font> - Lastname</td>
<td width="50%" height="40">
<input type="textarea" name="last_name" size=50 <?
modifie($_POST['last_name'])
?>></input>
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40"><font color="#0000FF">Organisme</font> - Affiliation</td>
<td width="50%" height="40">
<input type="textarea" name="compagny" size=50 <?
modifie($_POST['compagny'])
?>></input>
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40"><font color="#0000FF">Adresse postale</font> - Regular mail</td>
<td width="50%" height="40">
<input type="textarea" name="adress" size=50 <?
modifie($_POST['adress'])
?>></input>
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40"><font color="#0000FF">Ville</font> - City</td>
<td width="50%" height="40">
<input type="textarea" name="city" size=50 <?
modifie($_POST['city'])
?>></input>
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40"><font color="#0000FF">Code postal</font> - Zip code</td>
<td width="50%" height="40">
<input type="textarea" name="zip_code" size=20 <?
modifie($_POST['zip_code']);
?>></input>
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40"><font color="#0000FF">Pays</font> - Country</td>
<td width="50%" height="40">
<input type="textarea" name="country" size=20 value="<?
echo $_POST['country'];
?>"></input>
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40"><font color="#0000FF">Téléphone</font> - Phone</td>
<td width="50%" height="40">
<input type="textarea" name="phone" size=20 value="<?
echo $_POST['phone'];
?>"></input>
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40">Fax</td>
<td width="50%" height="40">
<input type="textarea" name="fax" size=20 value="<?
echo $_POST['fax'];
?>"></input>
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40">Email</td>
<td width="50%" height="40">
<input type="textarea" name="email" size=50 <?
modifie($_POST['email']);
?>></input>
</td>
</tr>
<?
if(isset($_GET['id_categories']))
{
//selectionne les hebergements correspondant à la catégorie et effectue les operations suivantes pour chacuns d'eux
$select_housing_categories = Service::select_where("housing_categories","id_categories",$_GET['id_categories']);
while($housing_categories=@mysql_fetch_array($select_housing_categories))
{
echo "
<tr>
<td width='3%' height='20'> </td>
<td colspan=2 height='20' bgcolor='#CCCCCC'><b>Logement</b></td>
</tr>
";
//selectionne les hotels où les jours de reservation ne sont pas nuls
$select_used_places = Service::select_2where_2not("registration","id_categories",$_POST['id_categories'],"housing_presence","");
$used_places=mysql_num_rows($select_used_places);
$select_housing = Service::select_where("housing","id_housing",$housing_categories[id_housing]);
$housing=@mysql_fetch_array($select_housing);
$housing_price[$housing[id_housing]]=$housing[price_registration];
if($used_places<$housing[max_place])
{
echo "
<tr>
<td width='3%' height='40'> </td>
<td width='47%' height='40'>Lieux :</td>
<td width='50%' height='40'>
$housing[name]
</td>
</tr>
<tr>
<td width='3%' height='40'> </td>
<td width='47%' height='40'>Prix par nuit :</td>
<td width='50%' height='40'>";
if($housing[price_registration]!="")
echo $housing[price_registration]." ".$evenement[currency];
// <input type='hidden' name='night_price' value=".$housing[price_registration].">
echo"
<input type='hidden' name='housing_tab[$housing[id_housing]]' value=".$housing[price_registration].">
</td>
</tr>";
if($housing[description]!="")
{
echo"
<tr>
<td width='3%' height='40'> </td>
<td width='47%' height='40'>Remarques :</td>
<td width='50%' height='40'>
$housing[description]
</td>
</tr>";
}
if($housing[document]!="")
echo"
<tr>
<td width=\"3%\" height=\"40\"> </td>
<td width=\"47%\" height=\"40\" valign=top>Documents requis :</td>
<td width=\"50%\" height=\"40\">
<font color=\"#D89A8F\" >$housing[document]</font>
</td>
</tr>";
if($housing[remarque]!="")
echo"
<tr>
<td width='3%' height='40'> </td>
<td width='47%' height='40' valign=top>Remarque :</td>
<td width='50%' height='40'>
$housing[remarque]
</td>
</tr>";
/** DAY OF PRESENCE **/
echo"
<tr>
<td width=\"3%\" height=\"40\"> </td>
<td width=\"47%\" height=\"40\" valign=\"top\">Places disponibles</td>
<td width=\"50%\" height=\"40\">";
$tab_date=explode(" | ",$housing[date]);
for($i=0;$i<=sizeof($tab_date)&&$tab_date[$i]!="";$i++)
{
echo " <input type='checkbox' name='presence[$housing[id_housing]][]' value='$tab_date[$i]' class='noborder'> $tab_date[$i]<BR>";
}
/**********************/
echo "
</td>
</tr>
";
}
else
{
echo"
<tr>
<td width=\"3%\" height=\"40\"> </td>
<td colspan=2> Plus de place disponible.</td>
</tr>";
}
}
}
?>
<tr>
<td width="3%" height="20"> </td>
<td colspan=2 height="20" bgcolor="#CCCCCC"><b><font color="#0000FF">Informations complémentaires</font></b></td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40" valign="top"><font color="#0000FF">Présence aux repas de midi (inclus)</font></td>
<td width="50%" height="40">
<? /** DAY OF PRESENCE **/
$first_day = $evenement[date_debut];
list($year, $month, $day) = split('[-:\ ]', $first_day);
while("$year-$month-$day"<=$evenement[date_fin])
{
if (($tab_presence) and in_array("$day-$month-$year", $tab_presence)) {
echo " <input type='checkbox' name='tab_presence[]' value='$day-$month-$year' class='red' checked/> $day $month $year<br />";
} else {
echo " <input type='checkbox' name='tab_presence[]' value='$day-$month-$year' class='red' /> $day $month $year<br/ >";
}
$day++;
if(strlen($day)<2)
$day="0$day";
if($day>=28)
{
if(!checkdate($month, $day, $year))
{
$day="01";
$month++;
}
}
if(strlen($month)<2)
$month="0$month";
if($month>12)
{
$month=1;
$year++;
}
if(strlen($year)<2)
$year="0$year";
}
/**********************/
?>
</td>
</tr>
<?
/************ EXTRA ******************/
if(isset($categories_id['id_categories']))
{
$select_extra_categories = Service::select_where("extra_categories","id_categories",$_GET['id_categories']);
while($extra_categories=@mysql_fetch_array($select_extra_categories))
{
$select_extra = Service::select_2where_2not("extra","id_extra",$extra_categories[id_extra],"all_categories","all");
$extra=mysql_fetch_array($select_extra);
$extra_price[$extra[id_extra]]=$extra[price];
echo"
<tr>
<td width='3%' height='40'> </td>
<td width='47%' height='40'><B>$extra[name] ($extra[price] $evenement[currency]) :</B></td>
<td width='50%' height='40'>
<select name='extra_tab[$extra[id_extra]]'>
<option value='0'>0</option>
<option value='1'>1</option>
</select>
</td>
</tr>";
if($extra['description']!="")
echo"
<tr class=\"info\">
<td width='3%' valign='top'><img src='information.gif'></td>
<td width='47' colspan=\"2\">".$extra['description']."</td>
</tr>";
}
$select_extra = Service::select_where("extra","all_categories","all");
//$select_extra=mysql_db_query(SQL_BDD,"select * from extra where all_categories='all' ",$db_link);
while($extra=mysql_fetch_array($select_extra))
{
$extra_price[$extra[id_extra]]=$extra[price];
echo"
<tr>
<td width='3%' height='40'> </td>
<td width='47%' height='40'><font color='#0000FF'><B>$extra[name] ($extra[price] $evenement[currency]) :<B></font></td>
<td width='50%' height='40'>
<select name='extra_tab[$extra[id_extra]]'>
<option value='0'>0</option>
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
<option value='4'>4</option>
</select>
</td>
</tr>";
if($extra[description]!="")
echo"
<tr class=\"info\">
<td width=\"3%\" valign=\"top\">
</td>
<td width=\"47%\" colspan=\"2\"><font color=\"#0000FF\">$extra[description] </font></td>
</tr>";
}
}
?>
<tr>
<td width="3%" height="40"> </td>
<td width="50%">
<input type="submit" name="validate" value="Validation ">
</td>
</tr>
</table>
</h5>
</form>
<?
/****** UPDATE *******/
echo $error;
if($error==0&&isset($_POST['validate']))
{
/**** ERROR CONTROL ****/
if($_POST['id_categories']=="")
{
echo "<script language='javascript'>alert(\"you must choose a status.\")</script>";
exit;
}
/***********************/
/** Database update **/
if(isset($_POST['presence'])){
echo "post_presence : ".$_POST['presence']."var_dump(presence) : ".";<br>";var_dump($_POST['presence']);echo "<br>";
$nuit_presence=$_POST['presence'];
//il faut stocker les dates pour chaque hotel
//$night_presence=implode(" | ",$_POST['presence']); //contient nb_hotel tableau
// $night_presence1=implode(" | ",$nuit_presence[1]);
// $night_presence2=implode(" | ",$nuit_presence[2]);
// echo "les nuits d'hebergement réservées sont : ".$night_presence."<br>";
// echo "les nuits d'hebergement réservées sont : ".$night_presence1." ça fait".count($nuit_presence[1])."<br>";
// echo "les nuits d'hebergement réservées sont : ".$night_presence2." ça fait".count($nuit_presence[2])."<br>";
}
if(isset($_POST['tab_presence']))
$day_presence=implode(" | ",$_POST['tab_presence']);
if($categories_id[document]==""&&$housing['document']=="")
$document_req="OK";
/*** amount ***/
$extra_temp=$_POST['extra_tab'];
$tableau_extra=implode(" | ",$_POST['extra_tab']);
echo "tableau extra : ".$tableau_extra."<br>";
$housing_temp=$_POST['housing_tab'];
$tableau_housing=implode(" | ",$_POST['housing_tab']);
echo "tableau housing : ".$tableau_housing."<br>";
$amount = $_POST['amount'];
echo "prix : ".$amount."<br>";
if(isset($extra_temp))
foreach($extra_temp as $id_extra => $number)
{
$cal_extra = Service::select_where("extra","id_extra",$id_extra);
$calcul_extra = mysql_fetch_array($cal_extra);
$amount=$amount+($calcul_extra[3]*$number);
}
$nb_hotel=count($housing_temp);
echo "Nombre hotel : ".$nb_hotel."<br>";
$prix_hotel=0;
for ($i = 1; $i <= $nb_hotel; $i++)
{
$nb_nuit=count($nuit_presence[$i]); //nb nuit pour chaque hotel
$tab_night_presence[$i]=implode(" : ",$nuit_presence[$i]); //pour la partie facturation (new_order.php)
$prix_hotel+=$nb_nuit*$housing_temp[$i];
}
$night_presence=implode(" | ",$tab_night_presence); //convertit tableau en chaine pour (new_order.php)
echo "tableau des nuits : ".$night_presence."<br>";
echo "Prix hotel : ".$prix_hotel."<br>";
// echo "post_night : ".$_POST['night_price']."<br>";
// echo "prix avant hotel : ".$amount."<br>";
// echo "jours depresence : ".sizeof($_POST['presence'])."<br>";
// echo "prix de l'hotel : ".$_POST['night_price']."<br>";
// if(isset($_POST['presence']))
// $amount=$amount+($_POST['night_price']*sizeof($_POST['presence']));
$amount=$amount+$prix_hotel;
echo "prix apres hotel : ".$amount."<br>";
/**************/
if($amount==0)
$payment="OK";
$insert_registration = Service::insert_registration($_POST['id_categories'],$_POST['mr'],addslashes($_POST['first_name']),addslashes($_POST['last_name']),addslashes($_POST['title']),addslashes($_POST['compagny']),addslashes($_POST['adress']),addslashes($_POST['city']),addslashes($_POST['state']),$_POST['zip_code'],addslashes($_POST['country']), $_POST['phone'],$_POST['fax'],$_POST['email'],$night_presence,addslashes($online_information),$day_presence,addslashes($document_req),$amount,date("y-m-d"),$payment);
/*if(mysql_affected_rows()<0)
{
echo "<BR>Un probleme est survenu dans la mise à jour de la base.<BR><BR>";
echo "insert into registration (id_registration, id_categories, mr, first_name, last_name, title, compagny, adress, city, state, zip_code, country, phone, fax, email, compagnon, housing_presence, online_information, day_presence, document, amount) values ('', '".$_POST['id_categories']."','".$_POST['mr']."', '".$_POST['first_name']."', '".$_POST['last_name']."', '".$_POST['title']."', '".$_POST['compagny']."', '".$_POST['adress']."', '".$_POST['city']."', '".$_POST['state']."', '".$_POST['zip_code']."', '".$_POST['country']."', '".$_POST['phone']."', '".$_POST['fax']."', '".$_POST['email']."', '".$_POST['roomate']."','".$_POST['night_presence']."', '".$online_information."', '".$day_presence."', '".$document_req."', $amount')<br>";
echo mysql_errno().": ".mysql_error()."<br>";
// On importe les informations de la session pour le log
ecriture_log("ERROR on the database : ".mysql_errno());
}
else
{*/
if(!isset($_POST['id_registration']))
$id_registration=$insert_registration;
if(isset($_POST['extra_tab']))
foreach($_POST['extra_tab'] as $id_extra => $number)
{
if($number>0)
{
$insert_registration = Service::insert_trois_trois("extra_registration","id_extra","id_registration","number",$id_extra,$id_registration,$number);
}
}
// Log file
ecriture_log("Register : ".$_POST['first_name']." ".$_POST['last_name']);
//Send a confirmation mail
$mail=$_POST['email'];
$file="registration";
$name=$_POST['last_name'];
include(ROOT_DIR_PATH."/common/mail/send_mail.inc.php");
echo "<script language=\"javascript\">
window.open('order.php?id_registration='".$_POST['id_registration']."','registration')
</script>
";
//}
/*********************/
echo "
<script language='javascript'>
<!--//
window.location.replace('".ROOT_URL."');
//-->
</script>";
}
/*********************/
?>
</BODY>
</HTML>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
J'avance ... cela ne me parait pas trop normal... il doit manquer un
argument.... et comment fait on pour mettre un jour quelques chose qui
n'existe pas encore
update badge set width='60', height='40', font_size='12',
compagny='true' , country='true', description='Ma conf', title='Human'
WHERE `id_badge` ='1'
Warning: Missing argument 18 for update_huit()
in /drbd/drbd1/www/human07/html/common/service/service.php on line 566
Warning: Missing argument 19 for update_huit()
in /drbd/drbd1/www/human07/html/common/service/service.php on line 566
Warning: Missing argument 20 for update_huit()
in /drbd/drbd1/www/human07/html/common/service/service.php on line 566
Echec dans la récupération des données Veuillez vérifier votre
requete.
Même en créant à la main le premier enregistrement, ben ça marche ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> Même en créant à la main le premier enregistrement, ben ça marche ...
>
enfin presque... il manque comme qui dirait le champ Nom_prenom dans la
table badge... si bien que les noms n'apparaissent pas sur les bagdes...
Pas cool
du coup, voila la modification
#
# Structure de la table `badge`
#
CREATE TABLE badge (
id_badge int(11) NOT NULL auto_increment,
title varchar(50) NOT NULL default '',
width int(11) NOT NULL default '0',
height int(11) NOT NULL default '0',
font_size int(11) NOT NULL default '0',
nom_prenom varchar(5) NOT NULL default '',
compagny varchar(5) NOT NULL default '',
country varchar(5) NOT NULL default '',
description varchar(250) NOT NULL default '',
PRIMARY KEY (id_badge)
) TYPE=MyISAM;
et les données
INSERT INTO badge (id_badge, title, width, height, font_size,
nom_prenom, compagny, country, description) VALUES (1, 'Human', 60, 40,
12, '', 'TRUE', 'TRUE', 'Ma conf'), (2, 'Etiquette Human', 0, 0, 0, '',
'', '', '');
pour avoir aussi pour les étiquettes
et la modif de la requête dans badge_generator.inc.php (strtoupper
pour mettre en majuscule dans la table, mieux pour la gestion du PDF)
$update_badge=mysql_db_query(SQL_BDD,"update badge set
width='".$_POST['width']."', height='".$_POST['height']."',
font_size='".$_POST['font_size']."',
nom_prenom='".strtoupper($_POST['name'])."',
compagny='".strtoupper($_POST['compagny'])."' ,
country='".strtoupper($_POST['country'])."',
description='".$_POST['description']."', title='".$_POST['title']."'
WHERE `id_badge` ='1' ",$db_link);
puis il faut modifier pour prendre en compte l'apparition ou non du
nom-prénom sur le badge
la checked box dans badge_generator.inc.php
<DEFANGED_input type="checkbox" name="name" class="orange"
value="true" checked > <? echo "$strFirstName & $strLastName"?><br>
puis la gestion dans badge_generator.inc.php
$pdf->SetFont('Arial','B',$badge[font_size]);
if ($badge[nom_prenom]=="TRUE"){
$pdf->Cell($badge[width],$height,$registration[first_name]."
".$registration[last_name],'LR',1,'C');} else{
//il faut passer une ligne vide
$pdf->Cell($badge[width],$height,"",'LR',1,'C');
}
ya encore un pbn avec le logo de la conf, il est pile poil sur le titre
de la conf....
ben il suffit de de commenter une ligne et d'en décommenter une autre ;)
if(file_exists("logo.jpg")) {
list($im_width, $im_height, $im_type, $im_attr) =
getimagesize("logo.jpg"); // echo "Image size : $im_width X $im_height";
// $pdf->Image("logo.jpg",($logoX+1)+($badge[width]-
$im_width*($height-2)/$im_height)/2, ($logoY+1), '', ($height-2));
$pdf->Image("logo.jpg",($logoX+1), ($logoY+1), '', ($height-2)); };
ce serait biende pouvoir choisir ou mettre l'image de logo ;)
une liste déroulante en plus ....
Yann
PS : je pense que je vais devoir faire la même chose avec la création
d'étiquettes ;)
la voici :
$update_badge=mysql_db_query(SQL_BDD,"update badge set
width='".$_POST['width']."', height='".$_POST['height']."',
font_size='".$_POST['font_size']."',
nom_prenom='".strtoupper($_POST['name'])."',
compagny='".strtoupper($_POST['compagny'])."' ,
country='".strtoupper($_POST['country'])."',
description='".$_POST['description']."', title='".$_POST['title']."'
WHERE `id_badge` ='2' ",$db_link);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
J'ai d'ailleurs une question concernant le champ "comments" dans la
table "registration"... il a été enlevé ou ai je une vieille version de
la bdd
Je l'ai enlevé des requêtes concernant la mise à jour des données
Yann
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Bonjour,
Afin de pouvoir ajouter un logo dans le
rep /html/admin/participants/pdf il faut qu'il soit utilisable en
écriture
D'ou un chmod 770 /html/admin/participants/pdf
D'ailleurs en parlant des droits sur la fichiers, je suis d'avis de
remplacer les chmod 777 dans le fichier install.sh par des chmod 770
pour les répertoires, et pour les fichiers (comme php.conf qui contient
le mot de passe d'accès à la base de données).
pour éviter un warning lors de la consultation des log j'ai ajouté le
petit test suivant dans le
fichier /html/admin/administration/log.inc.php
remplacer
$fcontents = file( $_GET['nom_fichier'] );
par
if ($_GET['nom_fichier']!="")
{
$fcontents = file( $_GET['nom_fichier'] );
}
Yann
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dans le fichier /html/admin/participants/payment.inc.php, il faut
remplacer
<td bgcolor="#BFC4CB"><b><font color="#333333"><? echo
$strSummary ?></font></b></td>
par
<td bgcolor="#BFC4CB"><b><font
color="#333333"><? echo $strPayment ?></font></b></td>
pour avoir le bon intitulé dans la page;
Yann
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Comme je viens d'être confronté au pb, (j'ai résolu en utilisant la
bonne volonté des utilisateurs et le champs theme de la table article)
ce serait bien de pouvoir indiquer dans une partie du site de
l'administration les différents thèmes et sous-thèmes de la conférence
et de faire apparaître cela dans le formulaire de soumission d'article
Pour l'instant j'utilise le champs theme-keywords pour y mettre ces
informations
voila
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Petit bug corrigé dans user/article.php il était possible d'envoyer un
article sans avoir rempli le champs résumé
il faut modifier textarea_control("abstract",$abstract); par
textarea_control("abstract",$_POST['abstract']);
dans la partie concernée
<td width="47%"
height="40"><font color="#0000FF">Résumé (200 mots
max)</font><br>Abstract (Maximum 200 words)</td> <td width="50%"
height="40"> <? textarea_control("abstract",$_POST['abstract']); ?>
</td>
Yann
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Bonsoir,
Lorsque les utilisateurs ont modifiés une fois leurs données à l'aide
de l'adresse fournie dans l'email,
par exemple
http://human07.univ-metz.fr/user/info_user.php?pass=zhSEHnOHGtyu6&id=35
comment font ils pour se reconnecter plus simplement que par
http://human07.univ-metz.fr/user/info_user.php?pass=mon_nouveau_mot_de_passe&id=35
pour re modifier données perso et mot de passe
Pourquoi ne pas passer par un php-secure page ?
eest-ce difficile?
YAnn
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ben non pas trop difficile finalement
voila le code source à modifier du fichier info_user.php, bon encore un
p'tit soucis, il faut modifier son mot de pass à chaque modification
/******* DATA *******/
$premiere_connexion=1;
//modif par yann pour avoir phpsecurepage
if (isset($_GET['id'])){
$id = $_GET['id'];
} elseif(isset($_POST['id'])) {
$id = $_POST['id'];
} else {
//echo "Error : you have tried to access a protected page.";
//exit;
$premiere_connexion=0;
}
if (isset($_GET['pass'])){
$pass = $_GET['pass'];
} elseif(isset($_POST['pass'])) {
$pass = $_POST['pass'];
} else {
//echo "Error : you have tried to access a protected page.";
//exit;
$premiere_connexion=0;
}
if ($premiere_connexion==0)
{
/**** PROTECT MODE ****/
$select_access = Service::SelectAll("evenement");
//$select_access=mysql_db_query(SQL_BDD,"select * from
evenement",$db_link); $access=mysql_fetch_array($select_access);
if($access[access]!="everybody")
{
//require(ROOT_DIR_PATH."/common/phpSecurePages/functions.inc.php");
require(ROOT_DIR_PATH."/common/phpSecurePages/secure.php");
$requiredUserLevel = array(1,2,3);
}
//var_dump($access);
//var_dump($ID);
/*********************/
//modif par yann
//$select_personne =
Service::select_where("personne","id_personne",$id); $select_personne =
Service::select_where("personne","id_personne",$ID); }
else
{
$select_personne = Service::select_where("personne","id_personne",$id);
}
//var_dump($select_personne);
$personne = mysql_fetch_array($select_personne);
//var_dump($personne);
if ($premiere_connexion==1)
{
if ($pass != $personne['passe_personne']) {
echo "Error : you have tried to access a protected page.";
exit;
}
}
$fields =
array('mail','nom','prenom','ville','adresse','pays','tel','fax');
foreach ($fields as $field) { if(!isset($_POST[$field]))
$_POST[$field] = $personne[$field];
};
/********************/
ensuite pour avoir les images de l'interface phpsecure page, il faut
copier le répertoire ommon/phpSecurePages/images dans user/
voila on dirait que ça marche,
Peut être serait il plus simple de mettre ces infos dans l'interface d'administration... vu que ce sont des personnes connues (relecteurs, admin, CP)
voili
a+
Yann
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bof non pas si simple, les mise à jour ne se font pas dans le cas de
phpsecure page
je cherche
voici finalement un truc qui marche... c'est pas trop joli, mais ça
marche
Yann
fichier info_user.php
<?
session_start();
require_once("../conf.php");
include (ROOT_DIR_PATH."/archive/log/log.inc.php");
// Link to database
/**** FUNCTION ****/
$error=0;
require_once(ROOT_DIR_PATH."controle.php");
/********Service********/
require_once(ROOT_DIR_PATH."common/service/service.php");
/******* DATA *******/
$premiere_connexion=1;
//modif par yann pour avoir phpsecurepage
/*
if (isset($_GET['id'])){
$id = $_GET['id'];
} elseif(isset($_POST['id'])) {
$id = $_POST['id'];
} else {
//echo "Error : you have tried to access a protected page.";
//exit;
$premiere_connexion=0;
}
if (isset($_GET['pass'])){
$pass = $_GET['pass'];
} elseif(isset($_POST['pass'])) {
$pass = $_POST['pass'];
} else {
//echo "Error : you have tried to access a protected page.";
//exit;
$premiere_connexion=0;
}
*/
if (!empty($_GET['id'])){
$id = $_GET['id'];
} elseif(!empty($_POST['id'])) {
$id = $_POST['id'];
} else {
//echo "Error : you have tried to access a protected page.";
//exit;
$premiere_connexion=0;
}
if (!empty($_GET['pass'])){
$pass = $_GET['pass'];
} elseif(!empty($_POST['pass'])) {
$pass = $_POST['pass'];
} else {
//echo "Error : you have tried to access a protected page.";
//exit;
$premiere_connexion=0;
}
if ($premiere_connexion==0)
{
/**** PROTECT MODE ****/
$select_access = Service::SelectAll("evenement");
//$select_access=mysql_db_query(SQL_BDD,"select * from evenement",$db_link);
$access=mysql_fetch_array($select_access);
if($access[access]!="everybody")
{
//require(ROOT_DIR_PATH."/common/phpSecurePages/functions.inc.php");
require(ROOT_DIR_PATH."/common/phpSecurePages/secure.php");
$requiredUserLevel = array(1,2,3);
}
//var_dump($access);
//var_dump($ID);
/*********************/
//modif par yann
//$select_personne = Service::select_where("personne","id_personne",$id);
//$select_personne = Service::select_where("personne","id_personne",$ID);
//var_dump($ID);
$_POST['ident']=$ID;
//var_dump($_POST['ident']);
$select_personne = Service::select_where("personne","id_personne",$ID);
}
else
{
$_POST['ident']=$id;
//var_dump($_POST['ident']);
$select_personne = Service::select_where("personne","id_personne",$id);
}
//var_dump($select_personne);
$personne = mysql_fetch_array($select_personne);
//var_dump($personne);
if ($premiere_connexion==1)
{
if ($pass != $personne['passe_personne']) {
echo "Error : you have tried to access a protected page.";
exit;
}
}
$fields = array('mail','nom','prenom','ville','adresse','pays','tel','fax');
foreach ($fields as $field) {
if(!isset($_POST[$field]))
$_POST[$field] = $personne[$field];
};
/********************/
?>
<HTML>
<head>
<title>Inscription</title>
<style type="text/css">
BODY{
font-family: verdana, arial, sans-serif;
font-size: x-small;
}
<!--
*{
font-size: x-small;
}
input, textarea, select {
background-color: #CCCCCC;
border-style: solid;
border-width: 1px;
font-family: verdana, arial, sans-serif;
font-size: 10px;
color: #333333;
padding: 0px;
}
input.red, textarea.red, select.red {
background-color: #D89A8F;
border-style: dashed;
border-width: 1px;
font-family: verdana, arial, sans-serif;
font-size: 10px;
color: WHITE;
padding: 0px;
}
-->
</style>
</head>
<BODY>
<H2>Inscription</H2>
<p>All fields marked in <font color="#D89A8F">red</font> are mandatory.</p>
<p>
<form method="post" action="info_user.php">
<input type="hidden" name="id" size="20" value="<? echo $_GET['id'];?>">
<input type="hidden" name="pass" size="20" value="<? echo $_GET['pass'];?>">
<input type="hidden" name="ident" size="20" value="<? echo $_POST['ident'];?>">
<table width="90%" border="0">
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40">first name :</td>
<td width="50%" height="40">
<input type="text" name="nom" size="20" <?modifie($_POST['nom']);?>>
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40">last name :</td>
<td width="50%" height="40">
<input type="text" name="prenom" size="20" <?modifie($_POST['prenom']);?>>
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40">adress :</td>
<td width="50%" height="40">
<input type="text" name="adresse" size="50" value="<?
echo $_POST['adresse'];
?>">
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40">city :</td>
<td width="50%" height="40">
<input type="text" name="ville" size="20" value="<? echo $_POST['ville']; ?>">
zipcode : <input type="text" name="cp" size="5" value="<? echo $_POST['cp']; ?>">
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40">country :</td>
<td width="50%" height="40">
<input type="text" name="pays" size="50" value="<? echo $_POST['pays']; ?>">
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40">phone :</td>
<td width="50%" height="40">
<input type="text" name="tel" size="15" maxlenght="15" value="<? echo $_POST['tel']; ?>">
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40">fax :</td>
<td width="50%" height="40">
<input type="text" name="fax" size="15" value="<? echo $_POST['fax']; ?>">
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40">e-mail :</td>
<td width="50%" height="40">
<input type="text" name="mail" size="50" value=<?
modifie_mail($_POST['mail'])
?>>
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40">password :</td>
<td width="50%" height="40">
<input type="password" name="new_pass" size="20" class=red>
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40">confirme :</td>
<td width="50%" height="40">
<input type="password" name="confirme_pass" size="20" class=red>
</td>
</tr>
<tr>
<td width="3%" height="40"> </td>
<td width="47%">validate >></td>
<td width="50%">
<input type="submit" name="validate" value="validate">
</td>
</tr>
</table>
</p>
</form>
<?
/****** UPDATE *******/
if($error==0&&isset($_POST['validate']))
{
/*** VALIDE PASS ***/
if($_POST['confirme_pass']!=$_POST['new_pass'])
{
echo "<script language='Javascript'>alert('your password entries do not match. please retype them.')</script>";
exit;
}
if(strlen($_POST['new_pass'])<5)
{
echo "<script language=\"JavaScript\">alert(\"Your password must be at least 5 characters .\")</script>";
exit;
}
/** Database update **/
//var_dump($_POST['ident']);
$mail=strtolower($_POST['mail']);
$nom=strtolower($_POST['nom']);
$prenom=strtolower($_POST['prenom']);
$maj_personne = Service::update_douze("personne","titre",addslashes($_POST['titre']),"nom",addslashes($nom),"prenom",addslashes($prenom),"adresse",addslashes($_POST['adresse']),"tel",$_POST['tel'],"fax",$_POST['fax'],"mail",$mail,"passe_personne",$_POST['new_pass'],"ville",addslashes($_POST['ville']),"cp",$_POST['cp'],"pays",addslashes($_POST['pays']),"id_personne",$_POST['ident']); //$id
if(mysql_affected_rows($maj_personne)<0)
{
// On importe les informations de la session pour le log
ecriture_log("ERROR on the database : ".mysql_errno());
}
else
{
// On importe les informations de la session pour le log
ecriture_log("Update : ".$prenom." ".$nom);
echo "<SCRIPT language=\"JavaScript\">alert(\"Information updated.\\nThank you\")</SCRIPT>";
echo "
<script language='javascript'>
<!--//
window.location.replace('".ROOT_URL."');
//-->
</script>";
}
/*********************/
}
?>
</BODY>
</HTML>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Bonjour,
Si comme moi votre site de conference est hébergé par un serveur apache
qui autorise l'affichage du contenu des répertoires, utilisez le
fichier index.html suivant afin d'éviter le listage.
yann@yoda:~/temp$ more index.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"> <html>
<head>
<DEFANGED_meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Conférence human07</title>
</head>
<body>
Accès non Autorisé.
</body>
</html>
yann@yoda:~/temp$
Copiez le dans chaque répertoire de l'arborescence du site de la conf,
qui ne contient ni fichier "index.php" ni fichier "index.html". en
effet par défaut apache cherche et affiche les fichiers index.*, et
s'il ne les trouve pas affiche le contenu du répertoire si cela est
autorisé.
Cela évitera à des personnes mal intentionnées de télécharger
facilement les fichiers php de les étudier et d'y trouver une faille
afin de prendre le contrôle de votre conférence
Je rappelle pour info que les mots de passe sont en clair dans la
base!!!
Il est toujours possible de faire un wget sur le site de la conf et de
récupérer les fichiers, mais cela fait un premier rempart (enfin une
petite barrière).
Yann
PS : j'ai remarqué que certain fichier étaient encodé en UTF-8 et
d'autres en ISO-8859-1.
Pourrait on harmoniser ?
L'aide d'iconv sera la bienvenue... iconv -f utf-8 -t iso-8859-1 par exemple
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Bonjour
Dans le formulaire de soumission de papier, il est possible d'envoyé un
papier sans remplir le champs obligatoire "abstract" ou keywords..
voici les modifications
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40"><font color="#0000FF">Résumé (200
mots max)</font><br>Abstract (Maximum 200 words)</td> <td width="50%"
height="40"> <? textarea_control("abstract",$_POST['abstract']); ?>
</td>
</tr>
<!--
<? textarea_control("abstract",$abstract); ?>
<input type"textarea" name="abstract" rows="5" cols="50" <?
modifie($_POST['abstract']);
?>></input>
-->
<tr>
<td width="3%" height="40"> </td>
<td width="47%" height="40">
<table border="0" width="100%">
<tr>
<td width="50%" height="40" valign="top">
<font color="#0000FF">
Mots-clés (séparés par |)<br>
Les mots clés doivent être constitués d'une
catégorie et d'une ou plusieurs sous catégories parmi les suivantes
(vous pouvez eventuellement rajouter des sous-catégories) séparés par
des |. <b>Attention : Veuillez remplir ce champs avec les termes
anglais.</b> </font> </td> <td width="50%" height="40" valign="top">
Keywords (separeted by | ) :<br> Keyword list is made of one category
word and one or more sub-category words from the following lists (you
can add sub-category) separated by |. <b>Warning : Please, fill this
field with english words</b> </td> </tr></table> <td width="50%"
height="40"> <? textarea_control("theme",$_POST['theme']); ?>
</td>
<!-- commentaire
<td width="50%" height="40">
<? textarea_control("theme",$theme); ?>
<input type="textarea" name="theme" rows="5" cols="50" <?
modifie($_POST['theme']);
?>></type>
<textarea name="theme" rows="5" cols="50"><? echo
$_POST['theme']; ?></textarea> </td>
-->
Yann
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%