php-windows Digest 13 Jul 2002 18:13:24 -0000 Issue 1239
Topics (messages 14748 through 14753):
php4 session variables HELP!!
14748 by: Kit Kerbel
14749 by: Scott Carr
Re: PHP meetup [CROSS-POST] Meet other PHP Developers in Your Area
14750 by: J. Alden Gillespy
Re: Available PHP Whitepapers
14751 by: Tracker1
Re: How to dectect if a file exist in specific Folder
14752 by: toby z
SESSION QUESTION
14753 by: Kit Kerbel
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
I've looked through the other posts just to let you know. Here's the code I
have, not sure why it's not working:
page1.php:
<?
session_start();
if (($mode=="logoff"))
{
$_SESSION['userid'] = "";
}
if (($error=="badusername"))
{
$_SESSION['errorstring'] = "You have entered an incorrect UserId";
}
else
if (($error=="badpassword"))
{
$_SESSION['errorstring'] = "You have entered an incorrect password";
}
if (($userid!="") && ($password!=""))
{
$query="SELECT * FROM tblUser WHERE dUserID='".$userid."'";
$rs = odbc_do($connection, $query);
$numrows = odbc_num_rows($rs);
while(odbc_fetch_row($rs))
{
$_SESSION['dUserID'] = odbc_result($rs, "dUserID");
$_SESSION['dPassword'] = odbc_result($rs, "dPassword");
}
if ($numrows == 0)
{
$_SESSION['error'] = "badusername";
}
else
if ($dPassword!=$Password)
{
$_SESSION['error'] = "badpassword";
$_SESSION['acct'] = $_SESSION['wUserID'];
header("Location: login.php");
}
else
{
$_SESSION['userid'] = strtoupper($_SESSION['userid']);
}
header("Location: my_account.php");
}
else
{
?>
<html>
<head>
</head>
<body>
<? include("includes/header.php"); ?>
***This is the form that sends wUserID and wPassword to login.php
<form name="form1" method="post" action="login.php">
<table width="77%" border="0"
cellspacing="0" cellpadding="0" align="center">
<tr>
<td colspan="2"><img
src="images/username.gif" width="71" height="11"><br>
<input type="text" name="wUserID"
size="11">
</td>
</tr>
<tr>
<td colspan="2" height="3"><img
src="images/spacer.gif" width="12" height="5"></td>
</tr>
<tr>
<td colspan="2"><img
src="images/password.gif" width="71" height="11"><br>
<input type="password"
name="wPassword" size="11">
</td>
</tr>
<tr>
<td colspan="2"><img
src="images/spacer.gif" width="12" height="5"></td>
</tr>
<tr>
<td colspan="2">
<input type="image" img
src="images/button_signin.gif" width="66" height="12" border="0">
</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2">
<input type="checkbox" name="checkbox"
value="checkbox">
Save for next visit</td>
</tr>
</table>
</form>
</body>
</html>
<?
}
?>
page2.php:
<?
session_start();
$_SESSION['wUserID'] = $_REQUEST["wUserID"];
$_SESSION['wPassword'] = $_REQUEST["wPassword"];
//echo "User ID is ".$_SESSION["wUserID"];
//echo "<br>";
//echo "Password is ".$_SESSION["wPassword"];
if (($_SESSION['wUserID']!="") && ($_SESSION['wPassword']!=""))
{
$query = "SELECT * FROM tblUser WHERE dUserID='".$_SESSION['wUserID']."'";
$rs = odbc_exec($connection, $query);
$numrows = odbc_num_rows($rs);
while(odbc_fetch_row($rs))
{
$_SESSION['USERID'] = odbc_result($rs, "dUserID");
$_SESSION['PASSWORD'] = odbc_result($rs, "dPassword");
}
if ($numrows==0)
{
$_SESSION['error'] = "badusername";
header("Location: login.php");
}
else
if ($_SESSION['PASSWORD']!=$_SESSION['wPassword'])
{
$_SESSION['error'] = "badpassword";
$_SESSION['acct'] = $_SESSION['wUserID'];
header("Location: login.php");
}
else
{
$_SESSION['displayid'] = strtoupper($_SESSION['wUserID']);
}
header("Location: my_account.php");
}
else
{
echo "DIDN'T WORK";
}
?>
page3.php:(this is the page that can't get values on)
<?
session_start();
echo "value is ".$_SESSION['USERID'];
?>
_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com
--- End Message ---
--- Begin Message ---
It looks like everything is OK, except where you check $userid and $password.
You are not using _SESSION for those variables so it appears they will never be set.
--
Scott Carr
OpenOffice.org
Documentation Maintainer
http://documentation.openoffice.org/
Quoting Kit Kerbel <[EMAIL PROTECTED]>:
> I've looked through the other posts just to let you know. Here's the code I
>
> have, not sure why it's not working:
>
> page1.php:
> <?
> session_start();
>
>
> if (($mode=="logoff"))
> {
> $_SESSION['userid'] = "";
> }
>
>
> if (($error=="badusername"))
> {
> $_SESSION['errorstring'] = "You have entered an incorrect UserId";
> }
> else
> if (($error=="badpassword"))
> {
> $_SESSION['errorstring'] = "You have entered an incorrect password";
> }
>
>
> if (($userid!="") && ($password!=""))
> {
>
>
> $query="SELECT * FROM tblUser WHERE dUserID='".$userid."'";
> $rs = odbc_do($connection, $query);
> $numrows = odbc_num_rows($rs);
>
> while(odbc_fetch_row($rs))
> {
> $_SESSION['dUserID'] = odbc_result($rs, "dUserID");
> $_SESSION['dPassword'] = odbc_result($rs, "dPassword");
> }
>
> if ($numrows == 0)
> {
> $_SESSION['error'] = "badusername";
> }
> else
> if ($dPassword!=$Password)
> {
> $_SESSION['error'] = "badpassword";
> $_SESSION['acct'] = $_SESSION['wUserID'];
> header("Location: login.php");
> }
> else
> {
>
> $_SESSION['userid'] = strtoupper($_SESSION['userid']);
> }
>
> header("Location: my_account.php");
> }
> else
> {
>
>
> ?>
>
>
> <html>
> <head>
> </head>
>
>
> <body>
> <? include("includes/header.php"); ?>
>
>
> ***This is the form that sends wUserID and wPassword to login.php
>
>
> <form name="form1" method="post" action="login.php">
> <table width="77%" border="0"
> cellspacing="0" cellpadding="0" align="center">
> <tr>
> <td colspan="2"><img
> src="images/username.gif" width="71" height="11"><br>
> <input type="text" name="wUserID"
> size="11">
> </td>
> </tr>
> <tr>
> <td colspan="2" height="3"><img
> src="images/spacer.gif" width="12" height="5"></td>
> </tr>
> <tr>
> <td colspan="2"><img
> src="images/password.gif" width="71" height="11"><br>
> <input type="password"
> name="wPassword" size="11">
> </td>
> </tr>
> <tr>
> <td colspan="2"><img
> src="images/spacer.gif" width="12" height="5"></td>
> </tr>
> <tr>
> <td colspan="2">
> <input type="image" img
> src="images/button_signin.gif" width="66" height="12" border="0">
> </td>
> </tr>
> <tr>
> <td colspan="2"> </td>
> </tr>
> <tr>
> <td colspan="2">
> <input type="checkbox" name="checkbox"
>
> value="checkbox">
> Save for next visit</td>
> </tr>
> </table>
> </form>
>
> </body>
> </html>
> <?
> }
> ?>
>
> page2.php:
> <?
> session_start();
>
>
> $_SESSION['wUserID'] = $_REQUEST["wUserID"];
> $_SESSION['wPassword'] = $_REQUEST["wPassword"];
>
>
> //echo "User ID is ".$_SESSION["wUserID"];
> //echo "<br>";
> //echo "Password is ".$_SESSION["wPassword"];
>
>
> if (($_SESSION['wUserID']!="") && ($_SESSION['wPassword']!=""))
> {
>
> $query = "SELECT * FROM tblUser WHERE dUserID='".$_SESSION['wUserID']."'";
> $rs = odbc_exec($connection, $query);
> $numrows = odbc_num_rows($rs);
>
> while(odbc_fetch_row($rs))
> {
> $_SESSION['USERID'] = odbc_result($rs, "dUserID");
> $_SESSION['PASSWORD'] = odbc_result($rs, "dPassword");
> }
>
> if ($numrows==0)
> {
> $_SESSION['error'] = "badusername";
> header("Location: login.php");
> }
> else
> if ($_SESSION['PASSWORD']!=$_SESSION['wPassword'])
> {
> $_SESSION['error'] = "badpassword";
> $_SESSION['acct'] = $_SESSION['wUserID'];
> header("Location: login.php");
> }
> else
> {
>
> $_SESSION['displayid'] = strtoupper($_SESSION['wUserID']);
> }
>
>
> header("Location: my_account.php");
>
> }
> else
> {
> echo "DIDN'T WORK";
> }
> ?>
>
>
> page3.php:(this is the page that can't get values on)
>
> <?
> session_start();
>
> echo "value is ".$_SESSION['USERID'];
>
>
> ?>
>
>
>
>
> _________________________________________________________________
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/
--- End Message ---
--- Begin Message ---
I'm a programming geek. So, my chances of getting a date are
virutally...... nothing?
:)
J. Alden Gillespy (DJ Rage)
Broadcasting on Test Pattern Radio
Shock Rock! Every Sunday 5-8pm edt (21-0 gmt)
http://www.thetestpattern.com
----- Original Message -----
From: "C. Hendrie" <[EMAIL PROTECTED]>
To: "'Jay Blanchard'" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Friday, July 12, 2002 10:26 PM
Subject: RE: [PHP-WIN] PHP meetup [CROSS-POST] Meet other PHP Developers in
Your Area
> Tho, when you think about it, most PHP developers COULD use a dating
> service. :)
>
> Seriously tho, this is a good idea. Thanks for the info Jay.
> ~ Chris
> D.O.D
>
> -----Original Message-----
> From: Jay Blanchard [mailto:[EMAIL PROTECTED]]
> Sent: Friday, July 12, 2002 12:24 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED];
> [EMAIL PROTECTED]; [EMAIL PROTECTED];
> [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: [PHP-WIN] PHP meetup [CROSS-POST] Meet other PHP Developers in
> Your Area
>
> No, it's not a dating service.... :)
> Want to meet other PHP developers in your area? Check out:
>
> http://php.meetup.com/
>
> Pretty nifty idea... especially given the lack of user groups in the
> U.S.
> [/snip]
>
> I thought for others who had not seen this I would post this. There is
> probably already a user group in your area if you live near a major
> city.
> According to the PHPusergroups.org web site
> [http://www.phpusergroups.org/groups.phtml?menu=groups] there 189 PHP
> user
> groups in 52 countries.
>
> Jay
>
> "Chaos, panic & disorder.my work here is done!"
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
To: Mikey
"Mikey" <[EMAIL PROTECTED]> wrote in message...
> > A larger company will see the cost of licensing compared to the talent
> > pool available, as well as the fact that you have "someone to call" when
> > you need support for 2K-Server/IIS/ASP/MS-SQL... that you won't quite
> > get any cheaper for Linux/Apache/PHP/mySQL.
>
> However, anyone that has worked for a large company who pays for this
> "someone to call" facility will tell you that it isn't actally that good -
> not when you need it to be... I have found these ng's to be a much better
> source of help.
Yeah, the 15seconds asp list is probably the best resource for that,
and these groups get a lot of traffic, although sometimes with a bunch
of scarcasm interlaced... Don't get me wrong, I do like what php has
to offer, and php-gtk is just cool as hell.. if only there was a pre-
compiler for it, to hide code, for say a php-gtk app..
--
=======================================================================
Michael J. Ryan - tracker1[*at*]theroughnecks.com
Roughneck BBS: http://www.theroughnecks.net telnet://theroughnecks.net
=======================================================================
Y!: aztracker1 - aim: azTracker1 - icq: 4935386 - msn: see email
One program for aim/icq/yahoo/msn/irc - http://www.trillian.cc/
--- Synchronet NewsLink v1.00 Beta
* Roughneck BBS - www.theroughnecks.net - telnet://theroughnecks.net
--- End Message ---
--- Begin Message ---
hi Jack
I had a folder which contain some pdf report, the
> > name of the Report will be
> > :
> > xxx.xxx.20020702.pdf.
pleez do tell me how u accomplished thid date format
coz i ve been tryint (fo mre then a week now) to save
my files with a time/date post/prefix
n i get a horrid digit like 1026191598- '$firstName'
> > Here is what i want to do :
> > 1. there will be a Form let user to submit the
> date
> > of reports that he / she
> > wants to view.
now i want my form to pick up the system date ...
can any one tell me how i can do that ?????
> > 2. the php will get the xxx.xxx from a mysql
> > database and add the date at
> > the end of the string as the file name.
> > 3. If the filename exist in that specific folder,
> > then it will show a
> > hyperlink for each exist report, otherwise nothing
> > will shows up!
ppl ... help plz ...
toby .....
seconding jack ......
__________________________________________________
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com
--- End Message ---
--- Begin Message ---
Is there a bug in php4.2.1 dealing with sessions? I am using $_SESSION to
set my session variables and it will not work. Can anyone offer examples
that they have used that work? I am going insane.
Thanx,
Kit
_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com
--- End Message ---