|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: php-general-digest-help
lists.php.netDate: Wed Aug 22 2001 - 00:32:49 CDT
php-general Digest 22 Aug 2001 05:32:49 -0000 Issue 830
Topics (messages 63742 through 63853):
Re: hacks we should know about
63742 by: Alexander Skwar
63744 by: Ashley M. Kirchner
63767 by: Alexander Skwar
63815 by: Richard Lynch
Re: force download in IE
63743 by: Tim Frank
Newbie Question: Forcing a page load with no click
63745 by: LB
63746 by: Dallas K.
Help with ImageCreateFromGIF()
63747 by: Uchendu Nwachukwu
63832 by: Richard Lynch
Re: Use cron to execute a script --> OTHER problem now
63748 by: Travis Cannell
Re: mime types
63749 by: Evan Nemerson
Re: List of files?
63750 by: Hugh Danaher
63848 by: David Robley
Re: sysvsem extention question
63751 by: Tom May
63784 by: Jason Greene
63793 by: Chris Chabot
To jump or not to jump?
63752 by: Seb Frost
63754 by: Jay Paulson
63768 by: Gabe da Silveira
63773 by: Alexander Skwar
63802 by: Richard Lynch
63837 by: Maxim Maletsky
header() not working.
63753 by: Jay Paulson
63755 by: Gijsbert te Riet
63756 by: scott [gts]
63757 by: Jay Paulson
Re: Multi-dimensional array issue >solved<
63758 by: Ken Hopkins
PHP_UK Meeting, Sat Sept 8th, Taunton, Somerset
63759 by: James Moore
sessions
63760 by: Jeremy Morano
63761 by: Johnson, Kirk
URGENT AND CONFIDENTAIL
63762 by: ceaser benene
63778 by: Christopher CM Allen
Re: header function
63763 by: Christian Reiniger
Re: Need "Working..." pop up dialog (repost)
63764 by: Christian Reiniger
63772 by: Ray Clouse
63819 by: Richard Lynch
Sessions, Is this behavior by design?
63765 by: Johnny Nguyen
63769 by: Johnson, Kirk
63774 by: Alexander Skwar
Session Headaches
63766 by: Johnny Nguyen
63770 by: Johnson, Kirk
63783 by: Johnny Nguyen
63786 by: Johnson, Kirk
63790 by: Johnny Nguyen
63795 by: Johnson, Kirk
Re: IIS
63771 by: hassan el forkani
how expensive is Image functions?
63775 by: ERISEN, Mehmet Kamil
63827 by: Richard Lynch
mySql_fetch_array($result) question.
63776 by: ERISEN, Mehmet Kamil
63777 by: CC Zona
Not allowing same value in array. Example requested
63779 by: Montz, James C. (James Tower)
63782 by: CC Zona
Returning info from a function
63780 by: Richard Kurth
63792 by: Dave
change user after uploading file using a form
63781 by: Jeroen Olthof
63829 by: Richard Lynch
attachments
63785 by: Nicholas Thompson
63805 by: Richard Lynch
Re: Page detect
63787 by: J Smith
Re: how to discover cause of php crash under win98?
63788 by: Chris Hayes
63791 by: Chris Hayes
Re: chicken and egg problem with SID
63789 by: Johnson, Kirk
63825 by: Richard Lynch
63851 by: Egan
Regular Expressions....
63794 by: Steve Wright
63835 by: Dave
hello and a question
63796 by: Kevin Keeler
63797 by: jimw.apache.org
63798 by: Kevin Keeler
download script
63799 by: AD
63800 by: Brad Hubbard
Mcrypt: just a little tip:-)
63801 by: Alex Piaz
Re: strange upload/db-insert problem with ie5.5
63803 by: Richard Lynch
Re: Include/requrie secure pages
63804 by: Richard Lynch
Re: passing variables between PHP and Perl
63806 by: Richard Lynch
63841 by: Dave
Re: showing submitted images
63807 by: Richard Lynch
Re: Passing variables to a file
63808 by: Richard Lynch
Re: unix permission converter
63809 by: Richard Lynch
63840 by: Raphael Pirker
Re: Session expiration detection and handling
63810 by: Richard Lynch
Re: 2D-3D Imagem (GD Library)
63811 by: Richard Lynch
Re: Countries and ip addresses
63812 by: Richard Lynch
Re: security check - virtual host and mod php setup
63813 by: Richard Lynch
63843 by: Dave
Re: PHP files appearing in error_log
63814 by: Richard Lynch
Re: confusing problem w/sessions
63816 by: Richard Lynch
Re: flash and mysql
63817 by: Richard Lynch
Re: INPUT type=file value=????
63818 by: Richard Lynch
Re: register_globals odd behaviour?
63820 by: Richard Lynch
Re: $PATH_INFO strangeness
63821 by: Richard Lynch
Re: Help me on server.
63822 by: Richard Lynch
Re: Increase field value by 1 problem
63823 by: Richard Lynch
Re: 404 header
63824 by: Richard Lynch
Re: PHP and the Console
63826 by: Richard Lynch
Re: our country
63828 by: Richard Lynch
Re: HELP with Regular Expressions
63830 by: Richard Lynch
Re: Mem and variables
63831 by: Richard Lynch
Re: if statement and imageline()
63833 by: Richard Lynch
Re: Returning a string from a function
63834 by: Richard Lynch
Strings with Spaces in URLS
63836 by: Chris Aitken
63838 by: Jason Murray
63839 by: Lawrence.Sheed.dfait-maeci.gc.ca
sockets question
63842 by: Gregor Jaksa
63847 by: CC Zona
AudioGalaxy-like stuff
63844 by: Christian Dechery
63846 by: Johnny Nguyen
63849 by: Andrew Brampton
md5(), uniqid(), rand(), password()
63845 by: Christian Dechery
Unable to use fopen to read a URL - DNS Problem?
63850 by: Brian White
Re: Why lynx don't work with cron?
63852 by: Rob Hardowa
problem with $HTTP_POST_FILES
63853 by: Jason Dulberg
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:
So sprach »Seb Frost« am 2001-08-21 um 18:25:08 +0100 :
> I don't host my own site so how can I put include files outside of the web
> root? I log on ftp and my top level IS the web root (htdocs), I can't go
> any higher.
In this case you can't.
Alexander Skwar
-- How to quote: http://learn.to/quote (german) http://quote.6x.to (english) Homepage: http://www.digitalprojects.com | http://www.iso-top.de iso-top.de - Die günstige Art an Linux Distributionen zu kommen Uptime: 1 hour 29 minutes
attached mail follows:
Alexander Skwar wrote:
> So sprach »Seb Frost« am 2001-08-21 um 18:25:08 +0100 : > > I don't host my own site so how can I put include files outside of the web > > root? I log on ftp and my top level IS the web root (htdocs), I can't go > > any higher. > > In this case you can't.
Dumb question: Can't he create a new folder under his web root (let's call it 'incs') and setup an .htaccess file that denies requests to files within that?
-- W | I haven't lost my mind; it's backed up on tape somewhere. +-------------------------------------------------------------------- Ashley M. Kirchner <mailto:ashleypcraft.com> . 303.442.6410 x130 IT Director / SysAdmin / WebSmith . 800.441.3873 x130 Photo Craft Laboratories, Inc. . 3550 Arapahoe Ave. #6 http://www.pcraft.com ..... . . . Boulder, CO 80303, U.S.A.
attached mail follows:
So sprach »Ashley M. Kirchner« am 2001-08-21 um 11:46:29 -0700 : > Dumb question: Can't he create a new folder under his web root (let's call > it 'incs') and setup an .htaccess file that denies requests to files within > that?
Yes, he might be able to do so - but it's also possible that the provider has disabled parsing of the .htacess file.
Alexander Skwar
-- How to quote: http://learn.to/quote (german) http://quote.6x.to (english) Homepage: http://www.digitalprojects.com | http://www.iso-top.de iso-top.de - Die günstige Art an Linux Distributionen zu kommen Uptime: 4 hours 36 minutes
attached mail follows:
There *SHOULD* be some directory outside htdocs you can get to...
Talk to your ISP to see if there is.
If not, create a directory and add Apache directives to Deny All access to that directory. Not as good, but better than nothing.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Seb Frost <sebfrost
icmtb.co.uk> Newsgroups: php.general To: Rasmus Lerdorf <rasmus
php.net> Cc: <php-general
lists.php.net> Sent: Tuesday, August 21, 2001 12:25 PM Subject: RE: [PHP] hacks we should know about
> I don't host my own site so how can I put include files outside of the web > root? I log on ftp and my top level IS the web root (htdocs), I can't go > any higher. > > - seb > > -----Original Message----- > From: Rasmus Lerdorf [mailto:rasmus
php.net] > Sent: 17 August 2001 05:01 > To: Bob > Cc: php-general
lists.php.net > Subject: Re: [PHP] hacks we should know about > > > > hi i found it very helpful to know about hacks such as the below list > > and was wondering if anyone had any more dumb mistakes they could tell > > us before we make them. > > > > 1. http://www.somesite.com/source.php3?url=/etc/passwd > > 2. http://www.somesite.com?page=../../../../etc/passwd > > 3. not setting .inc files to be parsed by php > > This is the wrong solution to securing include files. The correct > solution is to block any direct access to .inc files by either putting > them outside your document root or by using an Apache deny rule. > > -Rasmus > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net > For additional commands, e-mail: php-general-help
lists.php.net > To contact the list administrators, e-mail: php-list-admin
lists.php.net > >
attached mail follows:
Some versions of IE will "sniff" the file to determine what type it is rather than taking your word for it that you REALLY want to download the file. From my memory this is IE 4, and IE 5.5 where this is a problem. The way I dealt with this is to totally make up an application type that IE will not have a helper app for... such as "new/type" or whatever you want. This should then trick IE into forcing a download. The other trick I noted was that IE 5.5 doesn't like the "attachement" keyword in the Content-Disposition header. Don't ask me why, all I know is that it won't pick up the supplied filename if you include it. That is from my experiences in forcing download files and it seems to work out once you figure out every combination of what does/doesn't work for the various versions of IE. Netscape is always fine, and I haven't tried any others extensively.
Fiddle with the various headers for the different IE browsers and you will get it to work.
Tim Frank
>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<
On 20/08/01, 1:45:29 PM, dave
dminor.com (David Minor) wrote regarding
Re: force download in IE:
> on 8/20/01 12:07 PM, bill
billtron.com wrote:
> This gave the same result: it launches the helper app.
> Please help!!
> Regards. > dm
> > Have you tried this? > > > > header("Content-Type: application/x-octet-stream"); > > header("Content-Description: MP3 file"); > > > > David Minor wrote: > > > >> Can anybody tell me why this doesn't work in IE? I need to force download > >> mp3 files instead of IE5.5 trying to apply a helper app. This code works > >> fine for NN. > >> > >> // detect for MSIE bug > >> if (strstr($HTTP_USER_AGENT, "MSIE")) > >> $attachment = ""; > >> else > >> $attachment = " attachment;"; > >> > >> // stream file to user > >> header("Content-Type: application/octet-stream"); > >> header("Content-Disposition:$attachment filename=$filename"); > >> header("Content-Length: ".filesize($tmp_file)); > >> header("Content-Transfer-Encoding: binary"); > >> readfile($tmp_file);
attached mail follows:
I've built a small login script (code fragment below), and want to force a page load depending on if the login was valid or not. How do I make PHP redirection to a new page? Ideally, I want the equivalent of building an query string such as "goodpage.php?Username=<?echo $Username?>" and forcing it to load.
if (trim($CheckPW) == $Password) { echo ("Good Login!"); } else { echo ("Bad Login"); }
Thanks in advance
attached mail follows:
use require_once("<page>"); to include the page....
or use header("Location: <page>"); to redirect to a different page
----- Original Message -----
From: "LB" <loydNOSPAM420
hotmail.com>
To: <php-general
lists.php.net>
Sent: Tuesday, August 21, 2001 10:58 AM
Subject: [PHP] Newbie Question: Forcing a page load with no click
> I've built a small login script (code fragment below), and want to force a
> page load depending on if the login was valid or not. How do I make PHP
> redirection to a new page? Ideally, I want the equivalent of building an
> query string such as "goodpage.php?Username=<?echo $Username?>" and
forcing
> it to load.
>
> if (trim($CheckPW) == $Password) {
> echo ("Good Login!");
> }
> else {
> echo ("Bad Login");
> }
>
> Thanks in advance
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
Is it possible to import images from external sources using ImageCreateFromGIF()? I am working on a script that is designed to pull a web-based counter into another image on my server, but I get errors from every external URL I've tried so far.
Any help would be appreciated.
-- Uchendu Nwachukwu unndunn AT yahoo DOT com - www.unndunn.com
attached mail follows:
> Is it possible to import images from external sources using > ImageCreateFromGIF()? I am working on a script that is designed to pull a > web-based counter into another image on my server, but I get errors from > every external URL I've tried so far.
Probably not.
You'll have to suck the GIF down into a local file, and then use CreateImageFromGIF, I think.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
Ok I have the same problem but this isnt working. The first line of my sript is #!/usr/local/php -q , BTW this isnt in the <? ?> brackets, but should it be?
then I use lynx -dump -http://localhost/show_reminder.php in the crontab, but the mailer demon gives me the message
your terminal lacks the ability to clear the screen or move the cursor. So maybe i dont have php installed correctly as a cgi? I simply downloaded php and then put the php.exe into a folder. Is there some setup that I need to do?
"Dave" <dave
hawk-systems.com> wrote in message
news:DBEIKNMKGOBGNDHAAKGNIEADHOAA.dave
hawk-systems.com...
> php files are text files
> you have to tell cron (or more directly the system) what to do with it.
>
> like a perl script, simply tell it where to find the PHP processor and it
will
> then use it to run your script... otherwise it is just diaplaying a page
of
> text every minute.
>
> you must have a cgi copy of PHP executable available to run your script,
yes you
> can have both on your server if you are already running the mod_php
version.
>
> add
>
> #!/usr/local/bin/php -q
>
> to the first line in your script... then cron will know what to do with
your
> text file.
>
> BTW; a quick search on google for "run php as shell script" produced this
as the
> number 1 result http://www.phpbuilder.com/columns/darrell20000319.php3
> searching for "PHP and CRON" produced yet another plethora of responses.
>
> Dave
>
attached mail follows:
Making a web based proxy server.
On Tuesday 21 August 2001 01:08, you wrote: > On Tue, 21 Aug 2001 18:01, Evan Nemerson wrote: > > Well, I hope nobody will ever have to do what I just did, so here you go. > > I got them from the apache/conf/mime.types > > > > Have fun! > > > > > > > > $extensions = Array( "ez" => "application/andrew-inset", > > <snip> > > What are you using them for Evan? > > Brad
attached mail follows:
how about readdir() in a while loop.
----- Original Message -----
From: Seb Frost <seb
raceshoot.com>
To: <php-general
lists.php.net>
Sent: Tuesday, August 21, 2001 5:26 AM
Subject: [PHP] List of files?
> OK so I'vebeen reading about reading and writing to/from files, but what I
> want to do is (I think) simpler than this.
>
> Basically I want to look at a directory and be able to get a list of all
> subdirectories and then a list of the files in each directory. Can
someone
> give me a hint?
>
> cheers....
>
> - seb
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
On Tue, 21 Aug 2001 21:56, Seb Frost wrote: > OK so I'vebeen reading about reading and writing to/from files, but > what I want to do is (I think) simpler than this. > > Basically I want to look at a directory and be able to get a list of > all subdirectories and then a list of the files in each directory. Can > someone give me a hint? > > cheers.... > > - seb
Goody - a recursive routine. I have just the thing-
// Dirs you don't want listed $badlist = "secret phpMyAdmin stats test tools"; $bad_dirs = explode(" ", $badlist); $docroot = "/usr/local/apache/htdocs/"; $basedir = $docroot;
function read_files($dirname) { global $filelist; $dirid = opendir($dirname); while($entry = readdir($dirid)): $this = $dirname . '/' . $entry; if ( (is_file($this)) && ($entry != ".") && ($entry != "..") && (!eregi("old$",$entry)) && (!eregi("bck$",$entry)) && (strstr($this, ".htm") || strstr($this, ".html") || strstr($this, ".php"))): $filelist[] = $entry; endif; endwhile; }
function exclude_dir($dirname) { global $bad_dirs; $outcome = false; while(list($key, $value) = each($bad_dirs)): if (strstr("$dirname", "$value")): $outcome = true; endif; endwhile; reset($bad_dirs); return $outcome; }
function recurse_dir($basedir) { global $dirlist; $dirid = opendir("$basedir"); while ($entry = readdir($dirid) ) { $this = $basedir . $entry; if ( (is_dir($this)) && ($entry != ".") && ($entry != "..") && (!exclude_dir("$this/"))) { $dirlist[] = $this; recurse_dir("$this/"); }; }; }; ?>
Call it with recurse_dir(dir-to_start) and get the results in $dirlist[] Have fun. And yes, there's room for improvement, having looked at it for the first time in a year or so :-) The first obvious would be to return $dirlist....
-- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIAOxymoron: Sugarless Candy.
attached mail follows:
First off, before you get the wrong impression of my answer, let me say that your observation "It all seems kinda kludgy and quick-hack for a specific > project, and not 'sysv semaphores implimented in php'" is right on.
Chris Chabot <chabotc
reviewboard.com> writes:
> I have been playing with the idea of making some application backend > services using pcntl (for singaling and fork)+ sysvsem's (for > synchronisation).
Cool. But see below.
> However while reading thru the sysvsem source code, i noticed the > behaviour of the semaphores in PHP is basicly as a 'lock' (as one would > use a file lock w/ flock()). From what i understand from my advanced > unix programming book, and the linux man pages, this is not what > semaphores are supposed to be (though they can be abused to be so). > > The way one would -expect- semaphores to function on a unix platform > is best described in "Linux Programmers Guide" at > http://uiarchive.uiuc.edu/mirrors/ftp/ftp.ibiblio.org/pub/Linux/docs/linux-doc-project/programmers-guide/lpg-0.4.pdf > (page 46 and on). > > A short sumary would be: a semaphore is a resource counter (not an > absolute lock).
A lock is just a degenerate case. A slightly less degenerate case (that can't be implemented with flock) is when you want to allow N users of the resource instead of just one.
> The main this is that a process other then the process that acquired > the semaphore can decrease the semaphore count, thus releasing it for > another client. Another big difference is that a process can set the > semaphore count lower then zero (0 == locked). This sometimes can be > usefull for Client / Server synchonisation. > > Example usage for a typical Client / Server program flow using > semaphores / signals :
I admit I haven't looked at this hard enough to understand all the details, but could message queues help you out here? You could get higher throughput since the server fills the buffer and calls msgsnd() beforehand, whereas in your signalling implementation clients will stall between the time they signal the server and the time the server has filled a buffer for them. Also, you need some additional overhead to manage the buffer handoff from client to server. And doing things in signal handlers can get dicey.
If a message queue isn't big enough for you, you can pass references to shared memory in your messages.
> Server : > create sem > sem acquire > setup envirioment > fork children > > Multiple Clients: > repeat (wait for sem acquire) { > send signal to Server > communicate with server, get 'buffer' > process buffer > } > > Server: > > while (Fill data into buffer) { > semaphore release (!); > Sleep(infinite or untill time out); > } > > -> Sleeps untill interupted by signal (signal send by Client/Child) > -> In signal handler: > Send 'buffer' to client that acquired semaphore > return; > will cause the program to go back to main loop, sleep was interupted, > so goes to while (fill buffer) again. Also note that the Client -never- > calls semaphore release. The server does that once the resource is > available again. > > Rinse and Repeat till end of time, or end of data :-) This will > distribute the data to be processed over all the different clients > (since semaphores guarantee a linear processing of clients, so all > clients get there equal share). > > Last, i don't see why the implimentation as exists, requires 3 > semaphores.
I don't remember why either. I did that code somewhere around the end of 1998 . . .
> It all seems kinda kludgy and quick-hack for a specific > project, and not 'sysv semaphores implimented in php'. (please forgive > my rude assumptions)
Bingo.
> Does the maintainer (Tom May) want to work on this, or anyone else? I'd > be happy to help out, but my last C coding days are over 6 years behind > me, so i don't feel very confident to lead this project.. So any/all > help and/or comments would be apreciated.
I no longer use php or maintain any of the stuff I helped with (aside from answering the occaisional question, like this one.
> Also i noticed a potential security hole in the exisiting source, at > line 190 of sysvsem.c it uses > > semget(key, 3, perm|IPC_CREATE); > > However, perm is not zero'd to 7 bits before being used, thus allowing > extra flags being added to the call, which presumably is unintentional, > since it allows nasty flags to be passed to this call. perm is gotton > from arg_perm, which is a lval. What i imagine you 'should' do is zero > out all non-relivant bits, basicly AND perm with 0x777. this will clear > all bits other then the (file style) permission flags.
AND with 0777. Good catch.
> -- Chris Chabot > > Ps. please CC me in replies, since im not subscribed to the php lists.
Me either.
Tom.
attached mail follows:
There probably should be a full implementation of semaphores in php. If you have a need for this, we should discuss exactly how it should be implemented. I will have some free time available soon, so I can start working on this. Though I have a couple other projects as well. If you would be interested in contributing a CVS account can be arranged. This should probably start as a separate module, and then eventually replace the sysvsem extension as it is no long being actively maintained.
I have a great desire for php to function well as a standalone scripting language as well as web, so I am always interested as projects like this.
Is there anyone else who would find this useful?
-Jason
----- Original Message -----
From: "Tom May" <tom.may
infospace.com>
To: "Chris Chabot" <chabotc
reviewboard.com>
Cc: <php-dev
lists.php.net>; <php-general
lists.php.net>; <jason
inetgurus.net>
Sent: Tuesday, August 21, 2001 1:58 PM
Subject: Re: sysvsem extention question
> First off, before you get the wrong impression of my answer, let me
> say that your observation "It all seems kinda kludgy and quick-hack
> for a specific > project, and not 'sysv semaphores implimented in
> php'" is right on.
>
> Chris Chabot <chabotc
reviewboard.com> writes:
>
> > I have been playing with the idea of making some application backend
> > services using pcntl (for singaling and fork)+ sysvsem's (for
> > synchronisation).
>
> Cool. But see below.
>
> > However while reading thru the sysvsem source code, i noticed the
> > behaviour of the semaphores in PHP is basicly as a 'lock' (as one would
> > use a file lock w/ flock()). From what i understand from my advanced
> > unix programming book, and the linux man pages, this is not what
> > semaphores are supposed to be (though they can be abused to be so).
> >
> > The way one would -expect- semaphores to function on a unix platform
> > is best described in "Linux Programmers Guide" at
> > http://uiarchive.uiuc.edu/mirrors/ftp/ftp.ibiblio.org/pub/Linux/docs/linux-doc-project/programmers-guide/lpg-0.4.pdf
> > (page 46 and on).
> >
> > A short sumary would be: a semaphore is a resource counter (not an
> > absolute lock).
>
> A lock is just a degenerate case. A slightly less degenerate case
> (that can't be implemented with flock) is when you want to allow N
> users of the resource instead of just one.
>
> > The main this is that a process other then the process that acquired
> > the semaphore can decrease the semaphore count, thus releasing it for
> > another client. Another big difference is that a process can set the
> > semaphore count lower then zero (0 == locked). This sometimes can be
> > usefull for Client / Server synchonisation.
> >
> > Example usage for a typical Client / Server program flow using
> > semaphores / signals :
>
> I admit I haven't looked at this hard enough to understand all the
> details, but could message queues help you out here? You could get
> higher throughput since the server fills the buffer and calls msgsnd()
> beforehand, whereas in your signalling implementation clients will
> stall between the time they signal the server and the time the server
> has filled a buffer for them. Also, you need some additional overhead
> to manage the buffer handoff from client to server. And doing things
> in signal handlers can get dicey.
>
> If a message queue isn't big enough for you, you can pass references
> to shared memory in your messages.
>
> > Server :
> > create sem
> > sem acquire
> > setup envirioment
> > fork children
> >
> > Multiple Clients:
> > repeat (wait for sem acquire) {
> > send signal to Server
> > communicate with server, get 'buffer'
> > process buffer
> > }
> >
> > Server:
> >
> > while (Fill data into buffer) {
> > semaphore release (!);
> > Sleep(infinite or untill time out);
> > }
> >
> > -> Sleeps untill interupted by signal (signal send by Client/Child)
> > -> In signal handler:
> > Send 'buffer' to client that acquired semaphore
> > return;
> > will cause the program to go back to main loop, sleep was interupted,
> > so goes to while (fill buffer) again. Also note that the Client -never-
> > calls semaphore release. The server does that once the resource is
> > available again.
> >
> > Rinse and Repeat till end of time, or end of data :-) This will
> > distribute the data to be processed over all the different clients
> > (since semaphores guarantee a linear processing of clients, so all
> > clients get there equal share).
> >
> > Last, i don't see why the implimentation as exists, requires 3
> > semaphores.
>
> I don't remember why either. I did that code somewhere around the end
> of 1998 . . .
>
> > It all seems kinda kludgy and quick-hack for a specific
> > project, and not 'sysv semaphores implimented in php'. (please forgive
> > my rude assumptions)
>
> Bingo.
>
> > Does the maintainer (Tom May) want to work on this, or anyone else? I'd
> > be happy to help out, but my last C coding days are over 6 years behind
> > me, so i don't feel very confident to lead this project.. So any/all
> > help and/or comments would be apreciated.
>
> I no longer use php or maintain any of the stuff I helped with (aside
> from answering the occaisional question, like this one.
>
> > Also i noticed a potential security hole in the exisiting source, at
> > line 190 of sysvsem.c it uses
> >
> > semget(key, 3, perm|IPC_CREATE);
> >
> > However, perm is not zero'd to 7 bits before being used, thus allowing
> > extra flags being added to the call, which presumably is unintentional,
> > since it allows nasty flags to be passed to this call. perm is gotton
> > from arg_perm, which is a lval. What i imagine you 'should' do is zero
> > out all non-relivant bits, basicly AND perm with 0x777. this will clear
> > all bits other then the (file style) permission flags.
>
> AND with 0777. Good catch.
>
> > -- Chris Chabot
> >
> > Ps. please CC me in replies, since im not subscribed to the php lists.
>
> Me either.
>
> Tom.
attached mail follows:
As far as creating the new module goes, it shouldn't be 'to much effort'. The basic implimentation of system v semaphores is actualy quite simple, its the usage of sempahores that can be very confusing :-) sysv sem's are often refered to as the most difficult to comprehend of the sysv standards.
I would be more then willing to donate my time and efforts to that project, and i do have some knowledge of how semaphores can be used (reader-writer, resource count and lock implimentations). However as i mentioned before, my last C project is some years ago, also my knowledge of Zend internals is limited to the php-usage scope
do note a locked semaphore == 0, any value above 0 allows for a 'lock', this is done to allow multiple client-locks clasical example is : if the printer manager daemon has 5 printers, it creates a semaphore with a max_acquire of 5. (so acquire count == 5). Every client connecting, lowers that count... untill its zero. Then the client blocks 'till the value is positive again.
Proposed API of the sysvsem -----------------------------------
* $sem = sem_get($key,$max_acquire,$perms) Gets or creates a semaphore id, id is returned in $sem * $ret = sem_acquire($sem) Tries to lowerer the acquire count of the semaphore. If count is already 0, wait till it is raised (by sem_release) or returns an error (sem_remove was called or invalid permission to get semaphore). note: when the client blocks 'semzcnt' is increased (semzcnt = # of processes waiting for lock) * $ret = sem_release($sem) Increases the acquire count
[proposed new function] * $count = sem_get_waiting($sem) Returns the amount of processes blocking on a semaphore acquire call. I propose -1 = error, 0 > incicates # of waiting processes.
Man Pages ------------- man pages in linux are avail for: * semget * semop * semctl
more info can be found on the url i posted in orig email, it explains the sem api decently.
Documentation ------------------ I'd be happy to help write up some documentation, general how-to-use semaphores for usage in php docs, plus some example implimentations..
I will see how far i can get using the existing implimentation as a template for implimenting a php module.. however be sure i'll come knocking for help fairly soon :-)
-- Chris
Jason Greene wrote:
> There probably should be a full implementation of semaphores in php. If you
> have a need for this, we should discuss exactly how it should be implemented.
> I will have some free time available soon, so I can start working on this. Though I have
> a couple other projects as well. If you would be interested in contributing a CVS
> account can be arranged. This should probably start as a separate module, and then
> eventually replace the sysvsem extension as it is no long being actively maintained.
>
> I have a great desire for php to function well as a standalone scripting language
> as well as web, so I am always interested as projects like this.
>
> Is there anyone else who would find this useful?
>
> -Jason
>
> ----- Original Message -----
> From: "Tom May" <tom.may
infospace.com>
> To: "Chris Chabot" <chabotc
reviewboard.com>
> Cc: <php-dev
lists.php.net>; <php-general
lists.php.net>; <jason
inetgurus.net>
> Sent: Tuesday, August 21, 2001 1:58 PM
> Subject: Re: sysvsem extention question
>
> > First off, before you get the wrong impression of my answer, let me
> > say that your observation "It all seems kinda kludgy and quick-hack
> > for a specific > project, and not 'sysv semaphores implimented in
> > php'" is right on.
> >
> > Chris Chabot <chabotc
reviewboard.com> writes:
> >
> > > I have been playing with the idea of making some application backend
> > > services using pcntl (for singaling and fork)+ sysvsem's (for
> > > synchronisation).
> >
> > Cool. But see below.
> >
> > > However while reading thru the sysvsem source code, i noticed the
> > > behaviour of the semaphores in PHP is basicly as a 'lock' (as one would
> > > use a file lock w/ flock()). From what i understand from my advanced
> > > unix programming book, and the linux man pages, this is not what
> > > semaphores are supposed to be (though they can be abused to be so).
> > >
> > > The way one would -expect- semaphores to function on a unix platform
> > > is best described in "Linux Programmers Guide" at
> > > http://uiarchive.uiuc.edu/mirrors/ftp/ftp.ibiblio.org/pub/Linux/docs/linux-doc-project/programmers-guide/lpg-0.4.pdf
> > > (page 46 and on).
> > >
> > > A short sumary would be: a semaphore is a resource counter (not an
> > > absolute lock).
> >
> > A lock is just a degenerate case. A slightly less degenerate case
> > (that can't be implemented with flock) is when you want to allow N
> > users of the resource instead of just one.
> >
> > > The main this is that a process other then the process that acquired
> > > the semaphore can decrease the semaphore count, thus releasing it for
> > > another client. Another big difference is that a process can set the
> > > semaphore count lower then zero (0 == locked). This sometimes can be
> > > usefull for Client / Server synchonisation.
> > >
> > > Example usage for a typical Client / Server program flow using
> > > semaphores / signals :
> >
> > I admit I haven't looked at this hard enough to understand all the
> > details, but could message queues help you out here? You could get
> > higher throughput since the server fills the buffer and calls msgsnd()
> > beforehand, whereas in your signalling implementation clients will
> > stall between the time they signal the server and the time the server
> > has filled a buffer for them. Also, you need some additional overhead
> > to manage the buffer handoff from client to server. And doing things
> > in signal handlers can get dicey.
> >
> > If a message queue isn't big enough for you, you can pass references
> > to shared memory in your messages.
> >
> > > Server :
> > > create sem
> > > sem acquire
> > > setup envirioment
> > > fork children
> > >
> > > Multiple Clients:
> > > repeat (wait for sem acquire) {
> > > send signal to Server
> > > communicate with server, get 'buffer'
> > > process buffer
> > > }
> > >
> > > Server:
> > >
> > > while (Fill data into buffer) {
> > > semaphore release (!);
> > > Sleep(infinite or untill time out);
> > > }
> > >
> > > -> Sleeps untill interupted by signal (signal send by Client/Child)
> > > -> In signal handler:
> > > Send 'buffer' to client that acquired semaphore
> > > return;
> > > will cause the program to go back to main loop, sleep was interupted,
> > > so goes to while (fill buffer) again. Also note that the Client -never-
> > > calls semaphore release. The server does that once the resource is
> > > available again.
> > >
> > > Rinse and Repeat till end of time, or end of data :-) This will
> > > distribute the data to be processed over all the different clients
> > > (since semaphores guarantee a linear processing of clients, so all
> > > clients get there equal share).
> > >
> > > Last, i don't see why the implimentation as exists, requires 3
> > > semaphores.
> >
> > I don't remember why either. I did that code somewhere around the end
> > of 1998 . . .
> >
> > > It all seems kinda kludgy and quick-hack for a specific
> > > project, and not 'sysv semaphores implimented in php'. (please forgive
> > > my rude assumptions)
> >
> > Bingo.
> >
> > > Does the maintainer (Tom May) want to work on this, or anyone else? I'd
> > > be happy to help out, but my last C coding days are over 6 years behind
> > > me, so i don't feel very confident to lead this project.. So any/all
> > > help and/or comments would be apreciated.
> >
> > I no longer use php or maintain any of the stuff I helped with (aside
> > from answering the occaisional question, like this one.
> >
> > > Also i noticed a potential security hole in the exisiting source, at
> > > line 190 of sysvsem.c it uses
> > >
> > > semget(key, 3, perm|IPC_CREATE);
> > >
> > > However, perm is not zero'd to 7 bits before being used, thus allowing
> > > extra flags being added to the call, which presumably is unintentional,
> > > since it allows nasty flags to be passed to this call. perm is gotton
> > > from arg_perm, which is a lval. What i imagine you 'should' do is zero
> > > out all non-relivant bits, basicly AND perm with 0x777. this will clear
> > > all bits other then the (file style) permission flags.
> >
> > AND with 0777. Good catch.
> >
> > > -- Chris Chabot
> > >
> > > Ps. please CC me in replies, since im not subscribed to the php lists.
> >
> > Me either.
> >
> > Tom.
attached mail follows:
Is it good practice (sp?) to jump in and out of php whenever you've got some plain html to write, or should one write an entire file in php? I'm leaning towards the latter, unless there's a huge chunk of html code.
opinions?
- seb
attached mail follows:
I would say not to embed php in html... look at class.FastTemplates.php, just go to google.com and do a search.. also some people like PHPLib Templates.
jay
----- Original Message -----
From: "Seb Frost" <sebfrost
icmtb.co.uk>
To: <php-general
lists.php.net>
Sent: Tuesday, August 21, 2001 2:10 PM
Subject: [PHP] To jump or not to jump?
> Is it good practice (sp?) to jump in and out of php whenever you've got
some
> plain html to write, or should one write an entire file in php? I'm
leaning
> towards the latter, unless there's a huge chunk of html code.
>
> opinions?
>
> - seb
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
I generally like to write separate library files containing most of the code, store them outside of the web directory, include the necessary libraries and then just insert function calls where I need them in the html.
> From: sebfrost
icmtb.co.uk (Seb Frost)
> Newsgroups: php.general
> Date: Tue, 21 Aug 2001 20:10:38 +0100
> To: <php-general
lists.php.net>
> Subject: To jump or not to jump?
>
> Is it good practice (sp?) to jump in and out of php whenever you've got some
> plain html to write, or should one write an entire file in php? I'm leaning
> towards the latter, unless there's a huge chunk of html code.
>
> opinions?
>
> - seb
>
attached mail follows:
> > From: sebfrost
icmtb.co.uk (Seb Frost)
> > Newsgroups: php.general
> > Date: Tue, 21 Aug 2001 20:10:38 +0100
> > To: <php-general
lists.php.net>
> > Subject: To jump or not to jump?
> >
> > Is it good practice (sp?) to jump in and out of php whenever you've got some
> > plain html to write, or should one write an entire file in php? I'm leaning
> > towards the latter, unless there's a huge chunk of html code.
I'm starting to do it the right way (tm). That is, I start to not do it like you do anymore, but instead try to use templates as much as possible. This doesn't clutter up your PHP code with HTML and thus makes it easier to read.
I use Smarty (www.phpinsider.com). I haven't tested anything else and find it quite easy to use.
Alexander Skwar
-- How to quote: http://learn.to/quote (german) http://quote.6x.to (english) Homepage: http://www.digitalprojects.com | http://www.iso-top.de iso-top.de - Die günstige Art an Linux Distributionen zu kommen Uptime: 5 hours 10 minutes
attached mail follows:
Jump out for anything more than three lines of pure HTML.
Your HTML will be much easier to read.
Speed-wise, it just doesn't matter, unless you intentionally alternate back-and-forth every other line... Even then, the difference is negligible.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Seb Frost <sebfrost
icmtb.co.uk> Newsgroups: php.general To: <php-general
lists.php.net> Sent: Tuesday, August 21, 2001 2:10 PM Subject: To jump or not to jump?
> Is it good practice (sp?) to jump in and out of php whenever you've got some > plain html to write, or should one write an entire file in php? I'm leaning > towards the latter, unless there's a huge chunk of html code. > > opinions? > > - seb >
attached mail follows:
Hey, we've got an article about it on PHPBeginner.com http://www.phpbeginner.com/columns/jason/echo
Cheers, Maxim Maletsky
www.PHPBeginner.com
-----Original Message-----
From: Alexander Skwar [mailto:ASkwar
DigitalProjects.com]
Sent: Wednesday, August 22, 2001 6:14 AM
To: Gabe da Silveira
Cc: php-general
lists.php.net
Subject: Re: [PHP] Re: To jump or not to jump?
> > From: sebfrost
icmtb.co.uk (Seb Frost)
> > Newsgroups: php.general
> > Date: Tue, 21 Aug 2001 20:10:38 +0100
> > To: <php-general
lists.php.net>
> > Subject: To jump or not to jump?
> >
> > Is it good practice (sp?) to jump in and out of php whenever you've got
some
> > plain html to write, or should one write an entire file in php? I'm
leaning
> > towards the latter, unless there's a huge chunk of html code.
I'm starting to do it the right way (tm). That is, I start to not do it like you do anymore, but instead try to use templates as much as possible. This doesn't clutter up your PHP code with HTML and thus makes it easier to read.
I use Smarty (www.phpinsider.com). I haven't tested anything else and find it quite easy to use.
Alexander Skwar
-- How to quote: http://learn.to/quote (german) http://quote.6x.to (english) Homepage: http://www.digitalprojects.com | http://www.iso-top.de iso-top.de - Die günstige Art an Linux Distributionen zu kommen Uptime: 5 hours 10 minutes-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
anyone know why the header() wouldn't work? I don't have anything being printed out before or after I call the header(). The only thing that does happen is when it tries to redirect the user it sends them to a 404 page error. Also, when I check the web server log it says it's trying to call ".php" (note no file name in front of the '.php'). I'm not sure what's going on but any suggestions?
Thanks, Jay
attached mail follows:
Hi Jay,
> anyone know why the header() wouldn't work? I don't have anything > being printed out before or after I call the header(). The only thing > that does happen is when it tries to redirect the user it sends them > to a 404 page error. Also, when I check the web server log it says > it's trying to call ".php" (note no file name in front of the '.php'). > I'm not sure what's going on but any suggestions? >
If you call the function Header, like: Header($name.".php");
Then there's an possibility that $name (your variable name) isn't set. Could you supply the part of your code where you call Header? That should make the problem better traceable.
Regards, Gijs.
attached mail follows:
header() works.
it's the text that header() is printing that's causing problems.
what are you outputting via header() ?
> -----Original Message-----
> From: Jay Paulson [mailto:jpaulson
lbjs.com]
> Sent: Tuesday, August 21, 2001 3:10 PM
> To: php-general
lists.php.net
> Subject: [PHP] header() not working.
>
>
> anyone know why the header() wouldn't work? I don't have anything being
> printed out before or after I call the header(). The only thing that does
> happen is when it tries to redirect the user it sends them to a 404 page
> error. Also, when I check the web server log it says it's trying to call
> ".php" (note no file name in front of the '.php'). I'm not sure what's
> going on but any suggestions?
>
> Thanks,
> Jay
>
attached mail follows:
There's my code below:
header("Location:loggedon.php?SID=$SID"); exit;
I know the file is there cause I look right at it when I do an ls command. I also know that the $SID variable is set cause I've echoed that out before the header(). The header() seems not to work on files that are in the same directory that the header() calls. However, when I put say yahoo.com in the header() it works fine, it just doesn't seem to work when I call local files.
Thanks, Jay
----- Original Message -----
From: "scott [gts]" <scott
graphictype.com>
To: "php" <php-general
lists.php.net>
Sent: Tuesday, August 21, 2001 2:27 PM
Subject: RE: [PHP] header() not working.
> header() works.
>
> it's the text that header() is printing
> that's causing problems.
>
> what are you outputting via header() ?
>
> > -----Original Message-----
> > From: Jay Paulson [mailto:jpaulson
lbjs.com]
> > Sent: Tuesday, August 21, 2001 3:10 PM
> > To: php-general
lists.php.net
> > Subject: [PHP] header() not working.
> >
> >
> > anyone know why the header() wouldn't work? I don't have anything being
> > printed out before or after I call the header(). The only thing that
does
> > happen is when it tries to redirect the user it sends them to a 404 page
> > error. Also, when I check the web server log it says it's trying to
call
> > ".php" (note no file name in front of the '.php'). I'm not sure what's
> > going on but any suggestions?
> >
> > Thanks,
> > Jay
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
Thanks; after some all-nighter testing have come up with a solution. Will definitely have to access the individual variables as ("quoted_strings") instead of ($variable). Looks like this works: <? $out = array(0 => array("name", "srch", "sel", "case", "qvalues" => array(0 => array("values", "valtypes"), 1 => array("values", "valtypes"), 2 => array("values", "valtypes"), 3 => array("values", "valtypes"), 4 => array("values", "valtypes"), 5 => array("values", "valtypes"), 6 => array("values", "valtypes"), 7 => array("values", "valtypes"), 8 => array("values", "valtypes"), 9 => array("values", "valtypes")), 1 => array("name", "srch", "sel", "case", "qvalues" => array(0 => array("values", "valtypes"), 1 => array("values", "valtypes"), 2 => array("values", "valtypes"), 3 => array("values", "valtypes"), 4 => array("values", "valtypes"), 5 => array("values", "valtypes"), 6 => array("values", "valtypes"), 7 => array("values", "valtypes"), 8 => array("values", "valtypes"), 9 => array("values", "valtypes")), )));
echo "<pre>"; $out[0]["srch"] = "outfreesrch"; $out[0]["sel"] = "outfreesel"; $out[0]["case"] = "outfreecase"; $out[0]["qvalues"][0]["values"] = "outfreeqval0"; $out[0]["qvalues"][0]["valtypes"] = "outfreeqtype0"; $out[0]["qvalues"][1]["values"] = "outfreeqval1"; $out[0]["qvalues"][1]["valtypes"] = "outfreeqtype1"; echo "<br>Basearray index : ", 0, "\n"; echo "<br> name : ", $out[0]["name"], "\n"; echo "<br> srch : ", $out[0]["srch"], "\n"; echo "<br> sel : ", $out[0]["sel"], "\n"; echo "<br> case : ", $out[0]["case"], "\n"; echo "<br> Subarray index : 0 \n"; echo "<br> vals : ", $out[0]["qvalues"][0]["values"], "\n"; echo "<br> valtypes : ", $out[0]["qvalues"][0]["valtypes"], "\n"; echo "<br> Subarray index : 1 \n"; echo "<br> vals : ", $out[0]["qvalues"][1]["values"], "\n"; echo "<br> valtypes : ", $out[0]["qvalues"][2]["valtypes"], "\n"; echo"<br><br>"; $out[1]["srch"] = "outnextsrch"; $out[1]["sel"] = "outnextsel"; $out[1]["case"] = "outnextcase"; $out[1]["qvalues"][0]["values"] = "outnextqval0"; $out[1]["qvalues"][0]["valtypes"] = "outnextqtype0"; $out[1]["qvalues"][1]["values"] = "outnextqval1"; $out[1]["qvalues"][1]["valtypes"] = "outnextqtype1"; echo "<br>Basearray index : ", 1, "\n"; echo "<br> name : ", $out[1]["name"], "\n"; echo "<br> srch : ", $out[1]["srch"], "\n"; echo "<br> sel : ", $out[1]["sel"], "\n"; echo "<br> case : ", $out[1]["case"], "\n"; echo "<br> Subarray index : 0 \n"; echo "<br> vals : ", $out[1]["qvalues"][0]["values"], "\n"; echo "<br> valtypes : ", $out[1]["qvalues"][0]["valtypes"], "\n"; echo "<br> Subarray index : 1 \n"; echo "<br> vals : ", $out[1]["qvalues"][1]["values"], "\n"; echo "<br> valtypes : ", $out[1]["qvalues"][1]["valtypes"], "\n"; echo "</pre>"; ?>
"Tim Ward" <tim.ward
stivesdirect.com> wrote in message
news:D2AC2CC91E72D511BD5600500416D3C0068C23
hunters-mail.itnetadmin.com...
The first thing is that 2-dimensional arrays don't really exist in php. Any
element of any array can be another array. The second important point is
that all php arrays are associative. If you don't declare the key of an
element (e.g. $out[] = "fred") when creating it you get the next integer
available as the key. Your initial declaration creates ...
$out[0] = $name; $out[1] = $srch; $out[2] = $sel; $out[3] = $case; $out[$qvalues][0] = $vals; $out[$qvalues][1] = $valtypes;
with $name, etc. being whatever the variables are at the time the array is initialised.
What I think you wanted (I'm not entirely sure) is more along the lines of .. for ($i=0; $I < $num_out; $I++) $out[] = array("name"=>$name, "srch"=>$srch, "sel"=>$sel, "case"=>$case, $qvalues => array($vals, $valtypes));
I'm not entirely sure what you're trying to do but I hope this points you in the right direction.
Tim
----------
From: Ken Hopkins [SMTP:hoppy
austin.rr.com]
Sent: 20 August 2001 21:02
To: php-general
lists.php.net
Subject: Multi-dimensional array issue
Hi from a recent PHP convert,
Having a heck of a time declaring and accessing 2 dimensional info in an array. any input on where to start looking for the answer would be greatly appreciated.
I want to have a base array of 5 elements. The first 4 elements are variables, and the fifth is an array of 2 elements. seemed harmless enough at the time;)
Coding conventions suggest access to the first level of elements is: $basearray[base_numerical_offset][$basearray_variable] and this works great for accessing the first 4 elements of the base array.
Accessing the fifth elements' variables in the next dimension is where it fails for me:
$basearray[base_numerical_offset][$subarray][sub_numerical_offset][$subarray _variable]
The documentation/snippets/samples, etc. have been to no avail; still can't get to elements in the second dimension properly. Attempts to populate the second level array trahses the entire structure.
I have the following declaration: $out => array($name, $srch, $sel, $case, $qvalues => array($vals, $valtypes); $out is the name of the base array $qvalues is the name of the sub-array under the base array "$out" I need for each $out array to consist of a name, srch, sel, case and then a variable number of qvalues array elements that each have single vals and valtypes elements.
Use the following snippet to see what happens; it's not what I had hoped to see. I hope I'm just doing something wrong..
Thanks, Ken.
mailto:hoppy
austin.rr.com
<?
$out = array($name, $srch, $sel, $case, $qvalues => array($vals, $valtypes)); echo "<pre>"; $out[0][$name] = "free"; $out[1][$name] = "next"; for ($i=0; $i<2; $i++) { echo "<br> OutIndex: ", $i, " Name: ", $out[$i][$name]; }
$out[0][$srch] = "outfreesrch"; $out[0][$sel] = "outfreesel"; $out[0][$case] = "outfreecase"; $out[0][$qvalues][0][$vals] = "outfreeqval0"; $out[0][$qvalues][0][$valtypes] = "outfreeqtype0"; $out[0][$qvalues][1][$vals] = "outfreeqval1"; $out[0][$qvalues][1][$valtypes] = "outfreeqtype1"; echo "<br>Basearray index : ", 0, "\n"; echo "<br> name : ", $out[0][$name], "\n"; echo "<br> srch : ", $out[0][$srch], "\n"; echo "<br> sel : ", $out[0][$sel], "\n"; echo "<br> case : ", $out[0][$case], "\n"; echo "<br> Subarray index : 0 \n"; echo "<br> vals : ", $out[0][$qvalues][0][$vals], "\n"; echo "<br> valtypes : ", $out[0][$qvalues][0][$valtypes], "\n"; echo "<br> Subarray index : 1 \n"; echo "<br> vals : ", $out[0][$qvalues][1][$vals], "\n"; echo "<br> valtypes : ", $out[0][$qvalues][2][$valtypes], "\n"; echo"<br><br>"; $out[1][$srch] = "outnextsrch"; $out[1][$sel] = "outnextsel"; $out[1][$case] = "outnextcase"; $out[1][$qvalues][0][$vals] = "outnextqval0"; $out[1][$qvalues][0][$valtypes] = "outnextqtype0"; $out[1][$qvalues][1][$vals] = "outnextqval1"; $out[1][$qvalues][1][$valtypes] = "outnextqtype1"; echo "<br>Basearray index : ", 1, "\n"; echo "<br> name : ", $out[1][$name], "\n"; echo "<br> srch : ", $out[1][$srch], "\n"; echo "<br> sel : ", $out[1][$sel], "\n"; echo "<br> case : ", $out[1][$case], "\n"; echo "<br> Subarray index : 0 \n"; echo "<br> vals : ", $out[1][$qvalues][0][$vals], "\n"; echo "<br> valtypes : ", $out[1][$qvalues][0][$valtypes], "\n"; echo "<br> Subarray index : 1 \n"; echo "<br> vals : ", $out[1][$qvalues][1][$vals], "\n"; echo "<br> valtypes : ", $out[1][$qvalues][1][$valtypes], "\n"; echo "</pre>"; ?>
attached mail follows:
Hi all,
Just to confirm over the past week or so I have received enough interest in the meeting for it to take place. The details will be as available at http://www.phpuk.org/meetings.php For those who asked how to get tickets please send monies to:
James Moore Prospect House Tower Hill Stogursey Somerset
Please include with this:
Your Name, Your Address, Your Email address Your Phone number
I Will provide receipts on the day to those of you who require them for expenses etc.
If you contacted me about speaking and heard back then please let me know that you are still willing to speak on the subject we spoke about or, if you would like to change your subject please let me know and we can discuss it. If you have not contacted me about speaking yet, but would like too, and think you have something to offer, then please feel free to email me as I'm sure I can find you some time in which to speak.
Any other questions and please feel free to email me about them too. For thoese reading this on PHP General list I am not subscribed to this list so please make sure you reply to me too.
Cheers,
- James
-- James Moore jmoorephp.net
attached mail follows:
Hi ,
I'm having problems with my session_unregister(). Maybe what i'm trying to do can't be done but I would like someones opinion. This is what I am doing and why i'm doing it.
session_start(); session_unregister(val_1); session_register(val_1);
I am doing this to clear the contents of val_1 before I use it again. Needless to say its not working. val_1 always contains the same value until I close the browser. How should I go about it?
P.S. Sorry if you've seen a similar post yesterday, I just never got a reply.
attached mail follows:
> session_start(); > session_unregister(val_1); > session_register(val_1); > > I am doing this to clear the contents of val_1 before I use it again. > Needless to say its not working. val_1 always contains the > same value until
session_registering()'ing a variable just puts it in a list of names of the session variables. session_unregister() just removes the name from the list. Neither function affects the variable's value.
To clear the variable's value, just assign it to blank, or call unset() on it, e.g.,
$val_1 = ""; unset($val_1);
There is no need, or use, in unregistering it, then registering it again.
Kirk
attached mail follows:
tel:874-762-727947 fax:874-762-727949
#20 LOUIS BOTHA CERSCENT, SADTON SOUTH AFRICA.
Dear sir,
In order to transfer out (USD 126 M) One hundred and twenty six million United States Dollars) from African Development Bank. I have the courage to ask you to look for a reliable and honest person who will be capable for this important business believing that you will never let me down either now or in future.
I am mr CEASER BENENE. the Chief auditor of African Development Bank (ADB). There is an account opened in this bank in 1980 and since 1990 nobody has operated on this account again. after going through some old files in the records I discovered that if I do not remit this money out urgently it will be forfeited for nothing. the owner of this account is Mr. Smith B. Andreas, a foreigner, and a miner at kruger gold co., a geologist by profession and he died since 1990. no other person knows about this account or any thing concerning it, the account has no other beneficiary and my investigation proved to me as well that this company does not know anything about this account and the amount involved is (USD 126M) One hundred and twenty six million United States Dollars million dollars. I want to first transfer USDM twenty six million United States Dollars from this money into a safe foreigners account abroad before the rest, but I don't know any foreigner, I am only contacting you as a foreigner because this money can not be approved to a local bank here, but can only be approved to any foreign account because the money is in us dollars and the former owner of the account is Mr. Smith B. Andreas is a foreigner too. I know that this message will come to you as a surprise as we don't know our selves before, we will sign agreement, but be sure that it is real and a genuine business. I only got your contact address my from my secretary who operates computer, with believe in god that you will never let me down in this business you are the only person that I have contacted in this business, so please reply urgently so that I will inform you the next step to take urgently. Send also your private telephone and fax number including the full details of the account to be used for the deposit.
I want us to meet face to face or sign a binding agreement to bind us together so that you can receive this money into a foreign account or any account of your choice where the fund will be safe. and I will fly to your country for withdrawal and sharing and other investments.
I am contacting you because of the need to involve a foreigner with foreign account and foreign beneficiary. I need your full co-operation to make this work fine. because the management is ready to approve this payment to any foreigner who has correct information of this account, which Iwill give to you later immediately, if you are able and with capability to handle such amount in strict confidence and trust according to my instructions and advice for our mutual benefit because this opportunity will never come again in my life. I need truthful person in this business because I don't want to make mistake I need your strong assurance and trust.
With my position now in the office I can transfer this money to any foreigner's reliable account which you can provide with assurance that this money will be intact pending my physical arrival in your country for sharing. I will destroy all documents of transaction immediately we receive this money leaving no trace to any place. you can also come to discuss with me face to face after which I will make this remittance in your presence and two of us will fly to your country at least two days ahead of the money going into the account.
I will apply for annual leave to get visa immediately I hear from you that you are ready to act and receive this fund in your account. I will use my position and influence to effect legal approvals and onward transfer of this money to your account with appropriate clearance forms of the ministries and foreign exchange departments.
At the conclusion of this business, you will be given 35% of the total amount, 60% will be for me, while 5% will be for expenses both parties might have incurred during the process of transferring.
I look forward to your earliest reply through my email address or by my tel:874-762-72-7947,fax:874 762 727949.
yours truly
mr.CEASER.
__________________________________________________ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
attached mail follows:
> > In order to transfer out (USD 126 M) One hundred and > twenty six million United States Dollars) from African > Development Bank >your private telephone and fax > number including the full details of the account to be > used for the deposit.
lol sheesh!
attached mail follows:
On Tuesday 21 August 2001 16:53, Jay Paulson wrote:
> I have a slight problem.. I'm running php 4.0.6 on RedHat 7.1 and I run > my script and it hit's: > > header("Location:index.php"); > > well the thing is once it hits that line in my script and just fails, > however i don't get any type of parse error the browser just says 404 > error page not found... could it be i forgot to add something when i > configured and installed php on my machine?
(1) Add a space after the colon (2) "Location:" should get a complete URL, i.e. header ("Location: http://your.server.us/index.php");
> and have it hit the header() line and i get teh 404 page error.. (and
A 404 can't come from parse errors or something. It *does* redirect you, but doesn't find the target file -> 404
-- Christian Reiniger LGDC Webmaster (http://lgdc.sunsite.dk/)Install once, run forever. Linux.
attached mail follows:
On Tuesday 21 August 2001 17:10, Ray Clouse wrote: > So we need to keep as much compressed as possible, but we have to > uncompress the data for the webpages to use it. The PHP webpages on > the server use the uncompressed data to generate plots. The data is > never sent to the user, just the plots. > > The main problem I'm having is with page resolution. If I say: > > print("<SCRIPT>jsPopupWindow('Starting UNZIP');</SCRIPT>\n"); > > $gunzipcmdline = "gunzip /PATHTO/MYDATA"; > $result = exec("$gunzipcmdline", $execout, $execretval);
Uncompressing should not take that much time. And you can speed it up by using the zlib functions instead of a exec (gunzip ...) http://php.net/gzopen
Also, if the file to be uncompressed is very large, you should cache the results (the generated plots).
-- Christian Reiniger LGDC Webmaster (http://lgdc.sunsite.dk/)Install once, run forever. Linux.
attached mail follows:
Another part of this is an external program on the server that can't read from the gzipped file. The file has to be uncompressed, unfortunately. The resulting uncompressed file is recompressed through a cron job after 30 days if it hasn't been used for 30 days.
I came up with something that appears to work WRT the pop up dialog problem. In my main browser window, from Javascript, I pop up an alert telling the luser the unzip is beginning. Then in the gunzip code, in the <BODY>, I do this:
print("<BODY"); print(" onUnload=\"alert('Finished uncompressing $datafile... please " . "refresh main window.')\"\n");
And I use Javascript to close the window. Now I just need a way to automatically refresh the main browser window and I'm happy.
Thanks for the help!
Christian Reiniger wrote:
>On Tuesday 21 August 2001 17:10, Ray Clouse wrote: > >>So we need to keep as much compressed as possible, but we have to >>uncompress the data for the webpages to use it. The PHP webpages on >>the server use the uncompressed data to generate plots. The data is >>never sent to the user, just the plots. >> >>The main problem I'm having is with page resolution. If I say: >> >> print("<SCRIPT>jsPopupWindow('Starting UNZIP');</SCRIPT>\n"); >> >> $gunzipcmdline = "gunzip /PATHTO/MYDATA"; >> $result = exec("$gunzipcmdline", $execout, $execretval); >> > >Uncompressing should not take that much time. And you can speed it up by >using the zlib functions instead of a exec (gunzip ...) >http://php.net/gzopen > >Also, if the file to be uncompressed is very large, you should cache the >results (the generated plots). >
-- ------------------------------------------------------------------------- Ray Clouse | Don't fear the penguins. Engineer Scientist/Specialist | Boeing Expendable Launch Vehicles | Ray.Clouse AT boeing.com Huntington Beach, CA | clouse AT rayclouse.org
attached mail follows:
You may just need a flush() call after the Starting UNZIP.
PHP (Apache, actually) sends data to the browser when there's enough to send, not right away.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Ray Clouse <ray.clouse
boeing.com> Newsgroups: php.general To: <justin
indent.com.au> Cc: php <php-general
lists.php.net>; <heiko.jones
boeing.com> Sent: Tuesday, August 21, 2001 10:10 AM Subject: Re: [PHP] Need "Working..." pop up dialog (repost)
> It's due to space restrictions on the server. We have 300GB available > on the server, but the compressed data takes up 200GB, and we're adding > new data (several GB) every month or so. > > So we need to keep as much compressed as possible, but we have to > uncompress the data for the webpages to use it. The PHP webpages on the > server use the uncompressed data to generate plots. The data is never > sent to the user, just the plots. > > The main problem I'm having is with page resolution. If I say: > > print("<SCRIPT>jsPopupWindow('Starting UNZIP');</SCRIPT>\n"); > > $gunzipcmdline = "gunzip /PATHTO/MYDATA"; > $result = exec("$gunzipcmdline", $execout, $execretval); > > print("<SCRIPT>jsPopupWindow('Finished UNZIP');</SCRIPT>\n"); > > the 'Starting UNZIP' popup appears at the same time as the 'Finished > UNZIP' one. The page hasn't resolved until after the gunzip is done, so > it doesn't execute the Javascript the way I want it to. I've tried > popping up a window, getting the handle, passing the handle to the > gunzip code, then closing the handle when the gunzip is done, but that > hasn't worked either. > > Justin French wrote: > > >Ray Clouse wrote: > > > >>When the user clicks on a link that has to gunzip a very large file, I > >>want a popup to say "Working..." while the file is uncompressing. > >>Then, when the file is uncompressed, I want the "Working..." popup to > >>close itself and then the parent window to load a new URL (where it > >>will use the uncompressed file). > >> > >>I've tried doing this with Javascript and window.open(), but I'm having > >>no luck. Any ideas? > >> > > > >Is the uncompressing taking place on the server? or on the local (user) > >machine? Sounds like it's on the server. > > > >The problem is, you have no *real* way of knowing how long the de-comp > >will take (due to other factors, like server/client load, etc etc), so > >how do you know when to go from "working" to "done". > > > > > >So, i'm trying to figure out WHY you're uncompressing a file on the > >server that will be used by visitors over http. > > > >Seems wrong to me. Increased server load, more programs, more problems, > >slower server response time, increased user anger, etc etc. > > > > > >Enlighten me as to why, because I may be missing something. > > > > > >Justin French > > > > -- > ------------------------------------------------------------------------- > Ray Clouse | Don't fear the penguins. > Engineer Scientist/Specialist | > Boeing Expendable Launch Vehicles | Ray.Clouse AT boeing.com > Huntington Beach, CA | clouse AT rayclouse.org > > > >
attached mail follows:
This is the code in the first page that I visit.
<? session_start(); $check0 = session_is_registered("fb"); $check1 = session_register("fa"); $check2 = session_is_registered("fa"); $check3 = isset($HTTP_SESSION_VARS["fa"]); $HTTP_SESSION_VARS["fa"] = "avalue"; $check4 = isset($HTTP_SESSION_VARS["fa"]);
echo "check0=$check0<br>check1=$check1<br>check2=$check2<br>check3=$check3<br>che ck4=$check4"; ?>
This is the output i get.
check0= check1=1 check2=1 check3= check4=1
apparently, session_is_registered and isset return null if they evaluate to false. I was expecting boolean true and false return values, but no matter i can work with it this way, just wondering if this is by design.?
regards, Johnny Nguyen
attached mail follows:
> apparently, session_is_registered and isset return null if > they evaluate to > false. I was expecting boolean true and false return values,
What you were expecting is correct, boolean true/false. However, it appears that PHP converts these values to strings during the echo. true converts to the string 1, while a false string is the empty (null) string.
<? $a = true; echo "a is $a <br>"; $a = false; echo "a is $a <br>"; ?>
Kirk
attached mail follows:
So sprach »Johnny Nguyen« am 2001-08-21 um 12:29:53 -0700 : > false. I was expecting boolean true and false return values, but no matter > i can work with it this way, just wondering if this is by design.?
There isn't such a thing as boolean true or false in PHP. In PHP, everything other than NULL, FALSE, 0 and "" (empty string) is considered to be TRUE if used in a boolean context.
Alexander Skwar
-- How to quote: http://learn.to/quote (german) http://quote.6x.to (english) Homepage: http://www.digitalprojects.com | http://www.iso-top.de iso-top.de - Die günstige Art an Linux Distributionen zu kommen Uptime: 5 hours 13 minutes
attached mail follows:
I have two pages page1.php and page2.php
here is the code for page1.php:
<? session_start(); if (session_is_registered != 1) { session_register("FailedLogins"); $HTTP_SESSION_VARS["FailedLogins"] = 0; }
if ($HTTP_SESSION_VARS["FailedLogins"] > 3) { echo "you have made " . $HTTP_SESSION_VARS["FailedLogins"] . " login attempts"; } ?> <a href="page2.php">Simulate a failed login</a>
here is the code for page2.php: <? session_start(); session_register("FailedLogins"); $HTTP_SESSION_VARS["FailedLogins"]++; Header("Location: page1.php"); ?>
Ok. so after i click on my link to simulate failed logins 3 times, I should see the number of failed logins. It seems like the gist of the problems is that different pages can't seem to modify the same session variables.
any ideas? thanks everyone.
regards, Johnny Nguyen
attached mail follows:
Start with this correction on page1.php:
> if (session_is_registered != 1) {
should be
> if (session_is_registered("FailedLogins") != 1) {
We'll go from there :)
Kirk
attached mail follows:
oops. of course that's what i meant.
-----Original Message-----
From: Johnson, Kirk [mailto:kjohnson
zootweb.com]
Sent: Tuesday, August 21, 2001 1:56 PM
To: php-general
lists.php.net
Subject: RE: [PHP] Session Headaches
Start with this correction on page1.php:
> if (session_is_registered != 1) {
should be
> if (session_is_registered("FailedLogins") != 1) {
We'll go from there :)
Kirk
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribelists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
OK, the session_is_registered() thing is correct.
> It seems like the gist of the problems is that different > pages can't seem to > modify the same session variables.
This is definitely not the case. Two things to try:
1. In page2, put some logic around the "session_register("FailedLogins");", otherwise you re-register on every visit. I don't think this affects the variable's value, but it is definitely wasted cycles.
2. If register_globals is set to "on" in php.ini, and you are using a PHP version earlier than 4.0.6, then the code below probably won't work. If this is the case, just use the global variable, $FailedLogins, instead of $HTTP_SESSION_VARS["FailedLogins"] everywhere.
Kirk
> -----Original Message-----
> From: Johnny Nguyen [mailto:johnny
zugara.com]
> Sent: Tuesday, August 21, 2001 1:58 PM
> To: php-general
lists.php.net
> Subject: [PHP] Session Headaches
>
>
> I have two pages page1.php and page2.php
>
> here is the code for page1.php:
>
> <?
> session_start();
> if (session_is_registered != 1) {
> session_register("FailedLogins");
> $HTTP_SESSION_VARS["FailedLogins"] = 0;
> }
>
> if ($HTTP_SESSION_VARS["FailedLogins"] > 3) {
> echo "you have made " .
> $HTTP_SESSION_VARS["FailedLogins"] . " login
> attempts";
> }
> ?>
> <a href="page2.php">Simulate a failed login</a>
>
>
>
> here is the code for page2.php:
> <?
> session_start();
> session_register("FailedLogins");
> $HTTP_SESSION_VARS["FailedLogins"]++;
> Header("Location: page1.php");
> ?>
>
> Ok. so after i click on my link to simulate failed logins 3
> times, I should
> see the number of failed logins.
> It seems like the gist of the problems is that different
> pages can't seem to
> modify the same session variables.
attached mail follows:
I am using php 4.0.6 and i would rather not use global variables.
regards, Johnny Nguyen
-----Original Message-----
From: Johnson, Kirk [mailto:kjohnson
zootweb.com]
Sent: Tuesday, August 21, 2001 3:33 PM
To: php-general
lists.php.net
Subject: RE: [PHP] Session Headaches
OK, the session_is_registered() thing is correct.
> It seems like the gist of the problems is that different > pages can't seem to > modify the same session variables.
This is definitely not the case. Two things to try:
1. In page2, put some logic around the "session_register("FailedLogins");", otherwise you re-register on every visit. I don't think this affects the variable's value, but it is definitely wasted cycles.
2. If register_globals is set to "on" in php.ini, and you are using a PHP version earlier than 4.0.6, then the code below probably won't work. If this is the case, just use the global variable, $FailedLogins, instead of $HTTP_SESSION_VARS["FailedLogins"] everywhere.
Kirk
> -----Original Message-----
> From: Johnny Nguyen [mailto:johnny
zugara.com]
> Sent: Tuesday, August 21, 2001 1:58 PM
> To: php-general
lists.php.net
> Subject: [PHP] Session Headaches
>
>
> I have two pages page1.php and page2.php
>
> here is the code for page1.php:
>
> <?
> session_start();
> if (session_is_registered != 1) {
> session_register("FailedLogins");
> $HTTP_SESSION_VARS["FailedLogins"] = 0;
> }
>
> if ($HTTP_SESSION_VARS["FailedLogins"] > 3) {
> echo "you have made " .
> $HTTP_SESSION_VARS["FailedLogins"] . " login
> attempts";
> }
> ?>
> <a href="page2.php">Simulate a failed login</a>
>
>
>
> here is the code for page2.php:
> <?
> session_start();
> session_register("FailedLogins");
> $HTTP_SESSION_VARS["FailedLogins"]++;
> Header("Location: page1.php");
> ?>
>
> Ok. so after i click on my link to simulate failed logins 3
> times, I should
> see the number of failed logins.
> It seems like the gist of the problems is that different
> pages can't seem to
> modify the same session variables.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribelists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
> I am using php 4.0.6 and i would rather not use global variables.
I hear ya.
After playing around with this, your approach works if register_globals is set to off (I did this with an .htaccess file). I'm surprised by this. It appears that the global version of a variable still overwrites the HTTP_SESSION_VARS version when the script ends and the data is stored to the session file, in spite of the change in this area in 4.0.6. This is not the behavior I expected with this bug fix, but it appears to be the case. Since your code never sets the global version of $FailedLogins, nothing gets stored in the session.
Unless I'm missing something, it looks like register_globals needs to be off to use session variables the way your code does. In case you haven't done this before, create .htaccess with this line:
php_flag register_globals off
All for me on this day. Good luck!
Kirk
attached mail follows:
:))
Microsoft's web server (Internet Information Server)
At 16:52 22/08/01, nafiseh saberi wrote:
>hi.
>what is IIS?
>
>thanks.
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
>For additional commands, e-mail: php-general-help
lists.php.net
>To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
Hello All, How expensive are the image functions as far as the system resources go. Would it be too expensive to use php to create simple gifs like buttons, tabs etc.....
Thanks, Erisen ulrAslan.
===== Mehmet Erisen http://www.erisen.com
__________________________________________________ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
attached mail follows:
> How expensive are the image functions as far as the system > resources go. Would it be too expensive to use php to > create simple gifs like buttons, tabs etc.....
How busy is your server?...
Would I recommend it for Yahoo.com? No.
Would I recommend it for some site that has low-traffic? Sure, why not?
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
Hello All, Another question. Here is the problem: - One SQL query - 1 result.
I have a form that has more than one drop down lists. I like to use the mysql_fetch_array($result) to populate the select options. The problem is that after the first use, the mysql_fetch_array($result) does not return anything.
Any suggestion.
note: As a workaround, I am running the select statement (The SQL) 10 time. I think it's not a good solution though!!
Thanks, Mehmet.
===== Mehmet Erisen http://www.erisen.com
__________________________________________________ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
attached mail follows:
In article <20010821213350.53675.qmail
web13406.mail.yahoo.com>,
erisen
yahoo.com (Mehmet Kamil Erisen) wrote:
> I have a form that has more than one drop down lists. I > like to use the mysql_fetch_array($result) to populate the > select options. > The problem is that after the first use, the > mysql_fetch_array($result) does not return anything.
http://php.net/manual/en/function.mysql-data-seek.php
-- CC
attached mail follows:
Can someone show me how I could walk through each value (a random number) in an array to make sure no 2 are the same?
I'm basically just trying to generate a random number generator. I'm just looking to create 10 numbers, none of which can be duplicates.
Thank you in advance!
attached mail follows:
In article
<01E4A5BAEE42D411977100508BC22C9F022BC672
tcexch3.taylorcorp.com>,
JCMontz
jamestower.com (James C. Montz) wrote:
> Can someone show me how I could walk through each value (a random number) in > an array to make sure no 2 are the same?
<http://php.net/manual/en/function.array-unique.php>
-- CC
attached mail follows:
Could somebody tell me way this function will not work I know the script inside the function works because I have tested it but when I put it in a function all I get back when I call it is a 1
function &getpath($search) { Global $search,$path; $a = `/bin/ls -al /home/sites/ | awk {'print $9" "$10" "$11" "'} | grep $search`; $items = explode ("www.", $a); For($i = 0; $i< (count($items)/1); $i +=1){ $path=strstr(($items[$i]), '/'); return $path; } }
$path=&getpath($search);
Best regards,
Richard
mailto:rkurth
pacifier.com
attached mail follows:
I'll assume the & is legit (never used it in PHP personally)
here is a restructured function assuming all your provided code does what you want
!untested!
function &getpath($search) { # removed $path and $search... $search is already passed # and you are only using $path in the function $a = `/bin/ls -al /home/sites/ | awk {'print $9" "$10" "$11" "'} | grep $search`; $items = explode ("www.", $a); For($i = 0; $i< (count($items)/1); $i +=1){ $path[]=strstr(($items[$i]), '/'); #you are doing this # multiple times, and unless you want to keep # overwriting the $path variable you need to # create an array } return $path; # last thing to do is return your values }
$path=&getpath($search);
>-----Original Message-----
>From: Richard Kurth [mailto:rkurth
pacifier.com]
>Sent: Tuesday, August 21, 2001 5:46 PM
>To: php
>Subject: [PHP] Returning info from a function
>
>
>Could somebody tell me way this function will not work I know the
>script inside the function works because I have tested it but when I
>put it in a function all I get back when I call it is a 1
>
>
>function &getpath($search) {
>Global $search,$path;
>$a = `/bin/ls -al /home/sites/ | awk {'print $9" "$10" "$11" "'} |
>grep $search`;
>$items = explode ("www.", $a);
> For($i = 0; $i< (count($items)/1); $i +=1){
> $path=strstr(($items[$i]), '/');
> return $path;
>}
>}
>
> $path=&getpath($search);
>
>
>
>
>
>
>
>
>
>
>
>
>
>Best regards,
> Richard
>mailto:rkurth
pacifier.com
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
>For additional commands, e-mail: php-general-help
lists.php.net
>To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
>
>
attached mail follows:
hi,
I'm using the form file object for uploading a file because php using ftp isn't supported on my provider but everthing ok so far.
Now the http user (lets say the user that php is running on) is owner of the file, I want to change this to the user I am (the ftp user) hosting is running linux and I'm a real user there.
is it possible to change user ?
kind regards Jeroen Olthof
attached mail follows:
> I'm using the form file object for uploading a file because php using ftp > isn't supported on my provider but everthing ok so far. > > Now the http user (lets say the user that php is running on) is owner of the > file, I want to change this to the user I am (the ftp user) > hosting is running linux and I'm a real user there. > > is it possible to change user ?
You can try: http://php.net/chown http://php.net/chmod http://php.net/umask
and various other functions that accept a permissions argument (fopen?) and see if any of them will let you do this...
Probably not, since then *ANY* PHP-scripter on your server could hijack your account, and that would be bad, eh?
What your IPS *MIGHT* do is create a GROUP with you and nobody user in it, and you *MIGHT* be able to chgrp the file to that group, and you *might* be able to do what you need to do with that file then...
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
I am currently using an e-mail page that supports uploads, but does anyone know how to get the attachment to actually attach to the message? (perhaps even upload it to other mail servers like yaho) Uploading to my server is fine, but when I send messages with attachments and check my mail through yahoo, the little attachments icon is not there.
--------------------------------- Do You Yahoo!? Make international calls for as low as $0.04/minute with Yahoo! Messenger.
attached mail follows:
You need to not just use the mail() function, but use something like Manuel Lemos' mail class that does the mime-encoding needed to do attachments...
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Nicholas Thompson <mcknight1111
yahoo.com> Newsgroups: php.general To: Bill Rausch <bill
numerical.com>; <php-general
lists.php.net> Sent: Tuesday, August 21, 2001 5:22 PM Subject: attachments
> > I am currently using an e-mail page that supports uploads, but does anyone know how to get the attachment to actually attach to the message? (perhaps even upload it to other mail servers like yaho) Uploading to my server is fine, but when I send messages with attachments and check my mail through yahoo, the little attachments icon is not there. > > > > --------------------------------- > Do You Yahoo!? > Make international calls for as low as $0.04/minute with Yahoo! Messenger.
attached mail follows:
If you're talking about the PHP page itself, try $PHP_SELF. If you want to know what page sent the form data to the PHP page, try $HTTP_REFER. Be careful, though, as not every browser sends the referring page along with a request, leaving $HTTP_REFER empty.
J
Kevin P wrote:
> Hi all > > I am just five days new to PHP. When sending an HTML form to a PHP > page > for handling, can you cause the PHP to detect the page name (like form.htm > or form2.htm)? > > thanks > > Kevin
attached mail follows:
Error.log does not get new lines, but if i have it open in an editor, and cause the crash again, the editor says it changed, so probably the date is changed?
vhost.acces.log gets these lines (each split in 3 by me): (uri: http://localhost/trials/postnuke/ )
127.0.0.1 - - [22/Aug/2001:00:20:18 +0200] "GET / HTTP/1.1" 200 4860 "-" "Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)" 127.0.0.1 - - [22/Aug/2001:00:20:24 +0200] "GET /trials/postnuke HTTP/1.1" 301 315 "-" "Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)" 127.0.0.1 - - [22/Aug/2001:00:20:26 +0200] "GET /trials/postnuke/themes/PostNuke/style/styleNN.css HTTP/1.1" 304 - "http://localhost/trials/postnuke/" "Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)" 127.0.0.1 - - [22/Aug/2001:00:20:26 +0200] "GET /trials/postnuke/themes/PostNuke/style/style.css HTTP/1.1" 304 - "http://localhost/trials/postnuke/" "Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)" 127.0.0.1 - - [22/Aug/2001:00:20:27 +0200] "GET /trials/postnuke/themes/PostNuke/images/black_dot.gif HTTP/1.1" 304 - "http://localhost/trials/postnuke/" "Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)" 127.0.0.1 - - [22/Aug/2001:00:20:32 +0200] "GET /trials/postnuke/ HTTP/1.1" 200 4063 "-" "Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)"
Does that mean anything to you??? 304 must be something ok, but what is this 200 4063 code?
Chris
> I assume your running apache, if so...take a look at
> the apache error.log file, there may be some hint in
> there as to the problems...usually/ program
> files/apache/logs
>
> rm
>
>
> --- Chris Hayes <chayes
antenna.nl> wrote:
> > hi,
> > i am trying to install the thousands-of-lines big
> > postnuke.com website
> > thingie.
> > Unfortunately it won't start and the community does
> > not seem to recognize
> > the problem.
> > I get this message:
> >
> > PHP caused an invalid page fault in
> > module PHP4TS.DLL at 015f:1008e884.
> >
> > (PHP4 on win98)
> >
> > Anyone any idea how i can debug?
> >
> >
> >
> >
> > E_ALL is not giving any related info.
> > I tracked down where the page stops loading but
> > these lines seem to be not
> > related to the problem.
> >
> > I made it print a html text and this keeps working
> > just unto the place where
> > the page suddenly stops loading in a straight html
> > bit.
> >
> > By the way, quite complicated structure. Never had
> > so many php files open at
> > the same time to track a bug!
> >
> >
> > thanks,
> > Chris
> >
> >
> --------------------------------------------------------------------
> > -- C.Hayes Droevendaal 35 6708 PB Wageningen the
> > Netherlands --
> >
> --------------------------------------------------------------------
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail:
> > php-general-unsubscribe
lists.php.net
> > For additional commands, e-mail:
> > php-general-help
lists.php.net
> > To contact the list administrators, e-mail:
> > php-list-admin
lists.php.net
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/
>
-------------------------------------------------------------------- -- C.Hayes Droevendaal 35 6708 PB Wageningen the Netherlands -- --------------------------------------------------------------------
attached mail follows:
Richard, thank you for your suggestion.
i installed PHP 406 over the 405 and now i don't get the error anymore. so whatever was the cause is solved now.
Chris
> vhost.acces.log gets these lines (each split in 3 by me):
> (uri: http://localhost/trials/postnuke/ )
>
> Chris
>
> > I assume your running apache, if so...take a look at
> > the apache error.log file, there may be some hint in
> > there as to the problems...usually/ program
> > files/apache/logs
> >
> > rm
> >
> >
> > --- Chris Hayes <chayes
antenna.nl> wrote:
> > > hi,
> > > i am trying to install the thousands-of-lines big
> > > postnuke.com website
> > > thingie.
> > > Unfortunately it won't start and the community does
> > > not seem to recognize
> > > the problem.
> > > I get this message:
> > >
> > > PHP caused an invalid page fault in
> > > module PHP4TS.DLL at 015f:1008e884.
> > >
> > > (PHP4 on win98)
> > >
> > > Anyone any idea how i can debug?
> > >
> > >
> > >
> > >
> > > E_ALL is not giving any related info.
> > > I tracked down where the page stops loading but
> > > these lines seem to be not
> > > related to the problem.
> > >
> > > I made it print a html text and this keeps working
> > > just unto the place where
> > > the page suddenly stops loading in a straight html
> > > bit.
> > >
> > > By the way, quite complicated structure. Never had
> > > so many php files open at
> > > the same time to track a bug!
> > >
> > >
> > > thanks,
> > > Chris
> > >
> > >
> > --------------------------------------------------------------------
> > > -- C.Hayes Droevendaal 35 6708 PB Wageningen the
> > > Netherlands --
> > >
> > --------------------------------------------------------------------
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail:
> > > php-general-unsubscribe
lists.php.net
> > > For additional commands, e-mail:
> > > php-general-help
lists.php.net
> > > To contact the list administrators, e-mail:
> > > php-list-admin
lists.php.net
> > >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Make international calls for as low as $.04/minute with Yahoo! Messenger
> > http://phonecard.yahoo.com/
> >
>
>
-------------------------------------------------------------------- -- C.Hayes Droevendaal 35 6708 PB Wageningen the Netherlands -- --------------------------------------------------------------------
attached mail follows:
One way around this is to make the first page just a dummy that starts a session then redirects to the real first page, with the session id passed on the redirect URL.
Kirk
> -----Original Message-----
> From: Egan [mailto:egan
sevenkings.net]
> Sent: Tuesday, August 21, 2001 10:56 AM
> To: php-general
lists.php.net
> Subject: [PHP] chicken and egg problem with SID
>
>
> I have a multi page sequence of input forms tied to a session. It
> works perfectly with cookies. But I also want to make it work without
> cookies, using:
>
> php_value session.use_cookies 0
> php_value session.use_trans_sid 1
>
> in my .htaccess file, to use the SID support provided by PHP.
>
> When testing this, I see that the SID works with all pages except the
> first. But because the first page has no SID passed to it in the URL,
> the first instance of:
>
> session_start();
>
> creates a new session every time you refresh the first page with the
> browser. And that is the problem. I only want one session to be
> created, no matter how many times the user hits refresh on the first
> page.
>
> So then I tried setting the session id myself, hard coding it to some
> arbitrary value like:
>
> <?
> session_id('7777625d282694214b0459cebe287777');
> session_start();
> ?>
>
> and that solves the multiple session problem; only one session is
> created, no matter how many times you hit refresh on the first page.
>
> Yay!
>
> But that still leaves a chicken and egg problem to solve:
>
> I can generate some random value to be used for the session_id, but I
> can't think of a good way to store it for use on the first page.
>
> Since the first page does not get the SID in the URL, I need to set
> the session_id before calling session_start. But that means I don't
> have any session where I can store my random value, for recalling it
> later, on the next page refresh.
>
> Ack! I only need some simple way to store the SID value I generate,
> before the page is loaded a second time.
>
> I thought of using a CGI to dynamically generate all the PHP and HTML
> for page 1, and also have the CGI put a random session_id value right
> into the page source itself, just like I did when testing. I suppose
> that would work, but it seems like there should be an easier way.
>
> Maybe there is some obvious solution, but it is not obvious to me at
> the moment.
>
> Has anyone else solved this problem, with a better method?
attached mail follows:
> I can generate some random value to be used for the session_id, but I > can't think of a good way to store it for use on the first page.
Why does it matter if they hit refresh and get a new session ID before you've collected any information about that ID?...
About all you *COULD* do is have a "fake" first page that does:
<?php $session_id = md5(rand()); header("Location: page2.php?session_id=$session_id"); ?>
They can now reload the "second" (first they'll see) page as much as they want.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
On Tue, 21 Aug 2001 19:41:29 -0500, "Richard Lynch" <ceo
l-i-e.com>
wrote:
>> I can generate some random value to be used for the session_id, but I >> can't think of a good way to store it for use on the first page. > >Why does it matter if they hit refresh and get a new session ID before >you've collected any information about that ID?...
Good user interface design can be difficult to achieve in a browser environment, and many of the browser form interfaces I have seen are poorly designed in terms of user experience.
I've created a multipart form without any "page expired" messages, no matter what the user does. It's pretty slick, as far as browser form interfaces go.
The user can use the browser back button, the browser forward button, the browser refresh button, or the form "next" button anywhere in the series of pages, all without disturbing any responses already entered.
Say they fill out 5 pages, then decide to go back and review the first page before completing page 6. In that case, I don't want to create a new session, and thereby discard all the responses already entered, in case they happen to hit refresh while on page 1.
Why? That's just good "user interface design 101."
>About all you *COULD* do is have a "fake" first page that does: > ><?php > $session_id = md5(rand()); > header("Location: page2.php?session_id=$session_id"); >?> >
Art Wells gave me an idea how to do it all on a single page, and here is what I worked out from his idea:
<? $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF']; session_start(); if (!session_is_registered('vsid')) { session_register('vsid'); $HTTP_SESSION_VARS['vsid'] = session_id(); $sidurl = "Location: $PHP_SELF" . '?' . SID; header("$sidurl"); exit(); } .... .... other code on first page .... ?>
Thanks to all for the ideas!
Egan
attached mail follows:
HEy, i am having major problems trying to work out this regular expression. Regular expressions are still quite new to me, and i don't fully understand them, so please bear with me... thanks!
This is what i wanmt to do, turn the following block of text:
if (top != self) top.location.replace(self.location.href) rcdb - Mantis (Cedar Point) rcdbroller coaster database MantisCedar Point Quick Search Coaster Park Advanced Search Roller CoasterAmusement ParkTree ViewBy Location & Distance Reports New for 2002New for 2001New for 2000CensusRecord HoldersInversion Breakdown Other Stuff Site NewsAbout This SiteUser CommentsFAQLinks Options English Metric Pictures Demographics Park:Cedar Point Type:Steel Status:Operating since 5/11/1996 Categories:Stand Up Builder:Bolliger & Mabillard (B & M) Cost:$12,000,000 Statistics Length (feet):3900' Height (feet):145' Drop (feet):137' Inversions:4 Speed (mph):60 Duration (m:ss):2:40 Angle Of Descent (degrees):52 Capacity (riders per hour):1800 Vehicles Arrangement:3 trains with 8 cars per train. Riders are arranged 4 across in a single row for a total of 32 riders per train. Restraints:Shoulder harnesses Height restriction:Riders must be 54" or taller to ride. Other Information Features:Six elements: 119-foot-tall vertical loop, 103-foot-high dive loop, heavily banked 360-degree turn, 83-foot-tall inclined loop, 360-degree flat spin and a figure-eight finale. Problems? Questions? Comments? Your feedback is welcome here.All pages Copyright © 1996-2001 Duane Marden. All Rights Reserved. Terms Of Use. CPU Time: 0.040 seconds.
Into a nice block of text like this below:
Mantis Park:Cedar Point Type:Steel Status:Operating since 5/11/1996 Categories:Stand Up Builder:Bolliger & Mabillard (B & M) Cost:$12,000,000 Statistics Length (feet):3900' Height (feet):145' Drop (feet):137' Inversions:4 Speed (mph):60 Duration (m:ss):2:40 Angle Of Descent (degrees):52 Capacity (riders per hour):1800 Vehicles Arrangement:3 trains with 8 cars per train. Riders are arranged 4 across in a single row for a total of 32 riders per train. Restraints:Shoulder harnesses Height restriction:Riders must be 54" or taller to ride. Other Information Features:Six elements: 119-foot-tall vertical loop, 103-foot-high dive loop, heavily banked 360-degree turn, 83-foot-tall inclined loop, 360-degree flat spin and a figure-eight finale.
CAN ANYONE WHO IS GOOD WITH REGULAR EXPRESSIONS HELP ME WITH THIS!!
I HAVE AROUND 1000 PAGES TO DO THIS ON!! PLZ HELP!
Thanks....
attached mail follows:
below
> >HEy, i am having major problems trying to work out this regular expression. >Regular expressions are still quite new to me, and i don't fully understand >them, so please bear with me... thanks!
regex is a different beast... however if the text that you have isa actually as such, it is difficult if not impossible to create one. bottom>>>
> >This is what i wanmt to do, turn the following block of text: > >if (top != self) top.location.replace(self.location.href) rcdb - Mantis <clipped> >Time: 0.040 seconds. > > >Into a nice block of text like this below: > >Mantis <clipped> >spin and a figure-eight finale. > > >CAN ANYONE WHO IS GOOD WITH REGULAR EXPRESSIONS HELP ME WITH THIS!! > >I HAVE AROUND 1000 PAGES TO DO THIS ON!! >PLZ HELP!
rather than try to create a regex, a few questions which may help peopl offer a better solution...
1) where are you getting the pages from... files? web sites? xml output? 2) do they appear as you posted in the web browser, or if you view source do they appear a little more organized (ie: the text is formatted, just not for HTML).
if all that you have to work with is a mix like you posted (no \n or \r\n in the blob at all) and if there is any wide variety in the descriptions or posts... you would have a difficult time creating a regex that would in one fell swoop correct all your problems.
if you have cr's and lf's in the file... we are in business.
Dave
attached mail follows:
Hi. I just joined the list and, of course, I have a question. I've searched for quite a bit of time now, but to no avail.. mostly, I suspect, because all the relevant search terms are to broad. But heres my problem:
I have a journal I whipped up and tweak often that uses PHP and MySQL (no small club there. :p ). The functionality I'm trying to add right now is to be able to enclose text in a <hide> tag (what? you didnt see that "hide"? html and email just don't mix) and it will not be displayed in the browser. example:
I had a good day today. <hide>I shot the milkman. </hide>Tho nothign much happened.
then i use: $entry_hidden = eregi_replace("<hide>.+</hide>","<hidden>",$entry);
and this works just fine, replacing the "secret" text with a non-displayed <hidden> tag. The problem arises when I use the tag 2 or more times:
Hey <hide>losers!</hide> I think that I <hide> do not</hide> like corn.
in this case, the above blurb gets outputted as: hey <hidden> like corn.
So how do I make it stop pattern-matching when it reaches the first instance of </hide>, and make it work properly for each subsequent set of the tag?
This is prolly something pretty basic in regular expressions, but in my limited working knowledge (and the 3 tutorials I've tried), it's not addressed. searches in the archive, the php manual, and google have also failed me. worthy list?
I thank you in advance and hope I can tolerate the mail volume long enough to return the favor.
--kevin
attached mail follows:
Kevin Keeler <insanity
uwns.underworld.net> wrote:
> $entry_hidden = eregi_replace("<hide>.+</hide>","<hidden>",$entry);
try: $entry_hidden = preg_replace("|<hide>.+?</hide>|i","<hidden>",$entry);
".+" is 'greedy', meaning it consumes as much as text as it can. with perl-like regular expressions, you can add a trailing "?" which makes the + and * operators non-greedy.
jim
attached mail follows:
yay.
this preg business methinks needs some more looking into. ;) everywhere I've looked theres always one or 2 people proselytizing its greatness.
my late-night "boredom" reading of O'Reilly's _Perl_ (sans computer or pause) left little behind little information in my head, not surprisingly.
Thanks much, sir.
--kevin
On 21 Aug 2001 jimw
apache.org wrote:
> Kevin Keeler <insanity
uwns.underworld.net> wrote:
> > $entry_hidden = eregi_replace("<hide>.+</hide>","<hidden>",$entry);
>
> try: $entry_hidden = preg_replace("|<hide>.+?</hide>|i","<hidden>",$entry);
>
> ".+" is 'greedy', meaning it consumes as much as text as it can. with
> perl-like regular expressions, you can add a trailing "?" which makes
> the + and * operators non-greedy.
>
> jim
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
Hi,
I'm working on a download script
header("Content-Type: application/octet-stream\n"); header("Content-Length: $size\n"); header("Content-Disposition: attachment; filename=\"$file\"\n"); header("Content-Description: Download\n"); readfile($path.$file);
This works, but when the initial file download box pops up it says downloading file download.php (the name of the script), instead of the filename. The correct filename does appear in the next save as box. Does anyone know how to get the filename to show up in the initial file download box? Or, alternatively, how to bypass the first box alltogether (like it is done at downloads.com, for example)?
Thanks,
Adam
attached mail follows:
On Wed, 22 Aug 2001 10:19, AD wrote: > Hi, > > I'm working on a download script > > header("Content-Type: application/octet-stream\n"); > header("Content-Length: $size\n"); > header("Content-Disposition: attachment; filename=\"$file\"\n"); > header("Content-Description: Download\n"); > readfile($path.$file); >
header( "Content-Type: application/download" ); if (strstr(getenv('HTTP_USER_AGENT'), 'Netscape6' )) header( "Content-Disposition: attachment; filename=chopper.exe" ); else header( "Content-Disposition: filename=chopper.exe" ); $fn=fopen( "chopper.exe" , "r" ); fpassthru( $fn );
This was as close as I ever got. Still doesn't work in Konqueror but is an acknowledged bug.
Cheers, Brad
-- Brad Hubbard Congo Systems 12 Northgate Drive, Thomastown, Victoria, Australia 3074 Email: bradcongosystems.com Ph: +61-3-94645981 Fax: +61-3-94645982 Mob: +61-419107559
attached mail follows:
Hi Folks!
I am working on a project where I need to encrypt some data that will be decrypted later by a visual basic application and also receive encrypted data from that application and decrypt it on the webserver. To exchange the data, I did some xml and everything went fine, but I can't tell you the same about the encryption.
We chose to use BLOWFISH cbc to encrypt the data on both ways (php and vb). On php I am using the mcrypt module and at the vb side, the guys are using a dll version of the Blowfish algoritm.
Well, we are starting to fight each other, me and the vb guys, because we can encrypt and decrypt data on our own applications, but the encrypted data from php cannot be decrypted by visual basic, and vice-versa.
Of course the key and the iv are the same on both sides and the data is converted to hexa before the encrypt process. I did a lot of tests according the manual and some other sources, and everything seems to be ok. The vb guys are telling me the same and we are all on a dilema now, and the time is becoming short....
If anybody knows something about it please let me know. Another point of views on doing this are welcome too.
Sorry for any language mistakes I did.
Regards
Alex
attached mail follows:
> 1)select the document, then upload through form with method post -> target > same document > 2)do the checking stuff with the document, if ok call the same script again > for displaying the property-page -> form-target same document
Don't do that. Just do everything in one script.
> 3) if everything went well, document-properties are inserted in the db in > two tables, then script > displays js-redirect to do more stuff with the doc.
Don't do that either. All in one script.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
You would have to use "cURL" to get those.
HTTPS pages require that the client (in this case PHP) negotiate a secure connection using SSL and thus sending back and forth some headers of public/private key-pairs.
cURL does this.
PHP's include() doesn't.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Tomazsa <mailliste2
email.si> Newsgroups: php.general To: <php-general
lists.php.net> Sent: Sunday, August 19, 2001 6:25 PM Subject: Include/requrie secure pages
> I can not include / require secure pages (https). > Is that the way it is in php? > If so how can I do that another way? > > lp, tomaz >
attached mail follows:
You can get back whatever Perl spews out to 'stdout' using that.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Tom Beidler <tom
orbittechservices.com> Newsgroups: php.general To: php list <php-general
lists.php.net> Sent: Sunday, August 19, 2001 6:31 PM Subject: passing variables between PHP and Perl
> I'm integrating a telephony service into a clients site. I'm pretty handy > with PHP but I don't have much knowledge of perl. I've setup up my client's > site using PHP and the service provided me with a Perl script to make the > telephone connection. I used virtual() in my PHP script to pass variables to > the Perl script but now I need to deal with passing the results from the > Perl back to PHP. > > Is there something like virtual() in Perl that I could use to relay the > variables back to my script? Can I call up the Perl variables from my PHP > script after virtual()? > > Any help would be appreciated. > > Tom >
attached mail follows:
Just a quick addition... when a PHP script is run as a shell script from a Perl script (that make sense?) it cannot pass back exit variables to the Perl script...
Would love to be proven wrong on this as I had to dust off Perl programming for a RADIUS interface some time ago.
Dave
> >http://php.net/exec/ > >You can get back whatever Perl spews out to 'stdout' using that. > >> I'm integrating a telephony service into a clients site. I'm pretty handy >> with PHP but I don't have much knowledge of perl. I've setup up my >client's >> site using PHP and the service provided me with a Perl script to make the >> telephone connection. I used virtual() in my PHP script to pass variables >to >> the Perl script but now I need to deal with passing the results from the >> Perl back to PHP. >> >> Is there something like virtual() in Perl that I could use to relay the >> variables back to my script? Can I call up the Perl variables from my PHP >> script after virtual()? >>
attached mail follows:
A FORM submission is supposed to return an HTML document, not a JPEG.
Have your return document look more like this:
echo "<IMG SRC=display.php?pathname=$form_data_name>";
Then, move your header() and fread into the display.php file.
The catch is the file is DELETED after the upload script finishes.
So what you *REALLY* need to do is use http://php.net/copy_uploaded_file first and pass the new home of that file into your display script.
If that infobar is being spewed out before your headers, though, you'll have to dink around some more, and *MAYBE* even go so far as to name your display.php script /screwy/display.jpeg, and have an .htaccess file in /screwy that makes JPEG get parsed by PHP. Your actual JPEGs then, should *NOT* go in /screwy/ but some place where they are just regular old jpeg files...
You may be able to avoid that by using:
echo "<IMG SRC=display.php/fakeoutinfobar.jpeg/pathame=$form_data_name>"
PHP and Apache will ignore that bogus fakeoutinfobar.jpeg in there, but infobar will probably see this URL as a JPEG and not output the HTML.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Simon Lysbjerg Hansen <lysbjerg
worldonline.dk> Newsgroups: php.general To: <php-general
lists.php.net> Sent: Sunday, August 19, 2001 5:24 PM Subject: showing submitted images
> Please help, > > I'm trying to submit a .jpg image via a html form and showing it with the > following piece of code > > <?php > if ($submit) { > header("Content-type: $form_data_type"); > $data = fread(fopen($form_data, "r"), filesize($form_data)); > echo $data; > } > else { > ?> > <form method="post" action="<?php echo $PHP_SELF ?>" > enctype="multipart/form-data"> > <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000000"> > <br>File to show:<br> > <input type="file" name="form_data" size="40"> > <p><input type="submit" name="submit" value="submit"> > </form> > <?php > } > ?> > > but I only get the binary contents of the .jpg file. What's wrong? > > My hostmaster has an infobar running at the top of my page [check > www.oss-fodbold.dk to see what I mean]. Is this the problem? > > Thanks in advance > > Simon > >
attached mail follows:
You could give them a session ID, and then keep foo completely on the server. http://php.net/session_start
If you just want it "invisible" to most users but not really *SECRET*, a simple POST form works. They can still see it if they do "View Source" in the browser.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Seb Frost <seb
raceshoot.com> Newsgroups: php.general To: <php-general
lists.php.net> Sent: Sunday, August 19, 2001 4:44 PM Subject: Passing variables to a file
> OK I know this can be done like so: > > file.php4?foo=bar > > but what if I want to keep the value of foo secret from the user? > > - seb
attached mail follows:
> I have written a "Permission Converter" which converts unix permissions (the > ones we know from CHMOD) into a "-" delimited string of numbers. I also made > it that it supports one more level (unix only has 3 different types of > permissions, (r,w,x) while mine can handle a fourth one. Since I'm just a > newbie to PHP, I was wondering whether there is a shorter way of achieving > the same thing. Here is my code:
"-" is probably not the best choice, since most Un*x boxes use "-" to display "None" of rxw set in "ls" and other human-readable output. You would probably win more fans if you just use the same format as "ls"
Also, what's the fourth level for?... If the OS doesn't support it, I'm having a hard time figuring out what possible good it does...
> // $num is the number (range: 1-15) > $done = ""; > $result = ""; > > while ($done != 1) { > > if ($num > 8) { > $num = $num - 8; > $result = "8-"; > } elseif ($num == 8) { > $result = 8; > $done = 1; > } elseif ($num > 4) { > $num = $num - 4; > $result .= "4-"; > } elseif ($num == 4) { > $result .= 4; > $done = 1; > } elseif ($num > 2) { > $result .= "2-1"; > $done = 1; > } elseif ($num == 2) { > $result .= "2-"; > $done = 1; > } else { > $result .= "1"; > $done = 1; > } > > }
You probably should be looking at >> and << (bit-shift operators)...
This function can probably be reduced to three lines of code, maybe even one.
> if ((strrpos($result, "-") == strlen($result)-1) && strlen($result) > 1) { > $result = strrev($result); > $result = substr($result, 1); > $result = strrev($result); > } > > echo $result;
Finally... *WHY* are you doing this?... I know the whole rwx and octal/hex notation can be tricky at first, but there's a reason why it's been done that way for quite a *LONG* time...
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
Hi Richard,
The system is not for any boxes use - it's for the user-access system I'm developing for my companie's Website. I copied the system they use at unix a little. We have READ and WRITE permissions and 4 different user-categories. 1,2,4,8 - the reason I'm splitting this up is actually quite simple, if I have a string like this
"1-2-8"
I can easier check if the user has the permission by checking whether "1" for example is inside the string. If I made the string look like this "128" it could easily be mistaken as a number...
I was trying to figure out a shorter way of achieving the same thing, since splitting up those numbers gave me (and my maths teacher) quite a headache at first :)) do you have any ideas?
TIA,
Raphael
attached mail follows:
On each page visit: Check their time-stamped (viz) session id to see if it's expired. if (expired) header("Location: expired.php"); UPDATE a record with their session id and a timestamp.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Ryan Mahoney <ryan
paymentalliance.net> Newsgroups: php.general To: <php-general
lists.php.net> Sent: Monday, August 20, 2001 2:56 AM Subject: Session expiration detection and handling
> I am interested in detecting when the session expires and displaying a > "your session has expired..." page. If anyone can recommend how to do this > or recommend a tutorial it would be greatly appreciated! > > > Thanks! > > -r
---------------------------------------------------------------------------- ----
> > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.251 / Virus Database: 124 - Release Date: 4/26/01 >
attached mail follows:
> I'd like to know if I can create 2D images with the > image function of GD Library.
I'm guessing you mean 3-D, since 2D is just there...
AFAIK, there's no built-in 3-D support to GD. You'd have to have a separate 3-D engine and a renderer to project it onto 2D before you ever touched the GD functions.
No idea what engines may or may not be available that you could interface to, or how.
If all else fails, look for a 3-D engine that has good command-line support, and use http://php.net/exec
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
In addition to scanning the results of http://php.net/gethostbyaddr
I believe there *ARE* records of who owns what IP ranges, and you could *MAYBE* access them with Whois, SNMP, and/or other tools to make an educated guess.
Nothing will be 100% accurate, however.
Why do you think you need this?...
If it's language, you can use the language-negotiation or content-negotiation or whatever it is, but most users don't set their browser up properly in the first place, so it's not real useful... You're pretty much stuck with the stupid/cute++ little flags interface :-)
++ Stupid or cute depends on how many times you've seen it :-)
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Mihailo Dzigurski <mdzigurski
yahoo.com> Newsgroups: php.general To: <php-general
lists.php.net> Sent: Monday, August 20, 2001 3:57 AM Subject: Countries and ip addresses
> Hello, > > How can I find out from witch country user is based on user ip address? I > need this from php script. > > Thanks, > Mihailo. > > > _________________________________________________________ > Do You Yahoo!? > Get your free
yahoo.com address at http://mail.yahoo.com >
attached mail follows:
> please hack apart this solution and point out the error/insecure nature of the > setup. > > goal, provide php access to name based virtual hosts on FreeBSD boxes > > problem, security of PHP access to base system and other user scripts > > solution, > > apache compiled with suexec > # set user and group to unique > chown USERID:USERID /path/to/user/html/directory
Make it -R in case any files managed to get in there before you did this.
> # no public access to any files under here that > # you don't want public reading, like scripts > # with database login information in them > chmod -R 0750 /path/to/user/html/directory
You still ought to move those files outside the web-tree...
> # set group sticky execution... we will run > # apache as this unique group so may not be needed > chmod g+s /path/to/user/html/directory
I don't grok this, so have no comment.
> >in apache's httpd.conf > # set each virtual host to run any accesses > # as the group USERID giving them only access > # to this directory... defeats PHP directory > # and shell scripts as long as no public read bits > # are set > <virtual *> > ServerName whatever.com > Group USERID
Bzzzzzt. Unless you are running Apache 2.0, this is ineffectual or downright illegal syntax. suExec will *ONLY* work with PHP CGI. You'd have to run a separate pool of httpd's for each user for this to work in Apache 1.3.x
At least, so I've been told a few times. :-)
You're welcome to try it, but don't do it on a public server.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
>> please hack apart this solution and point out the error/insecure nature of
>> apache compiled with suexec >> # set user and group to unique >> chown USERID:USERID /path/to/user/html/directory > >Make it -R in case any files managed to get in there before you did this. >
error of omission on my part
>> chmod -R 0750 /path/to/user/html/directory > >You still ought to move those files outside the web-tree...
noted
>> >in apache's httpd.conf >> # set each virtual host to run any accesses >> # as the group USERID giving them only access >> # to this directory... defeats PHP directory >> # and shell scripts as long as no public read bits >> # are set >> <virtual *> >> ServerName whatever.com >> Group USERID > >Bzzzzzt. Unless you are running Apache 2.0, this is ineffectual or >downright illegal syntax. suExec will *ONLY* work with PHP CGI. You'd have >to run a separate pool of httpd's for each user for this to work in Apache >1.3.x > >At least, so I've been told a few times. :-)
Would like to know by whom to challenge/clarify/gain insight...
>You're welcome to try it, but don't do it on a public server. >
since posting have tried with multiple directories and accessing each as such... appears to function as expected without any errors. >> Apache 1.3.19
Any particular locations where to go to get further info prior to trying on production server? (Not worth it if it works fine for today and blows up tomorrow :)
Thx
Dave
attached mail follows:
> The issue is that every once in a while I get a full copy of a page in my > system error_log. That is, not the error_log for the site the page exists > on, but the /var/log/httpd/error_log.
Wild Hypothesis: Some worm/virus/hacker is trying to access: http://yoursite.com/something/something/../../whatever.php in the hopes of getting into something. Apache and PHP are getting confused, and end up spewing your HTML/PHP file into the log as source. (Which sure beats giving the hacker anything, eh?)
This questin *HAS* appeared before. Check the archives at http://php.net/support.php
Not quite sure what key words will dredge up the thread, though...
> If this is in a FAQ somewhere or a common question, I apologize, I am new to > this list. I would greatly appreciate a pointer to such a FAQ if it exists.
Don't think this is an FAQ, but you want http://php.net/FAQ.php
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
> i have a simple snippet of code :
But before you got to this code, there was some more code, or some includes, or some HTML...
> <? > session_start(); > $a = 10; > session_register("a"); > ?> > > i am trying to understand how do session work. > > Accessing at this document directly from the server (it is a SuSE 7.2 PE - > running PHP 4.0.4 > and apache 1.3.9) i find out the following problem: > > Warning: cannot send session cookie - headers already sent (output started > at ....) > > and > > Warning: cannot send session cache limiter - headers already sent (output > started at ....)
Sessions work by sending Cookies. Cookies work by being transmitted as "Headers" Headers are called headers because they come *BEFORE* any HTML. Example: --------------- What your browser *REALLY* sees: --------------- Content-type: text/html X-Powered-By: PHP-4.0.6 Content-length: 42
<HTML> <more html in here> </HTML> ----------------------------------------------------------------
That blank line in there is *CRITICAL*. Everything before that line is a header. Everything after that line is HTML, and *NOT* a header.
Once your script has sent out some HTML, or even a blank line, PHP can't suck them back in and send out a header.
Common Causes: A trailing "newline" at the end of your "include" files. Get rid of them. Adding your session code after your HTML and HEAD sections. Don't.
The session stuff and any header() or setcookie() calls *MUST* come first.
Another option is to turn on "Output Buffering" It will slow down stuff, because PHP will basically store all your output until it's complete, and then only send it at the end. But then it can stick headers in at any time you like.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
Rasmus has some sample code in his talks.
It's not real fancy, just makes a Flash movie with "PHP" flying all around.
Should be enough to help you get started though.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Jack <jacky
activelifestyle.com> Newsgroups: php.general To: <php-general
lists.php.net> Sent: Monday, August 20, 2001 11:02 AM Subject: flash and mysql
Hi people I want to make a flash file with dynamic content, driven by database(Mysql in this case), is there anyone know where can I get more information about this? Jack jacky
activelifestyle.com "Love your enemies, it will drive them nuts"
attached mail follows:
> The W3C HTM 4x spec(s) say that when using the file type on a form > input element, "User agents may use the value of the value attribute > as the initial file name."
They *MAY* use it? As in, if they feel like it?...
W3C has a lot of specs that have nothing to do with what the browsers have actually implemented, it seems to me...
> Attachment #1: <INPUT NAME="s_attachment" TYPE="file" > VALUE="d:\\test.txt">
There's no way it should let you specify full path. Too likely for somebody to hack up something that would fool the user into submitting /etc/passwd or something.
HTML may or may not need \ escaped... Maybe \\\\?
> Is this an oversight, did I miss something in the docs, or have I done > something really stupid?
I've never seen this done on any site. Have you? Look at their HTML source if you have.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
I think you should still use $count++
The array is just there for you to *READ* data, not to alter it.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Sean C. McCarthy <smccarthy
sci-spain.com> Newsgroups: php.general To: PHP General List <php-general
lists.php.net> Sent: Tuesday, August 21, 2001 1:00 AM Subject: register_globals odd behaviour?
> Hi All, > > I just come across and odd behaviour with the register_globals and > session handling. The problem is that when I set the register globals to > on I cannot access the session_variables through the associative array > HTTP_SESSION_VARS. The manual says explicitly that with track_vars and > register_globals both on the array and the vars will point to the same. > > It just doesn't happen the vars are not written at the end of the > script. I mean with register_globals ON: > > <? > session_register("count"); > $HTTP_SESSION_VARS["count"]++; > ?> > > this does not work. My php is PHP Version 4.0.3pl1 running on Linux > 2.2.18 and Apache1.3.9 . Does this bogus behaviour happen with higher > versions too? > > Thanks in advance. > > Sean C. McCarthy > SCI, S.L. (www.sci-spain.com)
attached mail follows:
> Produces the result (among everything else): > HTTP_SERVER_VARS["PATH_INFO"]: /foo/bar > > However, an <? echo "Path info: $PATH_INFO"; ?> produces an empty > result. Same with $HTTP_SERVER_VARS["PATH_INFO"].
That's crazy...
You're not doing this inside a function and forgetting: global $PATH_INFO are you?
OH -- You also aren't having short_tags off, so <? just goes to the browser as an uninterpreted HTML tag are you? Use <?php *ALWAYS*.
> Scenario 2 (a & b): > Running a) Apache 1.3.12 on WIN2K w/ PHP 4.0.6 (cgi binary) or > b) Apache 1.3.12 on Linux with PHP 4.0.4pl1 (cgi binary) > > Calling test.php/foo/bar with the contents: > <? phpinfo(); ?> > > Produces a 500 internal server error.
Most likely, you aren't using Alias and Action properly, and Apache is looking for a file named "test.php/foo/bar" but can't find it, but knows it should feed it to PHP, and is getting very confused. What do your Apache error logs say?
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
Can you surf to the IIS machine and get HTML.
Can you use: telnet IIS-host 80 GET /whatever.php HTTP/1.0
(Hit return twice) and get the HTML?
If so, the problem is probably in Java, not in PHP.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Hari Prakash <hari
atnetindia.net> Newsgroups: php.general To: <php-general
lists.php.net> Sent: Tuesday, August 21, 2001 7:34 AM Subject: Help me on server.
> Hi, > > I'm a PHP Programmer. My collegue Java programmer need to connect a web > page which is a php page programmed by me. While he is calling a php page > thru apache he gets html o/p. But With IIS 5.0, he gets expection error. But > the script is same. Can any one help me?. > > Hari. > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.268 / Virus Database: 140 - Release Date: 8/7/2001 >
attached mail follows:
> function updateHitCounter($id,$PHPSESSID,$type){ > $flag=$this->validateSession($PHPSESSID); > if($flag==1){ > include("admin/config.inc.php"); > $connection = mysql_connect("$host","$username","$password"); > if ($connection == false){ > echo mysql_errno().": ".mysql_error()."<BR>"; > exit; > } > if($type=="out") $query = "select * from sites where id='$id'"; > elseif($type=="in") $query = "select * from sites where id='$id'";
# It's the same query?...
> $result = mysql_db_query ("$dbase", $query); > if ($result){ > $numOfRows = mysql_num_rows ($result); > $hitsIn= mysql_result ($result, $i, "hitsOut"); > $hitsOut= mysql_result ($result, $i, "hitsIn");
I'm guessing one of these is line 222, and you have no record for that '$id' yet in your database.
For a brand new site, you'll need to register them first, or stick an
in
front of these, or...
Or, just use your $numOfRows to decide if there's a value to retrieve or not.
> }else{ > echo mysql_errno().": ".mysql_error()."<BR>"; > } > if($type=="out"){ > $hits=$hitsOut; > }else{ > $hits=$hitsIn; > } > $hits++; > $query = "UPDATE sites SET hitsOut ='$hits' WHERE id='$id'";
And this has no effect, since there are no rows with that id of '$id'
> $result = mysql_db_query ("$dbase", $query); > if (!$result){ > echo mysql_errno().": ".mysql_error()."<BR>"; > } > mysql_close (); > } > }
> When I run it i get this error: > Warning: Unable to jump to row 0 on MySQL result index 4 in c:\program > files\apache group\apache\htdocs\phptopsites\top100.php on line 222
> Guys is there anyway i can avoid it?
Unless there's more to this function you are not showing, you could just do:
function updateHitCounter($id,$PHPSESSID,$type){ $flag=$this->validateSession($PHPSESSID); if($flag==1){ include("admin/config.inc.php"); $connection = mysql_connect("$host","$username","$password"); if ($connection == false){ echo mysql_errno().": ".mysql_error()."<BR>"; exit; } $query = "update sites set $type = $type + 1 where id = '$id'"; $update = mysql_query($query); } }
You could then use http://php.net/mysql_affected_rows to find out if there was a site you even updated...
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
Just telnet to a 404 page that works and see what that outputs...
I'm guessing: header("404: Page does not exist");
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Boaz Yahav <berber
netvision.net.il> Newsgroups: php.general To: PHP General (E-mail) <php-general
lists.php.net> Sent: Tuesday, August 21, 2001 9:57 AM Subject: 404 header
Hi
I'm using IIS and I changed the 404 page to something else. Now the server returns an 200 OK message for a mistaken page :) Does anyone know the exact headers I need to send b4 the page so that the server will send back to the client the 404 NOT FOUND header along with the new page?
thanks
berber
attached mail follows:
You have to compile PHP a second time without the --with-apxs (or --with-apache).
If you still have your PHP source code, just copy config.nice to config.cgi, and edit it to remove the --with-apxs line.
Then do make clean ./config.cgi make
You'll get a binary file called "php" which you can throw in /usr/bin and use it just like Perl, only better :-)
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Bill Brigden <Bill.at.mastokesDOTcoDOTuk
pb1.pair.com> Newsgroups: php.general To: <php-general
lists.php.net> Sent: Monday, August 20, 2001 11:14 AM Subject: PHP and the Console
> Hi all, > > How could I use a script on the console - to interact, and take the users > input. Like a shell/perl script - but in php? > > Bill. > >
attached mail follows:
Check at http://www.phpusergroups.org to see if there's a User Group in your area.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Nafiseh Saberi <nsaberi
iraninfocenter.net> Newsgroups: php.general To: <php-general
lists.php.net> Sent: Wednesday, August 22, 2001 8:52 AM Subject: our country
> > hi. > > I want to know how many of people in php group are IRANIAN?? > > I am IRANIAN too. > how about yours?? > thanks.
attached mail follows:
> if (($hostname) || ($HOSTNAME)) { > $hostname= trim($hostname); > if ($HOSTNAME) > $hostname = trim($HOSTNAME); > if (!eregi("^[-a-z0-9-]+(\.[a-z0-9-]+)*$ ", $hostname)) { > print_error("your <b>your hostname</b> is invalid"); > } > $HOSTNAME = $hostname; > }
Things I know are wrong: 1. I don't think you want a - before the a-z 2. You have ()s around only the stuff *AFTER* the first character. So you are losing that stuff in the ()s to be saved in the third argument you're not providing to eregi()... 3. You didn't escape your \ from PHP, nor eregi(). You need \\\\, I think. 4. You have a space after the $, which is wrong. 5. You didn't escape the $ from PHP with \
Warning: I hate Regex, and have no idea if fixing these will get you any closer to what you want.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
> odd question, but if variables are stored in memory > until the script terminates, that includes old unused > variable, isn't it more efficient, memory wise, to > reuse old variables that reference, in effect the same > basic data, rather than create new or additional > variables
The difference would only be measurable if you had a *LOT* of variables... Like, a whole lot.
Also, PHP *may* (for all I know) have to do more "work" to execute:
$string = substr($string, 0, 10);
than:
$foo = substr($string, 0, 10);
Dunno if it helps or hurts or has no effect for PHP to have to worry about where the string is going after it does substr, but it *MIGHT*.
At any rate -- The right way to worry about perforance is to figure out where your code is spending 90% of its time, and to optimize that. I'm betting it ain't in variable lookups for most of us :-)
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
What are you getting? An image at all? Broken image?
Try getting rid of the header("image/jpeg") or whatever, and see if you have some error message.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Hugh Danaher <hdanaher
earthlink.net> Newsgroups: php.general To: Php-General <php-general
lists.php.net> Sent: Tuesday, August 21, 2001 1:16 AM Subject: if statement and imageline()
help,
I am trying to set up a .jpg file to graph the earnings per year of a company. I can generate a log-normal graph, can get it to display the earnings per year as circles on the graph, but I can't get the " if () " statement to work. I know I am setting two of the variables in the if statement after the if statement executes once, but these variables won't be used until after the " for () " loops once, and therefore should be available for use in " imageline() " on the second loop (where $year>$startyear). Somehow, I think my logic is correct but it mustn't be so.
$startyear=1996; $chart_start_year=1992; for ($year=$startyear;$year<=$startyear+7;$year++) { $x=(($year-$chart_start_year)*20)+20; $y=420-log(${"earnings_".$year})*75; if ($year>$startyear) { imageline($image,$first_x,$first_y,$x,$y,$blue); } $first_x=$x; $first_y=$y; imagettftext($image,9,0,$x_distance-4,$y_distance+3,$blue,$font2,"m"); }
attached mail follows:
> For($i = 0; $i< (count($items)/1); $i +=1){ > $path=strstr(($items[$i]), '/'); > return $path;
You probably want the return *OUTSIDE* the loop.
You also probably want $path .= strstr(...), not just =
Can't tell for sure, as I don't understand what sed and awk are doing.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
I have come up with a bit of a problem....
I have a little funky search form on a page, and when I send the search data on as a URL, anything with a space is screwed up.... example
$search = "This is a test"; echo "<a href=http://www.blah.com/foo.php?search=$search>";
and when the link is clicked (or even when the mouse is put over the link), the URL in the browser is -
http://www.blah.com/foo.php?search=This
leaving out all words after the first space.
If I simply throw the while thing using the following header statement header("Location: http://www.blah.com/foo.php?search=$search"); then it brings it up properly in the browser.
Any suggestions ?
Cheers
Chris
--
Chris Aitken - Administration/Database Designer - IDEAL Internet
email: chris
ideal.net.au phone: +61 2 4628 8888 fax: +61 2 4628 8890
__-----------------------------------------__
*** Big Brother ***
It just shows that the dull will rule the world. And we will be watching it.
attached mail follows:
> $search = "This is a test"; > echo "<a href=http://www.blah.com/foo.php?search=$search>";
You'll want this:
echo "<a href=http://www.blah.com/foo.php?search=".urlencode($search).">"; ^^^^^^^^^^^^^^^^^^^^^^
Jason
attached mail follows:
$search= urlencode ($search);
urlencode - have a look on the php site.
-----Original Message-----
From: Chris Aitken [mailto:chris
ideal.net.au]
Sent: August 22, 2001 9:05 AM
To: php-general
lists.php.net
Subject: [PHP] Strings with Spaces in URLS
I have come up with a bit of a problem....
I have a little funky search form on a page, and when I send the search data on as a URL, anything with a space is screwed up.... example
$search = "This is a test"; echo "<a href=http://www.blah.com/foo.php?search=$search>";
and when the link is clicked (or even when the mouse is put over the link), the URL in the browser is -
http://www.blah.com/foo.php?search=This
leaving out all words after the first space.
If I simply throw the while thing using the following header statement header("Location: http://www.blah.com/foo.php?search=$search"); then it brings it up properly in the browser.
Any suggestions ?
Cheers
Chris
--
Chris Aitken - Administration/Database Designer - IDEAL Internet
email: chris
ideal.net.au phone: +61 2 4628 8888 fax: +61 2 4628 8890
__-----------------------------------------__
*** Big Brother ***
It just shows that the dull will rule the world. And we will be watching it.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
For additional commands, e-mail: php-general-help
lists.php.net
To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
One simple question: I need to use the same socket connectin in 2 different scripts, is that possible ? and if YES, then how to do it ?
for example:
i have login.php where i do $socket_handle = fsockopen($server, $port....);
now in add.php i would like to send msg to $socket_handle socket...
hope u know what i what...
thx
attached mail follows:
In article <20010822015401.49396.qmail
pb1.pair.com>,
gre-gor
delphi-si.com (Gregor Jaksa) wrote:
> i have login.php where i do > $socket_handle = fsockopen($server, $port....); > > now in add.php i would like to send msg to $socket_handle socket...
include("login.php");
<http://php.net/include> has more info.
-- CC
attached mail follows:
Is there anyone here familiar with Audiogalaxy's site? It's all in PHP, and there is something there which is really something...
when you're searching for songs, there's an icon that when u click, it adds the song to the queue. But the page remains... the file is added to the queue without leaving your current page... and the icon changes color (this is easy with Js, but that's not the point)..
Does anyone know how they did that? ____________________________ . Christian Dechery (lemming) . http://www.tanamesa.com.br . Gaita-L Owner / Web Developer
attached mail follows:
I suppose they could use a hidden frame, like a 1 pixel frame all the way down at the bottom that contains all the javascript in there to submit a form. And then the page that you see simply contains some javascript that calls a javascript function in that hidden frame.
I'm sure you get the idea...
Johnny
-----Original Message-----
From: Christian Dechery [mailto:cdechery
brfree.com.br]
Sent: Tuesday, August 21, 2001 6:59 PM
To: php-general
lists.php.net
Subject: [PHP] AudioGalaxy-like stuff
Is there anyone here familiar with Audiogalaxy's site? It's all in PHP, and there is something there which is really something...
when you're searching for songs, there's an icon that when u click, it adds the song to the queue. But the page remains... the file is added to the queue without leaving your current page... and the icon changes color (this is easy with Js, but that's not the point)..
Does anyone know how they did that? ____________________________ . Christian Dechery (lemming) . http://www.tanamesa.com.br . Gaita-L Owner / Web Developer
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribelists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
When you click on the image it reloads the image which is really a PHP page which returns a image.
That way when it loads the image, it can actually run some PHP and do whatever is required, once done it returns the approiate image
That make sense?
Andrew
----- Original Message -----
From: "Christian Dechery" <cdechery
brfree.com.br>
To: <php-general
lists.php.net>
Sent: Wednesday, August 22, 2001 2:59 AM
Subject: [PHP] AudioGalaxy-like stuff
> Is there anyone here familiar with Audiogalaxy's site? It's all in PHP,
and
> there is something there which is really something...
>
> when you're searching for songs, there's an icon that when u click, it
adds
> the song to the queue. But the page remains... the file is added to the
> queue without leaving your current page... and the icon changes color
(this
> is easy with Js, but that's not the point)..
>
> Does anyone know how they did that?
> ____________________________
> . Christian Dechery (lemming)
> . http://www.tanamesa.com.br
> . Gaita-L Owner / Web Developer
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
>
attached mail follows:
Is mysql's PASSWORD() function secure for storing passwords?
Or should I use one of PHP's md5() or uniqid(), or even md5(uniqid()) ??? ____________________________ . Christian Dechery (lemming) . http://www.tanamesa.com.br . Gaita-L Owner / Web Developer
attached mail follows:
This is a repost.
To summarise: My installtion of PHP is unable to resolve names. I can't use fopen to open a URL which uses a name, but if I manually calculate the IP address, I can read in the page OK. ( see example below ).
I need some tips on where to start looking to solve this problem.
If it helps, my config options when I built PHP were:
--with-gd=/usr/local/src/gd-1.8.4/ --enable-gd-imgstrttf --with-ttf=/usr/local/freetype/ --enable-calendar --disable-short-tags --with-mysql=/usr/local/mysql/ --with-jpeg-dir=/usr/local/src/jpeg-6b/ --with-apxs=/usr/local/apache/bin/apxs
and I am running PHP 4.0.4pl1 under Debian "Potato" Linux and Apache 1.3
Regs
Brian White
At 16:28 14/08/2001 +1000, Brian White wrote:
>The following code:
>
> $url = "http://www.php.net/";
> print ( implode( "", file( $url ) ));
>
>causes my browser to sit and twiddle it's thumbs for ages and then produce:
>
> Warning: file("http://www.php.net/") - Bad file descriptor in
> myfile.php on line 33
>
> Warning: Bad arguments to implode() in myfile.php on line 33
>
>If, however, I explictly use the IP address:
>
> $url = "http://208.247.106.187/";
> print ( implode( "", file( $url ) ));
>
>it will successfully dump a copy of the php front page.
>
>This says to me that PHP can't resolve names. It is not a problem
>with the linux box it's running on, given that I ran "ping www.php.net"
>on that particular box to find the IP address.
>
>Can anyone tell me what I need to do to make it work?
>
>Regs
>
>Brian White
>-------------------------
>Brian White
>Step Two Designs Pty Ltd - SGML, XML & HTML Consultancy
>Phone: +612-93197901
>Web: http://www.steptwo.com.au/
>Email: bwhite
steptwo.com.au
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
>For additional commands, e-mail: php-general-help
lists.php.net
>To contact the list administrators, e-mail: php-list-admin
lists.php.net
-------------------------
Brian White
Step Two Designs Pty Ltd - SGML, XML & HTML Consultancy
Phone: +612-93197901
Web: http://www.steptwo.com.au/
Email: bwhite
steptwo.com.au
attached mail follows:
Hiya,
I was waiting for someone to answer this question but it hasn't happened yet. I was using this a couple years ago to get a weather page from http after the ftp site with the raw text disappeared. Rest assured this has NOTHING to do with php and everything to do with lynx.
I ran my script fine, then after I upgraded my system (I believe it was redhat 6.2) I started getting the error msg you got. After doing 'man lynx' and reading what I could, I gave up really fast and just reinstalled an older version of lynx cause let's face it, it was just a weather script that didn't warrant more than 20 minutes on.
The message is basically saying "Hey, you're running me from a cron job and I can't find an ncurses terminal to output to!" I am assuming that's what it is but don't quote me :) You may want to spend a little time in the lynx docs, and then let us know when you find out :) Also, I'm not 100% sure that the script itself isn't running.....try redirecting that from dev/null to writing to a file like /home/user/TEST.PHP and examine the contents.....
On Tuesday 21 August 2001 05:50 am, you wrote: > Hi, I'm trying the command "lynx -dump -nolog > http://localhost/script.php > /dev/null" on crontab > but I (httpd) receive an e-mail from "Cron Daemon" > saying that: > "Your terminal lacks the ability to clear the screen > or position the cursor." > > what should I do run my script with cron? > > thanks, > > Augusto > > ___________________________________________________________________________ >____________________ Yahoo! GeoCities > Tenha seu lugar na Web. Construa hoje mesmo sua home page no Yahoo! > GeoCities. É fácil e grátis! http://br.geocities.yahoo.com/
attached mail follows:
I am working on an image upload script and I've tried to use the variables from $HTTP_POST_FILES however it seems that no matter how I try to get the variables, they are always empty -- even though they are populated when checking phpinfo();
HTTP_POST_FILES["binFile"] Array ( [name] => arrow-block.gif [type] => image/gif [tmp_name] => /var/tmp/phph60272 [size] => 857 )
I got some info on it from php.net and attempt to echo as they have on their site however it displays nothing.
echo $HTTP_POST_FILES['binFile']['name']."<br>";
I am attempting to get size/extension of the file to determine if its a valid extension and within the valid filesize range.
Is this a server issue or just my php newbie-ness? If anyone has any ideas on how I can get this working, please let me know.
Thanks.
__________________ Jason Dulberg Extreme MTB http://extreme.nas.net
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]