|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 23 Jul 2003 20:06:58 -0000 Issue 2193
php-general-digest-help
lists.php.net
Date: Wed Jul 23 2003 - 15:06:58 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 23 Jul 2003 20:06:58 -0000 Issue 2193
Topics (messages 156396 through 156520):
Re: arguments against moving site from Linux/Apache/PHP server to Windows/IIS/PHP needed
156396 by: George Pitcher
156398 by: Adrian Teasdale
156442 by: Curt Zirzow
156450 by: sebab.dialcom.com.pl
156461 by: Curt Zirzow
156464 by: Juan Nin
156466 by: Cesar Cordovez
156469 by: Chris Shiflett
156504 by: Chris W. Parker
Re: REDIRECT STATUS CGI
156397 by: Freek van de Griendt
Re: Hi
156399 by: skate
Re: Hi All
156400 by: Peter Clarke
I need a PHP alternative to Windows Scheduled Tasks
156401 by: Phil Powell
156402 by: skate
156403 by: skate
156412 by: Chris Hayes
156419 by: Joel Rees
156444 by: Tom Rogers
Mail functions in php
156404 by: Uma Shankari T.
156420 by: sven
156447 by: Justin French
reading in files
156405 by: bob pilly
156408 by: Marek Kilimajer
direcorty listing
156406 by: FB
156446 by: Curt Zirzow
Re: classes v. functions
156407 by: Joel Rees
Re: <Select><option......></select>
156409 by: sven
156480 by: Jason Wong
Re: radio button arrays and php3
156410 by: Sævar Öfjörð
Session problem
156411 by: tana dsasa
156415 by: Sævar Öfjörð
156416 by: tana dsasa
156417 by: tana dsasa
header & headers_sent BUG
156413 by: James M. Luedke
156422 by: Ivo Fokkema
156428 by: James M. Luedke
156430 by: Ford, Mike [LSS]
156431 by: Jay Blanchard
156432 by: Ford, Mike [LSS]
156433 by: Marek Kilimajer
156437 by: Curt Zirzow
156463 by: Chris Shiflett
homemade authentication function
156414 by: Sævar Öfjörð
156423 by: sven
Re: Redirection Question
156418 by: Ow Mun Heng
Re: Some SESSION Vars not Registering
156421 by: Ow Mun Heng
156438 by: Curt Zirzow
156439 by: Jeff Stillwall
156440 by: Jeff Stillwall
156441 by: Jeff Stillwall
156454 by: Curt Zirzow
156460 by: Curt Zirzow
156508 by: Jeff Stillwall
156520 by: CPT John W. Holmes
Re: Redirection Question (I spoke to soon)
156424 by: Ow Mun Heng
156429 by: Ford, Mike [LSS]
156449 by: Curt Zirzow
156487 by: Jason Wong
156503 by: Beauford.2005
156511 by: Grant Rutherford
Opinon please - Host refuses to install a later version than 4.2.3 - says they're too buggy.
156425 by: Steve Childs
156427 by: Ivo Fokkema
156436 by: Jason Wong
156451 by: Curt Zirzow
156453 by: Justin French
156459 by: Steve Childs
Re: homemade authentication function [SOLVED]
156426 by: Sævar Öfjörð
Reminder programs
156434 by: c b gambrell
Session problem when setting session variables in files that are in different directories
156435 by: Mikael Jansson
PHP CMS for high load
156443 by: Matt Schroebel
156496 by: Manuel Lemos
PECL v. PEAR
156445 by: Chris Boget
156452 by: Curt Zirzow
156456 by: Thomas Seifert
156457 by: Chris Boget
156462 by: Curt Zirzow
156467 by: Chris Shiflett
Re: Apache 2.x and PHP
156448 by: Brad Young
Re: images in databases & Flash via PHP
156455 by: Luis Lebron
How to Determine Number of connected users to PostgreSQL
156458 by: Andrei Verovski (aka MacGuru)
debug exhausted memory
156465 by: Chris Hayes
people who has done a POS system before
156468 by: Tan Ai Leen
walking through database one record at a time with forms.
156470 by: Artoo
156471 by: Luis Lebron
156472 by: Marek Kilimajer
156483 by: Curt Zirzow
Problem with a dinamic variable --> array
156473 by: Wan Do Ke
156482 by: Curt Zirzow
http://poker.club66.ro
156474 by: Rausch Alexandru
156475 by: Rausch Alexandru
156476 by: Rausch Alexandru
156477 by: Rausch Alexandru
156491 by: Ryan A
156500 by: Curt Zirzow
Search question ..
156478 by: James Hatridge
156484 by: Curt Zirzow
Is this possible?
156479 by: Tony Crockford
156481 by: Adam Voigt
156495 by: Tony Crockford
Re: IE Issues
156485 by: Jason Wong
156499 by: Curt Zirzow
PHP5?
156486 by: Jonathan Villa
156488 by: Tyler Longren
156497 by: Jonathan Villa
USB Hard Drive
156489 by: Digital Directory USA, Inc
156490 by: Robert Cummings
156501 by: Curt Zirzow
USB Flash Drive
156492 by: Digital Directory USA, Inc
156493 by: Adam Voigt
156494 by: skate
Re: changing the name of a variable by another variable.
156498 by: Joshua Groboski
How to pass connection to next page
156502 by: Yao, Minghua
156506 by: Kevin Stone
Global variable question question
156505 by: Jason Giangrande
156507 by: Kevin Stone
newbY prob
156509 by: Phillip Blancher
156510 by: Jennifer Goodie
156512 by: R'twick Niceorgaw
156514 by: Kevin Stone
156517 by: CPT John W. Holmes
156519 by: Carl Furst
I'm really getting annoyed with PHP
156513 by: Beauford.2005
156515 by: Jay Blanchard
156516 by: Petre Agenbag
156518 by: Chris W. Parker
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
> I know that PHP under windows is intended to be used only as test
> platform, but this is not enough to convince him.
>
Errr ... says who?
I'm out of a job here if this is true as I'm doing quite a bit of PHP
development on NT/IIS with both MySQL and MS Access (not my choice, but a
clients).
I'm quite happy with NT but I'll be switching over to Linux later in the
year - company policy to gradually move away from Win to Linux for servers.
I'd look at security as the main argument.
George
attached mail follows:
> I have to convince one guy to not move our site from Linux box where
> it runs with Apache/PHP + MySQL to Windows box where it's going to deal
> with Windows 2k/IIS/PHP(CGI) + MySQL and I need really good arguments,
> cause it's only way I can convince him (cause his position in company
> is much stronger than mine).
Firstly Sebastian I would try to find out his reasoning for it - there may
be something that you don't know. ie, does he have something else that he
wishes to run on the same server that will only run under a Windows box?
> I know that PHP under windows is intended to be used only as test
> platform, but this is not enough to convince him.
I disagree with you on this :) Although I generally push for Linux wherever
I can, the reality is that many clients do run Windows exclusively for
internal operations and don't have the in-house capability to manage Linux
boxes. We have quite a number of installations that run fine under Windows.
> Can you help me? I need some reasons like things that won't work under
> windows version of PHP (or at least MySQL) and that are not easy to
> fix. I've already found that IIS doesn't provide
> $_SERVER["DOCUMENT_ROOT"] but it's not too much work to fix that..
I'd suggest trying to work with the guy rather than against him. Find out
his reasoning and then this way you can look at the positive and negative
aspects of what he is trying to do. I know that this isn't the answer that
you were expecting, but it's the approach that I would take
Adrian
sourceguardian.com
attached mail follows:
* Thus wrote sebab
dialcom.com.pl (sebab
dialcom.com.pl):
> Hi,
>
> I have to convince one guy to not move our site from Linux box where
> it runs with Apache/PHP + MySQL to Windows box where it's going to deal
> with Windows 2k/IIS/PHP(CGI) + MySQL and I need really good arguments,
> cause it's only way I can convince him (cause his position in company
> is much stronger than mine).
>
> I know that PHP under windows is intended to be used only as test
> platform, but this is not enough to convince him.
Perhaps back when php3 was new and apache was strugling with windows,
it was considered test platform.
>
> Can you help me? I need some reasons like things that won't work under
> windows version of PHP (or at least MySQL) and that are not easy to
> fix. I've already found that IIS doesn't provide
> $_SERVER["DOCUMENT_ROOT"] but it's not too much work to fix that..
Its kind of difficult to come up with reasons not to use IIS without
knowledge of:
1. Who and what experience does he(she) have in administrating these
Windows servers.
2. What kind of application do you intend write in php.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
Wednesday, July 23, 2003, 3:33:48 PM, you wrote:
CZ> * Thus wrote sebab
dialcom.com.pl (sebab
dialcom.com.pl):
>> Hi,
>>
>> I have to convince one guy to not move our site from Linux box where
>> it runs with Apache/PHP + MySQL to Windows box where it's going to deal
>> with Windows 2k/IIS/PHP(CGI) + MySQL and I need really good arguments,
>> cause it's only way I can convince him (cause his position in company
>> is much stronger than mine).
>>
>> I know that PHP under windows is intended to be used only as test
>> platform, but this is not enough to convince him.
CZ> Perhaps back when php3 was new and apache was strugling with windows,
CZ> it was considered test platform.
Maybe, I just remembered that warning and actually I can't find such
one in PHP manual/installation notes.
Does the same apply to MySQL?
>>
>> Can you help me? I need some reasons like things that won't work under
>> windows version of PHP (or at least MySQL) and that are not easy to
>> fix. I've already found that IIS doesn't provide
>> $_SERVER["DOCUMENT_ROOT"] but it's not too much work to fix that..
CZ> Its kind of difficult to come up with reasons not to use IIS without
CZ> knowledge of:
CZ> 1. Who and what experience does he(she) have in administrating these
CZ> Windows servers.
CZ> 2. What kind of application do you intend write in php.
One of the reasons I (we) don't want to move to Windows and IIS is
that person being administrator of that box knows less than he thinks
he knows ;) and surely server is not well configured and protected..
Beside that site now works on Linux server without any problems and
moving it will cause only pointless work. But moving to IIS is
decision made by someone "above" me so without good reasons against I
can't stop that. And believe me - there is really no need to move to
IIS.
CZ> Curt
CZ> --
CZ> "I used to think I was indecisive, but now I'm not so sure."
Sebastian
attached mail follows:
* Thus wrote sebab
dialcom.com.pl (sebab
dialcom.com.pl):
>
> Wednesday, July 23, 2003, 3:33:48 PM, you wrote:
> CZ> * Thus wrote sebab
dialcom.com.pl (sebab
dialcom.com.pl):
> >> Hi,
> >>
> >> I have to convince one guy to not move our site from Linux box where
> >> it runs with Apache/PHP + MySQL to Windows box where it's going to deal
> >> with Windows 2k/IIS/PHP(CGI) + MySQL and I need really good arguments,
> >> cause it's only way I can convince him (cause his position in company
> >> is much stronger than mine).
>
> >>
> >> I know that PHP under windows is intended to be used only as test
> >> platform, but this is not enough to convince him.
>
> CZ> Perhaps back when php3 was new and apache was strugling with windows,
> CZ> it was considered test platform.
>
> Maybe, I just remembered that warning and actually I can't find such
> one in PHP manual/installation notes.
> Does the same apply to MySQL?
I have no experience with MySQL server on windows, therefore I can't
comment on that.
>
>
> >>
> >> Can you help me? I need some reasons like things that won't work under
> >> windows version of PHP (or at least MySQL) and that are not easy to
> >> fix. I've already found that IIS doesn't provide
> >> $_SERVER["DOCUMENT_ROOT"] but it's not too much work to fix that..
>
> CZ> Its kind of difficult to come up with reasons not to use IIS without
> CZ> knowledge of:
>
> CZ> 1. Who and what experience does he(she) have in administrating these
> CZ> Windows servers.
>
> CZ> 2. What kind of application do you intend write in php.
>
> One of the reasons I (we) don't want to move to Windows and IIS is
> that person being administrator of that box knows less than he thinks
> he knows ;) and surely server is not well configured and protected..
That always seems to be the case... expecially when this issue comes up.
> Beside that site now works on Linux server without any problems and
> moving it will cause only pointless work. But moving to IIS is
> decision made by someone "above" me so without good reasons against I
> can't stop that. And believe me - there is really no need to move to
> IIS.
I don't understand then why they want to move, it seems that what you
just said proves to be the strongest case... if it aint broke, leave it
alone.
I know this has been discussed plenty of times, have you searched the
archives? There might be some good points made on this already.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
First of all, security.. Windows is full of security holes
Second, a Win2k server ussually needs to be rebooted after several days of
running
A Linux box usually stays months and months running without any problem
without having to touch it
I got a Linux box running Apache + PHP + MySQL, Postfix + amavisd + uvscan,
cistron-radiusd plus some other things, and it has an uptime of 388 days.
And it works as the first day!!! I will pay the one who can achieve that
with Windows..
Third, Apache + PHP + MySQL rock, they are very well integrated
Regards,
Juan
attached mail follows:
sebab
dialcom.com.pl wrote:
>>>Can you help me? I need some reasons like things that won't work under
>>>windows version of PHP (or at least MySQL) and that are not easy to
>>>fix. I've already found that IIS doesn't provide
>>>$_SERVER["DOCUMENT_ROOT"] but it's not too much work to fix that..
In windows, strtotime only works from 1/1/1970. In linux can work with
any date.
HTH
PS. I use windows and apart from this is great. Not cheap, but great.
attached mail follows:
--- Juan Nin <juaid
juanin.com> wrote:
> First of all, security.. Windows is full of security holes
Actually, IIS is much worse than the Windows OS. In fact, the Gartner Group
(suits typically respect their opinion) has recommended that it not be used in
production (http://www3.gartner.com/DisplayDocument?doc_cd=101034). If security
is of no concern to management, mention the fact that IIS has a much higher TCO
than Apache for similar reasons. Money is always a concern. :-)
If you receive pressure to move away from Linux (a server OS) to Windows (a
desktop OS) for use as a server, ask if you can move to Mac OS X instead. While
Mac OS X is actually a saner choice (it is based on a server OS now), Apple's
marketing has not been as effective as Microsoft's in this area, and most
people tend to think of Macs as desktop computers. So, if moving to Mac seems
like a poor choice, and you can illustrate how Mac is actually a compromise,
you might open some eyes. :-)
If all else fails, quit. That might be difficult depending on the job market,
but I would try to not sacrifice my life (work takes up a significant portion
of it) due to other people's poor decisions. There is too much useful stuff out
there you can learn and spend your time doing.
Hope that helps.
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/
attached mail follows:
Chris Shiflett <mailto:shiflett
php.net>
on Wednesday, July 23, 2003 8:27 AM said:
> ...the Gartner
> Group (suits typically respect their opinion) has recommended that it
> not be used in production
> (http://www3.gartner.com/DisplayDocument?doc_cd=101034).
Interesting.
> If you receive pressure to move away from Linux (a server OS) to
> Windows (a desktop OS) for use as a server
References? AFAIK, this is not true.
Win2k server and up (advanced server, datacenter server) are meant for
high availability, especially datacenter server.
Chris.
attached mail follows:
Can I just change this status to 0 en then start my Xitami? Or do I have to
reinstall it after I have changed the status to 0? The first option didn't
seem to work properly.
Thanks in advance,
Freek
"Curt Zirzow" <curt
zirzow.dyndns.org> schreef in bericht
news:20030722225745.GR67309
bagend.shire...
> * Thus wrote Freek van de Griendt (freak
vtk.be):
> > Hi,
> >
> > I just started using PHP and installed it on my Windows machine,
together
> > with Xitami (Web server). But now, when I try to write a simple PHP file
I
> > get the following error:
> >
> > Security Alert! The PHP CGI cannot be accessed directly.
> > This PHP CGI binary was compiled with force-cgi-redirect enabled. This
means
> > that a page will only be served up if the REDIRECT_STATUS CGI variable
is
> > set, e.g. via an Apache Action directive.
>
> php.net has all your answers
> http://php.net/manual/en/install.xitami.php
>
> Curt
> --
> "I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
the poker game is actually really weak anyway...
a pair of 6's shouldn't win anything...
----- Original Message -----
From: "Rausch Alexandru" <rausch
go.ro>
To: <php-general
lists.php.net>
Sent: Tuesday, July 22, 2003 9:42 AM
Subject: [PHP] Hi
MYSQL problems problems.
I want to install an user login aplicationa on my site, but it is intarely
in FLASH. ( www.poker.club66.ro ).
What do u think?
attached mail follows:
Shishir Kumar Mishra wrote:
> Hi All,
>
> I am reading one XML which has some german characters. I am sending this data to PHP script but when try to echo ;it prints some other character.
> eg. XML has "für" but output is coming like " für ";
>
> My script is like following:
>
> <?php
>
> $loc = "UTF-8";
> putenv("LANG=$loc");
> setlocale (LC_ALL, 'de_DE');
> echo "<br>".$producttext[2];
> ?>
>
> in XML file : producttext has value like "für" ;
>
>
> regards..
> Shishir Kumar Mishra
> Agni Software (P) Ltd.
> www.agnisoft.com
What are you outputting to?
Is it able to display UTF-8?
Does it know that the string is UTF-8?
an html page would tell a browser with:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Peter
attached mail follows:
I have concluded that Bill Gates is Satan!
Ok, I'm late, but... I have had 26 scheduled tasks that run every hour on the hour every day for eternity to go and run a series of Java files I wrote that connect remotely to a remote server to do remote cleanup of stray XML files, etc.; things I cannot do on the remote machine box itself because it's remote and I don't have permissions were I physically on the box anyway.
However, on 7/18 all 26 of my scheduled tasks stopped running; one of which continuously ran for 4 days straight w/o stopping (nor could I manually stop it). I deleted the runaway process and recreated it; now not a single one of my 26 scheduled Win2000 tasks I created using MS-DOS AT commands work (which were working since 7/2).
I am now looking into programmatic alternatives. I really could use some ideas that are practical given my situation. I'm thinking PHP since I am very comfortable with it, were it possible within my bizarre Win2000 environment, but I need something that will clean those XML files remotely on a regular basis, it's important for website maintenance. Any help appreciated.
Thanx
Phil
attached mail follows:
you could have a look at AINTX, it's a windows port of the *nix cron
alternatively, if you've got a few bucks lying around, go buy yourself a
really old PC, install *nix on it, and use that to run your scheduled
cron's. they're much more reliable and obviously, if your not using that
machine, then there's a much lower chance of anything dying.
if you can't do this, and AINTX doesn't do the job, run a quick google
search for cron on windows. there's lots of versions ported across...
----- Original Message -----
From: "Phil Powell" <soazine
erols.com>
To: <talk
nyphp.org>; <php-general
lists.php.net>
Sent: Wednesday, July 23, 2003 10:13 AM
Subject: [PHP] I need a PHP alternative to Windows Scheduled Tasks
I have concluded that Bill Gates is Satan!
Ok, I'm late, but... I have had 26 scheduled tasks that run every hour on
the hour every day for eternity to go and run a series of Java files I wrote
that connect remotely to a remote server to do remote cleanup of stray XML
files, etc.; things I cannot do on the remote machine box itself because
it's remote and I don't have permissions were I physically on the box
anyway.
However, on 7/18 all 26 of my scheduled tasks stopped running; one of which
continuously ran for 4 days straight w/o stopping (nor could I manually stop
it). I deleted the runaway process and recreated it; now not a single one
of my 26 scheduled Win2000 tasks I created using MS-DOS AT commands work
(which were working since 7/2).
I am now looking into programmatic alternatives. I really could use some
ideas that are practical given my situation. I'm thinking PHP since I am
very comfortable with it, were it possible within my bizarre Win2000
environment, but I need something that will clean those XML files remotely
on a regular basis, it's important for website maintenance. Any help
appreciated.
Thanx
Phil
attached mail follows:
sorry, i should have also pointed out...
this isn't something that PHP could handle on it's own, well, it COULD, but
you shouldn't. you could write a PHP code to run continuosly in the
background, but people would poke and laugh at you... ideally you have
something to schedule the PHP script to run when you need it, rather than
the PHP script waking up and doing it's stuff when it should...
----- Original Message -----
From: "skate" <root
fatcuban.com>
To: "Phil Powell" <soazine
erols.com>; <talk
nyphp.org>;
<php-general
lists.php.net>
Sent: Wednesday, July 23, 2003 10:23 AM
Subject: Re: [PHP] I need a PHP alternative to Windows Scheduled Tasks
> you could have a look at AINTX, it's a windows port of the *nix cron
>
> alternatively, if you've got a few bucks lying around, go buy yourself a
> really old PC, install *nix on it, and use that to run your scheduled
> cron's. they're much more reliable and obviously, if your not using that
> machine, then there's a much lower chance of anything dying.
>
> if you can't do this, and AINTX doesn't do the job, run a quick google
> search for cron on windows. there's lots of versions ported across...
> ----- Original Message -----
> From: "Phil Powell" <soazine
erols.com>
> To: <talk
nyphp.org>; <php-general
lists.php.net>
> Sent: Wednesday, July 23, 2003 10:13 AM
> Subject: [PHP] I need a PHP alternative to Windows Scheduled Tasks
>
>
> I have concluded that Bill Gates is Satan!
>
> Ok, I'm late, but... I have had 26 scheduled tasks that run every hour on
> the hour every day for eternity to go and run a series of Java files I
wrote
> that connect remotely to a remote server to do remote cleanup of stray XML
> files, etc.; things I cannot do on the remote machine box itself because
> it's remote and I don't have permissions were I physically on the box
> anyway.
>
> However, on 7/18 all 26 of my scheduled tasks stopped running; one of
which
> continuously ran for 4 days straight w/o stopping (nor could I manually
stop
> it). I deleted the runaway process and recreated it; now not a single one
> of my 26 scheduled Win2000 tasks I created using MS-DOS AT commands work
> (which were working since 7/2).
>
> I am now looking into programmatic alternatives. I really could use some
> ideas that are practical given my situation. I'm thinking PHP since I am
> very comfortable with it, were it possible within my bizarre Win2000
> environment, but I need something that will clean those XML files remotely
> on a regular basis, it's important for website maintenance. Any help
> appreciated.
>
> Thanx
> Phil
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
attached mail follows:
At 11:13 23-7-03, you wrote:
>I have concluded that Bill Gates is Satan!
um, what about moving to linux and use cron?
But if you want to try it on satanic Windows: SINC
(http://sourceforge.net/projects/sinc/) can be used to start programmes but
also to invoke PHP scripts. I was not so happy with the little windows
popping up and away whenever a PHP file was activated but then i got it
moved to a windows server and that's not a workstation so the flashing
windows where no pain.
attached mail follows:
> However, on 7/18 all 26 of my scheduled tasks stopped running; one of
> which continuously ran for 4 days straight w/o stopping (nor could I
> manually stop it). I deleted the runaway process and recreated it; now
> not a single one of my 26 scheduled Win2000 tasks I created using
> MS-DOS AT commands work (which were working since 7/2).
I really don't know what I'm talking about here, but I think you have to
register those scheduled tasks. Is the registry ok?
> I am now looking into programmatic alternatives. I really could use
> some ideas that are practical given my situation. I'm thinking PHP
> since I am very comfortable with it, were it possible within my bizarre
> Win2000 environment, but I need something that will clean those XML
> files remotely on a regular basis, it's important for website
> maintenance. Any help appreciated.
Just a random suggestion, but how about having one scheduled task, and
it's job is to run the 26 jobs you are presently trying to run as
scheduled tasks. You reduce the load on MSW's scheduling, and you get
more control over things like which tasks have to complete before others
run.
Of course, moving it all to Linux or one of the BSDs might help, but you
might also want to check the design -- maybe there are some
interdependencies, so that it would help to be able to make sure certain
tasks are done before others, and that they all finish before starting
over.
I did a little script to mail out files on a regular basis. A co-worker
wrote a C program that was called by the MSW2k scheduler, and that C
program checked that my mailing script had completed before it tried to
start another instance of the script.
--
Joel Rees, programmer, Kansai Systems Group
Altech Corporation (Alpsgiken), Osaka, Japan
http://www.alpsgiken.co.jp
attached mail follows:
Hi,
Wednesday, July 23, 2003, 7:13:17 PM, you wrote:
PP> I have concluded that Bill Gates is Satan!
PP> Ok, I'm late, but... I have had 26 scheduled tasks that run every hour on the hour every day for eternity to go and run a series of Java files I wrote that connect remotely to a remote server to
PP> do remote cleanup of stray XML files, etc.; things I cannot do on the remote machine box itself because it's remote and I don't have permissions were I physically on the box anyway.
PP> However, on 7/18 all 26 of my scheduled tasks stopped running; one of which continuously ran for 4 days straight w/o stopping (nor could I manually stop it). I deleted the runaway process and
PP> recreated it; now not a single one of my 26 scheduled Win2000 tasks I created using MS-DOS AT commands work (which were working since 7/2).
PP> I am now looking into programmatic alternatives. I really could use some ideas that are practical given my situation. I'm thinking PHP since I am very comfortable with it, were it possible
PP> within my bizarre Win2000 environment, but I need something that will clean those XML files remotely on a regular basis, it's important for website maintenance. Any help appreciated.
PP> Thanx
PP> Phil
have a look for a file similar to this one and delete it, that should
get your scheduler running again while you upgrade to linux :)
C:\Documents and Settings\username_here\Application Data\Microsoft\Crypto\RSA\S-1-5-21-789336058-1788223648-682003330-1000
its the S-1... file
--
regards,
Tom
attached mail follows:
Hello,
I need to send audio/video files through PHP mail() function.
What is the MIME type i need to use?
or else
Is there any other way to send attachment as a mail?
Please help me.
Thanx in advance,
Uma
attached mail follows:
hi,
1. for mime-types try rfc2046. there are two top-level media types for you:
'audio' and 'video'. the subtypes depend on your media files.
2. to send files simply as attachment you can use
'application/octet-stream'. or use a readymade php-mime-mail-class.
ciao SVEN
Uma Shankari T. wrote:
> Hello,
>
> I need to send audio/video files through PHP mail() function.
> What is the MIME type i need to use?
> or else
> Is there any other way to send attachment as a mail?
>
> Please help me.
>
> Thanx in advance,
> Uma
attached mail follows:
Have you read the mail page in the manual?
Didn't think so :)
It discusses multipart messages/attachments/etc, links to and provides
examples/tutorials on the topic, etc etc. Start there, then come back
if you get stuck.
http://au.php.net/manual/en/function.mail.php
Justin
On Wednesday, July 23, 2003, at 07:36 PM, Uma Shankari T. wrote:
>
> Hello,
>
> I need to send audio/video files through PHP mail() function.
> What is the MIME type i need to use?
> or else
> Is there any other way to send attachment as a mail?
>
> Please help me.
>
> Thanx in advance,
> Uma
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> ---
> [This E-mail scanned for viruses]
>
>
attached mail follows:
Hello all
I have a page where a user uses a browse button in html to upload a file from there client pc. They then click upload which submits the form to the second page: example
<form name="form1" method="post" action="/test2.php">
<input type="file" name="file">
<input name="upload" type="submit" id="upload" value="upload">
</form>
I am then wanting to read the info in that file in the test2.php page but are struggling. At the moment im trying to use:
$file=file($_GET[file]);
echo $file[0];
which i thought would output the first line of the file but it doesnt. Can someone point me to some good docs on how php deals with files and how i can readthrough the file uploaded from a user please?
Thanks for any help in advance!
---------------------------------
Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger
attached mail follows:
www.php.net/uploads
1. use $_FILES
2. $_FILES['file'] would be na array holding info about the uploded file
bob pilly wrote:
> Hello all
>
> I have a page where a user uses a browse button in html to upload a file from there client pc. They then click upload which submits the form to the second page: example
> <form name="form1" method="post" action="/test2.php">
> <input type="file" name="file">
> <input name="upload" type="submit" id="upload" value="upload">
> </form>
> I am then wanting to read the info in that file in the test2.php page but are struggling. At the moment im trying to use:
> $file=file($_GET[file]);
> echo $file[0];
>
> which i thought would output the first line of the file but it doesnt. Can someone point me to some good docs on how php deals with files and how i can readthrough the file uploaded from a user please?
>
> Thanks for any help in advance!
>
>
> ---------------------------------
> Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger
attached mail follows:
Hi,
I have a directory like structure below
- cityname
--townname
---busname
----day
-----info.zip
I want to write a script and let it search the directory and find the zip
files open them do the operation and save the out file as
cityname_townname_busname_day_info.txt
I am doing it for any zip files so the last part is O.K. by now but I need a
loop to go under the direcoty structure and search for them. Cause if the
info file is at level 2 (I mean under the townname direcotry) than it means
a brief info of the time table so it will be save as
cityname_townname_info.txt
I am not familiar with the direcotry functions. Can anybody help me with
that?
regards
FB
attached mail follows:
* Thus wrote FB (s021183
student.dtu.dk):
> Hi,
>
> I have a directory like structure below
>
> - cityname
> --townname
> ---busname
> ----day
> -----info.zip
>
> I want to write a script and let it search the directory and find the zip
> files open them do the operation and save the out file as
>
> cityname_townname_busname_day_info.txt
>
> I am doing it for any zip files so the last part is O.K. by now but I need a
> loop to go under the direcoty structure and search for them. Cause if the
> info file is at level 2 (I mean under the townname direcotry) than it means
> a brief info of the time table so it will be save as
> cityname_townname_info.txt
>
> I am not familiar with the direcotry functions. Can anybody help me with
> that?
http://php.net/dir
There are some examples on how to scan the directory there (even
recursion ones although I'd do them differently)
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
> Say I have a database class with all kinds of functions for connection,
> data manipulation, errors, etc:
>
> $db = new db_sql;
> $db->connect();
> $db->do_this();
> $db->do_that();
>
> How would that be different from an include file with a bunch of functions
> doing the same thing?
As far as I'm concerned, the primary benefit of classes is that you
don't clutter up your namespace. If you have, for instance,
$accesses->count, you know more about that count than if you have
just $count. It's a method of organizing your code that doesn't (once
you get used to it) get in the way.
Also, you can be really sure that $accesses->resetCounter() is somehow
related to $accesses->count, whereas $accesses_count and
accesses_resetCounter() might win your confidence incorrectly. Or maybe
you slip and use access_resetCounter() instead, which might be the cause
of no end of grief.
(You know that $accesses->count and $accesses->resetCounter() are at
least declared in the same class declaration. $accesses_count and
accesses_resetCounter() could be declared in entirely unrelated include
files for entirely different purposes.)
> Is there any performance benefit one way or the other?
Programmer performance?
> I used EZ_Sql which is cool but didn't seem to speed things up in
> comparison to the said include file.
> Still don't see the beef.
Execution speed isn't all that matters. In fact, speed is not the point
at all.
> Brad recommended I spend even more time with google looking for OOP, maybe
> that's why I'm so confused:).
I think he's trying to point you to the mind-set. Do you like complex
puzzles with intricate interactions where you have to keep tens of
thousands of lines of code constantly in your head? Or do you like to
focus on several hundred lines at a time, get those to behave, then move
on to another part with a fairly high level of confidence that you won't
shoot yourself in the foot by using the wrong count or resetCount()
somewhere?
--
Joel Rees, programmer, Kansai Systems Group
Altech Corporation (Alpsgiken), Osaka, Japan
http://www.alpsgiken.co.jp
attached mail follows:
sorry, i didn't understand your problem.
can you give an example what you can get from your database (your keys,
years, months, ...) and how it should be transformed?
ciao SVEN
Etienne Mathot wrote:
> I am quite new to web programming and PHP/mySQL, I try to find my way
> between all these tools.
>
> Currently, I have a problem with a page where activities happen in 3
> steps.
>
> Encoding Key Fields is the first step, than reading the customer...etc
>
> Key Fields is composed by Year, month and auto-increment field.
>
> Up to this step, everything is Ok.
>
>
>
> But the form recalls themselves for going on.
>
> I use <SELECT><OPTION..> </SELECT> for the year and the month.
>
> If anybody knows a way to redisplay the correct values of these
> fields and not "Pick Up yours"?
>
>
>
> Thanks four your help.
>
>
>
> Etienne Mathot
>
> Email : etienne.mathot
chello.be
attached mail follows:
On Wednesday 23 July 2003 02:16, Etienne Mathot wrote:
> I use <SELECT><OPTION..> </SELECT> for the year and the month.
>
> If anybody knows a way to redisplay the correct values of these fields and
> not "Pick Up yours"?
If I understand you correctly, this is in fact an HTML question. To make a
drop down box default to a particular value you add "SELECTED" (without the
quotes) somewhere within the <OPTION> tag.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
I hope something GOOD came in the mail today so I have a REASON to live!!
*/
attached mail follows:
This is the very nature of radiobuttons. They are ment to return only
one value because you can only select one of them. If you want all
values returned in an array you have to use checkbox. Checkboxes allow
multiple selections.
-----Original Message-----
From: daniel
electroteque.org [mailto:daniel
electroteque.org]
Sent: 23. júlí 2003 03:12
To: php-general
lists.php.net
Subject: [PHP] radio button arrays and php3
hi there i dont know if this happens in php4 but say i have a list of
radio
buttons in an array like
<input type="radio" name="secondary_banner[]">
<input type="radio" name="secondary_banner[]">
it only returns the one selected into the array, so instead of having 2
keys i only get the one , the empty one doesnt seem to get submitted ,
how
can i make both turn up in the array ?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
I have installed an user-login aplication on my website ( http://www.norbertnet.ro ) but i have problems with session controls.
I receive all kinds of warnings and i don't know how to interpret them
thanks advanced
---------------------------------
Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger
attached mail follows:
You have to specify which warnings and errors if you want someone to
help
-----Original Message-----
From: tana dsasa [mailto:norbertnet2003
yahoo.co.uk]
Sent: 23. júlí 2003 09:58
To: php-general
lists.php.net
Subject: [PHP] Session problem
I have installed an user-login aplication on my website (
http://www.norbertnet.ro ) but i have problems with session controls.
I receive all kinds of warnings and i don't know how to interpret them
thanks advanced
---------------------------------
Want to chat instantly with your online friends? Get the FREE
Yahoo!Messenger
attached mail follows:
I have installed an user-login aplication on my website (
http://www.norbertnet.ro ) but i have problems with session controls.
I receive all kinds of warnings and i don't know how to interpret them, for instance when i want to register a session it is not very good registered
thanks advanced
---------------------------------
Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger
attached mail follows:
I have installed an user-login aplication on my website (
http://www.norbertnet.ro ) but i have problems with session controls.
I receive all kinds of warnings and i don't know how to interpret them, for instance when i want to register a session it is not very good registered
thanks advanced
---------------------------------
Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger
attached mail follows:
Hello all:
I am having a hard time with a small piece of code. I was wondering
if someone may be able to explain why the following code will not work... I
have been scratching my head for a few hours now and I am stumped.
<?php
header("Location: http://someplace.com");
if( ! headers_sent())
header("Location: http://somplaceelse.com");
?>
So I would expect this piece of code to direct me to somplace.com.
However it does not, and I always end up at somplaceelse.com.
I have done a tcpdump to assist with debugging here is the output below.
From the look of it the first header is getting ignored all toghether. Is
there some way to force changes I made to the headers, that will make
headers_sent return TRUE?
Thanks,
-James
---
GET /tracking/test.php HTTP/1.1
Host: dev.www.someplace.com
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0)
Gecko/20020623 Debian/1.0.0-0.woody.1
Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1
Accept-Encoding: gzip, deflate, compress;q=0.9
Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66
Keep-Alive: 300
Connection: keep-alive
Cookie: toolkitAccess=1
HTTP/1.1 302 Found
Date: Wed, 23 Jul 2003 10:04:55 GMT
Server: Apache/1.3.27 (Unix) mod_ssl/2.8.14 OpenSSL/0.9.6d PHP/4.3.1
mod_perl/1.27
X-Powered-By: PHP/4.3.1
Location: http://someplaceelse.com
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html
---
attached mail follows:
You might want to check whether or not your header output is getting
buffered. My suggestion is a flush() after the fist call. I'm not an expert
on this, it's just an idea.
HTH
--
Ivo Fokkema
PHP & MySQL programmer
Leiden University Medical Centre
Netherlands
"James M. Luedke" <james
dod.net> wrote in message
news:3F1CD481.1060802
dod.net...
> Hello all:
> I am having a hard time with a small piece of code. I was wondering
> if someone may be able to explain why the following code will not work...
I
> have been scratching my head for a few hours now and I am stumped.
>
> <?php
>
> header("Location: http://someplace.com");
>
> if( ! headers_sent())
> header("Location: http://somplaceelse.com");
>
> ?>
>
> So I would expect this piece of code to direct me to somplace.com.
> However it does not, and I always end up at somplaceelse.com.
>
> I have done a tcpdump to assist with debugging here is the output below.
> From the look of it the first header is getting ignored all toghether. Is
> there some way to force changes I made to the headers, that will make
> headers_sent return TRUE?
>
> Thanks,
>
> -James
>
> ---
> GET /tracking/test.php HTTP/1.1
> Host: dev.www.someplace.com
> User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0)
> Gecko/20020623 Debian/1.0.0-0.woody.1
> Accept:
>
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=
0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1
> Accept-Encoding: gzip, deflate, compress;q=0.9
> Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66
> Keep-Alive: 300
> Connection: keep-alive
> Cookie: toolkitAccess=1
>
> HTTP/1.1 302 Found
> Date: Wed, 23 Jul 2003 10:04:55 GMT
> Server: Apache/1.3.27 (Unix) mod_ssl/2.8.14 OpenSSL/0.9.6d PHP/4.3.1
> mod_perl/1.27
> X-Powered-By: PHP/4.3.1
> Location: http://someplaceelse.com
> Keep-Alive: timeout=15, max=100
> Connection: Keep-Alive
> Transfer-Encoding: chunked
> Content-Type: text/html
> ---
>
attached mail follows:
according to the php doc, online the headers are not affected by the
Output Buffer,
so any functions that manipulate the OB should have no effect. flush I
do not beleive
will fix this issue. (* I have tested it and it did not *)
Still need a good way to accomplish this.
Thanks, James
Ivo Fokkema wrote:
>You might want to check whether or not your header output is getting
>buffered. My suggestion is a flush() after the fist call. I'm not an expert
>on this, it's just an idea.
>
>HTH
>
>
>--
>Ivo Fokkema
>PHP & MySQL programmer
>Leiden University Medical Centre
>Netherlands
>
>"James M. Luedke" <james
dod.net> wrote in message
>news:3F1CD481.1060802
dod.net...
>
>
>>Hello all:
>> I am having a hard time with a small piece of code. I was wondering
>>if someone may be able to explain why the following code will not work...
>>
>>
>I
>
>
>>have been scratching my head for a few hours now and I am stumped.
>>
>><?php
>>
>>header("Location: http://someplace.com");
>>
>>if( ! headers_sent())
>> header("Location: http://somplaceelse.com");
>>
>>?>
>>
>>So I would expect this piece of code to direct me to somplace.com.
>>However it does not, and I always end up at somplaceelse.com.
>>
>>I have done a tcpdump to assist with debugging here is the output below.
>> From the look of it the first header is getting ignored all toghether. Is
>>there some way to force changes I made to the headers, that will make
>>headers_sent return TRUE?
>>
>>Thanks,
>>
>>-James
>>
>>---
>>GET /tracking/test.php HTTP/1.1
>>Host: dev.www.someplace.com
>>User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0)
>>Gecko/20020623 Debian/1.0.0-0.woody.1
>>Accept:
>>
>>
>>
>text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=
>0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1
>
>
>>Accept-Encoding: gzip, deflate, compress;q=0.9
>>Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66
>>Keep-Alive: 300
>>Connection: keep-alive
>>Cookie: toolkitAccess=1
>>
>>HTTP/1.1 302 Found
>>Date: Wed, 23 Jul 2003 10:04:55 GMT
>>Server: Apache/1.3.27 (Unix) mod_ssl/2.8.14 OpenSSL/0.9.6d PHP/4.3.1
>>mod_perl/1.27
>>X-Powered-By: PHP/4.3.1
>>Location: http://someplaceelse.com
>>Keep-Alive: timeout=15, max=100
>>Connection: Keep-Alive
>>Transfer-Encoding: chunked
>>Content-Type: text/html
>>---
>>
>>
>>
>
>
>
>
>
attached mail follows:
> -----Original Message-----
> From: James M. Luedke [mailto:james
dod.net]
> Sent: 22 July 2003 07:07
> I am having a hard time with a small piece of code. I was
> wondering
> if someone may be able to explain why the following code will
> not work... I
> have been scratching my head for a few hours now and I am stumped.
>
> <?php
>
> header("Location: http://someplace.com");
At this point, you have specified that you want the header "Location: http://someplace.com" to be sent when headers are sent -- but headers are not sent until you output some actual content to your page. So...
> if( ! headers_sent())
... headers haven't been sent yet, so this test always triggers, so...
> header("Location: http://somplaceelse.com");
... this call always executes, specifying that, actually, you want *this* Location header to be sent when headers are sent, not the one specified before.
I haven't the faintest idea what you might be trying to achieve here, but I think you need to rethink the logic of how you choose which redirect to use.
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford
lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
attached mail follows:
[snip]
Hello all:
I am having a hard time with a small piece of code. I was wondering
if someone may be able to explain why the following code will not
work... I
have been scratching my head for a few hours now and I am stumped.
<?php
header("Location: http://someplace.com");
if( ! headers_sent())
header("Location: http://somplaceelse.com");
?>
So I would expect this piece of code to direct me to somplace.com.
However it does not, and I always end up at somplaceelse.com.
I have done a tcpdump to assist with debugging here is the output below.
From the look of it the first header is getting ignored all toghether.
Is
there some way to force changes I made to the headers, that will make
headers_sent return TRUE?
[/snip]
First of all, let's not call something a bug unless we are pretty darn
sure about it. Let's just call it a problem...
Second, from http://www.php.net/headers_sent "You can't add any more
header lines using the header() function once the header block has
already been sent. Using this function you can at least prevent getting
HTTP header related error messages. Another option is to use Output
Buffering."
Also, do those spaces exist in your code? If so you may want to change;
if( ! headers_sent())
to
if(!headers_sent())
HTH!
attached mail follows:
> -----Original Message-----
> From: Jay Blanchard [mailto:jay.blanchard
niicommunications.com]
> Sent: 23 July 2003 12:31
<big snip>
> Also, do those spaces exist in your code? If so you may want
> to change;
>
> if( ! headers_sent())
>
> to
>
> if(!headers_sent())
There's nowt wrong there -- both of those are functionally identical. The
extra spaces are ignored by PHP, so the difference is purely cosmetic.
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford
lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
attached mail follows:
Added to this, your later header replaces the earlier one of the same
type, unless you specify false to the second parameter of header() function.
More in the manual.
Ford, Mike [LSS] wrote:
>>-----Original Message-----
>>From: James M. Luedke [mailto:james
dod.net]
>>Sent: 22 July 2003 07:07
>> I am having a hard time with a small piece of code. I was
>>wondering
>>if someone may be able to explain why the following code will
>>not work... I
>>have been scratching my head for a few hours now and I am stumped.
>>
>><?php
>>
>>header("Location: http://someplace.com");
>
>
> At this point, you have specified that you want the header "Location: http://someplace.com" to be sent when headers are sent -- but headers are not sent until you output some actual content to your page. So...
>
>
>>if( ! headers_sent())
>
>
> ... headers haven't been sent yet, so this test always triggers, so...
>
>
>> header("Location: http://somplaceelse.com");
>
>
> ... this call always executes, specifying that, actually, you want *this* Location header to be sent when headers are sent, not the one specified before.
>
> I haven't the faintest idea what you might be trying to achieve here, but I think you need to rethink the logic of how you choose which redirect to use.
>
> Cheers!
>
> Mike
>
> ---------------------------------------------------------------------
> Mike Ford, Electronic Information Services Adviser,
> Learning Support Services, Learning & Information Services,
> JG125, James Graham Building, Leeds Metropolitan University,
> Beckett Park, LEEDS, LS6 3QS, United Kingdom
> Email: m.ford
lmu.ac.uk
> Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
>
attached mail follows:
* Thus wrote Marek Kilimajer (kilimajer
webglobe.sk):
> Added to this, your later header replaces the earlier one of the same
> type, unless you specify false to the second parameter of header() function.
> More in the manual.
The second parameter specifies whether it will overwrite an existing
parameter. I think it is unpredictable on which Location header the
browser will actually use.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
--- "James M. Luedke" <james
dod.net> wrote:
> I was wondering if someone may be able to explain why the following
> code will not work... I have been scratching my head for a few hours
> now and I am stumped.
>
> <?php
> header("Location: http://someplace.com");
>
> if( ! headers_sent())
> header("Location: http://somplaceelse.com");
> ?>
>
> So I would expect this piece of code to direct me to somplace.com.
Your second call to header() uses the same header name, thus that header
(Location) is replaced with http://someplaceelse.com. The code works as
expected.
If you expected your conditional statement to fail, you are probably confusing
headers_sent() to mean something like have_i_used_the_header_function_yet().
The headers are all sent at once, regardless of how many times you use
header(). This function helps people avoid receiving the headers already sent
warning, and as long as you have no output yet in your script, you should still
be able to make changes to the headers.
Hope that helps.
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/
attached mail follows:
I’m making an authentication script with groups and roles. This function
checks if the groups the user belongs to specified groups and compares
them to the groups required. However, since this is a loop, the function
doesn’t return true or false as expected. If I call the function and
require 3 groups, and the user belongs to only one of them, he is still
accepted. Is this method right thinking? Should I make the function stop
somehow when it returns false for the first time? All suggestions and
comments are appreciated. Thanks.
This is the function:
function require_groups() {
if (!isset($this->user['groups'])) {
$this->user['groups'] =
$this->get_user_groups($this->id);
}
$groups = func_get_args();
foreach ($groups as $value) {
if
(!isset($this->user['groups'][$value]) ||
!$this->user['groups'][$value]) {
return false;
}
else{
return true;
}
}
}
And I call it like this: require_groups(“admins”,
“moderators”,“members”);
This returns true.
Kveðja,
Sævar Öfjörð
ofjord
reddast.is
þetta reddast - hönnunarlausnir
<file:///C:\Documents%20and%20Settings\S%E6var\Application%20Data\Micros
oft\Signatures\www.reddast.is> www.reddast.is
attached mail follows:
i think the problem isn't only your 'return false' but also your 'return
true' in your first loop through your foreach will definetly a 'return' be
passed. and return means return a value AND stop the function. not?
try it this way:
foreach ($groups as $value)
{
if(!isset($this->user['groups'][$value]) ||
!$this->user['groups'][$value])
{
return false;
}
}
return true;
ciao SVEN
SævË Ölêöyp wrote:
> I'm making an authentication script with groups and roles. This
> function checks if the groups the user belongs to specified groups
> and compares them to the groups required. However, since this is a
> loop, the function doesn't return true or false as expected. If I
> call the function and require 3 groups, and the user belongs to only
> one of them, he is still accepted. Is this method right thinking?
> Should I make the function stop somehow when it returns false for the
> first time? All suggestions and comments are appreciated. Thanks.
>
> This is the function:
>
> function require_groups() {
> if (!isset($this->user['groups'])) {
> $this->user['groups'] > $this->get_user_groups($this->id);
> }
> $groups = func_get_args();
> foreach ($groups as $value) {
> if
> (!isset($this->user['groups'][$value]) ||
> !$this->user['groups'][$value]) {
> return false;
> }
> else{
> return true;
> }
> }
> }
>
> And I call it like this: require_groups("admins",
> "moderators","members");
> This returns true.
>
> Kveðja,
> Sævar Öfjörð
> ofjord
reddast.is
> þetta reddast - hönnunarlausnir
>
> <file:///C:\Documents%20and%20Settings\S%E6var\Application%20Data\Micros
> oft\Signatures\www.reddast.is> www.reddast.is
attached mail follows:
Hi,
I'm not sure if this is going to help or not.. Since I understand
your issue only barely.. If I understand correctly, regardless of whether
the user comes from a.php, b.php or z.php, if they're not authenticated on
the system (via sessions or cookies) then the only place for them to go is
login.php. RIGHT???
Here's my 2 cents. (part of code I'm working on)
=========login.php===============
if ( check_if_authenticated() ) <--- I have this fucntion located at the
top of a.php,b.php,c.php
{
header_refresh_html("home.php"); <--- Function call -> back to
Home.php if logged in
exit;
}
else <--- display login form is not already logged in
{
top_html();
display_welcome_msg_html();
}
==================================
===============html_functions.php ==========
# ===========================
# This is where I print headers to redirect pages
# Default wait time is 2 seconds
# NOTE : WE MUST PRINT THE REDIRECTION BEFORE WE OUTPUT ANYTHING!
# Just put the redirection BEFORE the outputs!
# ===========================
function header_refresh_html($l_refresh_url) <--- the page to redirect to is
given as an argument
{
// This is taken from php-manual
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); //
always modified
header("Cache-Control: no-store, no-cache, must-revalidate"); //
HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
// HTTP/1.0
header( "Refresh:2;url=$l_refresh_url" ); // Wait
default of 2 seconds
}
function header_redirect_html($l_redirect_url)
{
header( "Location:$l_redirect_url"); // Instant
Redirection
}
=========================================
Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia
DID : 03-7870 5168
-----Original Message-----
From: Beauford.2005 [mailto:beauford.2005
rogers.com]
Sent: Thursday, July 24, 2003 8:55 AM
To: 'PHP'
Subject: RE: [PHP] Redirection Question
Thanks to all, I got it working - sort of. It works perfectly on
Windows, but will not work on Linux. I am using the same versions of
PHP, Apache and MySQL on both. I have asked this before and have been
told they are interchangeable, but more times than not I have to make a
bunch of changes to get it to work on Linux - and this is just another
example. I use Windows to do all the coding and design as it has all the
tools. Linux is just a bare bones box with no gui or tools. The php.ini
and httpd.conf are the same on both platforms (other than what is needed
for the specific platform). This makes it a real pain.
Oh well, back to my debugging.
-----Original Message-----
From: Curt Zirzow [mailto:curt
zirzow.dyndns.org]
Sent: July 22, 2003 7:04 PM
To: PHP
Subject: Re: [PHP] Redirection Question
* Thus wrote Beauford.2005 (beauford.2005
rogers.com):
> Maybe I didn't explain enough. What if they come from b.php or c.php.
> How do I automatically log what page they tried to access. So hard
> coding login.php?next=a.php would only work for one page.
Use the code that Grant Rutherford posted earlier, its the same concept
just a whole lot more flexible than mine. Not to mention a bit more
secured.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
I'm new but.. aren't you also supposed to register the session??
My code ..
session_start();
session_register('username');
$_SESSION['username'] = $row['username'];
session_register('user_id');
$_SESSION['user_id'] = $row['user_id'];
session_register('access_level');
$_SESSION['access_level'] = $row['access_level'];
Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia
DID : 03-7870 5168
-----Original Message-----
From: Jeff Stillwall [mailto:jstill
audioengine.net]
Sent: Wednesday, July 23, 2003 12:02 PM
To: Tom Rogers; Warren Vail
Cc: php-general
lists.php.net
Subject: Re: [PHP] Some SESSION Vars not Registering
"Tom Rogers" wrote:
> I am sure they do not but....
> I just tried reading the docs and it is as clear as mud so its back to
> the suck it and see method
From the on-line docs, regarding $_SESSION (at
http://us3.php.net/manual/en/reserved.variables.php#reserved.variables.sessi
on):
"This is a 'superglobal', or automatic global, variable. This simply means
that it is available in all scopes throughout a script. You don't need to do
a global $_SESSION; to access it within functions or methods, as you do with
$HTTP_SESSION_VARS."
So, this gets more perplexing.
I should also note that I did try to use the global keyword, and it didn't
help. Also, I tried setting the $_SESSION variables in question to
something else ($_SESSION["fname"] = " ") before calling the function.
Didn't help either.
I have just never had a problem with sessions before. But I'm guessing it's
my code, as I can replicate the behavior on three different installations of
PHP/Apache.
--
Jeff Stillwall
attached mail follows:
* Thus wrote Ow Mun Heng (ow.mun.heng
wdc.com):
> I'm new but.. aren't you also supposed to register the session??
>
> My code ..
>
> session_start();
> session_register('username');
> $_SESSION['username'] = $row['username'];
> session_register('user_id');
> $_SESSION['user_id'] = $row['user_id'];
> session_register('access_level');
> $_SESSION['access_level'] = $row['access_level'];
No that is incorrect.
<snip session_register()>
CAUTION:
If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use
session_register(), session_is_registered(), and session_unregister().
</snip>
What happens if you register session_register('username') is that the
$_SESSION['username'] namespace is dedicated to the global variable
$username.
So, if in your script after your block of code, you use the variable
$username (global scoped) then your $row['username'] value you assigned
in $_SESSION['username'] is gone.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
"Curt Zirzow" wrote:
> So i would also assume you have called session_start() already. and yes
> global for version >= 4.1.0
Yes, I have session_start at the top of every page, and have run this
against PHP versions 4.12, 4.31 and 4.32.
> <quote>
> If register_globals is disabled, only members of the global associative
> array $_SESSION can be registered as session variables. The restored
> session variables will only be available in the array $_SESSION.
> </quote>
>
> I can't make heads or tails what that means.
It means that you can't use session_register. With register_globals off,
you can on directly manipulate the $_SESSION array.
> I've set up something what you describe, it works for me:
>
> http://zirzow.dyndns.org/php/session.php
Wow, thanks. The only thing that I'm doing differently is that the function
is part of an included file (via 'require'). Would that change anything?
I've done this before also - never had a problem until now!
--
Jeff Stillwall
attached mail follows:
"Ow Mun Heng" wrote:
> I'm new but.. aren't you also supposed to register the session??
The code I posted was just a single function. I am calling session_start()
at the head of the page. Thanks, though.
--
Jeff Stillwall
attached mail follows:
"Curt Zirzow" wrote:
> I've set up something what you describe, it works for me:
>
> http://zirzow.dyndns.org/php/session.php
OK, here's more fuel for the fire. When passed to this function, $userArray
is 31 elements long. The initial function I was using (and posted) was only
grabbing 6 of those. I changed my function to grab all of them:
function setupUserEnv ($userArray) {
$_SESSION['loggedIn'] = 1;
foreach($userArray as $key=>$value) {
echo "Assigning $key = $value<br>";
$_SESSION[$key] = $value;
}
}
Thanks to the echo statements, I see all 31 getting assigned. However, when
I exit this function, and var_dump($_SESSION), only 6 are assigned!
Wracking my brain.....
--
Jeff Stillwall
attached mail follows:
* Thus wrote Jeff Stillwall (jstill
audioengine.net):
> "Curt Zirzow" wrote:
>
> > So i would also assume you have called session_start() already. and yes
> > global for version >= 4.1.0
>
> Yes, I have session_start at the top of every page, and have run this
> against PHP versions 4.12, 4.31 and 4.32.
hmm.. i'm running 4.33RC1.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
* Thus wrote Jeff Stillwall (jstill
audioengine.net):
> "Curt Zirzow" wrote:
>
> > I've set up something what you describe, it works for me:
> >
> > http://zirzow.dyndns.org/php/session.php
>
> OK, here's more fuel for the fire. When passed to this function, $userArray
> is 31 elements long. The initial function I was using (and posted) was only
> grabbing 6 of those. I changed my function to grab all of them:
>
> function setupUserEnv ($userArray) {
> $_SESSION['loggedIn'] = 1;
> foreach($userArray as $key=>$value) {
> echo "Assigning $key = $value<br>";
> $_SESSION[$key] = $value;
> }
> }
>
I modified this to do 31 variables:
http://zirzow.dyndns.org/php/session.php
> Thanks to the echo statements, I see all 31 getting assigned. However, when
> I exit this function, and var_dump($_SESSION), only 6 are assigned!
The only thing i can think, mabey, is size limit? how long are these
values your assigning?
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
"Curt Zirzow" wrote:
> I modified this to do 31 variables:
> http://zirzow.dyndns.org/php/session.php
Thanks again.
> The only thing i can think, mabey, is size limit? how long are these
> values your assigning?
Not long at all.
Now I'm (possibly) getting somewhere:
When I modify the function to be this (notice the key name change by adding
"s"):
function setupUserEnv ($userArray) {
$_SESSION['loggedIn'] = 1;
foreach($userArray as $key=>$value) {
echo "Assigning $key = $value<br>";
$_SESSION[$key."s"] = $value;
}
}
It works! Now, I don't really want to do this. It impacts other code.
These names match the columns in my database table. Frankly, I don't
understand why it refuses to register variables with the names I've chosen!
I can add anything to those keys (e.g. $_SESSION["g".$key]), but not use my
names! The key names that I'm trying to assign are:
loggedIn, uid, id, password, fname, lname, email, altemail, birthdate
hphonenum, wphonenum, cphonenum, street, mailstop, city, state
zip, country, weburl, freelance, coname, costreet, comailstop
cocity, costate, cozip, cotype, jobtitle, status, dateadded
dateapproved, lastlogin
Anything illegal about any of those names that is making PHP go nutty? I'm
assigning them in that order, and out of those, only 6 stay set (loggedIn,
uid, status, dateadded, dateapproved, lastlogin) .
What in the world....?
--
Jeff Stillwall
attached mail follows:
From: "Jeff Stillwall" <jstill
audioengine.net>
>
> Now I'm (possibly) getting somewhere:
>
> When I modify the function to be this (notice the key name change by
adding
> "s"):
>
> function setupUserEnv ($userArray) {
>
> $_SESSION['loggedIn'] = 1;
>
> foreach($userArray as $key=>$value) {
> echo "Assigning $key = $value<br>";
> $_SESSION[$key."s"] = $value;
> }
> }
Why not just
$_SESSION['userArray'] = $userArray;
??
Then $_SESSION['userArray']['fname'] to access the values, for example.
---John Holmes...
attached mail follows:
Hi Curt,
I'm confused..
<quote>
With $_SESSION, there is no need to use the session_register(),
session_unregister(), session_is_registered() functions. Session
variables are accessible like any other variables.
</quote>
I'm using
session_start();
session_register('username');
$_SESSION['username'] = $row['username'];
session_register('user_id');
$_SESSION['user_id'] = $row['user_id'];
session_register('access_level');
$_SESSION['access_level'] = $row['access_level'];
and checking if user is authenticated using
if ( session_is_registered('user_id') )
{
return true;
}
else
{
return false;
}
Am I in error? (I'm trying to code using register_globals=off)
Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia
DID : 03-7870 5168
-----Original Message-----
From: Curt Zirzow [mailto:curt
zirzow.dyndns.org]
Sent: Wednesday, July 23, 2003 12:20 PM
To: PHP
Subject: Re: [PHP] Re: Redirection Question (I spoke to soon)
* Thus wrote Beauford.2005 (beauford.2005
rogers.com):
> Sorry all, apparently this doesn't work on either Windows or Linux.
> Again, I thought it was working and once I got farther along I see that
> it really wasn't. Basically what I get after I login is an empty screen.
> Here is what I have :
>
> This is the script that runs to see if the user is logged in.
>
> session_start();
> if(!$_SESSION['logged']) {
>
> session_register('goto');
> $_SESSION['goto'] = "http://" . $_SERVER['SERVER_NAME'] .
> $_SERVER['REQUEST_URI'];
>
> $url = "http://www.mysite.org/login/login.php";
> header("Location: $url");
> }
>
> The above works and redirects me to the login page and has the right
> referring page as shown below.
>
> goto|s:59:"http://www.mysite.org/setup/inputs.php";
>
> This is in my login.php script. After I verify the user login is
> correct, this piece of code is executed.
>
> session_start();
> session_register('logged');
> session_register('user');
You don't need those two lines, they are only needed if ini.register_globals
is on and you want the variables $logged and $user to automatically be
sessioned as:
$_SESSION['logged']
$_SESSION['user']
<quote>
With $_SESSION, there is no need to use the session_register(),
session_unregister(), session_is_registered() functions. Session
variables are accessible like any other variables.
</quote>
I think this is were your problem is.
Also what php version?
<quote CAUTION>
If you are using $_SESSION and disable register_globals, do not use
session_register(), session_is_registered() and session_unregister(), if
your scripts shall work in PHP 4.2 and earlier. You can use these
functions in 4.3 and later.
</quote>
Hmm.. After looking at the session_* documentation there are CAUTIONS
all over the place...... The all seem to say dont use sesion_register,
unregister, and is_registered when your using $_SESSION;
>
> $_SESSION['logged'] = "True";
> $_SESSION['user'] = $row['user'];
>
> $target = "Location: " . $_SESSION['goto'];
>
> session_unregister('goto');
Use: unset($_SESSION['goto']);
>
> header($target);
what does echo($target) yeild?
>
> What I get after this is a blank page. The user has been logged in and
> shows in the session file, but it just isn't redirecting.
>
HTH,
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
> -----Original Message-----
> From: Ow Mun Heng [mailto:ow.mun.heng
wdc.com]
> Sent: 23 July 2003 11:37
>
> I'm confused..
>
> <quote>
> With $_SESSION, there is no need to use the session_register(),
> session_unregister(), session_is_registered() functions. Session
> variables are accessible like any other variables.
> </quote>
>
> I'm using
>
> session_start();
> session_register('username');
> $_SESSION['username'] = $row['username'];
> session_register('user_id');
> $_SESSION['user_id'] = $row['user_id'];
> session_register('access_level');
> $_SESSION['access_level'] = $row['access_level'];
>
> and checking if user is authenticated using
>
> if ( session_is_registered('user_id') )
> {
> return true;
> }
> else
> {
> return false;
> }
>
>
> Am I in error? (I'm trying to code using register_globals=off)
Yes.
If you use only the $_SESSION array to set/get the values of your session
variables, you do not need (and, in some versions of PHP, MUST NOT use)
session_register() or any of its friends.
The proper coding for what you are doing above is:
session_start();
$_SESSION['username'] = $row['username'];
$_SESSION['user_id'] = $row['user_id'];
$_SESSION['access_level'] = $row['access_level'];
and
if (isset($_SESSION['user_id']) )
{
return true;
}
else
{
return false;
}
(or even just
return isset($_SESSION['user_id']);
! ;)
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford
lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
attached mail follows:
* Thus wrote Ow Mun Heng (ow.mun.heng
wdc.com):
> Hi Curt,
>
> I'm confused..
I'll try to clear this up for you. I'm going to see if I can get the
documentation on the web site fixed also. It is rather confusing.
There appears to be two ways to do sessions:
'---------------------------
Style 1 (discuraged use):
'---------------------------
session_start(); // start the session
session_register('var'); // register global $var as session var
$var = $row['var']; // assign global $var a value
// now the session will save the value
// that is inside $var as long as its global
// scoped
// check to see if $var is registered with the session handler
if ( session_is_registered('var') ) {
// session is registered but doesn't gaurentee
// that a value is inside of it.
// so check to see if there is a value
&nbs