|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 2 Jul 2004 11:24:02 -0000 Issue 2853
php-general-digest-help
lists.php.net
Date: Fri Jul 02 2004 - 06:24:02 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 2 Jul 2004 11:24:02 -0000 Issue 2853
Topics (messages 189498 through 189530):
Create a function
189498 by: John Taylor-Johnston
189499 by: Jason Barnett
189500 by: Jason Barnett
Online Users
189501 by: Matt Palermo
189502 by: Curt Zirzow
189503 by: zareef ahmed
189508 by: Matt Palermo
PHP Bug ?
189504 by: adwinwijaya
189505 by: zareef ahmed
189518 by: Pierre
HTTP RAW DATA
189506 by: Alan McDonald
189510 by: raditha dissanayake
HTTP_AUTHORIZATION question
189507 by: Alan McDonald
189509 by: raditha dissanayake
189513 by: Alan McDonald
189530 by: Torsten Roehr
Just wanted to say....
189511 by: Brent Clements
php functions avail ?
189512 by: Brent Clark
Re: Online Users[Scanned]
189514 by: Michael Egan
Re: MySQL QUERY Results Not Appearing
189515 by: Harlequin
Reference Scripts: Imaging Database, Recursion, Age Validation, Reg Ex
189516 by: Jason Paschal
Re: MySQL QUERY Results Not Appearing[Scanned]
189517 by: Michael Egan
Problem with session on first page loaded
189519 by: Jordi Canals
189521 by: Angelo binc2
189522 by: Jordi Canals
189524 by: Jordi Canals
189525 by: Lars Torben Wilson
189527 by: Daniel Kullik
189529 by: Jordi Canals
Object is not instatiated on POST, Fatal error
189520 by: Angelo binc2
189526 by: Daniel Kullik
Re: Object is not instatiated on POST, Fatal error SOLVED
189523 by: Angelo binc2
$_SESSION
189528 by: Dennis Koot
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
I have a menu with a bunch of items. How can I clean up this code and push it through a function?
Your basic newbie Question :)
Thanks,
John
<p><a class="nav" href="index.html"><?php
if(stristr($_SERVER["SCRIPT_FILENAME"],"index.html"))
{
echo "<b>Home</b>";
}else{
echo "Home";
}
?></a>
<p><a class="nav" href="index.html"><?php
if(stristr($_SERVER["SCRIPT_FILENAME"],"search.html"))
{
echo "<b>Search</b>";
}else{
echo "Search";
}
?></a>
attached mail follows:
$pages = array('index.html' => 'Home', 'search.html' => 'Search');
function menu($pages) {
foreach ($pages as $page => $desc) {
if (stristr($_SERVER['SCRIPT_FILENAME']), $page) {
echo '<p><a class="nav" href="index.html"</a><b>' .
$desc . '</b></p>';
} else {
echo '<p><a class="nav" href="index.html"</a>' . $desc . '</p>';
}
}
> <p><a class="nav" href="index.html"><?php
> if(stristr($_SERVER["SCRIPT_FILENAME"],"index.html"))
> {
> echo "<b>Home</b>";
> }else{
> echo "Home";
> }
> ?></a>
> <p><a class="nav" href="index.html"><?php
> if(stristr($_SERVER["SCRIPT_FILENAME"],"search.html"))
> {
> echo "<b>Search</b>";
> }else{
> echo "Search";
> }
> ?></a>
attached mail follows:
Jason Barnett wrote:
> $pages = array('index.html' => 'Home', 'search.html' => 'Search');
>
> function menu($pages) {
> foreach ($pages as $page => $desc) {
> if (stristr($_SERVER['SCRIPT_FILENAME']), $page) {
sheesh, $desc should be in between anchors
echo '<p><a class="nav" href="index.html"><b>' . $desc .
'</b></a></p>';
> } else {
echo '<p><a class="nav" href="index.html">' . $desc . '</a></p>';
> }
> }
attached mail follows:
I am trying to keep a MySQL table of all currently online users for a system
I'm making. It's pretty simple to add the username to the list when they
login, but I don't know how to remove their username when they leave (unless
they click the logout button). Basically I want to be able to keep a list
of all currently active users. So if they close out their browser, it will
remove their name from the list (within a reasonable time frame). I'm
basically trying to keep this list of online users for a chat application
I'm building. Anyone have any suggestions on how to do this?
Thanks,
Matt
http://sweetphp.com
attached mail follows:
* Thus wrote Matt Palermo:
> they click the logout button). Basically I want to be able to keep a list
> of all currently active users. So if they close out their browser, it will
> remove their name from the list (within a reasonable time frame). I'm
No can do.
You'll just have to expire people from inactivity.
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!
attached mail follows:
Hi,
If you are using a database on your server you can
do this as follows:
1. Make a table named
active_users(userid,last_access);
2. Record every visit of a user to any page.
3. you can delete the entries from this table on a
condition like ::
delete from active_users where last_access is less
than (currenttime-MAX_EXPIRE_TIME)
4. Display row count of active_users to visitors.
This is just a hint. Some knowldge of php/any database
assumed ,
Revert back with any comment or problem.
zareef ahmed
--- Curt Zirzow <php-general
zirzow.dyndns.org> wrote:
> * Thus wrote Matt Palermo:
> > they click the logout button). Basically I want
> to be able to keep a list
> > of all currently active users. So if they close
> out their browser, it will
> > remove their name from the list (within a
> reasonable time frame). I'm
=====
Zareef Ahmed :: A PHP Developer in Delhi(India).
Homepage :: http://www.zasaifi.com
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail
attached mail follows:
Is it possible to make a table of all logged in users session ids and then
check to see if the session still exists every couple minutes? So every
minute or two, it would go through the table and for each record it would
get the session id, then check that session id to see if it's still in
existance. Is this possible to do?
Thanks,
Matt
http://sweetphp.com
"Zareef Ahmed" <zasaifi
yahoo.com> wrote in message
news:20040702032807.18736.qmail
web13607.mail.yahoo.com...
> Hi,
> If you are using a database on your server you can
> do this as follows:
> 1. Make a table named
> active_users(userid,last_access);
> 2. Record every visit of a user to any page.
> 3. you can delete the entries from this table on a
> condition like ::
> delete from active_users where last_access is less
> than (currenttime-MAX_EXPIRE_TIME)
> 4. Display row count of active_users to visitors.
>
> This is just a hint. Some knowldge of php/any database
> assumed ,
>
> Revert back with any comment or problem.
>
> zareef ahmed
>
>
> --- Curt Zirzow <php-general
zirzow.dyndns.org> wrote:
> > * Thus wrote Matt Palermo:
> > > they click the logout button). Basically I want
> > to be able to keep a list
> > > of all currently active users. So if they close
> > out their browser, it will
> > > remove their name from the list (within a
> > reasonable time frame). I'm
>
>
> =====
> Zareef Ahmed :: A PHP Developer in Delhi(India).
> Homepage :: http://www.zasaifi.com
>
>
>
>
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - 100MB free storage!
> http://promotions.yahoo.com/new_mail
attached mail follows:
Hi...
I found a bug (may be)
I tried to do like this:
$temp = $country_list[$country_symbol['AU']] ;
this didnt work, so I have to change to :
$symbol = $country_symbol['AU'];
$temp = $country_list[$symbol] ;
is this PHP bug ?
--
Best regards,
adwinwijaya mailto:adwinwijaya
yahoo.com.au
attached mail follows:
Hi,
which version on php u r using?
it should work.
(Actually working on own system with php 4.3.2)
try
$country_list[($country_symbol['AU'])];
Zareef Ahmed
--- adwinwijaya <adwinwijaya
yahoo.com.au> wrote:
> Hi...
>
> I found a bug (may be)
> I tried to do like this:
>
> $temp = $country_list[$country_symbol['AU']] ;
> this didnt work, so I have to change to :
>
> $symbol = $country_symbol['AU'];
> $temp = $country_list[$symbol] ;
>
> is this PHP bug ?
>
> --
> Best regards,
> adwinwijaya
> mailto:adwinwijaya
yahoo.com.au
=====
Zareef Ahmed :: A PHP Developer in Delhi(India).
Homepage :: http://www.zasaifi.com
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail
attached mail follows:
Just try this : $temp = $country_list[$country_symbol]['AU'] ;
Seems better :)
Pierre
-----Message d'origine-----
De : adwinwijaya [mailto:adwinwijaya
yahoo.com.au]
Envoyé : vendredi 2 juillet 2004 05:01
À : php-general
lists.php.net
Objet : [PHP] PHP Bug ?
Hi...
I found a bug (may be)
I tried to do like this:
$temp = $country_list[$country_symbol['AU']] ;
this didnt work, so I have to change to :
$symbol = $country_symbol['AU'];
$temp = $country_list[$symbol] ;
is this PHP bug ?
--
Best regards,
adwinwijaya mailto:adwinwijaya
yahoo.com.au
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Does anyone know a way of getting the raw data passed back from a server?
I want to compare the total raw data sent back from Apache with that sent
back from IIS for a particular file. I don;t want any filtering at all and I
need to catch it so I can see it all.
Thanks
Alan
attached mail follows:
Alan McDonald wrote:
>Does anyone know a way of getting the raw data passed back from a server?
>I want to compare the total raw data sent back from Apache with that sent
>back from IIS for a particular file. I don;t want any filtering at all and I
>need to catch it so I can see it all.
>Thanks
>Alan
>
>
>
telnet hostname.com 80
GET /pathname HTTP/1.1
Host: hostname.com
(hit enter here again)
--
Raditha Dissanayake.
---------------------------------------------
http://www.raditha.com/megaupload/upload.php
Sneak past the PHP file upload limits.
attached mail follows:
I have files contained in a download directory (.doc, .xls etc files)
so I can't request authentication on each download from insie the files.
I use authentication against a DB for the rest of the site and all pages are
protected this way.
My only way to protect these download files is to place server
authentication on the folders they are contained in.
To avoid having to manage my users again as server users, does anyone know
how to set the HTTP_AUTHORIZATION variable at time of request?
I don't need high security, so the page setting the HTTP_AUTHORIZATION is
protected but does contain the username and pw couplet for the
HTTP_AUTHORIZATION setting.
Anyone know how? I know we stamped out URL methods of passing username and
pasword couplets but maybe there's another way?
This doesn't work
$_SERVER['HTTP_AUTHORIZATION'] = "Basic
".base64_encode("username:password");
because you can't appear to set this variable, only the server can set it
after it receives a
header('WWW-Authenticate: Basic realm="Test Authentication System"');
header.
thanks
Alan
attached mail follows:
Alan McDonald wrote:
>I have files contained in a download directory (.doc, .xls etc files)
>so I can't request authentication on each download from insie the files.
>I use authentication against a DB for the rest of the site and all pages are
>protected this way.
>My only way to protect these download files is to place server
>authentication on the folders they are contained in.
>
>To avoid having to manage my users again as server users, does anyone know
>how to set the HTTP_AUTHORIZATION variable at time of request?
>I don't need high security, so the page setting the HTTP_AUTHORIZATION is
>protected but does contain the username and pw couplet for the
>HTTP_AUTHORIZATION setting.
>
>
There authorizations settings are supposed to be sent back to the server
by the client so you cannot generate them with php. Your option include
using .htpasswd that checks against a mysql database (please ask in the
apache list.) and keeping your downloads 'offline' and delivering them
through a php script. The second suggested has been discussed to
exaustion in this list in the past.
--
Raditha Dissanayake.
---------------------------------------------
http://www.raditha.com/megaupload/upload.php
Sneak past the PHP file upload limits.
attached mail follows:
> >I have files contained in a download directory (.doc, .xls etc files)
> >so I can't request authentication on each download from insie the files.
> >I use authentication against a DB for the rest of the site and all pages
are
> >protected this way.
> >My only way to protect these download files is to place server
> >authentication on the folders they are contained in.
> >
> >To avoid having to manage my users again as server users, does anyone
know
> >how to set the HTTP_AUTHORIZATION variable at time of request?
> >I don't need high security, so the page setting the HTTP_AUTHORIZATION is
> >protected but does contain the username and pw couplet for the
> >HTTP_AUTHORIZATION setting.
> >
> >
> There authorizations settings are supposed to be sent back to the server
> by the client so you cannot generate them with php. Your option include
> using .htpasswd that checks against a mysql database (please ask in the
> apache list.) and keeping your downloads 'offline' and delivering them
> through a php script. The second suggested has been discussed to
> exaustion in this list in the past.
>
> --
> Raditha Dissanayake.
Thanks - I suppose I was thinking of building (via PHP) and client JS script
to set the property at the client. But anyway the offline way is the
answer - shold have thought of that.
Alan
attached mail follows:
"Alan McDonald" <alan
meta.com.au> wrote in message
news:20040702064119.66393.qmail
pb1.pair.com...
> > >I have files contained in a download directory (.doc, .xls etc files)
> > >so I can't request authentication on each download from insie the
files.
> > >I use authentication against a DB for the rest of the site and all
pages
> are
> > >protected this way.
> > >My only way to protect these download files is to place server
> > >authentication on the folders they are contained in.
> > >
> > >To avoid having to manage my users again as server users, does anyone
> know
> > >how to set the HTTP_AUTHORIZATION variable at time of request?
> > >I don't need high security, so the page setting the HTTP_AUTHORIZATION
is
> > >protected but does contain the username and pw couplet for the
> > >HTTP_AUTHORIZATION setting.
> > >
> > >
> > There authorizations settings are supposed to be sent back to the server
> > by the client so you cannot generate them with php. Your option include
> > using .htpasswd that checks against a mysql database (please ask in the
> > apache list.) and keeping your downloads 'offline' and delivering them
> > through a php script. The second suggested has been discussed to
> > exaustion in this list in the past.
> >
> > --
> > Raditha Dissanayake.
>
> Thanks - I suppose I was thinking of building (via PHP) and client JS
script
> to set the property at the client. But anyway the offline way is the
> answer - shold have thought of that.
> Alan
Hi Alan,
check PEAR's HTTP_Download for serving files for download from a protected
directory:
http://pear.php.net/package/HTTP_Download
Regards,
Torsten Roehr
attached mail follows:
PHP 5 rocks. Thanks to all of the developers who have spent their time and efforts creating such an awesome application development language.
Sincerely,
Brent Clements
Innovative PHP Solutions, L.L.C.
attached mail follows:
Hi
I would like to know if these functions (for php 5)are already uploaded,
available on the php.net sites, in terms of research and or support.
http://zend.com/php5/whats-new.php
Kind Regards
Brent Clark
MSN: brentgclark
hotmail.com
eMail: bclark
eccotours.biz
Cell: +27 82 701 7827
Work No: +27 21 683 0069
Fax No: +27 21 683 6137
attached mail follows:
Matt,
The most comprehensive example of this is provided by PhpBB (www.phpbb.com).
This application pretty much follows the logic you've set out.
HTH,
Michael Egan
-----Original Message-----
From: Matt Palermo [mailto:webmaster
sweetphp.com]
Sent: 02 July 2004 06:13
To: php-general
lists.php.net
Subject: Re: [PHP] Online Users[Scanned]
Is it possible to make a table of all logged in users session ids and then
check to see if the session still exists every couple minutes? So every
minute or two, it would go through the table and for each record it would
get the session id, then check that session id to see if it's still in
existance. Is this possible to do?
Thanks,
Matt
http://sweetphp.com
"Zareef Ahmed" <zasaifi
yahoo.com> wrote in message
news:20040702032807.18736.qmail
web13607.mail.yahoo.com...
> Hi,
> If you are using a database on your server you can
> do this as follows:
> 1. Make a table named
> active_users(userid,last_access);
> 2. Record every visit of a user to any page.
> 3. you can delete the entries from this table on a
> condition like ::
> delete from active_users where last_access is less
> than (currenttime-MAX_EXPIRE_TIME)
> 4. Display row count of active_users to visitors.
>
> This is just a hint. Some knowldge of php/any database
> assumed ,
>
> Revert back with any comment or problem.
>
> zareef ahmed
>
>
> --- Curt Zirzow <php-general
zirzow.dyndns.org> wrote:
> > * Thus wrote Matt Palermo:
> > > they click the logout button). Basically I want
> > to be able to keep a list
> > > of all currently active users. So if they close
> > out their browser, it will
> > > remove their name from the list (within a
> > reasonable time frame). I'm
>
>
> =====
> Zareef Ahmed :: A PHP Developer in Delhi(India).
> Homepage :: http://www.zasaifi.com
>
>
>
>
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - 100MB free storage!
> http://promotions.yahoo.com/new_mail
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
The information contained in this email (and in any attachments sent with it) is confidential. It is intended for the addressee only. Access to this email by anyone else is unintended and unauthorized.
If you are not the original addressee, 3tc asks you to please maintain confidentiality. If you have received this email in error please notify 3tc immediately by replying to it, then destroy any copies and delete it from your computer system.
Any use, dissemination, forwarding, printing or copying of this email by anyone except the addressee in the normal course of his/her business, is strictly prohibited. 3tc owns the copyright in this email and any document created by us and assert the right to be identified as the author of it. Copyright has not been transferred to the addressee.
We protect our systems with Sophos Anti-virus -
www.sophos.com
attached mail follows:
Craig. Thanks for the response and sorry I've been delayed in getting back
to you.
I put a new page together and dropped all the peripheral code and this is
what I ended up with:
<?php
/* MySQL Connection Variables */
$host="localhost";
$user="arras_WebMaster";
$password="qwerty";
$dbase="arras_Members";
/* MySQL Connection String */
$Connection=mysql_connect ("$host", "$user", "$password")
or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("$dbase");
/* Display Current Members */
echo "\n\n\n\n\n";
echo "<h3>active members should appear here</h3>";
$query = mysql_query("SELECT * FROM RegisteredMembers") or die("could not
execute query");
while($result = mysql_fetch_array($query)){
echo $result['UserID'];
}
?>
Still no joy though. Any ideas...?
--
-----------------------------
Michael Mason
Arras People
www.arraspeople.co.uk
-----------------------------
"Craig Donnelly" <craig
deconstructor.net> wrote in message
news:20040630130116.76568.qmail
pb1.pair.com...
> $result is an array that has to be fetched...try this
>
> echo "<h3>active members should appear here</h3>";
>
> $query = mysql_query("SELECT * FROM RegisteredMembers") or die("could not
> execute query");
> while($result = mysql_fetch_array($query)){
> echo $result['YOUR_DB_FIELDNAME'];
> }
>
> change YOUR_DB_FIELDNAME' to whatever the fields are you are querying.
> you could also:
>
> <pre>
> <?php print_r($result); ?>
> </pre>
>
> HTH
>
> Craig
>
> "Harlequin" <michael.mason
arraspeople.co.uk> wrote in message
> news:20040630114124.8114.qmail
pb1.pair.com...
> > Hi all...
> >
> > Despite being able to make a connection to the server and execute a
query
> I
> > am unable to do this through PHP using the following commands:
> >
> > echo "<h3>active members should appear here</h3>";
> > $query = "SELECT * FROM RegisteredMembers";
> > $result = mysql_query($query) or die ("could not execute query");
> > echo "$result";
> >
> > Any ideas...?
> >
> > --
> > -----------------------------
> > Michael Mason
> > Arras People
> > www.arraspeople.co.uk
> > -----------------------------
attached mail follows:
Some things crop up while coding that I do not often use, so that I tend to
forget the proper way to handle them and end up researching it and going
through the same inoperable code again and again until I end up with
something that works.
Finally decided to host the code on my site and thought someone else might
benefit from it.
Storing Images in MySQL and Displaying them with PHP:
http://www.dailymedication.com/modules.php?name=Forums&file=viewtopic&t=15
Recursion (Word Permutations/Jumble):
http://www.dailymedication.com/modules.php?name=Forums&file=viewtopic&t=11
Age Validation (Determine Age from Birthdate):
http://www.dailymedication.com/modules.php?name=Forums&file=viewtopic&t=14
Regular Expressions (Finding links in Web Code/ Gallery Image Ripper):
http://www.dailymedication.com/modules.php?name=Forums&file=viewtopic&t=13
They all have working demos except for the Imaging Database stuff. Hope
these can help somebody. Plan to be adding more soon.
_________________________________________________________________
MSN Life Events gives you the tips and tools to handle the turning points in
your life. http://lifeevents.msn.com
attached mail follows:
Don't know that this will work but it might help isolate the problem:
/* MySQL Connection Variables */
$host="localhost";
$user="arras_WebMaster";
$password="qwerty";
$dbase="arras_Members";
/* MySQL Connection String */
if(!$dbConnect =
mysql_connect ("$host", "$user", "$password"))
{
echo "Couldn't connect to the database server: ".mysql_error()."<br />";
}
if(!$dbSelect =
mysql_select_db ("$dbase"))
{
echo "Couldn't select the database: ".mysql_error()."<br />";
}
if(!$query =
mysql_query("SELECT * FROM RegisteredMembers"))
{
echo "Couldn't execute query: ".mysql_error()."<br />";
}
else
{
while($result = mysql_fetch_array($query))
{
echo $result['UserID'];
}
}
HTH,
Michael Egan
-----Original Message-----
From: Harlequin [mailto:michael.mason
arraspeople.co.uk]
Sent: 02 July 2004 09:34
To: php-general
lists.php.net
Subject: [PHP] Re: MySQL QUERY Results Not Appearing[Scanned]
Craig. Thanks for the response and sorry I've been delayed in getting back
to you.
I put a new page together and dropped all the peripheral code and this is
what I ended up with:
<?php
/* MySQL Connection Variables */
$host="localhost";
$user="arras_WebMaster";
$password="qwerty";
$dbase="arras_Members";
/* MySQL Connection String */
$Connection=mysql_connect ("$host", "$user", "$password")
or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("$dbase");
/* Display Current Members */
echo "\n\n\n\n\n";
echo "<h3>active members should appear here</h3>";
$query = mysql_query("SELECT * FROM RegisteredMembers") or die("could not
execute query");
while($result = mysql_fetch_array($query)){
echo $result['UserID'];
}
?>
Still no joy though. Any ideas...?
--
-----------------------------
Michael Mason
Arras People
www.arraspeople.co.uk
-----------------------------
The information contained in this email (and in any attachments sent with it) is confidential. It is intended for the addressee only. Access to this email by anyone else is unintended and unauthorized.
If you are not the original addressee, 3tc asks you to please maintain confidentiality. If you have received this email in error please notify 3tc immediately by replying to it, then destroy any copies and delete it from your computer system.
Any use, dissemination, forwarding, printing or copying of this email by anyone except the addressee in the normal course of his/her business, is strictly prohibited. 3tc owns the copyright in this email and any document created by us and assert the right to be identified as the author of it. Copyright has not been transferred to the addressee.
We protect our systems with Sophos Anti-virus -
www.sophos.com
attached mail follows:
Hi all,
I have an extrange problem with the session cookie:
In all my pages there I have this two lines to start the session:
session_name('jcwse');
session_start();
When I access my website, at any page, everytyhink works OK, and the
session cookie is set with no problem except for links.
In the fist page I aceess, all links are appended with the session ID.
I mean that in every link, the ?jcwse=da22311212 ... is appended. This
occurs just on the load of first page (not any else). If I reload the
page, then links are formed correctly with no session ID (And sessions
works perfect).
This problem only arises on my ISP hosting (Linux+Apache 1.3) and does
not show on my devel computer (Windows+Apache 2.0). I've been searching
the manual, but found no explanation about that.
Any help will be really welcome.
Regards,
Jordi.
attached mail follows:
shouldn't session_start() come first?
also remember that your devel computer might have different settings in
the PHP.ini file to that of your ISP, probably register_globals is set
to off. I would check it.
HTH
Angelo
>>> Jordi Canals <llistes
jcanals.net> 7/2/2004 11:14:28 AM >>>
Hi all,
I have an extrange problem with the session cookie:
In all my pages there I have this two lines to start the session:
session_name('jcwse');
session_start();
When I access my website, at any page, everytyhink works OK, and the
session cookie is set with no problem except for links.
In the fist page I aceess, all links are appended with the session ID.
I mean that in every link, the ?jcwse=da22311212 ... is appended. This
occurs just on the load of first page (not any else). If I reload the
page, then links are formed correctly with no session ID (And sessions
works perfect).
This problem only arises on my ISP hosting (Linux+Apache 1.3) and does
not show on my devel computer (Windows+Apache 2.0). I've been searching
the manual, but found no explanation about that.
Any help will be really welcome.
Regards,
Jordi.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--------------------------------------------------------------------
Disclaimer
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is
intended for the attention and use only of the addressee.
Should you have received this e-mail in error, please delete
and destroy it and any attachments thereto immediately.
Under no circumstances will the Cape Technikon or the sender
of this e-mail be liable to any party for any direct, indirect,
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911
attached mail follows:
Jordi Canals wrote:
> This problem only arises on my ISP hosting (Linux+Apache 1.3) and does
> not show on my devel computer (Windows+Apache 2.0). I've been searching
> the manual, but found no explanation about that.
Sorry forgot it: The two platforms run PHP 4.3.7
Thanks again,
Jordi.
attached mail follows:
Angelo, thanks for your comments.
session_name must go before session_start.
I think register_globals has nothing to do with session cookies. I
always work with register_globals = off as recommended.
About the cookie params (In PHP.INI) I checked them on the two platforms
with phpinfo() and are exactly the same.
I'm relly lost with this issue. It is not a browser problem, because
browsers are accepting (and saving) the cookies. I tested it with
Firefox, MSIE and Mozilla, and always have the same issue.
Why the first page loaded, and only the first one, passes the session ID
on the URL? I think perhaps could be something related with the system
trying to read the cookie on the same page that first created it. But
don't find a way to solve it.
Thanks for your time,
Jordi.
Angelo binc2 wrote:
> shouldn't session_start() come first?
>
> also remember that your devel computer might have different settings in
> the PHP.ini file to that of your ISP, probably register_globals is set
> to off. I would check it.
>
> HTH
> Angelo
>
>
>>>>Jordi Canals <llistes
jcanals.net> 7/2/2004 11:14:28 AM >>>
>
> session_name('jcwse');
> session_start();
>
attached mail follows:
Jordi Canals wrote:
> Angelo, thanks for your comments.
>
> session_name must go before session_start.
>
> I think register_globals has nothing to do with session cookies. I
> always work with register_globals = off as recommended.
>
> About the cookie params (In PHP.INI) I checked them on the two platforms
> with phpinfo() and are exactly the same.
>
> I'm relly lost with this issue. It is not a browser problem, because
> browsers are accepting (and saving) the cookies. I tested it with
> Firefox, MSIE and Mozilla, and always have the same issue.
>
> Why the first page loaded, and only the first one, passes the session ID
> on the URL? I think perhaps could be something related with the system
> trying to read the cookie on the same page that first created it. But
> don't find a way to solve it.
>
> Thanks for your time,
> Jordi.
Was your binary compiled with --enable-trans-sid? If so, I imagine the
explanation would be something along the lines that because the session
manager doesn't know whether you have cookies enabled until it gets a cookie
back, it uses trans_sid. On the second page view, it gets a cookie, and
starts using cookies instead.
No research went into this; it's just a guess. ;)
Torben
attached mail follows:
Source: http://www.php.net/set_cookie
[snip]
Once the cookies have been set, they can be accessed on the next page
load with the $_COOKIE or $HTTP_COOKIE_VARS arrays.
[/snip]
Since PHP cannot access a cookie right after it has been set PHP cannot
be sure if the cookie has been accepted on client-side (user might deny
cookies). Therefore PHP chooses another way of storing the current
session id until next page has been loaded (GET-param, hidden-field...).
Daniel
Jordi Canals wrote:
> Hi all,
>
> I have an extrange problem with the session cookie:
>
> In all my pages there I have this two lines to start the session:
>
> session_name('jcwse');
> session_start();
>
> When I access my website, at any page, everytyhink works OK, and the
> session cookie is set with no problem except for links.
>
> In the fist page I aceess, all links are appended with the session ID.
> I mean that in every link, the ?jcwse=da22311212 ... is appended. This
> occurs just on the load of first page (not any else). If I reload the
> page, then links are formed correctly with no session ID (And sessions
> works perfect).
>
> This problem only arises on my ISP hosting (Linux+Apache 1.3) and does
> not show on my devel computer (Windows+Apache 2.0). I've been searching
> the manual, but found no explanation about that.
>
> Any help will be really welcome.
> Regards,
> Jordi.
--
WWE e-commerce IT GmbH
Eiffestrasse 462, D-20537 Hamburg
Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50
attached mail follows:
Lars Torben Wilson wrote:
>>
>> About the cookie params (In PHP.INI) I checked them on the two
>> platforms with phpinfo() and are exactly the same.
>>
>
> Was your binary compiled with --enable-trans-sid? If so, I imagine the
> explanation would be something along the lines that because the session
> manager doesn't know whether you have cookies enabled until it gets a
> cookie
> back, it uses trans_sid. On the second page view, it gets a cookie, and
> starts using cookies instead.
>
Thanks Torben,
The binary is not compiled with --enable-trans-sid. But I've seen that
the ISP changed a param in the PHP.INI, and they changed
session.use_trans_sid setting it to 1.
I tested setting it on my devel computer and really now the problem
reproduces here :) So I think this could be really the problem.
Now I should talk to the provider to not set this parameter to ON by
default, because the security risk on it (As stated on the manuals).
On the sessions manuals, says that this parameter can only be set on
PHP_INI_SYSTEM and PHP_INI_PERDIR, but in the ini_set() manual says it
can be set in PHP_INI_ALL. I think the first is correct and the second
is not as I tried setting it with ini_set with no result.
I cannot understand this change from the provider as it is a security
risk as the comments in PHP.INI says:
; trans sid support is disabled by default.
; Use of trans sid may risk your users security.
; Use this option with caution.
; - User may send URL contains active session ID
; to other person via. email/irc/etc.
; - URL that contains active session ID may be stored
; in publically accessible computer.
; - User may access your site with the same session ID
; always using URL stored in browser's history or bookmarks.
Thanks for your valuable help. Now *I've seen where the problem is*, and
I can look for a solution.
Regards,
Jordi.
attached mail follows:
Hi all,
I have a PHP file. and when it loads it creates an object for my
database :
include("db_class.inc");
fine.
I make a couple of calls to the database class this is also working
fine. Then I post the page but to itself and then I go into a function
(lets call it xfunction) which is ONLY accessed once the form has been
posted and I get a fatal error:
Fatal error: Call to a member function on a non-object in c:\program
files\apache group\apache\htdocs\zero\opdocument.php on line 98
From what I've read my database object is not instatiated and therefore
is in theory not an object. However I check before I go into the
xfunction to see if the object is set and it is, then once in the
function (where the error occurs) I test to see if the object is set
again and it tells me that the object is not set.
What could be the reason for the object not being set once being called
in the function (xfunction)?? I have googled and many people get this
error but not many have a clear solution.
Any help or suggestions will be appreciated.
Thanks
Angelo
--------------------------------------------------------------------
Disclaimer
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is
intended for the attention and use only of the addressee.
Should you have received this e-mail in error, please delete
and destroy it and any attachments thereto immediately.
Under no circumstances will the Cape Technikon or the sender
of this e-mail be liable to any party for any direct, indirect,
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911
attached mail follows:
You might as well add a reference of your db-object to global scope.
[code]
$GLOBALS['_db_object'] =& $db;
[/code]
Then you could access it anywhere in your code like this:
[code]
$GLOBALS['_db_object']->sumbitQuery($query);
[/code]
Daniel
Angelo Binc2 wrote:
> Ok guys, I have fixed the problem and its a really easy fix. basically
> the object was out of scope and therefore PHP treated my object name as
> a new variable and therefore it obvioulsy was not set because it is a
> new variable. SO the way I got it working was to just call the code
> directly and not put it in a function, or you could pass the object to
> the function as an argument.
>
> Hope this can help others in the future!
> Angelo
>
>
>>>>"Jason Paschal" <j_paschal
hotmail.com> 7/2/2004 11:22:04 AM >>>
>
> would it be necessary/possible to make it global inside the function?
>
>
> ---------------------------------------------------------
> http://www.dailymedication.com - Everything you didn't know you
> needed
> until you went there and said to yourself, "What did I do before I
> visited
> DailyMedication.com?" and another part of you said, "It does not
> matter."
>
>
>
>
>
>
>>From: "Angelo binc2" <binc2
ctech.ac.za>
>>To: <php-general
lists.php.net>
>>Subject: [PHP] Object is not instatiated on POST, Fatal error
>>Date: Fri, 02 Jul 2004 11:14:53 +0200
>>
>>Hi all,
>>
>>I have a PHP file. and when it loads it creates an object for my
>>database :
>>
>>include("db_class.inc");
>>
>>fine.
>>
>>I make a couple of calls to the database class this is also working
>>fine. Then I post the page but to itself and then I go into a
>
> function
>
>>(lets call it xfunction) which is ONLY accessed once the form has
>
> been
>
>>posted and I get a fatal error:
>>
>>Fatal error: Call to a member function on a non-object in c:\program
>>files\apache group\apache\htdocs\zero\opdocument.php on line 98
>>
>
>>From what I've read my database object is not instatiated and
> therefore
>
>>is in theory not an object. However I check before I go into the
>>xfunction to see if the object is set and it is, then once in the
>>function (where the error occurs) I test to see if the object is set
>>again and it tells me that the object is not set.
>>
>>What could be the reason for the object not being set once being
>
> called
>
>>in the function (xfunction)?? I have googled and many people get this
>>error but not many have a clear solution.
>>
>>Any help or suggestions will be appreciated.
>>Thanks
>>
>>Angelo
>>--------------------------------------------------------------------
>>Disclaimer
>>This e-mail transmission contains confidential information,
>>which is the property of the sender.
>>The information in this e-mail or attachments thereto is
>>intended for the attention and use only of the addressee.
>>Should you have received this e-mail in error, please delete
>>and destroy it and any attachments thereto immediately.
>>Under no circumstances will the Cape Technikon or the sender
>>of this e-mail be liable to any party for any direct, indirect,
>>special or other consequential damages for any use of this e-mail.
>>For the detailed e-mail disclaimer please refer to
>>http://www.ctech.ac.za/polic or call +27 (0)21 460 3911
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
>
> _________________________________________________________________
> MSN Life Events gives you the tips and tools to handle the turning
> points in
> your life. http://lifeevents.msn.com
>
> --------------------------------------------------------------------
> Disclaimer
> This e-mail transmission contains confidential information,
> which is the property of the sender.
> The information in this e-mail or attachments thereto is
> intended for the attention and use only of the addressee.
> Should you have received this e-mail in error, please delete
> and destroy it and any attachments thereto immediately.
> Under no circumstances will the Cape Technikon or the sender
> of this e-mail be liable to any party for any direct, indirect,
> special or other consequential damages for any use of this e-mail.
> For the detailed e-mail disclaimer please refer to
> http://www.ctech.ac.za/polic or call +27 (0)21 460 3911
--
WWE e-commerce IT GmbH
Eiffestrasse 462, D-20537 Hamburg
Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50
attached mail follows:
Ok guys, I have fixed the problem and its a really easy fix. basically
the object was out of scope and therefore PHP treated my object name as
a new variable and therefore it obvioulsy was not set because it is a
new variable. SO the way I got it working was to just call the code
directly and not put it in a function, or you could pass the object to
the function as an argument.
Hope this can help others in the future!
Angelo
>>> "Jason Paschal" <j_paschal
hotmail.com> 7/2/2004 11:22:04 AM >>>
would it be necessary/possible to make it global inside the function?
---------------------------------------------------------
http://www.dailymedication.com - Everything you didn't know you
needed
until you went there and said to yourself, "What did I do before I
visited
DailyMedication.com?" and another part of you said, "It does not
matter."
>From: "Angelo binc2" <binc2
ctech.ac.za>
>To: <php-general
lists.php.net>
>Subject: [PHP] Object is not instatiated on POST, Fatal error
>Date: Fri, 02 Jul 2004 11:14:53 +0200
>
>Hi all,
>
>I have a PHP file. and when it loads it creates an object for my
>database :
>
>include("db_class.inc");
>
>fine.
>
>I make a couple of calls to the database class this is also working
>fine. Then I post the page but to itself and then I go into a
function
>(lets call it xfunction) which is ONLY accessed once the form has
been
>posted and I get a fatal error:
>
>Fatal error: Call to a member function on a non-object in c:\program
>files\apache group\apache\htdocs\zero\opdocument.php on line 98
>
>From what I've read my database object is not instatiated and
therefore
>is in theory not an object. However I check before I go into the
>xfunction to see if the object is set and it is, then once in the
>function (where the error occurs) I test to see if the object is set
>again and it tells me that the object is not set.
>
>What could be the reason for the object not being set once being
called
>in the function (xfunction)?? I have googled and many people get this
>error but not many have a clear solution.
>
>Any help or suggestions will be appreciated.
>Thanks
>
>Angelo
>--------------------------------------------------------------------
>Disclaimer
>This e-mail transmission contains confidential information,
>which is the property of the sender.
>The information in this e-mail or attachments thereto is
>intended for the attention and use only of the addressee.
>Should you have received this e-mail in error, please delete
>and destroy it and any attachments thereto immediately.
>Under no circumstances will the Cape Technikon or the sender
>of this e-mail be liable to any party for any direct, indirect,
>special or other consequential damages for any use of this e-mail.
>For the detailed e-mail disclaimer please refer to
>http://www.ctech.ac.za/polic or call +27 (0)21 460 3911
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
_________________________________________________________________
MSN Life Events gives you the tips and tools to handle the turning
points in
your life. http://lifeevents.msn.com
--------------------------------------------------------------------
Disclaimer
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is
intended for the attention and use only of the addressee.
Should you have received this e-mail in error, please delete
and destroy it and any attachments thereto immediately.
Under no circumstances will the Cape Technikon or the sender
of this e-mail be liable to any party for any direct, indirect,
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911
attached mail follows:
Hello all,
i have a question concerning the $_SESSION stuff.
i have a domain registered with online webspace on this webspace i have put a litte bit of code that will send the visitor's of the website to my server using a frame. I open one frame full-screen size and i let it open MY_IP/base/index.php as page.
i then have a login page which uses $_SESSION and which sends you to either MY_IP/login1/index.php or MY_IP/login2/index.php depending on your username. (which are stored in mysql)
this all works fine. i get redirected to the right page and all. but then on the new page the session doesn't work anymore.
so the user gets a error for not being logged in and returns to the login page at /base
AND here's the strange thing.. when i open it using the http://MY_IP link it all works great.
it just doesn't when i use the frame via my hosting provider. So i tried to make a fram on my site which is exactly the same as the frame at the hosting provider. And it all works great aswell. just not when i place the frame at my Hosting Prov.
has anybody got a clue how to do this?
thanx
Dennis
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]