kochier
12-02-2008, 01:11 AM
if(isset($_POST['update']))
{
$Name = $_POST['Name'];
$Name = preg_replace("/[^a-zA-Z]/", "\n", $Name);
$Name2 = first_words($Name, 0, 1);
$Name3 =first_words($Name, 1, 1);
$Nam = strtolower($Name2);
$Nam2 = strtolower($Name3);
if (preg_match('/([a-z])\1/i', $Name2) and empty($Name3))
{
include 'library/opendb.php';
mysql_select_db('greendoor') or die('Cannot select database');
$result = mysql_query("SELECT Word1 FROM greendoor") or die(mysql_error());
while($row = mysql_fetch_array($result)){
$Word1 = $row['Word1'];
if ($Word1 == $Nam)
{
$result2 = mysql_query("SELECT Word1, Word2, Plural FROM greendoor WHERE Word1 = '$Nam'") or die(mysql_error());
while($row = mysql_fetch_array($result2)){
$Word2 = $row['Word2'];
$Plural = $row['Plural'];
{
if ($Plural == '0')
{
echo 'There is a '. $Nam. ' through the Green Glass Door, but there are no '. $Word2. '.';
}
else
{
if ($Plural == '1')
{
echo 'There are '. $Nam. ' through the Green Glass Door, but there is no '. $Word2. '.';
}}}}}
else
{
echo $Nam.' will go through the Green Glass Door.';
$fname = 'library/greendoor.php';
$fhandle = fopen($fname,"r");
$content = fread($fhandle,filesize($fname));
$content = $content .'<br />' .$Name;
$fhandle = fopen($fname,"w");
fwrite($fhandle,$content);
fclose($fhandle);
$to = 'kochier@absurdity981.com';
$subject = 'Green Door Word';
$message = "$Name";
$headers = 'From: ggd@absurdity981.com';
mail($to, $subject, $message, $headers) or exit('mail fail');
}}}
else
{
if (preg_match('/([a-z])\1/i', $Name2) and preg_match('/([a-z])\1/i', $Name3))
{
echo $Name2 .' ' .$Name3 .' will go through the Green Glass Door.';
}
else
{
if (preg_match('/([a-z])\1/i', $Name2) or preg_match('/([a-z])\1/i', $Name3))
{
if ($Nam == 'double' and $Nam2 == 'letters')
{
echo "Congratulations, you've beat the Green Glass Door. Now try the <a href =" .'"willitgothrough107.php">Red Plastic Window</a>.';
}
else
{
echo $Name2 .' ' .$Name3 .' will both go through and not go through the Green Glass Door.';
}}
else
{
if (!empty($Name3))
{
echo $Name2 .' ' .$Name3 .' will not go through the Green Glass Door.';
}
else
{
if ($Nam == 'branches')
{
echo 'There are no branches through the Green Glass Door, but there are trees.';
}
else
{
if ($Nam == 'heaven')
{
echo 'There is no heaven beyond the Green Glass Door, but there is a hell.';
}
else
{
if ($Nam == 'microsoft')
{
echo 'There is no Microsoft beyond the Green Glass Door, but there is Yahoo and Google.';
}
else
{
if ($Nam == 'yesterdays')
{
echo 'There are no yesterdays beyond the Green Glass Door, but there are tomorrows.';
}
else
{
if ($Nam == 'yesterday')
{
echo 'There is no yesterday beyond the Green Glass Door, but there is a tomorrow.';
}
else
{
if ($Nam == 'circles')
{
echo 'There are no circles beyond the Green Glass Door, but there are balls.';
}
else
{
if ($Nam == 'circle')
{
echo 'There is no circle beyond the Green Glass Door, but there is a ball.';
}
else
{
if ($Nam == 'colour')
{
echo 'There is no colour beyond the Green Glass Door, but there is green.';
}
else
{
if ($Nam == 'plastic')
{
echo 'There is no plastic through the Green Glass Door, but there is glass.';
}
else
{
echo $Name2 .' will not go through the Green Glass Door.';
$fname = 'library/greendoor.php';
$fhandle = fopen($fname,"r");
$content = fread($fhandle,filesize($fname));
$content = $content .'<br />' .$Name;
$fhandle = fopen($fname,"w");
fwrite($fhandle,$content);
fclose($fhandle);
$to = 'kochier@absurdity981.com';
$subject = 'Green Door Word';
$message = "$Name";
$headers = 'From: ggd@absurdity981.com';
mail($to, $subject, $message, $headers) or exit('mail fail');
}}}}}}}}}}}}}}
?>
I hate to post such a huge chunk of code, but it's really frustrating me right now, and I can't seem to figure it out. You can see it in action here (http://absurdity981.com/willitgothrough106.php). Basically if I put hello in it should go through, if I put trees through it will go through, and since there's a database entry for trees, it will say there's trees but no soil. I had it working perfectly but I made a minor change, and now it's not working, it keeps repeating the same line twice, if it will go through the door. I'm been moving things around for the last hour and can't figure out what I messed up, I was just about to make a back-up after making these changes but haven't gotten to it, so there's no backup to go to. Please help me I just want this working again.
{
$Name = $_POST['Name'];
$Name = preg_replace("/[^a-zA-Z]/", "\n", $Name);
$Name2 = first_words($Name, 0, 1);
$Name3 =first_words($Name, 1, 1);
$Nam = strtolower($Name2);
$Nam2 = strtolower($Name3);
if (preg_match('/([a-z])\1/i', $Name2) and empty($Name3))
{
include 'library/opendb.php';
mysql_select_db('greendoor') or die('Cannot select database');
$result = mysql_query("SELECT Word1 FROM greendoor") or die(mysql_error());
while($row = mysql_fetch_array($result)){
$Word1 = $row['Word1'];
if ($Word1 == $Nam)
{
$result2 = mysql_query("SELECT Word1, Word2, Plural FROM greendoor WHERE Word1 = '$Nam'") or die(mysql_error());
while($row = mysql_fetch_array($result2)){
$Word2 = $row['Word2'];
$Plural = $row['Plural'];
{
if ($Plural == '0')
{
echo 'There is a '. $Nam. ' through the Green Glass Door, but there are no '. $Word2. '.';
}
else
{
if ($Plural == '1')
{
echo 'There are '. $Nam. ' through the Green Glass Door, but there is no '. $Word2. '.';
}}}}}
else
{
echo $Nam.' will go through the Green Glass Door.';
$fname = 'library/greendoor.php';
$fhandle = fopen($fname,"r");
$content = fread($fhandle,filesize($fname));
$content = $content .'<br />' .$Name;
$fhandle = fopen($fname,"w");
fwrite($fhandle,$content);
fclose($fhandle);
$to = 'kochier@absurdity981.com';
$subject = 'Green Door Word';
$message = "$Name";
$headers = 'From: ggd@absurdity981.com';
mail($to, $subject, $message, $headers) or exit('mail fail');
}}}
else
{
if (preg_match('/([a-z])\1/i', $Name2) and preg_match('/([a-z])\1/i', $Name3))
{
echo $Name2 .' ' .$Name3 .' will go through the Green Glass Door.';
}
else
{
if (preg_match('/([a-z])\1/i', $Name2) or preg_match('/([a-z])\1/i', $Name3))
{
if ($Nam == 'double' and $Nam2 == 'letters')
{
echo "Congratulations, you've beat the Green Glass Door. Now try the <a href =" .'"willitgothrough107.php">Red Plastic Window</a>.';
}
else
{
echo $Name2 .' ' .$Name3 .' will both go through and not go through the Green Glass Door.';
}}
else
{
if (!empty($Name3))
{
echo $Name2 .' ' .$Name3 .' will not go through the Green Glass Door.';
}
else
{
if ($Nam == 'branches')
{
echo 'There are no branches through the Green Glass Door, but there are trees.';
}
else
{
if ($Nam == 'heaven')
{
echo 'There is no heaven beyond the Green Glass Door, but there is a hell.';
}
else
{
if ($Nam == 'microsoft')
{
echo 'There is no Microsoft beyond the Green Glass Door, but there is Yahoo and Google.';
}
else
{
if ($Nam == 'yesterdays')
{
echo 'There are no yesterdays beyond the Green Glass Door, but there are tomorrows.';
}
else
{
if ($Nam == 'yesterday')
{
echo 'There is no yesterday beyond the Green Glass Door, but there is a tomorrow.';
}
else
{
if ($Nam == 'circles')
{
echo 'There are no circles beyond the Green Glass Door, but there are balls.';
}
else
{
if ($Nam == 'circle')
{
echo 'There is no circle beyond the Green Glass Door, but there is a ball.';
}
else
{
if ($Nam == 'colour')
{
echo 'There is no colour beyond the Green Glass Door, but there is green.';
}
else
{
if ($Nam == 'plastic')
{
echo 'There is no plastic through the Green Glass Door, but there is glass.';
}
else
{
echo $Name2 .' will not go through the Green Glass Door.';
$fname = 'library/greendoor.php';
$fhandle = fopen($fname,"r");
$content = fread($fhandle,filesize($fname));
$content = $content .'<br />' .$Name;
$fhandle = fopen($fname,"w");
fwrite($fhandle,$content);
fclose($fhandle);
$to = 'kochier@absurdity981.com';
$subject = 'Green Door Word';
$message = "$Name";
$headers = 'From: ggd@absurdity981.com';
mail($to, $subject, $message, $headers) or exit('mail fail');
}}}}}}}}}}}}}}
?>
I hate to post such a huge chunk of code, but it's really frustrating me right now, and I can't seem to figure it out. You can see it in action here (http://absurdity981.com/willitgothrough106.php). Basically if I put hello in it should go through, if I put trees through it will go through, and since there's a database entry for trees, it will say there's trees but no soil. I had it working perfectly but I made a minor change, and now it's not working, it keeps repeating the same line twice, if it will go through the door. I'm been moving things around for the last hour and can't figure out what I messed up, I was just about to make a back-up after making these changes but haven't gotten to it, so there's no backup to go to. Please help me I just want this working again.