Setcookie variable use issue after moving php app to different se rver
| From: | Shapiro, David | Date: | Thu, 26 Aug 2004 13:15:44 +0000 |
| Subject: | Setcookie variable use issue after moving php app to different se rver | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-194774@lists.php.net to get a copy of this message | ||
Hello,
We are trying to move our php app to a different server. For some reason,
when we type in the login/password/account number info and click submit, it
does not seem to set the variables.
The webpage portion that collects the login/password/account looks like the
following:
<tr>
<td><b>username:</b></td>
<td><input type="text"
name="UserName"
value="<?php echo $UserName
?>" maxlength=8 class="form_style">
</td>
</tr>
<tr>
<td><b>password:</b></td>
<td><input type="password"
name="Password" class="form_style"></td>
</tr>
<tr>
<td colspan="2"
align="center">
<font color='gray'
size=1>Username and Password are case sensitive.</font>
</td>
</tr>
<tr>
<td colspan="2"
align="center"><font
color='red'><?php echo $status; ?></font></td>
</tr>
<tr>
<td colspan="2" align="right">
<input type="submit"
name="Submit" value=" Login " style="font-weight:bold;">
</td>
</tr>
It looks like the value= line for user name puts the text the user types
into in the $UserName variable (or is this setting a default value if
$UserName exists?).
The password line does not have this. Either way, this setup works fine on
the original server.
At the top of the index.php page, it then has php code like the following:
<?php
setcookie ("ccp_logged_in");
setcookie ("ccp_username");
setcookie ("ccp_uid");
setcookie ("ccp_fname");
setcookie ("ccp_lname");
setcookie ("ccp_access");
setcookie ("ccp_company");
setcookie ("ccp_account");
setcookie ("ccp_maccount");
setcookie ("ccp_master");
//Get Global Variable Settings
require("internet/include/global.php");
/****************************************************************
**** Open a Database connection to the MySQL Database ****
****************************************************************/
if ($UserName != ""){
$link = mysql_connect($SERVERNAME, $DB_USER,
$DB_PWD)
or die ("Could not Connect");
mysql_select_db ($DB)
(code continues on to validate user and then if approved, goes to another
page called page2.php)
Note: The submit action is to go back to itself (index.php).
It never gets in here as if $UserName is not set (at least that is what I
think is going on because if I put $UserName =
someuser/$Password=password/$AccountNo=someacctno just before the if...then
statement, it validates and moves on to page2.php). If I hardcode set these
(which is not an option for use..just for troubleshooting), it goes to
page2.php, with the cookies, which I checked with print_r option. However,
it has a if ($ccs_logged_in = 1) check that fails, even though the print_r
shows it is set to 1 as if it is not using the cookie. I am fairly new to
php, so I do not know if I am supposed to capture the ccs_logged_in cookie
value and assign it to $ccs_logged_in variable. I am not doing this
because, well, it is working as such on the other server.
Can anybody please help me understand what is going on with these php pages?
This electronic message transmission contains information from the office of
David Shapiro, ITC^DeltaCom, Inc., which may be confidential or privileged.
The information is intended to be for the use of the individual or entity
named above. If you are not the intended recipient, be aware that any
disclosure, copying, distribution or use of the contents of this information
is prohibited. If you have received this electronic transmission in error,
please notify us by telephone 1-919-865-6955 or by electronic mail
david.shapiro@itcdeltacom.com <mailto:david.shapiro@itcdeltacom.com>
immediately.