Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Lost Right Column Boxes


jscrilla

Recommended Posts

I placed a free script code to do captcha security codes on my contact_us.php page, but now I can't see the right column infoboxes. Here's the snippet of code I added. It works fine and everything, but somehow doesn't allow the right boxes to show up. Can someone tell me how to get them included again?

 

<tr><td class="main">
<?php
/*************************************************************************
*																		*
* This script generates and checks a turing number					   *
*																		*
* Copyright (C) 2004-2005 PatheticCockroach							  *
*						 <http://patheticcockroach.com>				 *
* Version 1.1															*
*																		*
* This program is free software; you can redistribute it and/or modify   *
* it under the terms of the GNU General Public License as published by   *
* the Free Software Foundation; either version 2, or (at your option)	*
* any later version.													 *
*																		*
* This program is distributed in the hope that it will be useful,		*
* but WITHOUT ANY WARRANTY; without even the implied warranty of		 *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the		  *
* GNU General Public License for more details.						   *
*																		*
* You should have received a copy of the GNU General Public License	  *
* along with this program; if not, write to the Free Software			*
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.			  *
* You can also provide yourself with an online copy of the text:		 *
* <http://www.gnu.org/copyleft/gpl.html>								 *
* <http://www.gnu.org/copyleft/gpl.txt>								  *
*																		*
*************************************************************************/
include("l_db.php");

if (isset($_POST["session"]))					// If the form has been filled...
{
$session=htmlentities($_POST["session"], ENT_QUOTES);
$code_entre=strtoupper($_POST["code"]);				// Reads the code entered. strtoupper() converts into upper-case and can be removed if you use the code with digits only (default) or if you want your code to be case-senseitive
$sql = "SELECT code FROM turings WHERE session ='".$session."'";

$resultat = mysql_query($sql);

if(false==($ligne = mysql_fetch_array ($resultat)))		// If we can't find the session in the DB, it means that it's already been removed (or that the surfer is trying to cheat but we don't care;) )
{
mysql_close();
die("Sorry, this turing number has expired.");
}

$code=$ligne['code'];

mysql_query("DELETE FROM turings WHERE session ='".$session."'");	// Any respectable turing number works only once !
mysql_close();

if ($code_entre!=$code)						// If wrong code...
{
echo "Unable to log in : a correct turing number must be provided.";
	// you should include some footer code here to have valid XHTML (eg echo '</body></html>';)
die();
}
}

else								// If no form filled...
{
$session=md5(time().rand(10,1000));
/* You can choose here between a code with letters or a code with digits.
*  Personally, I prefer digits only (I think it's easier to type, and
*  also to program;) ), so this is the default code type.
*/
$code=mt_rand(1000,9999);		// Code with digits

/* Code with letters :
$vowels = array("","a","e","i","o","u","y");
$consonants = array("","b","c","d","f","g","h","j","k","l","m","n","p","r","s","t","v","w","z");
$code = "";
$i = 1;
while($i<=2){
$code .= $consonants[mt_rand(1, 18)].$vowels[mt_rand(1, 6)];
$i++;
}
$code = strtoupper($code);
*/

$heure=time();
$heure2=$heure-1200;						// Edit here the validity time of the code, in seconds (default is 1200 seconds)

// query
$query = "INSERT INTO turings VALUES('".$session."','".$code."','".$heure."')";

mysql_query($query);
mysql_query("DELETE FROM turings WHERE heure<$heure2");		// We delete old, unused codes
mysql_close();

// We (finally) display the form and stop the execution :
echo 'Enter Security Code -->?:
<form action="l_form.php" method="post">
<input type="hidden" name="session" value="'. $session .'" />
<img src="l_gen.php?session='. $session .'" alt="Turing Number" />
<input type="text" name="code" />
<input type="submit" value="Submit" /></form>';
// you should include some footer code here to have valid XHTML (eg echo '</body></html>';)
die();
}

// If the execution arrives here, it means that the turing number was entered properly by the user
?>

Link to comment
Share on other sites

It's because if the die()s. They tell the script to stop executing, and the script for the right column is executed towards the end of the contact_us.php page.

 

Try this instead:

 

<tr><td class="main">
<?php
/*************************************************************************
*																		*
* This script generates and checks a turing number					   *
*																		*
* Copyright (C) 2004-2005 PatheticCockroach							  *
*						 <http://patheticcockroach.com>				 *
* Version 1.1															*
*																		*
* This program is free software; you can redistribute it and/or modify   *
* it under the terms of the GNU General Public License as published by   *
* the Free Software Foundation; either version 2, or (at your option)	*
* any later version.													 *
*																		*
* This program is distributed in the hope that it will be useful,		*
* but WITHOUT ANY WARRANTY; without even the implied warranty of		 *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the		  *
* GNU General Public License for more details.						   *
*																		*
* You should have received a copy of the GNU General Public License	  *
* along with this program; if not, write to the Free Software			*
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.			  *
* You can also provide yourself with an online copy of the text:		 *
* <http://www.gnu.org/copyleft/gpl.html>								 *
* <http://www.gnu.org/copyleft/gpl.txt>								  *
*																		*
*************************************************************************/
include("l_db.php");

if (isset($_POST["session"]))					// If the form has been filled...
{
$session=htmlentities($_POST["session"], ENT_QUOTES);
$code_entre=strtoupper($_POST["code"]);				// Reads the code entered. strtoupper() converts into upper-case and can be removed if you use the code with digits only (default) or if you want your code to be case-senseitive
$sql = "SELECT code FROM turings WHERE session ='".$session."'";

$resultat = mysql_query($sql);

if(false==($ligne = mysql_fetch_array ($resultat)))		// If we can't find the session in the DB, it means that it's already been removed (or that the surfer is trying to cheat but we don't care;) )
{
mysql_close();
echo("Sorry, this turing number has expired.");
}

$code=$ligne['code'];

mysql_query("DELETE FROM turings WHERE session ='".$session."'");	// Any respectable turing number works only once !
mysql_close();

if ($code_entre!=$code)						// If wrong code...
{
echo "Unable to log in : a correct turing number must be provided.";
	// you should include some footer code here to have valid XHTML (eg echo '</body></html>';)
}
}

else								// If no form filled...
{
$session=md5(time().rand(10,1000));
/* You can choose here between a code with letters or a code with digits.
*  Personally, I prefer digits only (I think it's easier to type, and
*  also to program;) ), so this is the default code type.
*/
$code=mt_rand(1000,9999);		// Code with digits

/* Code with letters :
$vowels = array("","a","e","i","o","u","y");
$consonants = array("","b","c","d","f","g","h","j","k","l","m","n","p","r","s","t","v","w","z");
$code = "";
$i = 1;
while($i<=2){
$code .= $consonants[mt_rand(1, 18)].$vowels[mt_rand(1, 6)];
$i++;
}
$code = strtoupper($code);
*/

$heure=time();
$heure2=$heure-1200;						// Edit here the validity time of the code, in seconds (default is 1200 seconds)

// query
$query = "INSERT INTO turings VALUES('".$session."','".$code."','".$heure."')";

mysql_query($query);
mysql_query("DELETE FROM turings WHERE heure<$heure2");		// We delete old, unused codes
mysql_close();

// We (finally) display the form and stop the execution :
echo 'Enter Security Code --> :
<form action="l_form.php" method="post">
<input type="hidden" name="session" value="'. $session .'" />
<img src="l_gen.php?session='. $session .'" alt="Turing Number" />
<input type="text" name="code" />
<input type="submit" value="Submit" /></form>';
// you should include some footer code here to have valid XHTML (eg echo '</body></html>';)

}

// If the execution arrives here, it means that the turing number was entered properly by the user
?>

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...