Heres my Code Goodluck lol any how the if statement works but always coming up true not false dont understand why
$_POST = valid_post($_POST);
$i=1;
$i4=1;
$result4 = mysql_query("DESCRIBE ".$table2."");
while($row4 = mysql_fetch_array($result4))
{
$test4 = mysql_num_rows(mysql_query("DESCRIBE ".$table2.""));
if($row4["Field"] == "id")
{
print'';
}
elseif($row4["Field"] != "id" AND $i4 != $test4)
{
$info4 .= '`'.$row4["Field"].'`, ';
}
elseif($row4["Field"] != "id" AND $i4 == $test4)
{
$info4 .= '`'.$row4["Field"].'`';
}
elseif($row4["Field"] == "id" AND $i4 == $test4)
{
$info4 .= '`'.$row4["Field"].'`';
}
$i4++;
}
$query = "SELECT ".$info4." FROM ".$table2." WHERE `require` = '1'";
$result = mysql_query($query);
while($row = mysql_fetch_array($result))
{
$row = valid_row($row);
$sql = 'SELECT count(name) AS `counting` FROM '.$table2.' WHERE `require` = "1"';
$result2 = mysql_query($sql);
$row2 = mysql_fetch_array($result2);
$row2 = valid_row($row2);
$last = $row2["counting"];
if($row["stype"] == 'normal')
{
if($i != $last AND $i > '1')
{
$scheck .= '$_POST["'.$row['name'].'"] < "0" OR ';$i++;
}
elseif($i == '1' AND $i != $last)
{
$scheck .= '$_POST["'.$row['name'].'"] < "0" OR ';$i++;
}
elseif($i == $last AND $i > '1')
{
$scheck .= '$_POST["'.$row['name'].'"] < "0"';$i++;
}
elseif($i == $last AND $i == '1')
{
$scheck .= '$_POST["'.$row['name'].'"] < "0"';$i++;
}
}
elseif($row["stype"] == 'email')
{
if($i > '1' AND $i != $last)
{
$scheck .= '!eregi(\'^[a-zA-Z]+[a-zA-Z0-9_-]*@([a-zA-Z0-9]+){1}(\.[a-zA-Z0-9]+){1,2}\', stripslashes(trim($_POST["'.$row['name'].'"])) ) OR $_POST["'.$row['name'].'"] != $_POST["verify_email"] OR ';$i++;
}
elseif($i == '1' AND $i != $last)
{
$scheck .= '!eregi(\'^[a-zA-Z]+[a-zA-Z0-9_-]*@([a-zA-Z0-9]+){1}(\.[a-zA-Z0-9]+){1,2}\', stripslashes(trim($_POST["'.$row['name'].'"])) ) OR $_POST["'.$row['name'].'"] != $_POST["verify_email"] OR ';$i++;
}
elseif($i == $last AND $i > '1')
{
$scheck .= '!eregi(\'^[a-zA-Z]+[a-zA-Z0-9_-]*@([a-zA-Z0-9]+){1}(\.[a-zA-Z0-9]+){1,2}\', stripslashes(trim($_POST["'.$row['name'].'"])) ) OR $_POST["'.$row['name'].'"] != $_POST["verify_email"]';$i++;
}
elseif($i == $last AND $i == '1')
{
$scheck .= '!eregi(\'^[a-zA-Z]+[a-zA-Z0-9_-]*@([a-zA-Z0-9]+){1}(\.[a-zA-Z0-9]+){1,2}\', stripslashes(trim($_POST["'.$row['name'].'"])) ) OR $_POST["'.$row['name'].'"] != $_POST["verify_email"]';$i++;
}
}
}
if($scheck)
{
print'<table>
<form name="autocfg" action="?p='.$_GET["p"].'&v=1" method="post">';
$query = "SELECT `title`, `name`, `type`, `default`, `stype`, `require` FROM ".$table2."";
$result = mysql_query($query);
while($row = mysql_fetch_array($result))
{
$row = valid_row($row);
if($row["stype"] == "normal" AND $row["require"] = "1")
{
if($_POST["".$row["name"].""] < "0")
{
print'<tr>
<td></td>
<td >'.$row["title"].' is required</td>
</tr>';
text(''.$row["title"].'', ''.$row["name"].'', ''.$row["type"].'', ''.$_POST["".$row['name'].""].'', ''.$row["default"].'');
}
else
{
text(''.$row["title"].'', ''.$row["name"].'', ''.$row["type"].'', ''.$_POST["".$row['name'].""].'', ''.$row["default"].'');
}
}
elseif($row["stype"] == "email" AND $row["require"] = "1")
{
if(!eregi('^[a-zA-Z]+[a-zA-Z0-9_-]*@([a-zA-Z0-9]+){1}(\.[a-zA-Z0-9]+){1,2}', stripslashes(trim($_POST["".$row['name'].""])) ) OR $_POST["".$row['name'].""] != $_POST["verify_email"])
{
if(!eregi('^[a-zA-Z]+[a-zA-Z0-9_-]*@([a-zA-Z0-9]+){1}(\.[a-zA-Z0-9]+){1,2}', stripslashes(trim($_POST["".$row['name'].""])) ))
{
print'<tr>
<td></td>
<td>E-mail is not valid</td>
</tr>';
text(''.$row["title"].'', ''.$row["name"].'', ''.$row["type"].'', ''.$_POST["".$row['name'].""].'', ''.$row["default"].'');
}
elseif($_POST["".$row['name'].""] != $_POST["verify_email"])
{
print'<tr>
<td></td>
<td>E-mail and Verify E-mail does not match</td>
</tr>';
text(''.$row["title"].'', ''.$row["name"].'', ''.$row["type"].'', ''.$_POST["".$row['name'].""].'', ''.$row["default"].'');
}
}
else
{
text(''.$row["title"].'', ''.$row["name"].'', ''.$row["type"].'', ''.$_POST["".$row['name'].""].'', ''.$row["default"].'');
}
}
else
{
text(''.$row["title"].'', ''.$row["name"].'', ''.$row["type"].'', ''.$_POST["".$row['name'].""].'', ''.$row["default"].'');
}
}
text('', '', 'submit', 'Submit', '');
print'</form>
</table>';
}
else
{
$query = "SELECT `email` FROM `config`";
$result = mysql_query($query);
$config2 = mysql_fetch_array($result);
$config2 = valid_row($config2);
$_POST = valid_row($_POST);
$email = $_POST["email"];
$to = "".$config2["email"]."";
$subject = "".$_POST["subject"]."";
$body = "".$_POST["name"]."<br />".$_POST["message"]."";
$headers = "MIME-Version: 1.0 \r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1 \r\n";
$headers .= "From: ".$email."";
$send = mail($to, $subject, $body, $headers);
$_POST = valid_post($_POST);
$i2=1;
$i3 = 1;
$result = mysql_query("DESCRIBE ".$table2."");
while($row = mysql_fetch_array($result))
{
$test = mysql_num_rows(mysql_query("DESCRIBE ".$table2.""));
if($row["Field"] == "id")
{
print'';
}
elseif($row["Field"] != "id" AND $i3 != $test)
{
$info2 .= '`'.$row["Field"].'`, ';
}
elseif($row["Field"] != "id" AND $i3 == $test)
{
$info2 .= '`'.$row["Field"].'`';
}
elseif($row["Field"] == "id" AND $i3 == $test)
{
$info2 .= '`'.$row["Field"].'`';
}
$i3++;
}
$query = "SELECT ".$info2." FROM ".$table2."";
$result = mysql_query($query);
while($row = mysql_fetch_array($result))
{
$row = valid_row($row);
$sql = 'SELECT count(id) AS `counting` FROM '.$table2.'';
$result2 = mysql_query($sql);
$row2 = mysql_fetch_array($result2);
$row2 = valid_row($row2);
if($row["name"] != 'time' AND $i2 != $row2["counting"])
{
$values .= '$_POST["'.$row["name"].'"], ';
}
elseif($row["name"] != 'time' AND $i2 == $row2["counting"])
{
$values .= '$_POST["'.$row["name"].'"]';
}
elseif($row["name"] == 'time' AND $i2 == $row2["counting"])
{
$values .= ''.time().'';
}
elseif($row["name"] == 'time' AND $i2 != $row2["counting"])
{
$values .= ''.time().', ';
}
$i2++;
}
$i3 = 1;
$result = mysql_query("DESCRIBE ".$table."");
while($row = mysql_fetch_array($result))
{
$test3 = mysql_num_rows(mysql_query("DESCRIBE ".$table.""));
if($row["Field"] == "id")
{
print'';
}
elseif($row["Field"] != "id" AND $i3 != $test3)
{
$info .= '`'.$row["Field"].'`, ';
}
elseif($row["Field"] != "id" AND $i3 == $test3)
{
$info .= '`'.$row["Field"].'`';
}
elseif($row["Field"] == "id" AND $i3 == $test3)
{
$info .= '`'.$row["Field"].'`';
}
$i3++;
}
$query = "INSERT into ".$table." (".$info.") values(".$values.")";
$result = mysql_query($query);
print'Thank You for contacting us we will get back to you as soon as possible';
}