|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 2 May 2003 03:26:17 -0000 Issue 2032
php-general-digest-help
lists.php.net
Date: Thu May 01 2003 - 22:26:17 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 2 May 2003 03:26:17 -0000 Issue 2032
Topics (messages 145971 through 146045):
Re: Recommendations
145971 by: Dan Joseph
145972 by: Awlad Hussain
145978 by: Pushpinder Singh Garcha
Re: Replacing a space with an underscore
145973 by: John W. Holmes
145983 by: James
145994 by: John W. Holmes
Re: Zip code search script
145974 by: Frappy John
145975 by: Awlad Hussain
exec, passthru, etc. for interactive command line scripts
145976 by: Lee P. Reilly
145977 by: M.A.Bond
145979 by: Lee P. Reilly
145993 by: Jason Wong
session_destroy() but re-use session ID: security risk?
145980 by: Johnson, Kirk
145984 by: Bobby Patel
145986 by: Johnson, Kirk
145989 by: John W. Holmes
Re: Custom Session Handlers and User Tracking
145981 by: Rob Lacey
Re: Translate web site language
145982 by: Steve Keller
Calling a Specific Function in a Remote File
145985 by: chris.wakeboarder.com
Image Gallery Script
145987 by: karthikeyan.balasubramanian
145992 by: Jason Wong
Ordinary Timer Indicator
145988 by: Pushpinder Singh Garcha
145991 by: Jason Wong
Re: Error undefined index
145990 by: Jason Wong
Code dying at Include borders
145995 by: Derrick Fogle
145997 by: Rasmus Lerdorf
Re: Street Name Naming Convention.
145996 by: Jason Wong
Re: where is php error log?
145998 by: Jason Wong
Cant get one value in an array
145999 by: David D
Re: Getting variables before the submit button is hit
146000 by: Morgan Doocy
Error using snmpset Please Help!
146001 by: Lance O'Connor
Mail function corrupting images
146002 by: Jeff Schwartz
location of scripts with DB passwords
146003 by: Dennis Gearon
146004 by: Dan Joseph
146015 by: John W. Holmes
Tutorials sites
146005 by: Ron Clark
146006 by: Rasmus Lerdorf
File check in/check out
146007 by: shaun
146010 by: John W. Holmes
146016 by: James
Globals defined in functions
146008 by: Liam Gibbs
146011 by: Rasmus Lerdorf
146012 by: John W. Holmes
146014 by: Liam Gibbs
How do I make such a complicated demand (for me)on mysql and php
146009 by: mailing
146029 by: David Otton
Re: function question
146013 by: shaun
Meaning of "Session object destruction failed" error?
146017 by: Johnson, Kirk
Session Question
146018 by: Pushpinder Singh Garcha
146019 by: John W. Holmes
echo problem
146020 by: Ryan A
146021 by: Brian V Bonini
146022 by: Philip Olson
146028 by: Steve Keller
Segmentation fault bug #20108 in 4.2.2-8.0.7?
146023 by: DB
146030 by: Tom Rogers
php...menu generation...
146024 by: Bruce Douglas
146026 by: Steve Keller
146027 by: Bruce Douglas
send header and close connection, but still run additional code
146025 by: Antony Nguyen
Zip/Postal Codes
146031 by: C.R.
146044 by: J J
to whom it may concern
146032 by: Dina A.
146033 by: Jennifer Goodie
Newbie question
146034 by: Michael Lewis
146036 by: Justin French
146039 by: Michael Lewis
Re: PHP with openssl......THANK YOU!!!
146035 by: Felderi Santiago
PHP php-4.2.2-8.0.7 - MySQL 4.x compatibility?
146037 by: DB
146038 by: John W. Holmes
PHP & AOL
146040 by: kris.listzapper.com
146041 by: John W. Holmes
146042 by: kris.listzapper.com
146043 by: John W. Holmes
146045 by: kris.listzapper.com
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:
www.oreilly.com and www.php.net
-Dan Joseph
> -----Original Message-----
> From: Ron Allen (newbie) [mailto:allenro
firsthandcomm.com]
> Sent: Thursday, May 01, 2003 11:21 AM
> To: php-general
lists.php.net
> Subject: [PHP] Recommendations
>
>
> Can anybody recommend a PHP book or a form of learning. Please
> keep in mind
> that I am in Kosovo so going to class is not really possible...
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
Read online tutorials
http://www.phpbuilder.com ,
http://www.phpfreaks.com
http://www.devshed.com
and the PHP manual of course
-awlad
----- Original Message -----
From: "Dan Joseph" <djoseph
duhq.us>
To: <php-general
lists.php.net>
Sent: Thursday, May 01, 2003 4:25 PM
Subject: RE: [PHP] Recommendations
> www.oreilly.com and www.php.net
>
> -Dan Joseph
>
> > -----Original Message-----
> > From: Ron Allen (newbie) [mailto:allenro
firsthandcomm.com]
> > Sent: Thursday, May 01, 2003 11:21 AM
> > To: php-general
lists.php.net
> > Subject: [PHP] Recommendations
> >
> >
> > Can anybody recommend a PHP book or a form of learning. Please
> > keep in mind
> > that I am in Kosovo so going to class is not really possible...
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
also try www.zend.com ... the site has some pretty great tutorials !
all the best
-pS
On Thursday, May 1, 2003, at 10:29 AM, Awlad Hussain wrote:
> Read online tutorials
> http://www.phpbuilder.com ,
> http://www.phpfreaks.com
> http://www.devshed.com
>
> and the PHP manual of course
> -awlad
>
> ----- Original Message -----
> From: "Dan Joseph" <djoseph
duhq.us>
> To: <php-general
lists.php.net>
> Sent: Thursday, May 01, 2003 4:25 PM
> Subject: RE: [PHP] Recommendations
>
>
>> www.oreilly.com and www.php.net
>>
>> -Dan Joseph
>>
>>> -----Original Message-----
>>> From: Ron Allen (newbie) [mailto:allenro
firsthandcomm.com]
>>> Sent: Thursday, May 01, 2003 11:21 AM
>>> To: php-general
lists.php.net
>>> Subject: [PHP] Recommendations
>>>
>>>
>>> Can anybody recommend a PHP book or a form of learning. Please
>>> keep in mind
>>> that I am in Kosovo so going to class is not really possible...
>>>
>>>
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
> Mysql:
>
> SELECT REPLACE(blah,' ','_') as blahWithUnderScore WHERE x=x
>
> PHP:
>
> $string = str_replace(" ","_", $string);
> $string = preg_replace("/[\s]/","_",$string);
> $string = eregi_replace("[[:space:]]","_",$string);
>
> I would use the mySql way.
It's always good to include a reason why, like a benchmark, when you
suggest a certain method to use.
You should always benchmark your own solutions. If you have a database
heavy application, then I wouldn't tax the database with the extra work
of taking care of the spaces for you.
Using this code:
$query1 = 'SELECT c1 FROM test LIMIT 100';
$query2 = 'SELECT REPLACE(c1," ","_") FROM test LIMIT 100';
//Str_Replace Method
$result = mysql_query($query1);
while($row = mysql_fetch_row($result))
{ echo str_replace(' ','_',$row[0]); }
//Query Method
$result = mysql_query($query2);
while($row = mysql_fetch_row($result))
{ echo $row[0]; }
Achieved these results:
Str_Replace Method: 0.00233495235443 (Avg: 0.00253650387128)
Query Method: 0.00189101696014 (Avg: 0.00206401030223)
(Over 300 iterations.)
The test table has 1,000,000 rows in it with 4 different repeated
sentences in it similar to: "The question is whether it's faster for the
database or PHP to do it though". (Created this table for other
benchmarks. :)
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
attached mail follows:
Benchmarking is surely only related to your specific server setup.
> Str_Replace Method: 0.00233495235443 (Avg: 0.00253650387128)
> Query Method: 0.00189101696014 (Avg: 0.00206401030223)
I can't decide which method you are agreeing with, your benchmark
and my own show the sql replace method to be faster...
> You should always benchmark your own solutions. If you have a database
> heavy application, then I wouldn't tax the database with the extra work
> of taking care of the spaces for you.
It depends on your setup.
jim.
John W. Holmes wrote:
>>Mysql:
>>
>> SELECT REPLACE(blah,' ','_') as blahWithUnderScore WHERE x=x
>>
>>PHP:
>>
>> $string = str_replace(" ","_", $string);
>> $string = preg_replace("/[\s]/","_",$string);
>> $string = eregi_replace("[[:space:]]","_",$string);
>>
>>I would use the mySql way.
>
>
> It's always good to include a reason why, like a benchmark, when you
> suggest a certain method to use.
>
> You should always benchmark your own solutions. If you have a database
> heavy application, then I wouldn't tax the database with the extra work
> of taking care of the spaces for you.
>
> Using this code:
>
> $query1 = 'SELECT c1 FROM test LIMIT 100';
> $query2 = 'SELECT REPLACE(c1," ","_") FROM test LIMIT 100';
>
> //Str_Replace Method
> $result = mysql_query($query1);
> while($row = mysql_fetch_row($result))
> { echo str_replace(' ','_',$row[0]); }
>
> //Query Method
> $result = mysql_query($query2);
> while($row = mysql_fetch_row($result))
> { echo $row[0]; }
>
> Achieved these results:
>
> Str_Replace Method: 0.00233495235443 (Avg: 0.00253650387128)
> Query Method: 0.00189101696014 (Avg: 0.00206401030223)
> (Over 300 iterations.)
>
> The test table has 1,000,000 rows in it with 4 different repeated
> sentences in it similar to: "The question is whether it's faster for the
> database or PHP to do it though". (Created this table for other
> benchmarks. :)
>
> ---John W. Holmes...
>
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
>
>
attached mail follows:
> Benchmarking is surely only related to your specific server setup.
Exactly. I was only providing my results.
> > Str_Replace Method: 0.00233495235443 (Avg: 0.00253650387128)
> > Query Method: 0.00189101696014 (Avg: 0.00206401030223)
>
> I can't decide which method you are agreeing with, your benchmark
> and my own show the sql replace method to be faster...
Yes, it does, for that limited test. Again, someone should benchmark
their own solution to see what works best for them.
> > You should always benchmark your own solutions. If you have a
database
> > heavy application, then I wouldn't tax the database with the extra
work
> > of taking care of the spaces for you.
>
> It depends on your setup.
Exactly. I think we're actually agreeing here. :)
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
attached mail follows:
> Does anyone know where I could obtain a php script so my
> members can search by zip code?
What do you mean by "search by zip code"?
--Frappy
On Thursday 01 May 2003 04:37 am, blade xtreme wrote:
> Does anyone know where I could obtain a php script so my
> members can search by zip code?
>
> Thanks in advance
> Blade
>
>
>
>
> _________________________________________________________
>________ STOP MORE SPAM with the new MSN 8 and get 2
> months FREE* http://join.msn.com/?page=features/junkmail
attached mail follows:
Try this
i am assuming you have a field called zipcode in your table..
create a form with text field called zipcode ...
then ...............on search page do this
$result = mysql_query("SELECT * FROM tbl_name WHERE zipcode ='$zipcode'");
while($row=msql_fetch_array($result)){
// display your results here
}
----- Original Message -----
From: "Frappy John" <frappyjohn
dos2linux.org>
To: "blade xtreme" <bladextreme99
hotmail.com>; <php-general
lists.php.net>
Sent: Thursday, May 01, 2003 4:58 PM
Subject: Re: [PHP] Zip code search script
> > Does anyone know where I could obtain a php script so my
> > members can search by zip code?
>
> What do you mean by "search by zip code"?
>
> --Frappy
>
> On Thursday 01 May 2003 04:37 am, blade xtreme wrote:
> > Does anyone know where I could obtain a php script so my
> > members can search by zip code?
> >
> > Thanks in advance
> > Blade
> >
> >
> >
> >
> > _________________________________________________________
> >________ STOP MORE SPAM with the new MSN 8 and get 2
> > months FREE* http://join.msn.com/?page=features/junkmail
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
Can anyone tell me if there is a solution to the following?
I am running a program from the command line that, when executed, asks
for a filename. When the filename is given, it does some background
processing and returns to the command prompt. Simple. Can I interact
with this in PHP? I can run the program okay and get the message
prompting for the filename e.g.
$command = exec ( "fextrap.exe"); // $command = "LIST FILENAME :"
What I can't do however is figure out how to pass it the filename
*after* I have called the program. I thought that maybe a second call to
exec passing in the filename instead of an actual command might work,
but perhaps I was a little naive.
Does anyone have any ideas? I'm stumped.
Thanks!
- Best regards,
Lee
attached mail follows:
Just guessing really, but have you tried:
$command = exec (" fextrap.exe < filename ");
(I can't remember if the filename after the < needs to contain your filename
or it it is your filename)
Mark
-----Original Message-----
From: Lee P. Reilly [mailto:lreilly
lanl.gov]
Sent: 01 May 2003 17:12
To: PHP
Subject: [PHP] exec, passthru, etc. for interactive command line scripts
Can anyone tell me if there is a solution to the following?
I am running a program from the command line that, when executed, asks
for a filename. When the filename is given, it does some background
processing and returns to the command prompt. Simple. Can I interact
with this in PHP? I can run the program okay and get the message
prompting for the filename e.g.
$command = exec ( "fextrap.exe"); // $command = "LIST FILENAME :"
What I can't do however is figure out how to pass it the filename
*after* I have called the program. I thought that maybe a second call to
exec passing in the filename instead of an actual command might work,
but perhaps I was a little naive.
Does anyone have any ideas? I'm stumped.
Thanks!
- Best regards,
Lee
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
I should have mentioned that. I'm actually doing it the way you mentioned for a
few programs, but the one I'm having problems with was written in Fortran in the
80s. I don't think the author ever saw a need to support that. I do have the
source code for it, but I'd rather find a solution in PHP than do a Fortran
hack.
attached mail follows:
On Friday 02 May 2003 00:19, Lee P. Reilly wrote:
> I should have mentioned that. I'm actually doing it the way you mentioned
> for a few programs, but the one I'm having problems with was written in
> Fortran in the 80s. I don't think the author ever saw a need to support
> that. I do have the source code for it, but I'd rather find a solution in
> PHP than do a Fortran hack.
I think you've got it mixed up. Fixing the fortran program to accept the
filename from the command line is preferable to hacking something in PHP.
You can try something like:
exec("echo 'filename' | fextrap.exe");
--
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
------------------------------------------
/*
A writer is congenitally unable to tell the truth and that is why we call
what he writes fiction.
-- William Faulkner
*/
attached mail follows:
Say an application, using sessions, has a "logout" button which destroys the
session data. Say, also, that a user clicks that button, but then logs back
into the site without first closing their browser. Under these
circumstances, the session cookie and ID from their previous session will
get re-used for their new session. Is there any harm in this, from a
security viewpoint, or otherwise?
TIA
Kirk
attached mail follows:
It all depends on the session info saved on the server. But if you destroy
the session data using session_destroy() then the next time the script
starts with session_start(), it should issue a new session ID. Are you sure
it gives the same session ID? if it does do this, for the script that
terminates the session,
<?php
session_start();
session_destroy();
session_start(); # This will create a new session ID
session_destroy();
# instead of session_destroy(); I use this
# setcookie(session_name(),"","","/");
?>
"Kirk Johnson" <kjohnson
zootweb.com> wrote in message
news:B11731D518B5D61183C700A0C98BE0D9FFC023
chef...
> Say an application, using sessions, has a "logout" button which destroys
the
> session data. Say, also, that a user clicks that button, but then logs
back
> into the site without first closing their browser. Under these
> circumstances, the session cookie and ID from their previous session will
> get re-used for their new session. Is there any harm in this, from a
> security viewpoint, or otherwise?
>
> TIA
>
> Kirk
>
attached mail follows:
Yes, the session ID is re-used, and a new, empty session file with the same
name is created. I believe session_start() will only result in a new session
ID being issued if the client didn't submit a cookie with an ID. In the
hypothetical example I gave, the client will send the cookie with an ID,
since a session cookie persists for the life of the browser instance.
> -----Original Message-----
> From: Bobby Patel [mailto:anup_patel
rogers.com]
> Sent: Thursday, May 01, 2003 10:49 AM
> To: php-general
lists.php.net
> Subject: [PHP] Re: session_destroy() but re-use session ID: security
> risk?
>
>
> It all depends on the session info saved on the server. But
> if you destroy
> the session data using session_destroy() then the next time the script
> starts with session_start(), it should issue a new session
> ID. Are you sure
> it gives the same session ID? if it does do this, for the script that
> terminates the session,
> <?php
> session_start();
> session_destroy();
> session_start(); # This will create a new session ID
> session_destroy();
> # instead of session_destroy(); I use this
> # setcookie(session_name(),"","","/");
> ?>
>
>
>
>
> "Kirk Johnson" <kjohnson
zootweb.com> wrote in message
> news:B11731D518B5D61183C700A0C98BE0D9FFC023
chef...
> > Say an application, using sessions, has a "logout" button
> which destroys
> the
> > session data. Say, also, that a user clicks that button,
> but then logs
> back
> > into the site without first closing their browser. Under these
> > circumstances, the session cookie and ID from their
> previous session will
> > get re-used for their new session. Is there any harm in this, from a
> > security viewpoint, or otherwise?
> >
> > TIA
> >
> > Kirk
attached mail follows:
> Yes, the session ID is re-used, and a new, empty session file with the
> same
> name is created. I believe session_start() will only result in a new
> session
> ID being issued if the client didn't submit a cookie with an ID. In
the
> hypothetical example I gave, the client will send the cookie with an
ID,
> since a session cookie persists for the life of the browser instance.
The only security risk I see is that you're letting the user supply
their own session ID when they log in. You may be vulnerable to a
"session fixation" attack. You're basically letting the user define
their own session ID. A malicious user could create a URL link to a user
to log into your site, supplying the session ID in the URL, thus
simplifying the hijacking of that user's session once they log in (since
they already know the session id). You can use md5() and uniqid() and
session_id() to create your own session ids when users log in.
As for the general idea of keeping the same session id after a user logs
out, I don't see any issues as long as you're sure the data is wiped.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
attached mail follows:
having attempted to implement this using the code here
http://www.zend.com/codex.php?id=1126&single=1
I am somewhat stumped, I can follow the logic in their code easily. I have
changed the php.ini file to reflect the following
session.save_handler = user
I have also restarted the web server to take notice of these changes. I don't
however, get any session information stored in my db. I have checked sql
permissions, etc and they are all sane. Is there anything else I should be
aware of when trying to use a db for storing php sessions.
Rob
>
> You'll be using this function:
>
> http://www.php.net/manual/en/function.session-set-save-handler.php
>
> You should find some examples there. Searching for tutorials on your
> subject with Google should yield some more results.
>
> ---John W. Holmes...
>
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
attached mail follows:
At , Orlando Pozo wrote:
> I think that PHP have libraries to translate one language into another,
> if you have information about it, please, give me a hand, thanks, bye.
Please don't use different headers for the same question.
PHPClasses has a few tools available, although I haven't tested them and
can't vouch for how well they work.
http://www.phpclasses.org/browse.html/class/5.html
--
S. Keller
UI Engineer
The Health TV Channel, Inc.
(a non - profit organization)
3820 Lake Otis Pkwy.
Anchorage, AK 99508
907.770.6200 ext.220
907.336.6205 (fax)
Email: skeller
healthtvchannel.org
Web: www.healthtvchannel.org
attached mail follows:
Hi all,
I have purchased a set of PHP scripts that build a classified ad website.
They include various functions, two of which create navigation bars.
Everything works fine within the application, however, I have implemented a
home page that is external to the application and would like to include these
navigation bars within that home page.
I know the function names that generate the navigation bars and I know the
file where they reside. Is it possible for me to call those two functions
specifically? If so, what is the syntax?
The bulk of the home page is in HTML. I have designated a table row in which
I intend to place the PHP code that will call the remote functions.
Another twist to this is that the navigation bars dynamically change based
on data in a cookie (logged in/logged out). There is a file that is
responsible for managing these cookies. Is handling this as simple as
including that file?
Can anyone help me with this?
Thanks!
Chris
----------------------------------------------------------------
This message was sent from Wakeboarder.com Free E-mail.
For wakeboarding information visit http://www.wakeboarder.com.
attached mail follows:
Hi Guys,
I would like to create a gallery script. Uploading of image part i can
take care of. Now what i m concerned is that
the User can set the image size say 50x50 for display and when they click on
it it shows the full image. Now this
50x50 image must keep the aspect ratio otherwise it will look distorted. Are
their any script out there which
already does this job. Which i can make use of.
Have a great day.
Karthikeyan B
attached mail follows:
On Friday 02 May 2003 01:01, karthikeyan.balasubramanian wrote:
> I would like to create a gallery script. Uploading of image part i can
> take care of. Now what i m concerned is that
> the User can set the image size say 50x50 for display and when they click
> on it it shows the full image. Now this
> 50x50 image must keep the aspect ratio otherwise it will look distorted.
> Are their any script out there which
> already does this job. Which i can make use of.
Take a look at:
freshmeat.net
sourceforge.net
www.phpclasses.org
www.zend.com
--
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
------------------------------------------
/*
Stop searching. Happiness is right next to you. Now, if they'd only
take a bath ...
*/
attached mail follows:
Hello all,
I am trying to make a small timer status indicator. the code looks up a
file to see if the entry is correct. In order to show the user that
some processing is being, I want to show a small timer as described
below:
Checking Passport Code . (wait 1 sec and display '.') . (wait 1 sec
and display '.') .. and so on.
This is the code that I came up with and something does not seem to be
working fine. All it does is to wait for some time and display the
entire line. I want it to display the text and a '.' and wait for 1 sec
and display another '.' and so on.
<?
echo "Checking passport code";
for ($i =0; $i < 4; $i++)
{
echo " . ";
sleep(1);
}
?>
Thanks in advance.
--Pushpinder
attached mail follows:
On Friday 02 May 2003 02:35, Pushpinder Singh Garcha wrote:
> I am trying to make a small timer status indicator. the code looks up a
> file to see if the entry is correct. In order to show the user that
> some processing is being, I want to show a small timer as described
> below:
>
> Checking Passport Code . (wait 1 sec and display '.') . (wait 1 sec
> and display '.') .. and so on.
>
>
> This is the code that I came up with and something does not seem to be
> working fine. All it does is to wait for some time and display the
> entire line. I want it to display the text and a '.' and wait for 1 sec
> and display another '.' and so on.
>
> <?
>
> echo "Checking passport code";
>
> for ($i =0; $i < 4; $i++)
>
> {
> echo " . ";
> sleep(1);
> }
>
> ?>
The short answer is that you need to use flush(). The better solution is to
search the archives "progress page" or "progress indicator" or "process page"
or something along those lines.
--
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
------------------------------------------
/*
Ahead warp factor one, Mr. Sulu.
*/
attached mail follows:
On Thursday 01 May 2003 21:37, Michael Timinger wrote:
> I am running a form, containing a checkbox item: val_all
> I sent the intem via POST and get the value by:
> $v01=$_POST["val_all"];
> If the checkbox is empty, the following error message occurs:
> Undefined Index: val_all
> Whats going wrong?
Nothing is going wrong. That is the normal behaviour -- if a checkbox is not
checked then it will not appear in $_POST (or $_GET).
--
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
------------------------------------------
/*
Let your conscience be your guide.
-- Pope
*/
attached mail follows:
I've got a web app that uses include() extensively - like a substitute
for function calls. I learned this style of modular, file-based
programming from Lasso, then converted to PHP. I like the fact that
includes automatically both inherit and bequeath variables;
Anyway, this web app I wrote ( a registration system for sporting
events ) is having problems. Sometimes the code execution just dies,
and it always dies around the borders of the include() statements. It
is an intermittent problem - I've got 10 cases of code execution dying
out of about 800 accesses. It only happens when feeding the pages via
SSL, and it seems to only happen when the server is handling several
registrations at the same time.
Is there a problem with Includes where the included file is subject to
some type of 1-at-a-time access limitations? The most common 'death'
I've got is a little include that sends the HTML to draw some tab-like
stuff. It gets called 7 times for each access, so if there are several
people using the system at the same time, then the file is likely to
get called almost simultaneously from more than one user.
This is driving me nuts. Any suggestions?
-Derrick
attached mail follows:
On Thu, 1 May 2003, Derrick Fogle wrote:
> I've got a web app that uses include() extensively - like a substitute
> for function calls. I learned this style of modular, file-based
> programming from Lasso, then converted to PHP. I like the fact that
> includes automatically both inherit and bequeath variables;
This is amazingly inefficient. If you care in any way about performance
you'd change to proper function calls.
-Rasmus
attached mail follows:
On Thursday 01 May 2003 08:43, Bob Irwin wrote:
> Oops forgot to change the subject.
You have started a new thread by taking an existing posting and replying to
it while you changed the subject.
That is bad, because it breaks threading. Whenever you reply to a message,
your mail client generates a "References:" header that tells all recipients
which posting(s) your posting refers to. A mail client uses this information
to build a threaded view ("tree view") of the postings.
With your posting style you successfully torpedoed this useful feature; your
posting shows up within an existing thread it has nothing to do with.
Always do a fresh post when you want to start a new thread. To achieve this,
click on "New message" instead of "Reply" within your mail client, and enter
the list address as the recipient. You can save the list address in your
address book for convenience.
--
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
------------------------------------------
/*
Wiker's Law:
Government expands to absorb revenue and then some.
*/
attached mail follows:
On Thursday 01 May 2003 00:58, Merlin wrote:
> I would like to check for an error in the php error log.
>
> PHPinfo says that error log is called: error_log_php
> end loging is on.
>
> I cant locate this file on the server. Can anybody give me hint on this?
Try explicitly setting this in php.ini to somewhere your filesystem which is
writeable by the webserver and restart webserver. Then you'll know exactly
where it is.
--
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
------------------------------------------
/*
Love your enemies: they'll go crazy trying to figure out what you're up to.
*/
attached mail follows:
I dont understant what happen.
I have an associative array that when print_r($passeport) give :
Array
(
['d_lng'] =>
['login'] => ddev
['password'] => da33ve79
['password2'] => da33ve79
...
)
But when trying to print elements :
**<br>**<br>
with
echo "*".$passeport['login']."*<br>";
echo "*".$passeport[login]."*<br>";
The array was set with :
//$passeport_post the array that was posted with the help of a form
setcookie("passeport_cookie",base64_encode(gzcompress(serialize($passeport_p
ost))),(time()+3600)*24*365,"/",".ndd.com");
And was retrive with :
$passeport = GetPasseport() ;
function GetPasseport() {
global $passeport_id,$passeport_cookie ;
if (!empty($passeport_cookie))
$passeport=unserialize(gzuncompress(base64_decode($passeport_cookie)));
return $passeport;
}
$passeport_cookie=
"eJx1kdtugzAQRP+FF17r0ITE/Ri0whtkyRfqNaRp1X+vjYrkS3gCzRl7Zz3AT1f+Q7znTSsGZaa
2+SD+xpv4iaKykzSb+M4bIXCNvywY2hmIHtaJDV4DhK5bsb9tBpYYToeOu3TkDWhMp14CKLWYBDV
IVRo9KpZq56BNpFPpFiQQwiFRKm87KLniKP2z9Ef9W86Zn/3r5MFn4Vi332QX4112GYuBNJlBh/F
oJnQVBate0wjl+JkdCCW0o9UzmOdQPhK7JDCmXKiKuePFqUN2h68q5M6qErKToY2M9Ql7VUG6TVl
DdnHZxbnYFA/HVp38/gHJNtu0";
You can test with that snippet :
<?php
$passeport_cookie2=
"eJx1kdtugzAQRP+FF17r0ITE/Ri0whtkyRfqNaRp1X+vjYrkS3gCzRl7Zz3AT1f+Q7znTSsGZaa
2+SD+xpv4iaKykzSb+M4bIXCNvywY2hmIHtaJDV4DhK5bsb9tBpYYToeOu3TkDWhMp14CKLWYBDV
IVRo9KpZq56BNpFPpFiQQwiFRKm87KLniKP2z9Ef9W86Zn/3r5MFn4Vi332QX4112GYuBNJlBh/F
oJnQVBate0wjl+JkdCCW0o9UzmOdQPhK7JDCmXKiKuePFqUN2h68q5M6qErKToY2M9Ql7VUG6TVl
DdnHZxbnYFA/HVp38/gHJNtu0";
$passeport = GetPasseport() ;
function GetPasseport() {
global $passeport_id,$passeport_cookie2 ;
$passeport=unserialize(gzuncompress(base64_decode($passeport_cookie2)));
return $passeport;
}
echo "*".$passeport['login']."*<br>";
echo "*".$passeport[login]."*<br>";
print_r($passeport);
// strange ?:(
// I m fed up
?>
Thanks.
attached mail follows:
You don't necessarily need JavaScript for this:
<?
if (isset($_GET) && array_key_exists("s", $_GET))
$MODE = "expanded";
else
$MODE = "normal";
// ...
if ($MODE == "normal")
{
?>
<form name="form" action="<?= $_SERVER["SCRIPT_NAME"]; ?>" method="get">
<select name="s">
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
<input type="submit" value="Continue" />
</form>
<?
}
else if ($MODE == "expanded")
{
?>
<form name="form" action="nextpage.php" method="get">
<select name="s">
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
<input type="text" name="foo" value="Now fill me out!" />
<input type="submit value="Next Page" />
</form>
<?
}
?>
Of course, if you want to have the dropdown selection automatically
resubmit the page, without the user having to click "Continue", then
you'll have to use JavaScript.
Cheers,
Morgan
On Thursday, May 1, 2003, at 07:59 AM, Gavin Nouwens wrote:
> www.google.com
>
> Search: javascript drop down menu
>
> Not a PHP thing at all!
>
> -gav.
>
> | -----Original Message-----
> | From: bob pilly [mailto:bobpilly
yahoo.co.uk]
> | Sent: Friday, 2 May 2003 12:54 AM
> | To: php-general
lists.php.net
> | Subject: [PHP] Getting variables before the submit button is hit
> |
> |
> | Hello all
> |
> | I have a drop down list in html that consists of two
> | choices:
> |
> | yes
> | no
> |
> | Thie result of choosing either is assigned to a
> | variable that is available to the next php page using
> | $_GET once the 'submit' button is hit. Is there anyway
> | to get this value on the same page before the submit
> | button is hit? Im wanting to expand the page and offer
> | the user more options if they choose 'yes' from the
> | drop down menu.
> |
> | Thanks for any help in advance.
> |
> | __________________________________________________
> | Yahoo! Plus
> | For a better Internet experience
> | http://www.yahoo.co.uk/btoffer
> |
> | --
> | PHP General Mailing List (http://www.php.net/)
> | To unsubscribe, visit: http://www.php.net/unsub.php
> |
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
I'm having a problem using snmpset() on Linux. I'm getting the
following error message: PHP Warning: snmpset()
[http://www.php.net/function.snmpset]: Could not add variable
All other snmp functions work just fine. I saw in the user contributed
documentation that this could be due to an invalid or unknown OID, or
if using a fully qualified numeric OID that it doesn't begin with a
".". However, as you can see below, I'm using a fully qualified
numeric OID that does begin with a "." and it's a vaild OID as I can
snmpget() it without any problems.
If anyone has any ideas I'd greatly appreciate it. I really need
snmpset for a project I'm working on.
Please also reply to postings
ronnoco.net
Regards,
Lance O'Connor
This is the code I'm using:
<?
$name = ".1.3.6.1.4.1.9.2.2.1.1.28.5";
$host = "10.100.230.14";
$comm = "123456789";
// Get the current port name
if(!$test = snmpget($host, $comm, $name))
{
echo "Error getting snmp info\n";
}
else
{
echo "Port Name: $test\n";
}
// Set the name to phptest
if(!snmpset($host, $comm, $name, "s", "phptest"))
{
echo "Error setting snmp info\n";
}
else
{
echo "Portname set\n";
}
?>
Syntax Check:
root
nutter:~/scratch# php -l snmp1.php
No syntax errors detected in snmp1.php
Output:
root
nutter:~/scratch# php snmp1.php
PHP Warning: snmpset() [http://www.php.net/function.snmpset]: Could
not add variable: in /root/scratch/snmp1.php on line 17
Port Name: STRING: "settest"
Error setting snmp info
Compiled in Modules:
root
nutter:~/scratch# php -m
[PHP Modules]
ctype
ftp
ldap
mysql
openssl
overload
pcre
pgsql
posix
session
snmp
standard
tokenizer
xml
yp
Version Information (from php -i)
PHP Version => 4.3.1
System => Linux nutter 2.4.20 #3 SMP Fri Feb 28 11:01:15 PST 2003 i686
Build Date => Apr 30 2003 14:35:28
Configure Command => './configure' '--with-apache=../apache_1.3.27'
'--with-mysql=/usr/local' '--
with-pgsql=/usr/local/pgsql' '--with-snmp' '--enable-ucd-snmp-hack'
'--with-ldap' '--with-openssl'
'--enable-yp' '--enable-ftp'
snmp
NET-SNMP Support => enabled
NET-SNMP Version => 5.0.7
attached mail follows:
I'm relaying some email messages via mail(). Whenever the body contains a .gif attachment the attachment is unreadable at the other end. I know that mail() inserts exclamation points into text after 1024 characters without a hard break and I've added "\n" to text to solve that. But, that won't work in an image. Has anyone solved this or found a workaround? Thanks,Jeff
---------------------------------
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
attached mail follows:
------------------------------------------------
PLEASE RESPOND VIA BOTH THE LIST AND cc'ing ME,
thanks in advance.
------------------------------------------------
I've got a hosting provider who is switching me to an Ensim run site.
The previous one was monster controls.
I have another site on another host that also uses Ensim.
The new one going to Ensim can't seem to give me the true harddrive location of my root account so that I can put the DB passwords and classes files, etc, outside of the document root.
He is suggesting that I put those in the cgi directory, which resolves to the document root location:
http://www.thesite.tld/cgi-bin/
He says this will be safe for those files. I wonder about this. What is the access capability of a browser to *.php files in a cgi directory?
On my other Ensim powered site with a different host, he gave me the account directory no problem.
attached mail follows:
Dennis,
I am not the foremost authority on security, but it is NOT secure to put
them there. If its in the doc root, it can be had...
-Dan Joseph
> -----Original Message-----
> From: Dennis Gearon [mailto:gearond
cvc.net]
> Sent: Thursday, May 01, 2003 4:49 PM
> To: php-general
lists.php.net
> Subject: [PHP] location of scripts with DB passwords
>
>
> ------------------------------------------------
> PLEASE RESPOND VIA BOTH THE LIST AND cc'ing ME,
> thanks in advance.
> ------------------------------------------------
> I've got a hosting provider who is switching me to an Ensim run site.
>
> The previous one was monster controls.
>
> I have another site on another host that also uses Ensim.
>
> The new one going to Ensim can't seem to give me the true
> harddrive location of my root account so that I can put the DB
> passwords and classes files, etc, outside of the document root.
>
> He is suggesting that I put those in the cgi directory, which
> resolves to the document root location:
>
> http://www.thesite.tld/cgi-bin/
>
> He says this will be safe for those files. I wonder about this.
> What is the access capability of a browser to *.php files in a
> cgi directory?
>
> On my other Ensim powered site with a different host, he gave me
> the account directory no problem.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
> I've got a hosting provider who is switching me to an Ensim run site.
>
> The previous one was monster controls.
>
> I have another site on another host that also uses Ensim.
>
> The new one going to Ensim can't seem to give me the true harddrive
> location of my root account so that I can put the DB passwords and
classes
> files, etc, outside of the document root.
I worked on an ensim server once and this was a pain. The path shown
when you were logged in through SSH was only a part of the path. The
upper directories were masked somehow. The only way I was able to find
out the "real" path on the machine was to make a PHP script with an
error in it. The error message would give you the actual path to the
file. Hope that helps.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
attached mail follows:
Anyone know of good tutorials on how to use just one php template page to
run a site. In other words using one index.php page that rewites itself with
each click on a link. Make sense? I have seen them before, just can't
remember the links.
Thanks in advance,
Ron Clark
attached mail follows:
On Thu, 1 May 2003, Ron Clark wrote:
> Anyone know of good tutorials on how to use just one php template page to
> run a site. In other words using one index.php page that rewites itself with
> each click on a link. Make sense? I have seen them before, just can't
> remember the links.
There isn't any big trick to that. You simply write an index.php script
with a big switch($state) statement in it and pass your state from one
request to the next. The current state will then determine what the
script displays.
-Rasmus
attached mail follows:
Hi,
I have been asked to create a system so that a folder on a web server will
contain files and users can check them out, edit them and then check them
back in, obviously whilst a file is checked out, it can't be edited. Is this
possible with PHP, if so I would be very grateful for some advice on how to
tackle this problem.
Thanks for your help
attached mail follows:
> I have been asked to create a system so that a folder on a web server
will
> contain files and users can check them out, edit them and then check
them
> back in, obviously whilst a file is checked out, it can't be edited.
Is
> this
> possible with PHP, if so I would be very grateful for some advice on
how
> to
> tackle this problem.
Just keep track in a file or database when a file is checked out. When a
user "chooses" a file, save its name somewhere. When another user
chooses that file now, check and see if it's in your "list". If it is,
tell them it's checked out, otherwise check it out for them.
Be sure to implement a "timeout" feature so files cannot stay checked
out indefinitely (unless you want that).
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
attached mail follows:
I don't know the circumstances but CVS is brilliant. Versioning, rollback,
logging and so much more.
Tortoise CVS linked built into windows explorer is great
"Shaun" <shaun
mania.plus.com> wrote in message
news:20030501205925.66323.qmail
pb1.pair.com...
> Hi,
>
> I have been asked to create a system so that a folder on a web server will
> contain files and users can check them out, edit them and then check them
> back in, obviously whilst a file is checked out, it can't be edited. Is
this
> possible with PHP, if so I would be very grateful for some advice on how
to
> tackle this problem.
>
> Thanks for your help
>
>
attached mail follows:
I've done a parse_ini_file() like this: $_CUSTOMIZE = parse_ini_file("...");
so that I can refer to things like $_CUSTOMIZE["databasename"] and such. Anyway, when I have to globalize these in functions, like
function TableExists($tablename) {
global $_CUSTOMIZE["databasename"];
.
.
.
}
anyway, the global line causes a parse error. Does anyone have an option for me?
attached mail follows:
On Thu, 1 May 2003, Liam Gibbs wrote:
> function TableExists($tablename) {
> global $_CUSTOMIZE["databasename"];
> .
> .
> .
> }
>
> anyway, the global line causes a parse error. Does anyone have an option for me?
You can't make elements of an array global. You have to make the entire
array global.
eg.
function() {
global $_CUSTOMIZE;
..
}
-Rasmus
attached mail follows:
> I've done a parse_ini_file() like this: $_CUSTOMIZE =
> parse_ini_file("...");
>
> so that I can refer to things like $_CUSTOMIZE["databasename"] and
such.
> Anyway, when I have to globalize these in functions, like
>
> function TableExists($tablename) {
> global $_CUSTOMIZE["databasename"];
global $_CUSTOMIZE;
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
attached mail follows:
> global $_CUSTOMIZE;
Ah, stupid me. One of those it-takes-another-pair-of-eyes problems (I hope).
Thanks, John and Rasmus. Works fine now.
attached mail follows:
Hi
Okay... I am out of my depth and confused and would appreciate some help to push me in the right direction.
I have 3 tables in MYSQL:
"users" - contains users email address and the press release categories that they wish to hear about (in usr_4).
"releases" - contains press releases with a datstamp in (Ymd) format and presscatid
categories - which has all the press release categories and presscatid
What I want to do is send all users that have asked to receive daily updates of chosen categories the title, first 150 characters and the link back to the release, an email of the preferences that they have chosen (eg Food, Transport etc), if there is a new release in that category.
I have so far managed to get the releases with a datestamp of $today and send it to my email address (hardcoded in the script)
I can not work out how to get the script to step through all the press release categories on by one and which logic is needed. Do I select the cateorgies and start that end or do I select the users and the work through the categories that they have requested to hear about?
Many thanks
James
attached mail follows:
On Fri, 2 May 2003 00:24:34 +0100, you wrote:
>Okay... I am out of my depth and confused and would appreciate some help to push me in the right direction.
>
>I have 3 tables in MYSQL:
>"users" - contains users email address and the press release categories that they wish to hear about (in usr_4).
>"releases" - contains press releases with a datstamp in (Ymd) format and presscatid
>categories - which has all the press release categories and presscatid
>
>What I want to do is send all users that have asked to receive daily updates of chosen categories the title, first 150 characters and the link back to the release, an email of the preferences that they have chosen (eg Food, Transport etc), if there is a new release in that category.
>
>I have so far managed to get the releases with a datestamp of $today and send it to my email address (hardcoded in the script)
>
>I can not work out how to get the script to step through all the press release categories on by one and which logic is needed. Do I select the cateorgies and start that end or do I select the users and the work through the categories that they have requested to hear about?
What's "usr_4"?
Ok, if it's not too late I suggest normalising your database so the join
between (user and category) is in a separate table, because it's a
many-to-many relationship.
Something like this:
user
userid // primary key
email // email address
category
categoryid // primary key
description // "food", "transport", etc
usercategory
userid // primary key = (userid | categoryid)
categoryid
release
releaseid // primary key
categoryid // foreign key to category
releasedate // date of release
releasetext // body of release
[If you decide that a single press release can be in multiple
categories, you should create a similar joining table between category
and release].
Now, the SELECT is pretty simple:
SELECT email, description, releasetext
FROM user, release, category, usercategory
WHERE usercategory.userid = user.userid
AND category.categoryid = usercategory.categoryid
AND release.categoryid = category.categoryid
AND releasedate = $today
ORDER BY emailaddress, description
Untested, but should be ok - I'm not about to build a db just to test it
:)
This should returns rows like this :
emailaddress1, food, releasetextA
emailaddress1, food, releasetextB
emailaddress1, transport, releasetextD
emailaddress2, food, releasetextB
emailaddress2, transport, releasetextC
emailaddress2, transport, releasetextD
emailaddress3, food, releasetextA
emailaddress3, transport, releasetextC
emailaddress3, transport, releasetextD
At which point, it's simple to bundle the releases up into single emails
for each user.
If things get really high-volume, you might want to group emails with
identical category choices together, and bcc: the same email to groups
of people. But that is a little more difficult.
Hmm... oh yeah. That was a MySQL question, not PHP.
attached mail follows:
Problem solved!
Thanks John
"John W. Holmes" <holmes072000
charter.net> wrote in message
news:005e01c30fe5$0c4b1340$7c02a8c0
coconut...
> > I am using a function mofied from an earlier post to check whether a
> given
> > date is valid and does not occur in the past, however when i try to
> use
> > the
> > function with:
> >
> > if(futureDate($_POST[booking_date]) == 'weekend'){
> > echo 'date is a weekend'
> > }
> >
> > and the function is returning zero, it still enters the loop and
> prints
> > 'date is a weekend'
> >
> > I would be grateful for your help as this doesn't make sense to me!
> >
> > Date checking function:
> >
> > function futureDate($timestamp){
> > $error = 0;
>
> Type juggling. Since the function is returning an integer, PHP is going
> to convert 'weekend' to an integer and compare them. A string like
> 'weekend' will be converted to zero, so the two will end up matching.
>
> Have your function return an empty string as the default error.
>
> $error = '';
>
> ---John W. Holmes...
>
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
>
>
attached mail follows:
Well, this question has been asked many times over the years in the
archives, but I didn't see any answer. Does anyone know the cause of this
error: "Session object destruction failed"?
The error is not caused by not starting a session, or, the session timing
out, before calling session_destroy(); the error message in those cases is
"Trying to destroy uninitialized session".
Here is the PHP source code where the message is generated.
if (PS(mod)->destroy(&PS(mod_data), PS(id)) == FAILURE) {
retval = FAILURE;
php_error(E_WARNING, "Session object destruction failed");
}
Any help appreciated!
Kirk
attached mail follows:
Hello All,
I am using a Session based Login Module on my site. I register a
session called 'valid_user' on successful login. If another script on
the same site, dealing with another database registers a session using
the same name, what are the results?
Is it possible? Thanks in advance.
--Pushpinder
attached mail follows:
> I am using a Session based Login Module on my site. I register a
> session called 'valid_user' on successful login. If another script on
> the same site, dealing with another database registers a session using
> the same name, what are the results?
>
> Is it possible? Thanks in advance.
Sure it is, if I understand you correctly. If you set
$_SESSION['valid_user'] and then another part of your script/site tries
to set that again for the same user, the second value will just
overwrite the first. It's just a variable...
How that affects your script depends upon your actual code, though.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
attached mail follows:
Hi,
I have a file called messages.php
In messages .php I have $demo_wrong="Demo feature has been turned off";
I have a
require 'messages.php';
in file MainPHP.php and this:
if($allow_demo=="N")
{
if($demo=="Y")
{
echo '$demo_wrong';
exit;
}
}
but when i execute the program everything works fine except i get the output
:
$demo_wrong
instead of :
Demo feature has been turned off
What am I doing wrong?
Kindly reply,
-Ryan
attached mail follows:
On Thu, 2003-05-01 at 18:44, Ryan A wrote:
> Hi,
> I have a file called messages.php
> In messages .php I have $demo_wrong="Demo feature has been turned off";
>
> I have a
> require 'messages.php';
> in file MainPHP.php and this:
>
> if($allow_demo=="N")
> {
> if($demo=="Y")
> {
> echo '$demo_wrong';
> exit;
> }
> }
>
> but when i execute the program everything works fine except i get the output
> :
>
> $demo_wrong
>
> instead of :
>
> Demo feature has been turned off
>
>
>
> What am I doing wrong?
>
echo $demo_wrong;
attached mail follows:
> echo '$demo_wrong';
Read the manual section on strings:
http://us2.php.net/types.string
Especially the part about single quotes.
Regards,
Philip
attached mail follows:
At 5/2/2003 12:44 AM, Ryan A wrote:
> echo '$demo_wrong';
You can't echo a variable inside of single quotes.
--
S. Keller
UI Engineer
The Health TV Channel, Inc.
(a non - profit organization)
3820 Lake Otis Pkwy.
Anchorage, AK 99508
907.770.6200 ext.220
907.336.6205 (fax)
Email: skeller
healthtvchannel.org
Web: www.healthtvchannel.org
attached mail follows:
Hi,
I have php version 4.2.2-8.0.7 from my standard RH Linux 8 release,
kernel-2.4.18-27.8.0. I just read in the php change log at
http://www.php.net/ChangeLog-4.php that there was a segmentation fault bug
#20108 -
http://bugs.php.net/bug.php?id=20108 that was corrected in v 4.3 Does
anyone know if this bug is also in my 4.2.2-8.0.7 version I am getting ready
to run now?
I ask because about two weeks ago my entire server crashed due to a
segmentation fault problem, I could not log on as root, had to re partition
the whole system and start from scratch.
Not sure if it was PHP related; I want to make sure before I start running
scripts again that I'm not creating another problem for myself. Is
php-4.2.2-8.0.7 stable/bug free or should I upgrade to Version 4.3.1?
Thanks for any advice!
DB
attached mail follows:
Hi,
Friday, May 2, 2003, 9:05:15 AM, you wrote:
D> Hi,
D> I have php version 4.2.2-8.0.7 from my standard RH Linux 8 release,
D> kernel-2.4.18-27.8.0. I just read in the php change log at
D> http://www.php.net/ChangeLog-4.php that there was a segmentation fault bug
D> #20108 -
D> http://bugs.php.net/bug.php?id=20108 that was corrected in v 4.3 Does
D> anyone know if this bug is also in my 4.2.2-8.0.7 version I am getting ready
D> to run now?
D> I ask because about two weeks ago my entire server crashed due to a
D> segmentation fault problem, I could not log on as root, had to re partition
D> the whole system and start from scratch.
D> Not sure if it was PHP related; I want to make sure before I start running
D> scripts again that I'm not creating another problem for myself. Is
D> php-4.2.2-8.0.7 stable/bug free or should I upgrade to Version 4.3.1?
D> Thanks for any advice!
D> DB
For a seg fault to cause a system crash the problem would most likly
be in your main memory, it would be very rare for a script to bring a
complete server to it's knees.
I have done some some C coding trying to make php modules and seg faults
were the order of the day but never brought the server down (nor apache
for that matter)so your php is probably ok to use.
--
regards,
Tom
attached mail follows:
Hey....
A quick question.... I'm creating a quick/dirty dropdown menu... The menu
will allow the user to select the number of items that are to be displayed
on a given page. At the bottom of the page will be the usual
first/prev/next/last links as well as the ability to select individual pages
for the items listed. The item list will be dynamically generated from a
mysql query.
I'd like the menu to look like:
Drop Down Menu
xxxx
-------------
50
100
200
.
.
.
A rough sample page would be
+-----------------------------------------------+
| | |
|
| |
| |
| |
| |
| |
+-----------------------------------------------+
I'd like the user to be able to
-----Original Message-----
From: Brian V Bonini [mailto:b-bonini
cox.net]
Sent: Thursday, May 01, 2003 3:55 PM
To: Ryan A
Cc: PHP Lists
Subject: Re: [PHP] echo problem
On Thu, 2003-05-01 at 18:44, Ryan A wrote:
> Hi,
> I have a file called messages.php
> In messages .php I have $demo_wrong="Demo feature has been turned off";
>
> I have a
> require 'messages.php';
> in file MainPHP.php and this:
>
> if($allow_demo=="N")
> {
> if($demo=="Y")
> {
> echo '$demo_wrong';
> exit;
> }
> }
>
> but when i execute the program everything works fine except i get the
output
> :
>
> $demo_wrong
>
> instead of :
>
> Demo feature has been turned off
>
>
>
> What am I doing wrong?
>
echo $demo_wrong;
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
At 5/1/2003 04:03 PM, Bruce Douglas wrote:
> A quick question.... I'm creating a quick/dirty dropdown menu...
Please don't reply to existing threads with new questions. Start a new topic.
--
S. Keller
UI Engineer
The Health TV Channel, Inc.
(a non - profit organization)
3820 Lake Otis Pkwy.
Anchorage, AK 99508
907.770.6200 ext.220
907.336.6205 (fax)
Email: skeller
healthtvchannel.org
Web: www.healthtvchannel.org
attached mail follows:
Hey....
A quick question.... I'm creating a quick/dirty dropdown menu... The menu
will allow the user to select the number of items/(per page) that are to be
displayed on a given page. At the bottom of the page will be the usual
first/prev/next/last links as well as the ability to select individual pages
for the items listed. The item list will be dynamically generated from a
mysql query.
I'd like the menu to look like:
Drop Down Menu
xxxx
-------------
50
100
200
.
.
.
A rough sample page would be
+-----------------------------------------------+
| menu |
| |
| |
| item 1 |
| item 2 |
| item 3 |
| item 4 |
| . |
| . |
| . |
| . |
| . |
| item n |
| |
| |
| |
| first prev next last |
| 1 2 3..... |
| |
+-----------------------------------------------+
So if there were 300 items and the user selected 100 from the menu...The
firts page would display 100 items, the 2nd the next 100 etc.... The user
would be able to select from the first/prev/next/last links, as well as go
directly to the specific page as needed by slecting on the number.
I'd also like to be able to display the following numbers at the bottome
depending on how many pages would be displayed based on the number of items
to be displayed.....
less than 5 pages
1 2 3 4 5
less than 10 pages
1 2 3 4 5 6 7 10
less than 20 pages
1 2 3 4 5 6 7 10 15 20
or something resembling this!!!
I'm asking.. as I've done a quick look on google, and I didn't see anything
that was close... I know it's not that difficult.. but I'd rather not
reinvent the wheel..there's way too much of that being done.....
Any code/samples would be appreciated as I'm on a tight schedule.....
Thanks!!!!
Bruce
bedouglas
earthlink.net
attached mail follows:
Background info:
Running PHP 4.1.2 with Apache 1.3.27 on Redhat 7.3. These are the latest
errata updates for this OS from RedHat.
I am working on a redirect script that sends the client a "Location"
header via the header() function. This script needs to stay alive and do
additional work after the header is sent (database work, log crunching,
etc).
Basically, the code looks like:
<?php
header("Location: http://remote.site/url");
## Do my intensive work here...
...
...
?>
The problem is that the header will not be sent until the entire script
has finished.
Mr. John W. Holmes (love that name btw ;) mentioned that I should use the
register_shutdown_function() function to accomplish this. However, after
doing some research along with my own testing, it seems that this function
will still keep the connection open until the entire script is finished, thus
making the redirect "slow".
I found another possible solution that looks like:
<?
set_time_limit(0); // Make sure there is no limit
ob_start(); // Start output buffering
header("Location: $url");
ob_flush(); // This sends the output to your browser
ignore_user_abort(true);// Makes sure the script continues...
// Do my work here
...
?>
This sends the redirect right away, but has the side effect of killing the
script completely, thus the rest of the work never gets run.
My last resort is to move the additional work into a separate script and
using this code:
exec("php work_script.php '$argument' 2>/dev/null >&- <&- >/dev/null &");
This does what I need; ie, it does my work in the background while the
location header is sent to the browser immediately. The obvious problem
with this is that this would cause more load on the servers, as the OS
needs to create an entire new process to run the code. We expect this
script to be hit around 250-400K times a day.
Thanks,
Tony
attached mail follows:
Anyone know of a script that will automatically choose the city and state
from a zip or postal code?
TIA
attached mail follows:
I wrote one pretty quickly for a company project.
It's not too difficult. I can't offer the script
since it's considered internal programming, but let me
know if you have any questions.
--- "C.R." <odcs
rogers.com> wrote:
> Anyone know of a script that will automatically
> choose the city and state
> from a zip or postal code?
>
> TIA
>
>
__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com
attached mail follows:
i got this error that i need solving while using dreamweaverMX
Fatal error: main() [function.main]: Failed opening required ''
(include_path='.;c:\php4\pear') in c:\...\Register\TMPuyl41e8f11.php on line
1
any help would be great
_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail
attached mail follows:
It looks like you have a bad (possibly empty) call to require(). Hard to
tell without seeing your code. I would suggest learning PHP instead of
relying on Dreamweaver.
> -----Original Message-----
> From: Dina A. [mailto:dandash17
hotmail.com]
> Sent: Thursday, May 01, 2003 5:35 PM
> To: php-general
lists.php.net
> Subject: [PHP] to whom it may concern
>
>
>
>
> i got this error that i need solving while using dreamweaverMX
>
> Fatal error: main() [function.main]: Failed opening required ''
> (include_path='.;c:\php4\pear') in
> c:\...\Register\TMPuyl41e8f11.php on line
> 1
>
> any help would be great
attached mail follows:
I am a newbie to php, but have been using Zope, DTML and Python for the
last year or so. I have figured out a couple of things that are similar
between DTML and PHP so far, such as testing for browser versions.
DTML - <dtml-if "_.string.find(HTTP_USER_AGENT, 'MSIE') >= 0">
MSIE code
<dtml-elif "_.string.find(HTTP_USER_AGENT, 'Mozilla/5') >= 0">
Mozilla/5 code
<dtml-elif "_.string.find(HTTP_USER_AGENT, 'Mozilla/4') >= 0">
Mozilla/4 code
<dtml-else>
Generic code
</dtml-if>
PHP - <?php if (stristr($_SERVER['HTTP_USER_AGENT'],'MSIE')) : ?>
MSIE code
<?php elseif (stristr($_SERVER['HTTP_USER_AGENT'],'Mozilla/5')) : ?>
Mozilla/5 code
<?php elseif (stristr($_SERVER['HTTP_USER_AGENT'],'Mozilla/4')) : ?>
Mozilla/4 code
<?php else: ?>
Generic code
<?php endif; ?>
One question I have is, how do you test for a property or a cookie?
In DTML it would be:
<dtml-call "REQUEST.has_key('property or cookie')">
Enter block of code
<dtml-else>
Enter another block of code
</dtml-if>
Is ther a way to do this in PHP without having to echo each line? I've
tried <?php if (isset[property or cookie]) ; ?>
Enter Block of Code
<?php endif; ?>
But that errors out.
Another question I have is can a cookie be set within the HTML and how
would I do it? In DTML you can set them anywhere within the document you
want:
<dtml-call "RESPONSE.setCookie(cookieName, 'value', path='/')">
I have figured out how to set cookies in PHP but only before the html
starts, otherwise I get an error.
<?php setcookie('testCookie', 'value','path'); ?>
Any help, suggestions or pointers would be appreciated.
Michael
--
Michael Lewis
NicheStaffing.com
<michael
nichestaffing.com>
attached mail follows:
on 02/05/03 11:36 AM, Michael Lewis (michael
nichestaffing.com) wrote:
> PHP - <?php if (stristr($_SERVER['HTTP_USER_AGENT'],'MSIE')) : ?>
> MSIE code
> <?php elseif (stristr($_SERVER['HTTP_USER_AGENT'],'Mozilla/5')) : ?>
> Mozilla/5 code
> <?php elseif (stristr($_SERVER['HTTP_USER_AGENT'],'Mozilla/4')) : ?>
> Mozilla/4 code
> <?php else: ?>
> Generic code
> <?php endif; ?>
Try this:
<?
if (stristr($_SERVER['HTTP_USER_AGENT'],'MSIE'))
{
?>
MSIE CODE
<?
}
elseif (stristr($_SERVER['HTTP_USER_AGENT'],'Mozilla/5'))
{
?>
Mozilla/5 code
<?
}
elseif (stristr($_SERVER['HTTP_USER_AGENT'],'Mozilla/4'))
{
?>
Mozilla/4 code
<?
}
else
{
?>
Generic Code
<?
}
?>
In other words, the PHP syntax is:
<?
if(...)
{
...
}
elseif(...)
{
...
}
else
{
...
}
?>
... and all you're doing is escaping in and out of PHP to avoid echo'ing
everything.
Justin French
> One question I have is, how do you test for a property or a cookie?
> In DTML it would be:
> <dtml-call "REQUEST.has_key('property or cookie')">
> Enter block of code
> <dtml-else>
> Enter another block of code
> </dtml-if>
> Is ther a way to do this in PHP without having to echo each line? I've
> tried <?php if (isset[property or cookie]) ; ?>
> Enter Block of Code
> <?php endif; ?>
> But that errors out.
>
> Another question I have is can a cookie be set within the HTML and how
> would I do it? In DTML you can set them anywhere within the document you
> want:
> <dtml-call "RESPONSE.setCookie(cookieName, 'value', path='/')">
>
> I have figured out how to set cookies in PHP but only before the html
> starts, otherwise I get an error.
> <?php setcookie('testCookie', 'value','path'); ?>
>
> Any help, suggestions or pointers would be appreciated.
>
> Michael
attached mail follows:
On Thu, 2003-05-01 at 18:56, Justin French wrote:
> on 02/05/03 11:36 AM, Michael Lewis (michael
nichestaffing.com) wrote:
>
> Try this:
>
> <?
> if (stristr($_SERVER['HTTP_USER_AGENT'],'MSIE'))
> {
> ?>
> MSIE CODE
> <?
> }
> elseif (stristr($_SERVER['HTTP_USER_AGENT'],'Mozilla/5'))
> {
> ?>
> Mozilla/5 code
> <?
> }
> elseif (stristr($_SERVER['HTTP_USER_AGENT'],'Mozilla/4'))
> {
> ?>
> Mozilla/4 code
> <?
> }
> else
> {
> ?>
> Generic Code
> <?
> }
> ?>
>
>
> In other words, the PHP syntax is:
>
> <?
> if(...)
> {
> ...
> }
> elseif(...)
> {
> ...
> }
> else
> {
> ...
> }
> ?>
>
> ... and all you're doing is escaping in and out of PHP to avoid echo'ing
> everything.
>
>
> Justin French
The code for the browser test that I mentioned works as is. The problem
I'm having is testing for cookies. I am doing a new site for my church
and I'm using frames. I wanted to see if I could set a cookie inside
the <noframe> tag that I could test for on all the other pages to
determine if I should display page links or not. In the framesets, all
of the links are in the header and footer frames. If a user is not in
frames, I want to display the links on the individual pages so they can
navigate, but hide them if they are in frames. I tested your suggestion
and it didn't error, but hides the links even if the cookie is set. The
code is below.
<?
if (isset($NoFrames))
{
?>
<tr>
<td valign="top" align="center"> </td>
</tr>
<tr>
<td valign="middle" align="center">
<font face="verdana,helvetica,arial,sans-serif"
color="#cccccf"size="2"><b>
<a href="main.php">Home Page</a> |
<a href="believe.html">Who We Are</a> |
<a href="coffee.html">Coffee House</a> |
<a href="community.html">Outreaches</a><br><img src="trans.gif"
width="200"
height="3"><br>
<a href="house.html">House Ministry</a> |
<a href="calendar.html">Calendar</a> |
<a href="getSaved.html">Get Saved</a> |
<a href="index.html">Saturday Night Church</a>
</b></font></td>
</tr>
<?
}
?>
>
attached mail follows:
Thanks to everyone who helped me get this to work...I truly appreciate
your insight and willingness to help. THANKS SO MUCH!!!
Felderi Santiago
On Wed, 2003-04-30 at 16:39, Evan Nemerson wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Sorry i didn't see this thread sooner... been busy.
>
> Try this patch by Vlad Krupin <vlad
php.net>. It will patch the config.m4 in
> ext/openssl to add a --with-kerberos configuration option
>
> After you patch, you will need to ./buildconf before you ./configure
>
> You may need to tinker with it a bit to get it to work.
>
>
>
>
> On Wednesday 30 April 2003 11:45 am, Felderi Santiago wrote:
> > Thank you Jason for your input, I truly appreciate it. After searching on
> > the nt and Redhat Bugzilla, I found a bug for this problem.
> >
> > http://bugzilla.redhat.com/bugzilla/long_list.cgi?buglist=84331
> >
> > It happens to deal with the fact that krb5.h is not being linked correctly
> > by openssl. Therefore I need to add the directory to C_FLAGS when
> > compiling.
> >
> > Now I really don't know how to do that. I have to add this:
> > -I/usr/kerberos/include into CFLAGS
> >
> > Can anyone help me please?
> >
> > Thanks again to all those that have helped me narrow the problems!
> >
> > Fel.
> >