external php include problems.. :o(

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
raoulx
Posts: 13
Joined: Fri 12. Dec 2003, 22:21

external php include problems.. :o(

Post by raoulx »

hello everybody i have a trouble with {PHP:add_revendeur.php}

in this page http://www.logimmo.com/corporate/index. ... 71,0,0,1,0

you can found the add_revendeur.php here :
http://www.logimmo.com/corporate/add_revendeur.php
As you can see code run here but not include the cms...

I post a part of the code here... And sure need some help ;o)
<form action="<?php echo $_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING'] ?>" method="post" enctype="multipart/form-data">

<table width="100%" cellpadding="2" cellspacing="0">

<? if ($error)
{
?>
<tr>
<td><br>
<blockquote><? echo $error; ?></blockquote>
</td>
</tr>
<?
}
?>
<tr>
<td>Denomination </td>
<td><input type="text" size="40" name="denomination" value="<? echo stripslashes($denomination); ?>"></td>
<td>&nbsp;</td>
<td>&nbsp;</td>

</tr>
<tr>
<td>Adresse</td>
<td><input type="text" size="40" name="adresse" value="<? echo stripslashes($adresse); ?>"></td>
</tr><tr>
<td>Code postal</td>
<td><input type="text" size="8" name="codepostal" value="<? echo stripslashes($codepostal); ?>">
Ville
<input type="text" size="23" name="ville" value="<? echo stripslashes($ville); ?>"></td>
</tr>
<tr>

<td>Pays</td>
<td>
<select name="pays">
<option value="F"<? if ($pays=="F") echo " selected"; ?>>France</option>
<option value="L"<? if ($pays=="L") echo " selected"; ?>>Luxembourg</option>
<option value="D"<? if ($pays=="D") echo " selected"; ?>>Allemagne</option>
<option value="B"<? if ($pays=="B") echo " selected"; ?>>Belgique</option>
<option value="E"<? if ($pays=="E") echo " selected"; ?>>Espagne</option>
<option value="P"<? if ($pays=="P") echo " selected"; ?>>Portugal</option>
<option value="I"<? if ($pays=="I") echo " selected"; ?>>Italie</option>
</select>
</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>Contact</td>
<td><input type="text" size="40" name="contact" value="<? echo stripslashes($contact); ?>"></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Email</td>
<td><input type="text" size="40" name="email" value="<? echo stripslashes($email); ?>"></td>
</tr><tr><td>Site web</td>
<td><input type="text" size="40" name="url" value="<? echo stripslashes($url); ?>"></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>Telephone</td>
<td><input type="text" size="20" name="tel" value="<? echo stripslashes($tel); ?>" maxlength="20"></td>

</tr>
<tr>
<td>Fax</td>
<td><input type="text" size="20" name="fax" value="<? echo stripslashes($fax); ?>" maxlength="20"></td>

</tr>
<tr>
<td>&nbsp;</td>
</tr>
<td>Login</td>
<td><input type="text" name="log" value="<? echo stripslashes($log); ?>"></td>

</tr>
<tr>
<td>Mot de passe</td>
<td><input type="text" name="pass" value="<? echo stripslashes($pass); ?>"></td>
<td colspan="2">&nbsp;</td>
</tr>

<tr>
<td></td><td>
<input type="hidden" name="type" value="REV">
<input type="hidden" name="menu" value="<?php echo $_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING'] ?>">
<input type="submit" name="modvalid" value="Devenir revendeur">
</td>
<td>&nbsp;</td>
</tr>

</table>
<?

print("</form>");
?>
Spirou
Posts: 22
Joined: Fri 2. Jan 2004, 17:07
Location: Finland

Problem?

Post by Spirou »

What's the problem? Please describe it more
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post by DeXXus »

"Resultant" Source (based on DOM):

Code: Select all

<INPUT type='hidden' name='type' />
<INPUT type='hidden' name='menu' />
<INPUT type='submit' name='modvalid' />
Plain old "view source" in IE 6:

Code: Select all

<input type="hidden" name="type" value="REV">
		<input type="hidden" name="menu" value="/corporate/index.php?id=0,71,0,0,1,0">
		<input type="submit" name="modvalid" value="Devenir revendeur">
Instead of:

Code: Select all

<input type="hidden" name="type" value="REV">
		<input type="hidden" name="menu" value="/corporate/add_revendeur.php?">
		<input type="submit" name="modvalid" value="Devenir revendeur">
raoulx
Posts: 13
Joined: Fri 12. Dec 2003, 22:21

.../...

Post by raoulx »

I try all but doesnt work...

<input type="hidden" name="type" value="REV">
<input type="hidden" name="menu" value="/corporate/add_revendeur.php?">
<input type="submit" name="modvalid" value="Devenir revendeur">


I cant setup $modvalid


here the code (run on add_revendeur.php) !!

if ($modvalid)
{
if (!$insertion) $insertion = "N"; else $insertion = "O";
$url = ereg_replace("http://","",$url);
$url = ereg_replace(" ","",$url);

if (!$denomination) $error = "Veuillez précisez le nom...<br>\n";
if (!$contact) $error .= "Veuillez précisez le contact...<br>\n";
if (!$tel) $error .= "Veuillez précisez le numéro de téléphone principal...<br>\n";
if (!$log) $error .= "Veuillez choisir un login d'identification...<br>\n";
if (!$pass)
{
$error .= "Veuillez choisir un mot de passe d'identification...<br>\n";
}
elseif (strlen(stripslashes($pass)) < 5)
{
$error .= "Le mot de passe doit être de 5 caractères minimum...<br>\n";
}
else
{
$mdp2verif = md5(stripslashes($pass));
$verif = mysql_result(mysql_query("select count(*) from vendeurs where pass = '$mdp2verif'"),0,0);
if ($verif != 0)
{
$error .= "Le mot de passe est dejà utilisé, veuillez en choisir un autre...<br>\n";
}

}

if (!$error)
{
$datimport = date("Y-m-d");
$req = "INSERT INTO vendeurs (
client_id, log, pass, type, insertion, denomination, tel, tel2,
fax, gsm, adresse, codepostal, ville, pays, email, url, contact, dat_inscrip, humhum)
VALUES
('', '$log', '$mdp2verif', '$type', '$insertion', '$denomination', '$tel', '',
'$fax', '', '$adresse', '$codepostal', '$ville', '$pays', '$email', '$url', '$contact', '$datimport', '$pass')";
mysql_query($req);


$error = "Merci <b>'$denomination'</b> votre demande est prise en compte\n";
unset($denomination);
unset($adresse);
unset($ville);
unset($pays);
unset($codepostal);
unset($contact);
unset($email);
unset($url);
unset($tel);
unset($tel2);
unset($fax);
unset($gsm);
unset($log);
unset($pass);
unset($type);
}
}
User avatar
Oliver Georgi
Site Admin
Posts: 9900
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

The problem is that you have no access to the $var from your form because of the INCLUDE PHP function. It is included in a function in frontend rendering. So you have to use $_POST['my_formvar'] when you want to get posted values. Never use these kind of "register_globals" get value functionality. This should help you.

Regards
Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
raoulx
Posts: 13
Joined: Fri 12. Dec 2003, 22:21

All is OK

Post by raoulx »

$_POST[variable] is my friend in this case :o)

Thank you Oliver...
Post Reply