|
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 10 Jun 2003 04:34:09 -0000 Issue 2108
php-general-digest-help
lists.php.net
Date: Mon Jun 09 2003 - 23:34:09 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 10 Jun 2003 04:34:09 -0000 Issue 2108
Topics (messages 150773 through 150846):
Re: post data?
150773 by: Rasmus Lerdorf
150782 by: Rasmus Lerdorf
150846 by: Rasmus Lerdorf
Little help
150774 by: Mike Mannakee
150786 by: Pavel Janda
Re: Yearbook script?
150775 by: Edward Peloke
Re: Automatic Headers and Footers
150776 by: Wendell Brown
150777 by: Paul Chvostek
sessions, IE and pop-up windows
150778 by: Emma Jane Hogbin
150792 by: Emma Jane Hogbin
150801 by: Kevin Stone
150803 by: Emma Jane Hogbin
150805 by: Jason k Larson
150811 by: Kevin Stone
150813 by: Emma Jane Hogbin
Session not working?
150779 by: Frank Keessen
150780 by: Emma Jane Hogbin
150781 by: Frank Keessen
150784 by: Leif K-Brooks
150787 by: Emma Jane Hogbin
150789 by: Frank Keessen
150790 by: Frank Keessen
150793 by: Emma Jane Hogbin
150795 by: Frank Keessen
how to count memory used by a script
150783 by: Peter Berglund
150788 by: Philip Olson
PHP/Apache - Problem with REMOTE_USER var.
150785 by: Pavel Janda
Re: condensing a list from MySQL
150791 by: Pavel Janda
reading/writing the value of an <UL>/<LI> text value
150794 by: Bruce Douglas
150796 by: Leif K-Brooks
Re: access a static variable of a class
150797 by: Esteban Fernández
Another Session Question
150798 by: Pushpinder Singh Garcha
150800 by: CPT John W. Holmes
howto write a DOS file output into a file...
150799 by: Ferhat BINGOL
150802 by: R'twick Niceorgaw
150825 by: CPT John W. Holmes
150826 by: Ferhat BINGOL
php and flash chat program
150804 by: Matt Palermo
150815 by: Richard Baskett
150834 by: Matt Palermo
Re: move_uploaded_file > 1MB
150806 by: Maurício Valente
Question about current() and key()
150807 by: Jim Lucas
150809 by: Lars Torben Wilson
PHP using Linter...
150808 by: Scott Fletcher
150817 by: Ralph
Re: Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in f:\.....\none.php on line 286
150810 by: Marcelo Luiz de Laia
Cook Book Script
150812 by: Wendell Brown
150816 by: electroteque
Bitwise flagging in mysql database
150814 by: Mike Mannakee
solved Re: [PHP] sessions, IE and pop-up windows
150818 by: Emma Jane Hogbin
150820 by: Jason k Larson
150827 by: Kevin Stone
Is It Possible to Tell PHP To Output x Decimal Places Per Float?
150819 by: Dan Anderson
150822 by: CPT John W. Holmes
150824 by: Lars Torben Wilson
Rather unrelated
150821 by: Thomas Hochstetter
2 Questions Re: Anonymous Functions
150823 by: Timothy Boronczyk
Want to move M$Access frontend to PHP/MYSQL. Need suggestions...
150828 by: Apollo (Carmel Entertainment)
PHP vs. jsp, advice please
150829 by: Jean-Christian Imbeault
150840 by: Joel Rees
150841 by: Jean-Christian Imbeault
150844 by: DvDmanDT
.htaccess
150830 by: Ryan A
150842 by: CPT John W. Holmes
fetch then put record?
150831 by: Steve B.
150832 by: Jean-Christian Imbeault
150838 by: Jean-Christian Imbeault
working with sessions
150833 by: Matt Palermo
150835 by: Jean-Christian Imbeault
150836 by: Matt Palermo
150837 by: Jean-Christian Imbeault
Detecting Bots...
150839 by: Steven Kallstrom
150845 by: Evan Nemerson
Sendmail Problem
150843 by: Uma Shankari T.
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:
Apache-1.3.x with whatever version of PHP you want.
-Rasmus
On Tue, 10 Jun 2003, Billy wrote:
> Thx a lot John.
>
> Red Hat 8.0 is bundled with Apache 2 + php 4.2....
> if i needed to use Red Hat 8.0, except upgrading both program to the latest
> version (which as u said....not recommended) , any other combination of
> apache + php do u recommend?
>
> thx a lot!
> HPS
>
>
> "John W. Holmes" <holmes072000
charter.net> ???
> news:001f01c32e79$e769b190$7c02a8c0
coconut ???...
> > It's an Apache2 / PHP bug. Upgrade to the latest versions of each
> > (although Apache2 and PHP are still not recommended).
> >
> > ---John W. Holmes...
> >
> > Amazon Wishlist: http://www.amazon.com/o/registry/3BEXC84AB3A5E
> >
> > PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> > today. http://www.phparch.com/
> >
> > > -----Original Message-----
> > > From: esctoday.com | Wouter van Vliet [mailto:wouter
esctoday.com]
> > > Sent: Monday, June 09, 2003 7:21 AM
> > > To: HPS; php-general
lists.php.net
> > > Subject: RE: [PHP] post data?
> > >
> > > in that case,.. I guess something is going wrong in your checkform
> > > javascript function .. probably you attach the name and value (by
> > mistake)
> > > to eachother in there ....
> > >
> > > -----Oorspronkelijk bericht-----
> > > Van: HPS [mailto:hpsquare
yahoo.com]
> > > Verzonden: maandag 9 juni 2003 12:16
> > > Aan: php-general
lists.php.net
> > > Onderwerp: Re: [PHP] post data?
> > >
> > >
> > > the form tag is
> > > <form action="syn2.php" method="post" onSubmit="return
> > checkform(this);">
> > >
> > > Thx!
> > > HPS
> > >
> > >
> > >
> > > "Esctoday.Com | Wouter Van Vliet" <wouter
esctoday.com> wrote in
> > message
> > > news:OLECLCPPBLAAHPKBKILKGEOICDAA.wouter
esctoday.com...
> > > > What does your form tag look like?
> > > >
> > > > -----Oorspronkelijk bericht-----
> > > > Van: HPS [mailto:hpsquare
yahoo.com]
> > > > Verzonden: maandag 9 juni 2003 9:32
> > > > Aan: php-general
lists.php.net
> > > > Onderwerp: [PHP] post data?
> > > >
> > > >
> > > > Dear all,
> > > >
> > > > i am using PHP 4.2.2 with Red Hat 8.0
> > > > i had a form in <form.php>, which has a form like this
> > > > <input class=text type=text name=course_id size=10 maxlength=10
> > > > value="">
> > > > say, i enter "6" in the text box.
> > > >
> > > > After i click the submit button and i echo the value of "course_id",
> > it
> > > > returned "6course_id=6", NOT "6"
> > > > do you have any idea?
> > > >
> > > >
> > > > thx a lot!
> > > > HPS
> > > >
> > > >
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
On Mon, 9 Jun 2003, Michael A Smith wrote:
> Get Apache 1.3.27 (I think). and PHP. Follow the instructions on the PHP
> site! I found that those are the only one's I could get to work. Any PHP
> version using --with-apxs=/usr/local/apache I couldn't get to work. Also
> take a look at what you'll need first and make sure you know what to
> compile with!
You have to specify the full path to the apxs script. ie.
--with-apxs=/usr/local/apache/bin/apxs or wherever it is.
-Rasmus
attached mail follows:
Well, this is how millions of people build PHP. It works pretty well.
-Rasmus
On Mon, 9 Jun 2003, Michael A Smith wrote:
> Yes I know, but I've never been able to get it to work. I just followed
> the instructions on the PHP site.
>
> -Michael
> On Mon, 2003-06-09 at 10:34, Rasmus Lerdorf wrote:
> > On Mon, 9 Jun 2003, Michael A Smith wrote:
> > > Get Apache 1.3.27 (I think). and PHP. Follow the instructions on the PHP
> > > site! I found that those are the only one's I could get to work. Any PHP
> > > version using --with-apxs=/usr/local/apache I couldn't get to work. Also
> > > take a look at what you'll need first and make sure you know what to
> > > compile with!
> >
> > You have to specify the full path to the apxs script. ie.
> > --with-apxs=/usr/local/apache/bin/apxs or wherever it is.
> >
> > -Rasmus
>
attached mail follows:
Hi, I have a script that records the languange and time zone of every user
that comes to the site. Currently I am testing this and need some people to
just surf a couple pages in the site, from around the world. If you don't
mind, please just see a page or two on this site. It doesn't matter
anything else (you like it, do anything, etc) , I just need some browsers
from outside the US to surf a page or two.
www.basementideas.com/index.php
TIA
Mike
attached mail follows:
I've just visited your web from Czech rep... Does your script work OK? :o))
Pavel
"Mike Mannakee" <mike
basementideas.com> píše v diskusním příspěvku
news:20030609171247.37154.qmail
pb1.pair.com...
> Hi, I have a script that records the languange and time zone of every user
> that comes to the site. Currently I am testing this and need some people
to
> just surf a couple pages in the site, from around the world. If you don't
> mind, please just see a page or two on this site. It doesn't matter
> anything else (you like it, do anything, etc) , I just need some browsers
> from outside the US to surf a page or two.
>
> www.basementideas.com/index.php
>
> TIA
>
> Mike
>
>
attached mail follows:
not based off anything...wrote it
-----Original Message-----
From: MIKE YRABEDRA [mailto:php
323ent.com]
Sent: Monday, June 09, 2003 9:38 AM
To: PHP List
Subject: Re: [PHP] Yearbook script?
on 6/9/03 8:58 AM, Edward Peloke at epeloke
echoman.com wrote:
What script is this based off?
> I agree, this would be like most gallery type pages...
>
> I also did a small demo page for a used vehicle dealership that could be
> used....you just substitute the people for the cars...:)
>
> http:\\www.peloke.webhop.org
>
>
>
> -----Original Message-----
> From: John W. Holmes [mailto:holmes072000
charter.net]
> Sent: Monday, June 09, 2003 7:12 AM
> To: 'MIKE YRABEDRA'; 'PHP List'
> Subject: RE: [PHP] Yearbook script?
>
>
>> Anyone know of a good yearbook script? One that will show a listing of
>> photos, that when clicked on, will bring up a page with more info on
> the
>> individual?
>
> I'm sure any gallery type script could be used for this. Just get one
> that allows comments for the pictures. Maybe adapt the commenting a
> little to support certain fields.
>
> ---John W. Holmes...
>
> Amazon Wishlist: http://www.amazon.com/o/registry/3BEXC84AB3A5E
>
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
+--------------------------------------------+
Mike Yrabedra (President)
323 Incorporated
Home of MacDock, MacAgent and MacSurfshop
+--------------------------------------------+
W: http://www.323inc.com/
P: 770.382.1195
F: 734.448.5164
E: mike
323inc.com
I: ichatmacdock
+--------------------------------------------+
"Whatever you do, work at it with all your heart,
as working for the Lord, not for men."
~Colossians 3:23 <{{{><
+--------------------------------------------+
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
On Mon, 9 Jun 2003 07:21:45 -0500, Jay Blanchard wrote:
>I see what you are saying, but how much modification is too much? :)
>
>OK, another way....the HTML could be read into a page (fopen())
>containing the header/footer stuff. You'd have to deal with
>identification of which page you want loaded, but shouldn't be too hard.
Here is what I ended up doing....
http://marc.theaimsgroup.com/?l=php-general&m=105484835424858&w=2
attached mail follows:
On Mon, Jun 09, 2003 at 12:26:24PM -0500, Wendell Brown wrote:
> >
> >OK, another way....the HTML could be read into a page (fopen())
> >containing the header/footer stuff. You'd have to deal with
> >identification of which page you want loaded, but shouldn't be too hard.
>
> Here is what I ended up doing....
>
> http://marc.theaimsgroup.com/?l=php-general&m=105484835424858&w=2
That works. I did something similar, not to add headers and footers,
but to implement a simple templating system -- the HTML pages had text
like __FIRSTNAME__ and __LASTNAME__ which had to be replaced with
session variables. The site owner had some very strange ideas about how
they wanted to design their site, and wanted to do the whole thing in
FrontPage, yet customize pages using data from a PHP-based login.
The basic idea is that the customer uploads pages (a few hundred of 'em)
all under their DocumentRoot. I've got stuff like:
$base="http://www.example.com"; // URL *without* trailing backslash
$qu="'" . '"';
$href="(<a href=[$qu ]*)($base)?/?([^$qu ]+\.html?)";
$repl="\\1/show.php?what=\\3";
if (!file_exists($f)) {
header("Location: $base/show.php?err=missing%20file:%20$f");
} else
if ($fd=file_get_contents($f)) {
$fd = str_replace("__FIRSTNAME__", $_SESSION['fname'], $fd);
$fd = str_replace("__LISTNAME__", $_SESSION['lname'], $fd);
print $fd;
}
You could of course hide the URLs behind mod_rewrite with something like
RewriteEngine On
RewriteRule ^/.+\.php - [L]
RewriteRule ^/(.+\.html) /show.php\?f=$1 [L]
You could also make the arrays of the str_replace search and replace
fields, if you had multiple things to change.
But back to your issue -- Instead of __FIRSTNAME__ and __LASTNAME__,
just manipulate <body> and </body>, as you did with output buffering.
I'm not sure if either solution has a performance edge over the other.
In both cases, each of the HTML and PHP file get loaded once per page
view, and whether the translation happens in PHP's output buffering or
via mod_rewrite is probably insignificant.
As always, multiple solutions to every problem. :)
--
Paul Chvostek <paul
it.ca>
Operations / Abuse / Whatever
it.canada, hosting and development http://www.it.ca/
attached mail follows:
I'm working on a Calendar script right now that uses sessions. When a user clicks
on the "edit" button a pop-up window appears so that the full calendar is
still available along with the new event that's being editted. It works
fine in Mozilla but in IE the pop-up window appears to log out the user.
I've tried starting a new session_name in the pop-up window, but it doesn't
seem to be working. It looks (basically) like this:
edit.php
session_name("edit");
include("validate.php");
if (session_name != "edit") {
session_name("website");
}
session_start();
Any suggestions on how I can use pop-up windows for editing and maintain a
person's logged in status?
thanks!
emma
--
Emma Jane Hogbin
[[ 416 417 2868 ][ www.xtrinsic.com ]]
attached mail follows:
On Mon, Jun 09, 2003 at 09:26:45PM +0200, winst0n wrote:
> Hi, try to write a
session_start(); in ur popup windows... it will call the
> last session opened by the client.
I already do that....both the parent and the main window call a file which
has the session_start in it. I believe the problem is that I have two
windows open with the same session information. According to this page,
tha'ts a problem:
http://ca.php.net/manual/en/function.session-start.php
benja at benja dot be
15-Apr-2003 12:45
Just for info, session_start() blocks if another PHP using the same
session is still running in background. It seems it's waiting the other
PHP to finish... and sometimes it can be a problem. Create 2 different
sessions by setting 2 different names : session_name() solve the problem.
Benja.
--
Emma Jane Hogbin
[[ 416 417 2868 ][ www.xtrinsic.com ]]
attached mail follows:
----- Original Message -----
From: "Emma Jane Hogbin" <emmajane
xtrinsic.com>
To: <php-general
lists.php.net>
Sent: Monday, June 09, 2003 1:08 PM
Subject: Re: [PHP] sessions, IE and pop-up windows
> On Mon, Jun 09, 2003 at 09:26:45PM +0200, winst0n wrote:
> > Hi, try to write a
session_start(); in ur popup windows... it will call
the
> > last session opened by the client.
>
> I already do that....both the parent and the main window call a file which
> has the session_start in it. I believe the problem is that I have two
> windows open with the same session information. According to this page,
> tha'ts a problem:
>
> http://ca.php.net/manual/en/function.session-start.php
> benja at benja dot be
> 15-Apr-2003 12:45
> Just for info, session_start() blocks if another PHP using the same
> session is still running in background. It seems it's waiting the other
> PHP to finish... and sometimes it can be a problem. Create 2 different
> sessions by setting 2 different names : session_name() solve the problem.
>
> Benja.
I'll bet you're using an onLoad command to launch the popup aren't you. Use
Output Buffering to keep stdout from flushing before the parent script dies.
If my assumption about onLoad is correct then that'll solve your problem.
HTH,
Kevin
attached mail follows:
On Mon, Jun 09, 2003 at 02:27:50PM -0600, Kevin Stone wrote:
> I'll bet you're using an onLoad command to launch the popup aren't you. Use
> Output Buffering to keep stdout from flushing before the parent script dies.
> If my assumption about onLoad is correct then that'll solve your problem.
Um not "onload" the link looks like this:
<a onclick='openEdit("add=event&cellid=10"); return false;'
onkeypress='openEdit("add=event&cellid=10"); return
false;'href='edit.php?add=event&cellid=10'>Add an event</a>
and the javascript looks like this:
// its goal is to EDIT any type of content in a pop-up window
function openEdit(params) {
var url = "editsmall.php?"+params;
var ewin = window.open(url, "ewin", "width=500,height=300,toolbar=0,resizable=1,scrollbars=1");
ewin.focus();
}
--
Emma Jane Hogbin
[[ 416 417 2868 ][ www.xtrinsic.com ]]
attached mail follows:
Try adding the SessionID to the URL.
openEdit("add=event&cellid=10&<?PHP echo Session_Name ().'='.Session_ID();?>");
or a little better:
$thisSession = Session_Name().'='.Session_ID();
openEdit("add=event&cellid=10&<?PHP echo $thisSession;?>");
Then of course the editsmall.php must still do a session_start somewhere.
--
Jason k Larson
Emma Jane Hogbin wrote:
> On Mon, Jun 09, 2003 at 02:27:50PM -0600, Kevin Stone wrote:
>
>>I'll bet you're using an onLoad command to launch the popup aren't you. Use
>>Output Buffering to keep stdout from flushing before the parent script dies.
>>If my assumption about onLoad is correct then that'll solve your problem.
>
>
> Um not "onload" the link looks like this:
> <a onclick='openEdit("add=event&cellid=10"); return false;'
> onkeypress='openEdit("add=event&cellid=10"); return
> false;'href='edit.php?add=event&cellid=10'>Add an event</a>
>
> and the javascript looks like this:
> // its goal is to EDIT any type of content in a pop-up window
> function openEdit(params) {
> var url = "editsmall.php?"+params;
> var ewin = window.open(url, "ewin", "width=500,height=300,toolbar=0,resizable=1,scrollbars=1");
> ewin.focus();
> }
>
>
attached mail follows:
----- Original Message -----
From: "Emma Jane Hogbin" <emmajane
xtrinsic.com>
To: <php-general
lists.php.net>
Sent: Monday, June 09, 2003 2:32 PM
Subject: Re: [PHP] sessions, IE and pop-up windows
> On Mon, Jun 09, 2003 at 02:27:50PM -0600, Kevin Stone wrote:
> > I'll bet you're using an onLoad command to launch the popup aren't you.
Use
> > Output Buffering to keep stdout from flushing before the parent script
dies.
> > If my assumption about onLoad is correct then that'll solve your
problem.
>
> Um not "onload" the link looks like this:
> <a onclick='openEdit("add=event&cellid=10"); return false;'
> onkeypress='openEdit("add=event&cellid=10"); return
> false;'href='edit.php?add=event&cellid=10'>Add an event</a>
>
> and the javascript looks like this:
> // its goal is to EDIT any type of content in a pop-up window
> function openEdit(params) {
> var url = "editsmall.php?"+params;
> var ewin = window.open(url, "ewin",
"width=500,height=300,toolbar=0,resizable=1,scrollbars=1");
> ewin.focus();
> }
Blows that theory away. :-)
I still believe what's happening is the edit script is being executed before
the parent script has died. Are you doing some kind of looping background
process or something that's keeping the parent script from exiting?
As far as I know you cannot have two instances of the same session running
simultaneously. The way I understand sessions it should be systemically
impossible to do so unless there's some kind of flock'ing option for session
files that I don't know of. Of course that doesn't mean PHP won't let you
try.
You need to avoid this situation by -> killing that parent script<- before
the edit script is launched. You can ensure this with output buffering as I
suggested before. Becuase you're controlling the output there won't be a
button to press until the parent script has died.
ob_start();
//script here//
ob_end_flush();
HTH,
Kevin
attached mail follows:
On Mon, Jun 09, 2003 at 03:23:16PM -0600, Jason k Larson wrote:
> or a little better:
> $thisSession = Session_Name().'='.Session_ID();
> openEdit("add=event&cellid=10&<?PHP echo $thisSession;?>");
This plus a reboot did the trick, THANKYOU!!
> Then of course the editsmall.php must still do a session_start somewhere.
Already doing that part. :)
--
Emma Jane Hogbin
[[ 416 417 2868 ][ www.xtrinsic.com ]]
attached mail follows:
Hi,
I'm I missing something? I'm trying to get data into a session (booking.php) and then print it off by a second page (test3.php).
booking.php:
$_REQUEST["submit"]=isset($_REQUEST["submit"])?$_REQUEST["submit"]:"";
if($_REQUEST['submit']!="")
{
$dater=$_POST['$dater'];
$aantalvol=$_POST['$aantalvol'];
$aantalkind=$_POST['$aantalkind'];
$aantalvol=addslashes($_POST['aantalvol']);
session_start();
$_SESSION['dater'] = $dater;
$_SESSION['aantalvol'] = $aantalvol;
$_SESSION['aantalkind'] = $aantalkind;
$_SESSION['1pk'] = $eenpk;
$_SESSION['2pk'] = $tweepk;
header( "Location: test3.php" );
}
test3.php
<?
session_start();
echo $_SESSION['aantalvol'];
?>
I get page not be displayed...
Even with the full URL in the HEADER section it doesn't work..
Some one can help me please?
Txs,
Frank
attached mail follows:
On Mon, Jun 09, 2003 at 08:08:18PM +0200, Frank Keessen wrote:
> I get page not be displayed...
> Even with the full URL in the HEADER section it doesn't work..
What's the URL of the page it's trying to find? i.e. what does the
location bar on your browser say? Is it the right URL, or is it looking in
the wrong directory for test3.php?
emma
--
Emma Jane Hogbin
[[ 416 417 2868 ][ www.xtrinsic.com ]]
attached mail follows:
Hi,
It's pointing towards the booking.php
(which is the 'sender' page..)
Exact error message: The Page cannot be displayed..
So it's no 404.. I think..
Frank
----- Original Message -----
From: "Emma Jane Hogbin" <emmajane
xtrinsic.com>
To: <php-general
lists.php.net>
Sent: Monday, June 09, 2003 8:10 PM
Subject: Re: [PHP] Session not working?
> On Mon, Jun 09, 2003 at 08:08:18PM +0200, Frank Keessen wrote:
> > I get page not be displayed...
> > Even with the full URL in the HEADER section it doesn't work..
>
> What's the URL of the page it's trying to find? i.e. what does the
> location bar on your browser say? Is it the right URL, or is it looking in
> the wrong directory for test3.php?
>
> emma
>
> --
> Emma Jane Hogbin
> [[ 416 417 2868 ][ www.xtrinsic.com ]]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
Use a browser that displays errors properly, like Mozilla.
Frank Keessen wrote:
>Hi,
>
>It's pointing towards the booking.php
>
>(which is the 'sender' page..)
>
>Exact error message: The Page cannot be displayed..
>
>So it's no 404.. I think..
>
>Frank
>----- Original Message -----
>From: "Emma Jane Hogbin" <emmajane
xtrinsic.com>
>To: <php-general
lists.php.net>
>Sent: Monday, June 09, 2003 8:10 PM
>Subject: Re: [PHP] Session not working?
>
>
>
>
>>On Mon, Jun 09, 2003 at 08:08:18PM +0200, Frank Keessen wrote:
>>
>>
>>>I get page not be displayed...
>>>Even with the full URL in the HEADER section it doesn't work..
>>>
>>>
>>What's the URL of the page it's trying to find? i.e. what does the
>>location bar on your browser say? Is it the right URL, or is it looking in
>>the wrong directory for test3.php?
>>
>>emma
>>
>>--
>>Emma Jane Hogbin
>>[[ 416 417 2868 ][ www.xtrinsic.com ]]
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>
>
>
>
>
--
The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
attached mail follows:
On Mon, Jun 09, 2003 at 08:18:10PM +0200, Frank Keessen wrote:
> It's pointing towards the booking.php
> (which is the 'sender' page..)
> Exact error message: The Page cannot be displayed..
> So it's no 404.. I think..
Ah. So it's not even moving off the original page... I don't have your
original script and it's not in the archives yet; however, are you using
the right syntax for the header function?
header("Location: http://www.example.com/");
Note that the Location must be uppercase L.
--
Emma Jane Hogbin
[[ 416 417 2868 ][ www.xtrinsic.com ]]
attached mail follows:
Hi,
The orignal code was in the first mail; again;
$_REQUEST["submit"]=isset($_REQUEST["submit"])?$_REQUEST["submit"]:"";
if($_REQUEST['submit']!="")
{
$dater=$_POST['$dater'];
$aantalvol=$_POST['$aantalvol'];
$aantalkind=$_POST['$aantalkind'];
$aantalvol=addslashes($_POST['aantalvol']);
session_start();
$_SESSION['dater'] = $dater;
$_SESSION['aantalvol'] = $aantalvol;
$_SESSION['aantalkind'] = $aantalkind;
$_SESSION['1pk'] = $eenpk;
$_SESSION['2pk'] = $tweepk;
header( "Location: test3.php" );
}
test3.php
<?
session_start();
echo $_SESSION['aantalvol'];
?>
Txs for the help,
Frank
----- Original Message -----
From: "Emma Jane Hogbin" <emmajane
xtrinsic.com>
To: <php-general
lists.php.net>
Sent: Monday, June 09, 2003 8:49 PM
Subject: Re: [PHP] Session not working?
> On Mon, Jun 09, 2003 at 08:18:10PM +0200, Frank Keessen wrote:
> > It's pointing towards the booking.php
> > (which is the 'sender' page..)
> > Exact error message: The Page cannot be displayed..
> > So it's no 404.. I think..
>
> Ah. So it's not even moving off the original page... I don't have your
> original script and it's not in the archives yet; however, are you using
> the right syntax for the header function?
>
> header("Location: http://www.example.com/");
>
> Note that the Location must be uppercase L.
>
> --
> Emma Jane Hogbin
> [[ 416 417 2868 ][ www.xtrinsic.com ]]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
Hi,
The original code:
----- Original Message -----
From: "Emma Jane Hogbin" <emmajane
xtrinsic.com>
To: <php-general
lists.php.net>
Sent: Monday, June 09, 2003 8:49 PM
Subject: Re: [PHP] Session not working?
> On Mon, Jun 09, 2003 at 08:18:10PM +0200, Frank Keessen wrote:
> > It's pointing towards the booking.php
> > (which is the 'sender' page..)
> > Exact error message: The Page cannot be displayed..
> > So it's no 404.. I think..
>
> Ah. So it's not even moving off the original page... I don't have your
> original script and it's not in the archives yet; however, are you using
> the right syntax for the header function?
>
> header("Location: http://www.example.com/");
>
> Note that the Location must be uppercase L.
>
> --
> Emma Jane Hogbin
> [[ 416 417 2868 ][ www.xtrinsic.com ]]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
On Mon, Jun 09, 2003 at 09:01:49PM +0200, Frank Keessen wrote:
> The orignal code was in the first mail; again;
> $_REQUEST["submit"]=isset($_REQUEST["submit"])?$_REQUEST["submit"]:"";
> if($_REQUEST['submit']!="")
> {
> $dater=$_POST['$dater'];
> $aantalvol=$_POST['$aantalvol'];
> $aantalkind=$_POST['$aantalkind'];
> $aantalvol=addslashes($_POST['aantalvol']);
> session_start();
> $_SESSION['dater'] = $dater;
> $_SESSION['aantalvol'] = $aantalvol;
> $_SESSION['aantalkind'] = $aantalkind;
> $_SESSION['1pk'] = $eenpk;
> $_SESSION['2pk'] = $tweepk;
>
> header( "Location: test3.php" );
> }
>
> test3.php
>
> <?
> session_start();
> echo $_SESSION['aantalvol'];
> ?>
It looks to me like you must have an error somewhere else. I pasted this
PHP into a blank page and then tested it with:
http://localhost/testing/test.php?submit=you
the page correctly re-directed to test3.php
The header() function can ONLY re-direct the browser to another page if
*nothing* else has been printed/echoed to the browser. Can you check to
make sure that this is the very first thing that is called on the page?
emma
--
Emma Jane Hogbin
[[ 416 417 2868 ][ www.xtrinsic.com ]]
attached mail follows:
Dear all,
Fixed it!
Typed again the Header syntax and it worked!
Also installed Mozilla!
Thanks for the help!
Frank
----- Original Message -----
From: "Frank Keessen" <fkeessen
planet.nl>
To: "Emma Jane Hogbin" <emmajane
xtrinsic.com>; <php-general
lists.php.net>
Sent: Monday, June 09, 2003 8:59 PM
Subject: Re: [PHP] Session not working?
> Hi,
>
> The original code:
>
> ----- Original Message -----
> From: "Emma Jane Hogbin" <emmajane
xtrinsic.com>
> To: <php-general
lists.php.net>
> Sent: Monday, June 09, 2003 8:49 PM
> Subject: Re: [PHP] Session not working?
>
>
> > On Mon, Jun 09, 2003 at 08:18:10PM +0200, Frank Keessen wrote:
> > > It's pointing towards the booking.php
> > > (which is the 'sender' page..)
> > > Exact error message: The Page cannot be displayed..
> > > So it's no 404.. I think..
> >
> > Ah. So it's not even moving off the original page... I don't have your
> > original script and it's not in the archives yet; however, are you using
> > the right syntax for the header function?
> >
> > header("Location: http://www.example.com/");
> >
> > Note that the Location must be uppercase L.
> >
> > --
> > Emma Jane Hogbin
> > [[ 416 417 2868 ][ www.xtrinsic.com ]]
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
How do I count the memory usage of a script/page.
attached mail follows:
On Mon, 9 Jun 2003, Peter Berglund wrote:
> How do I count the memory usage of a script/page.
As of 4.3.2, if you compile PHP with --enable-memory-limit
you may use memory_get_usage(). This is documented and
will show up when the next PHP manual is built.
Regards,
Philip
attached mail follows:
Hello everyone,
I have installed apache and PHP (using Windows :o(() on two computers, where
httpd.conf and php.ini seem to be same. But, on one mashine is variable
REMOTE_USER working well and on the second it is empty all the time, however
apache auth.-function works well on both of them. (The computer, whitch is
OK is using apache 1.32 and the bad comp. is using apache 2.0.X(?)... - if
this information can help anyone to find the mistake)...
Any idea, where is the problem?
Thank you very much for any help!!!
Pavel
attached mail follows:
> How about just fixing this so it'll be easier in the future? You should
> have a separate table where each "keyword" is in it's own row, with or
> without duplicates (depends if you want a "count" of how often the
> keyword is used), and an ID relating back to the "article" or whatever
> you have.
I think, that the problem with duplicates can be solved by using "distinct"
parametr in SQL-query whitch count each keyword only once, however it is
there ten times...
Pavel
>
> The process of creating the table and creating the array are about the
> same. The table will give you more flexibility, though, when the client
> starts asking for more "stats".
>
> To use the array method, like you originally asked:
>
> $var = array();
> $query = "SELECT keyword FROM table";
> $rs = mysql_query($query);
> while($row = mysql_fetch_assoc($rs))
> {
> $ar = explode(' ',$row['keyword']);
> array_merge($var,$ar);
> }
> $var = array_unique($var);
> $final_array = sort($var);
>
> To INSERT everything into a second table:
>
> $query = "SELECT keyword FROM table";
> $rs = mysql_query($query);
> while($row = mysql_fetch_assoc($rs))
> {
> $keywords = explode(' ',$row['keyword']);
> $insert_string = "'" . implode("','",$keywords) . "'";
> //assumes no ' characters in $keywords
> $query = "INSERT INTO keywords_table VALUES ($insert_string)";
> $rs2 = mysql_query($query);
> }
> Make the keywords column UNIQUE if you don't want duplicates, although
> it would probably be better to just leave duplicates in there and do a
> SELECT DISTINCT to remove them. Leaving them in there will allow you to
> produce more stats on which keywords are most popular, etc.
>
> ---John W. Holmes...
>
> Amazon Wishlist: http://www.amazon.com/o/registry/3BEXC84AB3A5E
>
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
>
>
attached mail follows:
Hi.
I have a question regarding the DOM model. Does anyone know how to write to
the <UL>/<LI> text value using the DOM model. I more or less can write to
<select>/<option> attributes of the DOM. but I can't figure out how to write
(or read) the text of a <UL>-<LI> attribute....
I'd like to be able to do something like:
echo"
document.foo.element.LU.LI.text = "dfdgd";
";
(of course, using whatever the appropriate doument string would be...)
Any pointers/code samples/web sites would be helpful....
Thanks
Bruce
bedouglas
earthlink.net
(925) 866-2790
attached mail follows:
This has nothing to do with PHP!
Bruce Douglas wrote:
>Hi.
>
>I have a question regarding the DOM model. Does anyone know how to write to
>the <UL>/<LI> text value using the DOM model. I more or less can write to
><select>/<option> attributes of the DOM. but I can't figure out how to write
>(or read) the text of a <UL>-<LI> attribute....
>
>I'd like to be able to do something like:
>
>echo"
> document.foo.element.LU.LI.text = "dfdgd";
>";
>(of course, using whatever the appropriate doument string would be...)
>
>Any pointers/code samples/web sites would be helpful....
>
>
>Thanks
>
>Bruce
>bedouglas
earthlink.net
>(925) 866-2790
>
>
>
>
>
--
The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
attached mail follows:
Do you try with the "global" sentence ?
.
.
.
global $conf;
$var = 'foo';
echo $var::$conf ;
?>
EF.
On Mon, 09 Jun 2003 18:34:33 -0200
aberindei
ipacri.ro (Aberindei) wrote:
> Hello,
>
> One line to say this is my first post here, I thought about posting in
> php-general, but ZE2 is in development, so...
>
> I want to access a static variable of a class, but I CANNOT use
> directly the class name, so class name is in a variable.
>
> To be clear:
>
> <?PHP
>
> class foo {
> static $conf = 'configuration variable';
> }
>
> $var = 'foo';
>
> echo $var::$conf ;
>
> ?>
>
> this produces a parsing error...
>
> How could I do ?
>
> Thanks
>
attached mail follows:
Hello all,
I have php ver 4.1.1 running with register_globals() ON on my site. I
am trying to use sessions to maintain state during a visit to the site.
I have read thru the manual, but my mind is still cluttered with
doubts. I understand that use of the $_SESSION global array will
greatly add to the security of the site and will prevent variable
poisoning.
How do I register a session?
The manual (http://www.php.net/manual/en/print/ref.session.php) says
that there are 2 methods:
Example 1. Registering a variable with $_SESSION.
<?php
session_start();
// Use $HTTP_SESSION_VARS with PHP 4.0.6 or less
if (!isset($_SESSION['count'])) {
$_SESSION['count'] = 0;
} else {
$_SESSION['count']++;
}
?>
-----------------------------------------------------------------------
Example 4. Registering a variable with register_globals enabled
<?php
if (!session_is_registered('count')) {
session_register("count");
$count = 0;
}
else {
$count++;
}
?>
---------------------------------------------------------
This is a snippet of the code that I am testing:
<? session_start();
require_once('../Connections/MasterStream.php');
if ( $_POST['validuser'] && ($_POST['password']) ) {
mysql_select_db($database_MasterStream, $MasterStream);
$query_Recordset1 = "SELECT * FROM `admin` WHERE `admin`.username =
"$_POST['validuser']" AND `admin`.password = "$_POST['password']"";
$Recordset1 = mysql_query($query_Recordset1, $MasterStream) or
die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
if ($totalRows_Recordset1)
{
echo "Success!<br>";
if(!isset($_SESSION['validuser']))
$_SESSION['validuser'] = 0;
else $_SESSION['validuser']++;
}
else{
echo "Please try again later<br>";
}
}
?>
Thanks in advance,
Pushpinder
attached mail follows:
So does your code work? Here's a tip: Try a simple example, like what's in
the manual, and see which method works for you. If they both work, which one
do you understand? Use that one...
---John Holmes...
----- Original Message -----
From: "Pushpinder Singh Garcha" <pgarcha
adelphia.net>
To: <php-general
lists.php.net>
Sent: Monday, June 09, 2003 4:23 PM
Subject: [PHP] Another Session Question
Hello all,
I have php ver 4.1.1 running with register_globals() ON on my site. I
am trying to use sessions to maintain state during a visit to the site.
I have read thru the manual, but my mind is still cluttered with
doubts. I understand that use of the $_SESSION global array will
greatly add to the security of the site and will prevent variable
poisoning.
How do I register a session?
The manual (http://www.php.net/manual/en/print/ref.session.php) says
that there are 2 methods:
Example 1. Registering a variable with $_SESSION.
<?php
session_start();
// Use $HTTP_SESSION_VARS with PHP 4.0.6 or less
if (!isset($_SESSION['count'])) {
$_SESSION['count'] = 0;
} else {
$_SESSION['count']++;
}
?>
-----------------------------------------------------------------------
Example 4. Registering a variable with register_globals enabled
<?php
if (!session_is_registered('count')) {
session_register("count");
$count = 0;
}
else {
$count++;
}
?>
---------------------------------------------------------
This is a snippet of the code that I am testing:
<? session_start();
require_once('../Connections/MasterStream.php');
if ( $_POST['validuser'] && ($_POST['password']) ) {
mysql_select_db($database_MasterStream, $MasterStream);
$query_Recordset1 = "SELECT * FROM `admin` WHERE `admin`.username =
"$_POST['validuser']" AND `admin`.password = "$_POST['password']"";
$Recordset1 = mysql_query($query_Recordset1, $MasterStream) or
die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
if ($totalRows_Recordset1)
{
echo "Success!<br>";
if(!isset($_SESSION['validuser']))
$_SESSION['validuser'] = 0;
else $_SESSION['validuser']++;
}
else{
echo "Please try again later<br>";
}
}
?>
Thanks in advance,
Pushpinder
attached mail follows:
Hi,
When I use my system command in PHP I can run a old EXE file. It makes an
output and output is automaticly printing on the web browser. I wanna save
this output at the same time into a txt.
Anyone knows howto do it?
attached mail follows:
look at ob_start() function.
HTH
R'twick
"Ferhat Bingol" <ferhat
ventusvigor.com> wrote in message
news:20030609202456.91126.qmail
pb1.pair.com...
> Hi,
>
> When I use my system command in PHP I can run a old EXE file. It makes an
> output and output is automaticly printing on the web browser. I wanna save
> this output at the same time into a txt.
>
> Anyone knows howto do it?
>
>
>
attached mail follows:
> When I use my system command in PHP I can run a old EXE file. It makes
an
> output and output is automaticly printing on the web browser. I wanna
save
> this output at the same time into a txt.
>
> Anyone knows howto do it?
Use backticks to capture the output...
$output = `old.exe`;
Note that backtick (`) is not the same as a single quote (').
---John W. Holmes...
Amazon Wishlist: http://www.amazon.com/o/registry/3BEXC84AB3A5E
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
attached mail follows:
I go with
run.exe > out.txt
attached mail follows:
Hey, I need some advice if anyone is willing to offer it. I have a chat
program I am working on. The interface is built in flash, and it uses
PHP also. There is a main chat area where the users type their messages
back and forth, and there is also a smaller area which displays all of
the currently logged-in users. When a user logs into the chat room, it
adds their nickname to a users.txt file, which creates a list of all the
online users and is then displayed in the chat page. I also have a
logoff button that will search for the users nickname in the users.txt
file and remove it, so that it won't be displayed in the chat window
anymore. The only problem I am having is that if a user doesn't click
on the logoff button and instead just closes the internet window or
shuts off their computer, then their nickname will still appear in the
list of users, since it wouldn't get a chance to be removed by the
logoff button. I'm not sure how to accomplish this, I would appreciate
any help you can offer me. Thanks a lot.
Matt
attached mail follows:
What I normally do in these situations is have two fields separated by tabs
or commas or whatever you want. The first field is the username and the
second field is a timestamp.
The timestamp can be updated every time the user writes a message, since Im
sure you are logging also.. or after, say an hour, have their name removed
from the list, although this might make them have to log back in :)
Every time someone logs into the chat go through the list getting rid of any
usernames older than an hour or any other time. And everytime someone logs
off do the same thing.. or if you get a lot of activity, just go through the
list when people logoff.
Cheers!
Rick
"If you're going to be able to look back on something and laugh about it,
you might as well laugh about it now." - Marie Osmond
> From: "Matt Palermo" <mpalermo
vt.edu>
> Date: Mon, 9 Jun 2003 17:19:31 -0400
> To: <php-general
lists.php.net>
> Subject: [PHP] php and flash chat program
>
> Hey, I need some advice if anyone is willing to offer it. I have a chat
> program I am working on. The interface is built in flash, and it uses
> PHP also. There is a main chat area where the users type their messages
> back and forth, and there is also a smaller area which displays all of
> the currently logged-in users. When a user logs into the chat room, it
> adds their nickname to a users.txt file, which creates a list of all the
> online users and is then displayed in the chat page. I also have a
> logoff button that will search for the users nickname in the users.txt
> file and remove it, so that it won't be displayed in the chat window
> anymore. The only problem I am having is that if a user doesn't click
> on the logoff button and instead just closes the internet window or
> shuts off their computer, then their nickname will still appear in the
> list of users, since it wouldn't get a chance to be removed by the
> logoff button. I'm not sure how to accomplish this, I would appreciate
> any help you can offer me. Thanks a lot.
>
> Matt
>
attached mail follows:
I realize that this can be done, but I would like to make it as instant
as possible. I don't want to wait very long for the user to be removed
from the online users list. Got any other ideas? Thanks.
Matt
-----Original Message-----
From: Richard Baskett [mailto:php
baskettcase.com]
Sent: Monday, June 09, 2003 6:15 PM
To: Matt Palermo; PHP General
Subject: Re: [PHP] php and flash chat program
What I normally do in these situations is have two fields separated by
tabs
or commas or whatever you want. The first field is the username and the
second field is a timestamp.
The timestamp can be updated every time the user writes a message, since
Im
sure you are logging also.. or after, say an hour, have their name
removed
from the list, although this might make them have to log back in :)
Every time someone logs into the chat go through the list getting rid of
any
usernames older than an hour or any other time. And everytime someone
logs
off do the same thing.. or if you get a lot of activity, just go through
the
list when people logoff.
Cheers!
Rick
"If you're going to be able to look back on something and laugh about
it,
you might as well laugh about it now." - Marie Osmond
> From: "Matt Palermo" <mpalermo
vt.edu>
> Date: Mon, 9 Jun 2003 17:19:31 -0400
> To: <php-general
lists.php.net>
> Subject: [PHP] php and flash chat program
>
> Hey, I need some advice if anyone is willing to offer it. I have a
chat
> program I am working on. The interface is built in flash, and it uses
> PHP also. There is a main chat area where the users type their
messages
> back and forth, and there is also a smaller area which displays all of
> the currently logged-in users. When a user logs into the chat room,
it
> adds their nickname to a users.txt file, which creates a list of all
the
> online users and is then displayed in the chat page. I also have a
> logoff button that will search for the users nickname in the users.txt
> file and remove it, so that it won't be displayed in the chat window
> anymore. The only problem I am having is that if a user doesn't click
> on the logoff button and instead just closes the internet window or
> shuts off their computer, then their nickname will still appear in the
> list of users, since it wouldn't get a chance to be removed by the
> logoff button. I'm not sure how to accomplish this, I would
appreciate
> any help you can offer me. Thanks a lot.
>
> Matt
>
attached mail follows:
Another thing a noticed was that when I comment the line wich uploads the
file, it still give me the same error, saying server was not found.
I think, maybe, the amount of memory enabled for each object of the form is
limited by 1Mb. I got that idea because I use the following script:
print "path: $fupload<br>\n";
print "name: $fupload_name<br>\n";
print "size: $fupload_size bytes<br>\n";
print "type: $fupload_type<p>\n\n";
if ( $fupload_type == "image/gif" )
{
copy ( $fupload, "$file_dir/$fupload_name") or die ("Couldn't copy");
}
The fupload is the file object from the previous form page. Maybe if that
object cannot be more than 1mb so it shows that page.
Is it right or I am going crazy with it???
If so (i'm right :) ), where can I change it? I tried to set
LimitRequestFieldSize to 10240000000 but when i restarted Apache it said
Iniciando httpd: Syntax error on line 139 of /etc/httpd/conf/httpd.conf:
LimitRequestFieldsize "10240000000" must not exceed the precompiled maximum
of 8190
If this is the way i have to go... what can I do?
Thaks!!!
Maurício Valente
"Mike Ford" <M.Ford
lmu.ac.uk> escreveu na mensagem
news:841D90E489448A4F804E1D1B95768BF7D460CB
lis-exchange3.lmu.ac.uk...
> -----Original Message-----
> From: Maurício Valente [mailto:mauricio
agp5.com.br]
> Sent: 05 June 2003 21:56
>
> I couldn't find the option max_body_request somebody knows
> where it is?
There's no such option -- you could be looking for post_max_size in php.ini,
or the LimitRequestBody directive in Apache's httpd.conf or a .htaccess
file.
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford
lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
attached mail follows:
Does anybody know any benifits to using current() and key()
I will show two examples of what I mean.
<?php
echo "<PRE>";
$arr1 = array(array(1 => 10),
array(2 => 12),
array(3 => 13),
array(4 => 14),
array(5 => 15),
array(6 => 16),
array(7 => 17),
array(8 => 18),
array(9 => 19)
);
foreach ( $arr1 AS $value ) {
echo pow(key($value) , current($value))."\n";
}
$arr2 = array(1 => 10,
2 => 12,
3 => 13,
4 => 14,
5 => 15,
6 => 16,
7 => 17,
8 => 18,
9 => 19
);
foreach ( $arr2 AS $key => $value ) {
echo pow($key , $value)."\n";
}
?>
Now for me, these return the same results.
I would think that it would be overhead to use current() and key() in the
above example.
Can anybody point out why the first one would be better to use and why.
Jim Lucas
attached mail follows:
On Mon, 2003-06-09 at 14:38, Jim Lucas wrote:
> Does anybody know any benifits to using current() and key()
See below:
> I will show two examples of what I mean.
>
> <?php
>
> echo "<PRE>";
>
> $arr1 = array(array(1 => 10),
> array(2 => 12),
> array(3 => 13),
> array(4 => 14),
> array(5 => 15),
> array(6 => 16),
> array(7 => 17),
> array(8 => 18),
> array(9 => 19)
> );
>
> foreach ( $arr1 AS $value ) {
> echo pow(key($value) , current($value))."\n";
> }
>
> $arr2 = array(1 => 10,
> 2 => 12,
> 3 => 13,
> 4 => 14,
> 5 => 15,
> 6 => 16,
> 7 => 17,
> 8 => 18,
> 9 => 19
> );
>
> foreach ( $arr2 AS $key => $value ) {
> echo pow($key , $value)."\n";
> }
>
> ?>
>
>
> Now for me, these return the same results.
>
> I would think that it would be overhead to use current() and key() in the
> above example.
>
> Can anybody point out why the first one would be better to use and why.
No, you're right. There are situations where you might want to use
these two functions, but this isn't one of them. Doesn't buy you a
thing in this situation. :) There are times I've found them useful,
though, although I won't contrive an example for you...you'll usually
know when you've found one.
> Jim Lucas
--
Torben Wilson <torben
php.net> +1.604.709.0506
http://www.thebuttlesschaps.com http://www.inflatableeye.com
http://www.hybrid17.com http://www.themainonmain.com
-----==== Boycott Starbucks! http://www.haidabuckscafe.com ====-----
attached mail follows:
Hi Everyone!
Have anyone here ever use the Linter software? What is your opinion on
this? Have anyone experienced compiling Apache/PHP with Linter and was it
easy to use? Have anyone experienced writing a PHP script to access the
Linter? All of those questions, is it giving you a headache or is it a
very nice experience?
I already downloaded the Linter demo and been using it for a day or two.
I'm having trouble trying to make the SQL query work for the sample database
that come with the demo. I have not yet compile Apache and PHP to Linter
yet because I want to become familiar with Linter first. It's like playing
with database software to understand how to use it and manage it.
Thanks,
Scott F.
attached mail follows:
What is Linter?
-----Original Message-----
From: Scott Fletcher [mailto:scott
abcoa.com]
Sent: Monday, June 09, 2003 2:43 PM
To: php-general
lists.php.net
Subject: [PHP] PHP using Linter...
Hi Everyone!
Have anyone here ever use the Linter software? What is your opinion
on
this? Have anyone experienced compiling Apache/PHP with Linter and was
it
easy to use? Have anyone experienced writing a PHP script to access the
Linter? All of those questions, is it giving you a headache or is it a
very nice experience?
I already downloaded the Linter demo and been using it for a day or
two.
I'm having trouble trying to make the SQL query work for the sample
database
that come with the demo. I have not yet compile Apache and PHP to
Linter
yet because I want to become familiar with Linter first. It's like
playing
with database software to understand how to use it and manage it.
Thanks,
Scott F.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Hi Philip and Thomas and All.
Thanks very much for yours helps.
I am Brazillian and I speak in portuguese, for this, I am sorry very much
for my bad english.
After a long time, my code works very good! But, I dont understand what was
the problem!
My code was:
$result = sql_query("select categoria, nombre, datafim from
".$prefix."_anuncios order by datafim limit 0,30", $dbi);
while (list($categoria, $nombre) = sql_fetch_row($result, $dbi)) {
$content .= "<img src=blocks/images/diamond.gif> <a
href=\"modules.php?name=Concurso\"><font color=\"#096C88\"><b>$categoria
</b> $nombre</a> ";
}
and dont works.
If I change it for:
//$result = sql_query("select categoria, nombre, datafim from
".$prefix."_anuncios order by datafim limit 0,30", $dbi);
$sql = "select categoria, nombre, datafim from ".$prefix."_anuncios order by
datafim limit 0,30";
while (list($categoria, $nombre) = sql_fetch_row($result, $dbi)) {
$content .= "<img src=blocks/images/diamond.gif> <a
href=\"modules.php?name=Concurso\"><font color=\"#096C88\"><b>$categoria
</b> $nombre</a> ";
}
It works very good!
My question:
In while instruction have a $result and $dbi. They dont are necessary in the
sql_query? Understand me?
Marcelo
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.488 / Virus Database: 287 - Release Date: 5/6/2003
attached mail follows:
I'm looking for a cook book script. I've googled for it, looked in
php.resourceindex.com and hotscripts but I haven't found one that does
what I'm looking for. Here's what I'm shooting for.
1) User ID registration - need to be able to have users "own" recipes
and cookbooks.
2) Allow users to add recipes - moderator CAN choose to make the recipe
public
3) Users can add categories (with moderator approval)
4) Users can create "cookbooks" by selecting recipes from either (or
both) their own and "public" recipes. A "title" for the cookbook with
some basic info about it would be nice.
In a perfect world, it would allow for an external url where the user
could point people to their cookbook. They would only see that
cookbook's recipes and PLEASE allow it to be printed (using PDF???).
Maybe even allow the cookbook owner to select a "template" to control
how it will look both on the screen and printed????
attached mail follows:
this is easy i say do it yourself , when u get them to add the entries store
their userID in a session variable and add that userID value to a column in
the recipes table
-----Original Message-----
From: Wendell Brown [mailto:wbrown
arkie.net]
Sent: Tuesday, June 10, 2003 7:59 AM
To: php-general
lists.php.net
Subject: [PHP] Cook Book Script
I'm looking for a cook book script. I've googled for it, looked in
php.resourceindex.com and hotscripts but I haven't found one that does
what I'm looking for. Here's what I'm shooting for.
1) User ID registration - need to be able to have users "own" recipes
and cookbooks.
2) Allow users to add recipes - moderator CAN choose to make the recipe
public
3) Users can add categories (with moderator approval)
4) Users can create "cookbooks" by selecting recipes from either (or
both) their own and "public" recipes. A "title" for the cookbook with
some basic info about it would be nice.
In a perfect world, it would allow for an external url where the user
could point people to their cookbook. They would only see that
cookbook's recipes and PLEASE allow it to be printed (using PDF???).
Maybe even allow the cookbook owner to select a "template" to control
how it will look both on the screen and printed????
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
I have a script that is collecting a bunch of information, and storing this
in a database. However, the rows are kinda big and I'm thinking of packing
the information into flag bits, and storing this information in one string
in the database. I'm wondering if I should use mysql's bitwise operators to
manipulate the data, or just pull it out clean and manipulate it in php.
Does anyone have any experience using either mysql or php to do bitwise
flagging operations?
Mike
attached mail follows:
On Mon, Jun 09, 2003 at 03:56:28PM -0600, Kevin Stone wrote:
> I still believe what's happening is the edit script is being executed before
> the parent script has died. Are you doing some kind of looping background
> process or something that's keeping the parent script from exiting?
No. In fact I have explicitly closed the session at the end of the page
with a session_write_close(); This is called as the very last line on the
page (even after the </html>).
> You need to avoid this situation by -> killing that parent script<- before
> the edit script is launched. You can ensure this with output buffering as I
> suggested before. Becuase you're controlling the output there won't be a
> button to press until the parent script has died.
What ended up working was passing the session ID to the pop-up window
"manually" by including it in the function (and thus the URL).
emma
--
Emma Jane Hogbin
[[ 416 417 2868 ][ www.xtrinsic.com ]]
attached mail follows:
*woot!* :)
I love being right. ;)
--
Jason k Larson
Emma Jane Hogbin wrote:
> What ended up working was passing the session ID to the pop-up window
> "manually" by including it in the function (and thus the URL).
>
> emma
>
attached mail follows:
----- Original Message -----
From: "Emma Jane Hogbin" <emmajane
xtrinsic.com>
To: <php-general
lists.php.net>
Sent: Monday, June 09, 2003 4:21 PM
Subject: [PHP] solved Re: [PHP] sessions, IE and pop-up windows
> On Mon, Jun 09, 2003 at 03:56:28PM -0600, Kevin Stone wrote:
> > I still believe what's happening is the edit script is being executed
before
> > the parent script has died. Are you doing some kind of looping
background
> > process or something that's keeping the parent script from exiting?
>
> No. In fact I have explicitly closed the session at the end of the page
> with a session_write_close(); This is called as the very last line on the
> page (even after the </html>).
Calling session_write_close() at the end of the script will do nothing of
consiquence if you launch the edit script before the function is called.
You end up with the same "page not found" error.
> > You need to avoid this situation by -> killing that parent script<-
before
> > the edit script is launched. You can ensure this with output buffering
as I
> > suggested before. Becuase you're controlling the output there won't be
a
> > button to press until the parent script has died.
>
> What ended up working was passing the session ID to the pop-up window
> "manually" by including it in the function (and thus the URL).
I just don't see how this could have solved your problem except to do the
same thing that output buffering would have done and that is to
(essentially) queue the execution of the two scripts. Anyone care to
explain this?
*gnashing his teeth* :D
- Kevin
attached mail follows:
Is it possible to tell PHP when converting a number to a string (i.e. in
an echo or print command) to use x decimal places?
Specifically, if I
<?php
echo '$' . $some_price;
?>
And some_price is $1.50, it outputs:
$1.5
Thanks in advance,
Dan
attached mail follows:
> Is it possible to tell PHP when converting a number to a string (i.e.
in
> an echo or print command) to use x decimal places?
Yes, it is.
> Specifically, if I
>
> <?php
> echo '$' . $some_price;
> ?>
>
> And some_price is $1.50, it outputs:
>
> $1.5
>
> Thanks in advance,
You're welcome.
---John W. Holmes...
Amazon Wishlist: http://www.amazon.com/o/registry/3BEXC84AB3A5E
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
PS: Look at the printf() or sprintf() function. And don't ask YES/NO
questions. :)
attached mail follows:
On Mon, 2003-06-09 at 15:22, Dan Anderson wrote:
> Is it possible to tell PHP when converting a number to a string (i.e. in
> an echo or print command) to use x decimal places?
>
> Specifically, if I
>
> <?php
> echo '$' . $some_price;
> ?>
>
> And some_price is $1.50, it outputs:
>
> $1.5
>
> Thanks in advance,
>
> Dan
http://ca2.php.net/manual/en/function.number-format.php
...i.e.:
<?php
error_reporting(E_ALL);
$someValue = 1.50;
echo '$' . number_format($someValue, 2) . "\n"
?>
Hope this helps,
Torben
--
Torben Wilson <torben
php.net> +1.604.709.0506
http://www.thebuttlesschaps.com http://www.inflatableeye.com
http://www.hybrid17.com http://www.themainonmain.com
-----==== Boycott Starbucks! http://www.haidabuckscafe.com ====-----
attached mail follows:
Hi guys,
sorry that i am asking this rather non-php question here. I know how anoying
it is to get these unrelated mails ... it might just have to do with the
apache ... or whatever:
[problem]
if i declare in an external stylesheet the scrollbar-track-color to be
whatever, it does not show. even if i put it inline into the actual page. However,
if i get a page doing this from the net, it displays. It doesn't if i use
the apache server on my machine. Anyone had a similiar problem?
thanks
thom
--
+++ GMX - Mail, Messaging & more http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!
attached mail follows:
I'm extracting a list of items from an XML document using PHP. The desired
items are the attributes of different occurances of a specific element
within the document; the code will not need a callback for character data or
for closing tags.
$list = new Array();
function start_tag($p_id, $element, $attribs)
{
global $list;
if ($element = 'building')
$list[] = $attribs['address'];
return true;
}
//.. snip .. snip ..
xml_set_element_handler($parser, 'start_tag', create_function ('',''));
//.. snip .. snip ..
Two questions:
1. create_function ('',''); works just fine, but I was wondering if there
was a proper way to declare a void anonymous function?
2. If I were to place the parser related code within it's own function to
increase readability of the script, how would start_tag be rewritten as an
inline anonymous function? I've tried several ideas but I'm not sure how to
handle $location and it's change in scope.
Thanks in advance,
-Tim
attached mail follows:
I want to move my Microsoft Access based front end (back end is already on
MySQL/Linux) to PHP. MSAccess does have some forms that have VBscript in the,
but I think I can figure other ways to do that.I am not a wizard with PHP, so I
would interested in finding some open source apps, or something like that to
help me convert my front end to PHP/Apache/Mysql. GUI is what I am looking for.
Any advice? Anyone done this before?
attached mail follows:
I've just finished a big PHP project and I'm about to start a new
project. I've had both fun and pain with PHP.
The new project would be another one of those database driven online
store kind-of things for a somewhat large company.
Before I start my new project I am considering whether to use PHP again
or to switch to jsp. I'm worried that PHP won't scale well. And by
scaling I don't mean under heavy load, I mean maintenance wise :) I
can't imagine having to do a feature upgrade on a PHP project with more
than 100 files ... (this file requires that file which requires that one
and so on ...)
I used to be a java programmer and always wax nostalgic about how easy
it was to program-by-contract using objects and interfaces. And I'm
always gripping about how much pain session handling is (not because of
PHP but because HTTP is stateless).
I don't know anything about jsp but I've asked a few jsp programmer and
I've heard lots of good things about it. They tell me I can get "true"
object-oriented programming, object persistence *and* much easier to
manage session handling. However none of them have ever used PHP so they
can't really compare the two.
Can anyone give personal opinion of a comparison of the two?
Are they two completely different beast hence totally for totally
different purposes? Or are they two languages that are mostly used for
the same things?
Thanks,
Jean-Christian Imbeault
attached mail follows:
> ...
> Before I start my new project I am considering whether to use PHP again
> or to switch to jsp. I'm worried that PHP won't scale well. And by
> scaling I don't mean under heavy load, I mean maintenance wise :) I
> can't imagine having to do a feature upgrade on a PHP project with more
> than 100 files ... (this file requires that file which requires that one
> and so on ...)
>
> I used to be a java programmer and always wax nostalgic about how easy
> it was to program-by-contract using objects and interfaces. And I'm
> always gripping about how much pain session handling is (not because of
> PHP but because HTTP is stateless).
> ...
You might want to look around the jakarta projects and ask questions on
some of those mailing lists. I've monitored the tomcat and struts lists
in the past, and gotten a bit of help there:
http://jakarta.apache.org
(tomcat is an open source java server that can be used with or without
apache, and struts is an application framework.)
--
Joel Rees <joel
alpsgiken.gr.jp>
attached mail follows:
Joel Rees wrote:
>
> You might want to look around the jakarta projects and ask questions on
> some of those mailing lists.
Thanks for the advice. I'll try that. But I *would* like to hear the
opinions of PHP'ers too. I'm worried that by asking people on that list
Ill get one-sided views.
What do PHP people who've tried jsp or struts think?
> (tomcat is an open source java server that can be used with or without
> apache, and struts is an application framework.)
The jsp'ers that I talked with could not stop praising struts ... which
is what got me interested in finding out more and maybe even switching.
I just hope that if I do decide that struts are worth the switch the
learning curve isn't too steep. Or the installation curve also since I'm
the lone sysadmin too ...
Thanks,
Jean-Christian Imbeault
attached mail follows:
Installing JSP isn't impossible, but it can be a true pain... At least on
windows... There are lots of environiment variables to set (well, two at
least), config files to edit, a directory structure to understand (this is
probably way simplier than I currently think it is)... However, once you get
Tomcat running, it's quite easy to just install mod_jk to Apache and
configure it some, then you are set... I think...
AFAIK, Java is nicer when you like objects... PHP is more procedual... Some
people like objects, some like them in small scales and some people hate
them... I like objects as long as not _everything_ are objects like in
javascript... Although, now that I understand it, I like them more than
before (a number is a number for me, meaning it shouldn't have methods)...
Something more to think about is Aspects... I read somewhere that they are
the future, although, I didn't understand a word about what they are...
"Jean-Christian Imbeault" <jc
mega-bucks.co.jp> skrev i meddelandet
news:3EE54722.2020103
mega-bucks.co.jp...
> Joel Rees wrote:
> >
> > You might want to look around the jakarta projects and ask questions on
> > some of those mailing lists.
>
> Thanks for the advice. I'll try that. But I *would* like to hear the
> opinions of PHP'ers too. I'm worried that by asking people on that list
> Ill get one-sided views.
>
> What do PHP people who've tried jsp or struts think?
>
> > (tomcat is an open source java server that can be used with or without
> > apache, and struts is an application framework.)
>
> The jsp'ers that I talked with could not stop praising struts ... which
> is what got me interested in finding out more and maybe even switching.
>
> I just hope that if I do decide that struts are worth the switch the
> learning curve isn't too steep. Or the installation curve also since I'm
> the lone sysadmin too ...
>
> Thanks,
>
> Jean-Christian Imbeault
>
attached mail follows:
Hi,
Just one question, is there any way that when a person logs in via the
htaccess popup that i can know via my php script...and can i also get his
username?
Thanks,
-Ryan
attached mail follows:
> Just one question, is there any way that when a person logs in via the
> htaccess popup that i can know via my php script...and can i also get
his
> username?
Have you read the chapter on HTTP Authentication? No. Read the very
first paragraph:
"The HTTP Authentication hooks in PHP are only available when it is
running as an Apache module and is hence not available in the CGI
version. In an Apache module PHP script, it is possible to use the
header() function to send an "Authentication Required" message to the
client browser causing it to pop up a Username/Password input window.
Once the user has filled in a username and a password, the URL
containing the PHP script will be called again with the predefined
variables PHP_AUTH_USER, PHP_AUTH_PW, and AUTH_TYPE set to the user
name, password and authentication type respectively. These predefined
variables are found in the $_SERVER and $HTTP_SERVER_VARS arrays. Only
"Basic" authentication is supported. See the header() function for more
information."
You're welcome.
---John Holmes...
attached mail follows:
Hello,
In ASP you can set records fields then call a dbupdate function.
It appears mysql only supports update with the UPDATE query?
Here is my code:
<?
$sql="SELECT * FROM lsm where ID = ".$HTTP_GET_VARS["ID"];
$result=query($sql);
if (!$result) die('sql error');
$dbrec=getrec($result);
if ($dbrec)
{
$dbrec["Complexname"]=$HTTP_POST_VARS["Complexname"];
$dbrec["Subdivision"]=$HTTP_POST_VARS["Subdivision"];
$dbrec["Beds"]=$HTTP_POST_VARS["Beds"];
$dbrec["BathsTotal"]=$HTTP_POST_VARS["BathsTotal"];
if ($HTTP_POST_VARS["SqFtTotal"]!="")
$dbrec["SqFtTotal"]=$HTTP_POST_VARS["SqFtTotal"];
$dbrec["ListPriceLow"]=$HTTP_POST_VARS["ListPriceLow"];
$dbrec["Streetnum"]=$HTTP_POST_VARS["Streetnum"];
$dbrec["Streetname"]=$HTTP_POST_VARS["Streetname"];
dbrec.update();
}
?>
How would you do a dbrec.update (which updates just the row you changed with the variables)
thanks
Steve
__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com
attached mail follows:
Steve B. wrote:
> Hello,
> In ASP you can set records fields then call a dbupdate function.
There is no such function in PHP.
> It appears mysql only supports update with the UPDATE query?
Huh ... MySQL is a database. It understands SQL. dbupdate() is an ASP
function ... don't blame MySQL if it doesn't understand ASP ;) The only
way to update data in MySQL is to use SQL, and in SQL to update data you
use UPDATE queries :)
> Here is my code:
>
> $dbrec=getrec($result);
This is not PHP code. There is no function called getrec().
If you want to access a MySQL database using PHP you will also need to
learn SQL. You need to learn how to write SQL update queries ...
I suggest that you read the PHP online manual and learn all about the
MySQL functions. Read this section and then try again:
http://jp.php.net/manual/en/ref.mysql.php
Jean-Christian
attached mail follows:
[reply to a personal email posted here for the benefit of all :)]
> Are you sure you can't?
Yes.
> Could ASP do something that MySQL/SQL can't?
You confusing apples and oranges ... ASP is not a database. You should
be comparing ASP to PHP.
So the short answer is PHP does not have an equivalent function to ASP's
update() or whatever it is.
> That is very strange.
No it isn't. These are different languages.
> I wonder what mode ASP is accessing DB which lets you set record
variables then paste them into
> it?
A very bad mode I would think. Very dangerous. But I can see how it is
convenient.
> Perhaps it just does an update in the background.
Of course. No you understand. ASP is using a convenience method that
does all that ugly SQL updating in the background. As far as I know PHP
does not have such functionality.
> This bugs me because my db has 125 fields and it will be a very long
sql string!
I bet!
> The form page generates form contents by using a while loop.
>
> How would you build the sql string from the form page?
Use a while loop ;) Name the GET or POST vars the same as the field
names in the DB. Then you could use something like (I say like b/c this
won't work, it's just an idea):
$sql = "update table A SET ";
while (list($fieldName, $value) == each($_POST)) {
$sql .= " $fieldName='$value', ";
}
This won't work because there will be POST values passes in that are not
part of your form data. Oh, and there will be a trailing "," you need to
trim off ...
Just a quick idea.
--
Jean-Christian Imbeault
attached mail follows:
I was wondering if there is a way to tell if a session exists or not.
For example, have a system where people login and it starts a session
like:
sess_cf4c4f6a8cffaf3334df48b6ea1d55e4
If the user logs out or the session is destroyed, then it won't exist
anymore. I know you can use the session_id() function after the session
is started and in this case it would return:
cf4c4f6a8cffaf3334df48b6ea1d55e4
My question is can I search the session folder for:
cf4c4f6a8cffaf3334df48b6ea1d55e4 (or any other session id) to see if
that session still exists and is active, or if it is gone and doesn't
exist anymore? Can this be done? Please let me know if you have any
thoughts. Thanks..
Matt
attached mail follows:
Matt Palermo wrote:
>
> My question is can I search the session folder for:
> cf4c4f6a8cffaf3334df48b6ea1d55e4 (or any other session id