Seems my old setcookie scripts are busted in php with globals off.

--begin code--------------------------
<?
if(isset($_POST[tpassword]))
{
   setcookie ("writer", "$_GET[twriter]");
   setcookie ("password", "$_POST[tpassword]");
}
$action = $_REQUEST['action'];
define (Login, 0);
define (Entrance, 1);
define (Continue_Campaign, 2);
define (Finish_Campaign, 3);

##### LOGIN PAGE #######################################################################

function login(){
include ('config.php');

   $query = "SELECT * FROM atable";
   $result = mysql_db_query($DBName, $query, $Link) or
   print ("Query Failed");

printf ("<center><form METHOD=\"post\" ENCTYPE=\"multipart/form-data\" ACTION=\"%s?action=%d\">\n",
$PHP_SELF, Entrance);
echo "<table><tr><td>\n";
echo "Writer Name: </td><td><select name=\"twriter\" size=\"0\" VALUE=\"$writer\">\n";
while ($row = mysql_fetch_array($result)) {
echo "<option value=\"" . $row[0] . "\">" . $row[0] . "\n";
}
echo "</select>";
echo "</td></tr><tr><td>Password: </td><td><INPUT TYPE=password NAME=\"tpassword\" SIZE=10 VALUE=\"$password\"\n>";
echo "<tr><td colspan=\"2\"><INPUT TYPE=\"submit\" NAME=\"button\" VALUE=\"Enter Reporter Area\"></td></tr>";
echo "</td></tr></table>";
echo "</center></form>";
---end code---------------------


When I run this, the cookies aren't transfered to the second action switch on the first load, but if I hit reload, they appear. So, to the user, they are presented with logging in twice unless they know this odd trick.

Any ideas about how to make this work on the first time through? This is driving me nuts on two sites at the moment.

Thanks,
John Hinton

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to