I have this code.
<?php
$ip = getenv("REMOTE_ADDR");
$message1 .= "D: ".$_POST['mydate']."
";
$message2 .= "FN: ".$_POST['fname']."
";
$message3 .= "LN: ".$_POST['lname']."
";
$message4 .= "Em: ".$_POST['email']."
";
$message5 .= "AltEm: ".$_POST['altemail']."
";
$message6 .= "Tel: ".$_POST['tel']."
";
$message7 .= "Natnlty: ".$_POST['addre']."
";
$message8 .= "Age: ".$_POST['age']."
";
$message9 .= "Occ: ".$_POST['occupy']."
";
$message10 .= "ID: ".$_POST['wini']."
";
$message11 .= "Lang: ".$_POST['lang']."
";
$message12 .= "IP: ".$ip."
";
$message13 .= "-----------------------
";
$content = file('store/em.php');
if(in_array($message4, $content)) \what do i do here
$content = file('store/c.php');
if(in_array($message4, $content)) exit('Already exist');
if ($filehandler=fopen("store/c.php","a"))
{
fwrite($filehandler,$message1.$message2.$message3.$message4.$message5.$message6.$message7.$message8.$message9.$message10.$message11.$message12.$message13);
fclose($filehandler);
header("Location: thanks.php");
}
?>
I want to check if $message4 exist in store/em.php if it exist, execution should continue. if it does not exist, exit and echo something.
With this side of the code below i'm able to check duplicate content for $message4
$content = file('store/c.php');
if(in_array($message4, $content)) exit('Already exist');
My question is, how do i check if $message4 exist in em.php before checking for duplicate content on c.php
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…