php-install Digest 6 Jul 2003 09:43:33 -0000 Issue 1450
Topics (messages 11224 through 11229):
Sessions help needed!
11224 by: John Fuller
11227 by: Tony Dietrich
11229 by: Seung Hwan Kang
Help! I have two issues.
11225 by: Michael Pratt
Re: new install of PEAR on 2k - solution
11226 by: jsWalter
Re: How do I compiling MySQL Clients on Windows
11228 by: AzN
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 ---
Hello all,
I am new to php in general and am trying to set up a user authentification system
with mysql. The registration page works well and sends all of the data to the
appropriate table in mysql. However, when I try to get the registered user to log in
and start a session, the system will not remember the session information past the
page. For instance, this page will not work (the one that initially is supposed to
register the session from the login form):
<?
session_start();
$username="chris";
$database="login";
$login = $_POST['login'];
$password = $_POST['password'];
if((!$login) || (!$password)){
echo "Please enter ALL of the information! <br />";
include 'login.php';
exit();
}
mysql_connect(localhost,$username);
@mysql_select_db($database) or die( "Unable to select database");
$sql=mysql_query("SELECT * FROM login WHERE login='$login' AND password='$password'");
$login_check = mysql_num_rows($sql);
if($login_check > 0){
// This is where I register the session
session_register('login');
$_SESSION['login'] = $login;
mysql_close();
include 'success.php';
} else {
echo "You could not be logged in! Either the username and password do not match or
you have not validated your membership!<br />
Please try again!<br />";
include 'login.php';
}
?>
It proceeds to login the user for that page (I know this happens because I have played
around with it looking at the error checks), but it will not display any variable that
resembles "$_SESSION['login']".
The next page sequentially (success.php) looks like this:
<?
session_start();
echo 'Successful login for "$_SESSION['login']"';
?>
Any and all variations of this page come up blank and white whenever the variable
$_SESSION['login'] is called to display. It shows no memory of me registering a
session. Any variation of quotes verse apostrophes changes nothing, so I figure that
either I am blatantly screwing up the session code (possible for I have never written
any sessions before) or my system is not supporting sessions. I have a php4
something, windows, apache 1.3.27 for my home network server, and mysql. Any help on
this problem would be greatly appreciated.
Thanks a lot for your time, John
---------------------------------
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
--- End Message ---
--- Begin Message ---
John
Have you checked the setup of your session management? Check the
setting as reflected in the output from a phpinfo() command. for
example, make sure your session storage path is valid etc. (normally
/tmp if you haven't changed it)
Also check how php is set to access variables. (Look at the setting for
register_variables, and check the manual for an explanation of how this
*may* affect you)
Make sure your test browser is set to accept cookies too ... if the
setting in php.ini for session.use_cookies is ON (value 1) then session
data is transported via cookies, blocking these in the browser means the
data doesn't propogate.
TD
On Sat, 2003-07-05 at 20:39, John Fuller wrote:
> Hello all,
> I am new to php in general and am trying to set up a user authentification
> system with mysql. The registration page works well and sends all of the data to
> the appropriate table in mysql. However, when I try to get the registered user to
> log in and start a session, the system will not remember the session information
> past the page. For instance, this page will not work (the one that initially is
> supposed to register the session from the login form):
>
> <?
> session_start();
> $username="chris";
> $database="login";
>
> $login = $_POST['login'];
> $password = $_POST['password'];
> if((!$login) || (!$password)){
> echo "Please enter ALL of the information! <br />";
> include 'login.php';
> exit();
> }
> mysql_connect(localhost,$username);
> @mysql_select_db($database) or die( "Unable to select database");
> $sql=mysql_query("SELECT * FROM login WHERE login='$login' AND
> password='$password'");
> $login_check = mysql_num_rows($sql);
> if($login_check > 0){
> // This is where I register the session
> session_register('login');
> $_SESSION['login'] = $login;
> mysql_close();
> include 'success.php';
> } else {
> echo "You could not be logged in! Either the username and password do not match or
> you have not validated your membership!<br />
> Please try again!<br />";
> include 'login.php';
> }
> ?>
>
> It proceeds to login the user for that page (I know this happens because I have
> played around with it looking at the error checks), but it will not display any
> variable that resembles "$_SESSION['login']".
> The next page sequentially (success.php) looks like this:
>
> <?
> session_start();
> echo 'Successful login for "$_SESSION['login']"';
> ?>
>
> Any and all variations of this page come up blank and white whenever the variable
> $_SESSION['login'] is called to display. It shows no memory of me registering a
> session. Any variation of quotes verse apostrophes changes nothing, so I figure
> that either I am blatantly screwing up the session code (possible for I have never
> written any sessions before) or my system is not supporting sessions. I have a php4
> something, windows, apache 1.3.27 for my home network server, and mysql. Any help
> on this problem would be greatly appreciated.
> Thanks a lot for your time, John
>
>
>
>
> ---------------------------------
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
--
Tony Dietrich <[EMAIL PROTECTED]>
Transoft Computer Consultants
--- End Message ---
--- Begin Message ---
I assume you use PHP 4.3x with register_globals = off in php.ini.
Please read though my comments in your codes.
I hope this helpful!
John Fuller wrote:
Hello all,
I am new to php in general and am trying to set up a user authentification system with mysql. The registration page works well and sends all of the data to the appropriate table in mysql. However, when I try to get the registered user to log in and start a session, the system will not remember the session information past the page. For instance, this page will not work (the one that initially is supposed to register the session from the login form):
<?
session_start();
$username="chris";
$database="login";
// following codes waste your memory.
// why you need two variables which are doing exactly the same thing
//> $login = $_POST['login'];
//> $password = $_POST['password'];
if((!$_POST["login"]) || (!$_POST["password"])){
echo "Please enter ALL of the information! <br />";
include 'login.php';
exit();
}
mysql_connect(localhost,$username);
@mysql_select_db($database) or die( "Unable to select database");
$sql=mysql_query("SELECT * FROM login WHERE login=' " . $_POST["login"] . "' AND password='" .
$_POST["password"] . "'");
$login_check = mysql_num_rows($sql);
if($login_check > 0){
// This is where I register the session
you don't need session_register....
//> session_register('login');
you may need to get random numbers to set up you login
where did you get $login ? you mean $_POST["login"], ok!
it is not good iead to use the same login!
$_SESSION["login"] = md5(uniqid(rand(), 1));
//> $_SESSION['login'] = $login;
mysql_close();
include 'success.php';
} else {
echo "You could not be logged in! Either the username and password do not match or you have not validated your membership!<br />
Please try again!<br />";
include 'login.php';
}
?>
It proceeds to login the user for that page (I know this happens because I have played around with it looking at the error checks), but it will not display any variable that resembles "$_SESSION['login']".
The next page sequentially (success.php) looks like this:
<?
session_start();
echo 'Successful login for "$_SESSION['login']"';
?>
Any and all variations of this page come up blank and white whenever the variable $_SESSION['login'] is called to display. It shows no memory of me registering a session. Any variation of quotes verse apostrophes changes nothing, so I figure that either I am blatantly screwing up the session code (possible for I have never written any sessions before) or my system is not supporting sessions. I have a php4 something, windows, apache 1.3.27 for my home network server, and mysql. Any help on this problem would be greatly appreciated.
Thanks a lot for your time, John
---------------------------------
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
--- End Message ---
--- Begin Message ---
1. I get this error when trying to run php from a command line.
PHP Warning: Unknown(): Unable to load dynamic library
'N:\php\extensions\msql.dll' - The specified module could not be found.
in Unknown on line 0
2. I get this error trying to pull data from and ftp server:
Warning: file(ftp://iwin.nws.noaa.gov/data/text/FLUS43/KEAX.TXT) [
<http://www.php.net/function.file> function.file]: failed to create
stream: FTP server reports 125 Data connection already open; Transfer
starting. in N:\web\advancewarning\weather\specialwx.php on line 8
Warning: implode() [ <http://www.php.net/function.implode>
function.implode]: Bad arguments. in
N:\web\advancewarning\weather\specialwx.php on line 10
I have searched and searched and searched on the web and have not come
up with a solution for either one of these.
OS Windows 2000/IIS 5
DB: MySQL
PHP 4.3.2
Thanks
Michael Pratt
Philippians 4:13
"I can do all things through Christ which strengtheneth me."
--- End Message ---
--- Begin Message ---
OK, I solved it.
It seems that I **HAVE TO**, **MUST**, **NO CHOICE** place my php.ini in
C:\WINNT (for NT and 2k) or PHP will not find it. This is a hardcoded path
done at compile time.
So, since no ini file, PHP was running on default values, thus it could not
find DB.php since the default path there was 'C:\php4\pears'
So, I copied my php.ini file to C:\winnt, renamed the added php4 to php4x
(just to hide it to see if this would work), restarted my Apache (since the
docs tell me that the PHP process that runs with Apache reads this file once
at Apache startup) and I ran my script.
It now works.
Just thought I'd share to the next stubborn person finds this solution.
Walter
--- End Message ---
--- Begin Message ---
Does the new PHP5 force globals off? Because even if I turn on globals, my
script still does nothing =\.
"Seung Hwan Kang" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> you may need to change php.ini
>
> register_globals = off
>
> eg. $_SERVER["PHP_SELF"]
>
> to
>
> register_globals = on
>
> eg. $PHP_SELF
>
> by the way, register_globals = on is not recommended.
>
> Azn wrote:
> > Whats the error? I got PHP5 to work, except I still have a problem with
my
> > configuration. My PHP files that use $PHP_SELF? does not work... along
with
> > other PHP functions.
> > I have yet to try MySQL on PHP5 because I cant use any of my scripts
that
> > use MySQL!
> >
> > "Seung Hwan Kang" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> >
> >>Help!!!
> >>
> >>I just installed PHP 5.0.0 Beta 1 with Apache on W2K SP4, and I also
> >>read though the postings. The problem is that we have to use mysql
> >>clients which comes with mysql to use PHP. I read following mysql docs,
> >>and I don't have any clue, anyone?
> >>
> >>-----------------------------------------------------------------------
> >>2.6.2.6 Compiling MySQL Clients on Windows
> >>
> >>In your source files, you should include `windows.h' before you include
> >>`mysql.h':
> >>
> >>#if defined(_WIN32) || defined(_WIN64)
> >>#include <windows.h>
> >>#endif
> >>#include <mysql.h>
> >>
> >>You can either link your code with the dynamic `libmysql.lib' library,
> >>which is just a wrapper to load in `libmysql.dll' on demand, or link
> >>with the static `mysqlclient.lib' library.
> >>
> >>Note that as the mysqlclient libraries are compiled as threaded
> >>libraries, you should also compile your code to be multi-threaded!
> >>------------------------------------------------------------------------
> >>
> >>PHP 5.0x installation on W2K (apache module)
> >>
> >>Here is my prog. and conf.
> >>
> >>php-5.0.0b1-Win32.zip
> >>mysql-4.0.13-win.zip
> >>apache_20.046-win32-x86-no_src.msi
> >>
> >>1. edit httpd.conf
> >>
> >>LoadModule php5_module C:\php\sapi\php4apache2.dll
> >>
> >>#
> >># To use PHP scripts
> >>#
> >>AddType application/x-httpd-php .php
> >>AddType application/x-httpd-php-source .phps
> >>
> >>2. copy c:\php\php4ts.dll to c:\winnt\system32
> >>
> >>3. edit c:\winnt\php.ini
> >>
> >>; Windows: "\path1;\path2"
> >>include_path = ".;c:\php\dlls"
> >>
> >>; Directory in which the loadable extensions (modules) reside.
> >>extension_dir = "c:\php\extensions\"
> >>
> >>upload_tmp_dir = c:\tmp
> >>
> >>session.save_path = c:\tmp
> >>
> >
> >
> >
>
--- End Message ---