Jump to content

weird need help


dflow

Recommended Posts

:confused:

 

this works

<form action="" method="post">
<input name="DepartureDate" type="text">
<input name="" type="submit"></form>
<?php
$DepartureDate=$_POST['DepartureDate'];

echo  $DepartureDate = stripslashes($DepartureDate); // sql inject clean
$regex = "/^[a-z]+$/";
if (!preg_match($regex, $DepartureDate)){
echo 'CAPS BABY!';}
else
{echo 'OK!';}
?>

 

this doesnt

if (!preg_match($regex, $DepartureDate)) {
    mail($to, $subject, $message, $headers); 

echo $url_success = "confirmation.php";
 //echo("<meta http-equiv = refresh content=0;url=".$url_success.">");
   }

  else {
  

exit();



  }

Link to comment
https://forums.phpfreaks.com/topic/230809-weird-need-help/
Share on other sites

What do you mean it doesn't work? You need to state what you expect to happen and what is, or is not, happening. Normally I would also state you need to state what the input is that you are testing against. But, in this case, I'm pretty sure your problem is on this line

echo $url_success = "confirmation.php";

 

What are you trying to do on this line? Do you want to echo something or do you want to set a value?

Link to comment
https://forums.phpfreaks.com/topic/230809-weird-need-help/#findComment-1188188
Share on other sites

What do you mean it doesn't work? You need to state what you expect to happen and what is, or is not, happening. Normally I would also state you need to state what the input is that you are testing against. But, in this case, I'm pretty sure your problem is on this line

echo $url_success = "confirmation.php";

 

What are you trying to do on this line? Do you want to echo something or do you want to set a value?

 

the echo on this line was  for test purposes, in any case i dont want capital letters in the departuredate field,

but it still is sent despite the fact i inject "WeriUY" gibrish in the the date field

Link to comment
https://forums.phpfreaks.com/topic/230809-weird-need-help/#findComment-1188249
Share on other sites

//Look for ANY character that is not lower case alpha character
$regex = "/[^a-z]/";
if (!preg_match($regex, $DepartureDate))
{
    //All characters are lower case alpha caracters
    mail($to, $subject, $message, $headers);
    header("Location: {$url_success}");
}
exit();

Link to comment
https://forums.phpfreaks.com/topic/230809-weird-need-help/#findComment-1188300
Share on other sites

//Look for ANY character that is not lower case alpha character
$regex = "/[^a-z]/";
if (!preg_match($regex, $DepartureDate))
{
    //All characters are lower case alpha caracters
    mail($to, $subject, $message, $headers);
    header("Location: {$url_success}");
}
exit();

 

dont know why but this is not working

Link to comment
https://forums.phpfreaks.com/topic/230809-weird-need-help/#findComment-1188343
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.