03/07/2011, 17:35
|
| | Fecha de Ingreso: mayo-2007
Mensajes: 419
Antigüedad: 17 años, 6 meses Puntos: 20 | |
Respuesta: Problemas con PHP y iframe en Facebook Aqui el segundo archivo donde va todo el codigo de php se llama sign-up2.php (el que llamo en el iframe de arriba)
Código:
<?php if($_POST){
/**** Cambiar aqui ****/
$para = '[email protected]';
/*********************/
$asunto = 'New contact from Facebook';
$mensaje = '';
foreach($_POST as $key=>$value){
$vacio = trim($value);
if($key == 'Email Address'){
if(empty($vacio)){
echo 'The email address you introduced is incorrect, please check it';
$form = 'mal';
}
$mail_correcto = 0;
if ((strlen($value) >= 6) && (substr_count($value,"@") == 1) && (substr($value,0,1) != "@") && (substr($value,strlen($value)-1,1) != "@")){
if ((!strstr($value,"'")) && (!strstr($value,"\"")) && (!strstr($value,"\\")) && (!strstr($value,"\$")) && (!strstr($value," "))) {
//miro si tiene caracter .
if (substr_count($value,".")>= 1){
//obtengo la terminacion del dominio
$term_dom = substr(strrchr ($value, '.'),1);
//compruebo que la terminacion del dominio sea correcta
if (strlen($term_dom)>1 && strlen($term_dom)<5 && (!strstr($term_dom,"@")) ){
//compruebo que lo de antes del dominio sea correcto
$antes_dom = substr($value,0,strlen($value) - strlen($term_dom) - 1);
$caracter_ult = substr($antes_dom,strlen($antes_dom)-1,1);
if ($caracter_ult != "@" && $caracter_ult != "."){
$mail_correcto = 1;
}
}
}
}
}
if($mail_correcto == 0){
echo 'The email address you introduced is incorrect, please check it';
$form = 'mal';
}else{
$de = $value;
}
}else if($key == 'First Name' or $key == 'Last Name'){
if(empty($vacio)){
echo 'Please fill our contact form with real details';
$form = 'mal';
}
if(preg_match('/[0-9]/',$value) != 0){
echo 'Please fill our contact form with real details';
$form = 'mal';
}
}else if($key == 'Current Location'){
if(!empty($value)){
if(preg_match('/[0-9]/',$value) != 0){
echo 'Please fill our contact form with real details';
$form = 'mal';
}
}
}
$mensaje .= $key.': '.$value."\n";
}
mail($para,$asunto,$mensaje,'From: '.$de);
echo 'Thank you, your message has been sent!';
}
else if(!$_POST or $form == 'mal'){
?>
<FORM NAME="Submit" Enctype="text/plain" action="http://www.xxxxxx.com/social/sign-up.php" method="post">
<p align="center"><img src="http://www.xxxxxxxx.com/social/images/bravura-logo2.jpg" width="297" height="93" /></p><br>
<div class="textoweb2">Please fill out the fields below to receive our newsletter and promotional offers.</div>
<br><br>
<div class="textoweb3"><strong>(Required fields are bold)</strong></div>
<table width="340" border="0">
<tr>
<td><div class="textoweb2"><strong>Email Address*:</strong></div></td>
<td><br /><input type="text" name="Email Address"><br /><br /></td>
</tr>
<tr>
<td><div class="textoweb2"><strong>First Name*:</strong></div></td>
<td><br /><input type="text" name="First Name"><br /><br /></td>
</tr>
<tr>
<td><div class="textoweb2"><strong>Last Name*:</strong></div></td>
<td> <br><input type="text" name="Last Name"><br /><br /></td>
</tr>
<tr>
<td><div class="textoweb2">Current Location:</div></td>
<td> <br><input type="text" name="Current Location"><br /><br /></td>
</tr>
</table>
<br /><br />
<div class="textoweb2">Where did you hear about us? </div><br />
<div id="signform1"> <!--start signform1 -->
<table width="240" border="0" align="right">
<tr>
<td width="32"><input type="radio" name="marketing" value="Facebook" checked>
<td width="193">Facebook</td>
</tr>
<tr>
<td><input type="radio" name="marketing" value="Twitter"> <td>Twitter</td>
</tr>
<tr>
<td><input type="radio" name="marketing" value="Search Engine"><td>Search Engine</td>
</tr>
<tr>
<td><input type="radio" name="marketing" value="Newspaper or Magazine"><td>
Newspaper or Magazine</td>
</tr>
<tr>
<td><input type="radio" name="marketing" value="From a Friend"> <td>From a Friend</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</div><!--end signform1 -->
<br />
<table width="302" border="0" align="right">
<tr>
<td width="302" height="126"> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td></td>
</tr>
<tr></table>
<br><br><br><br><br><br><br><br><br>
<table width="400" border="0">
<tr>
<td> <div class="textoweb2"><br>Which service would most interest you?</div></td>
</tr>
</table>
<table width="277" border="0" align="right">
<tr>
<td width="10"> </td>
<td width="20"> </td>
<td width="182"> </td>
</tr>
<tr>
<td> </td>
<td><input type="radio" name="service" value="Personal Chef" checked></td><td width="182">Personal Chef</td>
<td width="47"></td>
</tr>
<tr>
<td>
<td><input type="radio" name="service" value="Private & Boutique Dining"><td> Private & Boutique Dining
<td></td>
</tr>
<tr>
<td>
<td> <input type="radio" name="service" value="Fit - Food Packages">
<td>Fit - Food Packages</td>
<td>
</tr>
<tr>
<td>
<td> <input type="radio" name="service" value="Corporate Entertaining"> <td>Corporate Entertaining</td>
<td>
</tr>
<tr>
<td>
<td> <input type="radio" name="service" value="Cookery Classes"><td> Cookery Classes</td>
<td>
</tr>
<tr>
<td>
<td> <input type="radio" name="service" value="Yacht Provisions"> <td>Yacht Provisions</td>
<td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" value="Submit"></td>
</tr>
</table>
</FORM>
<?php
}
?>
</div>
Avisarme con lo que sea, ya que facebook y su iframe me tienen super desesperada.
mil besos y gracias |