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
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
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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.