|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: php-general-digest-help
lists.php.netDate: Sun Jun 02 2002 - 20:15:34 CDT
php-general Digest 3 Jun 2002 01:15:34 -0000 Issue 1382
Topics (messages 100310 through 100355):
mail ( ) and $to
100310 by: Henry
Re: still running the old version after recompiling??
100311 by: Andy
100327 by: savaidis
100336 by: Evan Nemerson
Re: Apache, html, php and global variables
100312 by: Peter Goggin
100314 by: John Holmes
100315 by: Stuart Dallas
Re: Smart URLs
100313 by: Adrian Murphy
100319 by: Andrew Brampton
100321 by: Philip Olson
lots of trouble installing php on linux
100316 by: Andy
Re: php sessions
100317 by: John Holmes
100320 by: Alexander Skwar
Compilation error
100318 by: Richard Fox
php to generate statiscs
100322 by: Rodrigo Peres
100325 by: John Holmes
Re: Variables - Using The Contents Of A Varibale Name Built Dynamically
100323 by: Jason Teagle
100335 by: Michael Davey
mysql_select_db problem
100324 by: PossumPal
100331 by: Nathan
Re: pcntl functions for task manager - comments?
100326 by: Clay Loveless
Re: simple email validation ereg
100328 by: Analysis & Solutions
100329 by: Alexander Skwar
Re: Parsing file's
100330 by: Scott
Sessions
100332 by: r
100333 by: Justin French
100334 by: David Freeman
100338 by: Glenn Sieb
100352 by: Justin French
Re: Parsing file's (SOLVED)
100337 by: Scott
'Pure' php vs 'mixed' (html + php)
100339 by: Andre Dubuc
100341 by: Bogdan Stancescu
100343 by: Andre Dubuc
100344 by: Andre Dubuc
100345 by: Bogdan Stancescu
100347 by: Michael Davey
100348 by: Andre Dubuc
100349 by: Simon Troup
100350 by: Andre Dubuc
100351 by: David Freeman
100355 by: Bogdan Stancescu
newbie help please
100340 by: Christopher J. Crane
Setting PHP Include Dir
100342 by: Tim Thorburn
Encryption without Mcrypt?
100346 by: Jonathan Rosenberg
resolution
100353 by: reapern66
100354 by: Bogdan Stancescu
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:
just installed the win32 cgi 4.2.1 last night and discovered this strange thing with the $to string
in the mail function.
it crashes and gives me a Server Error Warning.
where usually i could go:
$to = "Mary<mary
mary.com>" ;
now it wants:
$to = "mary
mary.com" ;
$from formatting is ok though.
what's happening here?
cheers
Henry
attached mail follows:
Hello Jason,
you have been right, I did a new one on a fresh php untared dir. And the new
php install is recognized.
But I am still fighting with the installation. I need freetype2 and I did
configure it ok, compiled freetype, gd2 but still I am getting a:
function: imagettfbbox() not found
Php did not complain about not finding freetype. Maybe php compiled with
freetype 1 but how come?
This drives me cracy! I did install php on several machines at home running
the same operating system like my provider is offering. It always worked
fine.
do u have a good advice?
Thank you for your help,
Andy
"Jason Wong" <php-general
gremlins.com.hk> schrieb im Newsbeitrag
news:200206021738.18306.php-general
gremlins.com.hk...
> On Sunday 02 June 2002 17:32, Andy wrote:
> > Hi there,
> >
> > I did recompile php with different flags. Phpinfo() tells me that I am
> > still running the old insatllation! I did restart apache after
compiling.
> > So whats wrong. Did I forget something?
> >
> > I did
> > configure with some flags
> > make
> > make install
> >
> > restart apache
>
> 1) To avoid any complications I always compile from a freshly unpacked
tar.gz.
> 2) Stop apache before doing "make install" (not sure whether it makes any
> difference but it doesn't hurt to do so).
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> There are two ways of disliking poetry; one way is to dislike it, the
> other is to read Pope.
> -- Oscar Wilde
> */
>
attached mail follows:
I have one similar problem.
I had a directory "Php" under my "root" directory that was the root for
Apache.
Then I rename "Php" to "php" but after restart, reset ecc - some months now-
still recognize only "Php" and NOT "php".
What's wrong?
Makis
> -----Original Message-----
> From: Andy [mailto:news.letters
gmx.de]
> Sent: Sunday, June 02, 2002 4:51 PM
> To: php-general
lists.php.net
> Subject: Re: [PHP] still running the old version after recompiling??
>
>
> Hello Jason,
>
> you have been right, I did a new one on a fresh php untared dir.
> And the new
> php install is recognized.
>
> But I am still fighting with the installation. I need freetype2 and I did
> configure it ok, compiled freetype, gd2 but still I am getting a:
> function: imagettfbbox() not found
>
> Php did not complain about not finding freetype. Maybe php compiled with
> freetype 1 but how come?
> This drives me cracy! I did install php on several machines at
> home running
> the same operating system like my provider is offering. It always worked
> fine.
>
> do u have a good advice?
>
> Thank you for your help,
>
> Andy
>
>
>
>
> "Jason Wong" <php-general
gremlins.com.hk> schrieb im Newsbeitrag
> news:200206021738.18306.php-general
gremlins.com.hk...
> > On Sunday 02 June 2002 17:32, Andy wrote:
> > > Hi there,
> > >
> > > I did recompile php with different flags. Phpinfo() tells me that I am
> > > still running the old insatllation! I did restart apache after
> compiling.
> > > So whats wrong. Did I forget something?
> > >
> > > I did
> > > configure with some flags
> > > make
> > > make install
> > >
> > > restart apache
> >
> > 1) To avoid any complications I always compile from a freshly unpacked
> tar.gz.
> > 2) Stop apache before doing "make install" (not sure whether it
> makes any
> > difference but it doesn't hurt to do so).
> >
> > --
> > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> > Open Source Software Systems Integrators
> > * Web Design & Hosting * Internet & Intranet Applications Development *
> >
> > /*
> > There are two ways of disliking poetry; one way is to dislike it, the
> > other is to read Pope.
> > -- Oscar Wilde
> > */
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
Do "echo $PATH" from a shell. This will output a list of several folders,
seperated by a semi-colon. Check each of these folders for a file named
"Php". Rename to "php". That should do the trick.
On Sunday 02 June 2002 11:01 am, savaidis wrote:
> I have one similar problem.
>
> I had a directory "Php" under my "root" directory that was the root for
> Apache.
> Then I rename "Php" to "php" but after restart, reset ecc - some months
> now- still recognize only "Php" and NOT "php".
>
> What's wrong?
>
> Makis
>
> > -----Original Message-----
> > From: Andy [mailto:news.letters
gmx.de]
> > Sent: Sunday, June 02, 2002 4:51 PM
> > To: php-general
lists.php.net
> > Subject: Re: [PHP] still running the old version after recompiling??
> >
> >
> > Hello Jason,
> >
> > you have been right, I did a new one on a fresh php untared dir.
> > And the new
> > php install is recognized.
> >
> > But I am still fighting with the installation. I need freetype2 and I did
> > configure it ok, compiled freetype, gd2 but still I am getting a:
> > function: imagettfbbox() not found
> >
> > Php did not complain about not finding freetype. Maybe php compiled with
> > freetype 1 but how come?
> > This drives me cracy! I did install php on several machines at
> > home running
> > the same operating system like my provider is offering. It always worked
> > fine.
> >
> > do u have a good advice?
> >
> > Thank you for your help,
> >
> > Andy
> >
> >
> >
> >
> > "Jason Wong" <php-general
gremlins.com.hk> schrieb im Newsbeitrag
> > news:200206021738.18306.php-general
gremlins.com.hk...
> >
> > > On Sunday 02 June 2002 17:32, Andy wrote:
> > > > Hi there,
> > > >
> > > > I did recompile php with different flags. Phpinfo() tells me that I
> > > > am still running the old insatllation! I did restart apache after
> >
> > compiling.
> >
> > > > So whats wrong. Did I forget something?
> > > >
> > > > I did
> > > > configure with some flags
> > > > make
> > > > make install
> > > >
> > > > restart apache
> > >
> > > 1) To avoid any complications I always compile from a freshly unpacked
> >
> > tar.gz.
> >
> > > 2) Stop apache before doing "make install" (not sure whether it
> >
> > makes any
> >
> > > difference but it doesn't hurt to do so).
> > >
> > > --
> > > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> > > Open Source Software Systems Integrators
> > > * Web Design & Hosting * Internet & Intranet Applications Development *
> > >
> > > /*
> > > There are two ways of disliking poetry; one way is to dislike it, the
> > > other is to read Pope.
> > > -- Oscar Wilde
> > > */
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
-- I am prepared to meet anyone, but whether anyone is prepared for the great ordeal of meeting me is another matter.Samuel Clemens
attached mail follows:
I certainly read your reply and tried it with the session_start as the first line of the php secion. I have since remove the HTML etc. The script appears to work with out error .
I was able to set session vars etc and the script completed with out error and the session vars could be printed out at the end of the script.
I then called another php script from my menu frame and was not able to find the _session vars which showed as blanks. I put the session_start() as first line of php block but this still did not make it possible to read the session vars.
Do I need to use names sessions or what? Is there some setting that is required in the php.ini or apache to make this work?
As I stated at the beigining of the e-mail saga what i want to be able to do is to set global variables which will be available to any php script. In particular i want to ensure that each user has an individual connection to data abse and that this is maintained through out the session. I have set the connection up to use the mysql_pconnect function, but I still need to reconnect in every script which uses the database. I therefore need to be able to caryy the username/password from onepage to the next.
Is the start_session and session variables the corect way to do this or is there a better way?
Regards
Peter Goggin
----- Original Message -----
From: "John Holmes" <holmes072000
charter.net>
To: "'Peter Goggin'" <pgoggin
smartchat.net.au>; <php-general
lists.php.net>
Sent: Sunday, June 02, 2002 3:31 PM
Subject: RE: [PHP] Apache, html, php and global variables
> Did you read my reply at all? Call session_start() before any output to
> the browser.
>
> ---John Holmes...
>
> > -----Original Message-----
> > From: Peter Goggin [mailto:pgoggin
smartchat.net.au]
> > Sent: Sunday, June 02, 2002 1:20 AM
> > To: holmes072000
charter.net; php-general
lists.php.net
> > Subject: Re: [PHP] Apache, html, php and global variables
> >
> > My script is:
> > <html>
> > <body>
> > <?php
> > session_start();
> > printf("<P> loggin on as ");
> > printf ("<P>user name: ");
> > printf ($HTTP_POST_VARS['User']);
> > printf ("<P>Password: ");printf ($HTTP_POST_VARS['Password']);
> > printf ("<P>");
> >
> >
> > /* Connecting, selecting database */
> > $link = mysql_pconnect("localhost", $HTTP_POST_VARS['User'],
> > $HTTP_POST_VARS['Password'])
> > or die("Could not connect");
> > print "Connected successfully<P>";
> > printf ("<BR>");
> > print "Setting Global variables<BR>";
> > $_SESSION_VARS["dbauser"]=($HTTP_POST_VARS['User']);
> > $_SESSION_VARS["dbapassword"]=($HTTP_POST_VARS['Password']);
> > printf ($_SESSION_VARS["dbauser"]);
> > printf ("<BR>");
> > printf ($_SESSION_VARS["dbapassword"],"<BR>");
> > ?>
> > <P>
> > </body>
> > </html>
> > The errors I get are:
> > Warning: Cannot send session cookie - headers already sent by (output
> > started at c:\usr\www\my-domain\databaselogin.php:3) in
> > c:\usr\www\my-domain\databaselogin.php on line 4
> >
> > Warning: Cannot send session cache limiter - headers already sent
> (output
> > started at c:\usr\www\my-domain\databaselogin.php:3) in
> > c:\usr\www\my-domain\databaselogin.php on line 4
> >
> > loggin on as
> >
> > user name: stampuser
> >
> > Password: vantwest
> >
> > Connected successfully
> >
> >
> > Obviously I have something not configured correctly, or I am calling
> the
> > function in the wrong place. Any advice on how to overcome this would
> be
> > very useful.
> >
> >
> > Regards
> >
> >
> > Peter Goggin
> >
> > ----- Original Message -----
> > From: "John Holmes" <holmes072000
charter.net>
> > To: "'Peter Goggin'" <pgoggin
smartchat.net.au>; <php-
> > general
lists.php.net>
> > Sent: Sunday, June 02, 2002 12:09 AM
> > Subject: RE: [PHP] Apache, html, php and global variables
> >
> >
> > > Sessions use cookies, which use headers, which have to be sent
> before
> > > any output. <html> is output. So, put session_start() before that.
> > >
> > > <?
> > > Session_start();
> > >
> > > ...
> > >
> > > ?>
> > > <html>
> > > <body>
> > > ...
> > >
> > > Where are you putting dbauser and dbapassword into the session?
> > >
> > > Your sessions still aren't going to work because the
> session.save_path
> > > isn't set correctly in your PHP.ini. Set it to a directory on your
> > > computer that the web server has access to write to.
> > >
> > > ---John Holmes...
> > >
> > > > -----Original Message-----
> > > > From: Peter Goggin [mailto:pgoggin
smartchat.net.au]
> > > > Sent: Saturday, June 01, 2002 9:54 AM
> > > > To: holmes072000
charter.net; php-general
lists.php.net
> > > > Subject: Re: [PHP] Apache, html, php and global variables
> > > >
> > > > I am not clear what you mean by this. I have set session_start()
> on in
> > > the
> > > > php script that logs onto the database initially. i then call a
> test
> > > php
> > > > script from a button on the menu frame. This is the output it
> gives:
> > > >
> > > > Test php variables
> > > >
> > > > Warning: Cannot send session cookie - headers already sent by
> (output
> > > > started at c:\usr\www\my-domain\maintenance.php:4) in
> > > > c:\usr\www\my-domain\maintenance.php on line 5
> > > >
> > > > Warning: Cannot send session cache limiter - headers already sent
> > > (output
> > > > started at c:\usr\www\my-domain\maintenance.php:4) in
> > > > c:\usr\www\my-domain\maintenance.php on line 5
> > > >
> > > > Warning: open(/tmp\sess_593732809e269f91e78e7406d4a22808, O_RDWR)
> > > failed:
> > > > No
> > > > such file or directory (2) in c:\usr\www\my-domain\maintenance.php
> on
> > > line
> > > > 5
> > > > Test of global variables
> > > > DBA USER:
> > > > DBA Password;
> > > > Warning: open(/tmp\sess_593732809e269f91e78e7406d4a22808, O_RDWR)
> > > failed:
> > > > No
> > > > such file or directory (2) in Unknown on line 0
> > > >
> > > > Warning: Failed to write session data (files). Please verify that
> the
> > > > current setting of session.save_path is correct (/tmp) in Unknown
> on
> > > line
> > > > 0
> > > >
> > > >
> > > > The script is:
> > > > <HTML>
> > > > <BODY>
> > > > Test php variables<BR>
> > > > <?php
> > > > session_start();
> > > > printf ("Test of global variables<BR>");
> > > > printf ("DBA USER: ",$_SESSION_VARS["dbauser"],"<BR>");
> > > > printf ("<BR>");
> > > > printf ("DBA Password;
> ",$_SESSION_VARS["dbapassword"],"<BR>");
> > > > ?>
> > > > </BODY>
> > > > </HTML>
> > > >
> > > > Is there a problem with how I am using sessiot_start, or is there
> a
> > > php
> > > > config problem?
> > > >
> > > > Regards
> > > >
> > > > Peter Goggin
> > > >
> > > > ----- Original Message -----
> > > > From: "John Holmes" <holmes072000
charter.net>
> > > > To: "'Peter Goggin'" <pgoggin
smartchat.net.au>; <php-
> > > > general
lists.php.net>
> > > > Sent: Saturday, June 01, 2002 2:04 PM
> > > > Subject: RE: [PHP] Apache, html, php and global variables
> > > >
> > > >
> > > > > You still have to connect to a database every time a script is
> run,
> > > > > whether it's loaded in a frame or run by itself. If you start a
> > > session
> > > > > and save the username and password in it, then you can use that
> > > login
> > > > > and password on every other page that you call session_start()
> on.
> > > > >
> > > > > ---John Holmes...
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Peter Goggin [mailto:pgoggin
smartchat.net.au]
> > > > > > Sent: Friday, May 31, 2002 11:12 PM
> > > > > > To: php-general
lists.php.net
> > > > > > Subject: Re: [PHP] Apache, html, php and global variables
> > > > > >
> > > > > > I am not certain how this helps me, since it appears the data
> is
> > > only
> > > > > > carried to pages called directly from where it is set. The
> page
> > > where
> > > > > the
> > > > > > user logs onto the database does not link to other pages. This
> is
> > > done
> > > > > > from
> > > > > > the top frame of the form. The top frame of the inital page
> > > contains
> > > > > the
> > > > > > menu, one option of which is to log onto the data base to
> start a
> > > > > session.
> > > > > > The user will then select another page from the top form.
> > > > > >
> > > > > > This new page is displayed in the bottom frame of the intial
> page,
> > > and
> > > > > > there
> > > > > > may be futher links within this page on the bottom
> fram.Generally
> > > > > however
> > > > > > main navigation is from the top frame which remains in place
> > > through
> > > > > out.
> > > > > > What I wabt to do is to have the login information available
> at
> > > all
> > > > > times
> > > > > > once the user is logged in, nomattar how the current page is
> > > called.
> > > > > >
> > > > > > Is this possible?
> > > > > >
> > > > > > If so how is this done?
> > > > > >
> > > > > >
> > > > > > ----- Original Message -----
> > > > > > From: "Stuart Dallas" <stuart
sharedserver.net>
> > > > > > To: <php-general
lists.php.net>
> > > > > > Sent: Saturday, June 01, 2002 11:56 AM
> > > > > > Subject: Re: [PHP] Apache, html, php and global variables
> > > > > >
> > > > > >
> > > > > > > On Saturday, June 1, 2002 at 2:42:40 AM, you wrote:
> > > > > > > > Is there any way of caryying the login information from
> one
> > > web
> > > > > page
> > > > > > to
> > > > > > the
> > > > > > > > next in global variables so that the username and password
> > > entered
> > > > > in
> > > > > > the
> > > > > > > > login screen is available to all other web pages in the
> site
> > > or do
> > > > > I
> > > > > > have to
> > > > > > > > ask the user to re-enter this information at every screen?
> > > > > > >
> > > > > > > Sessions: http://www.php.net/session
> > > > > > >
> > > > > > > --
> > > > > > > Stuart
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > PHP General Mailing List (http://www.php.net/)
> > > > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > PHP General Mailing List (http://www.php.net/)
> > > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > >
> > > > >
> > > > > --
> > > > > PHP General Mailing List (http://www.php.net/)
> > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > >
> > > > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Page1:
<? Session_start(); $_SESSION['dbauser'] = "john"; $_SESSION['dbapassword'] = "password"; ?> <html> <body> Variables set </body> </html>
Page2: <? Session_start(); ?> <html> <body> User: <?=$_SESSION['dbauser']?> Password: <?=$_SESSION['dbapassword']?> </body> </html>
Does that work for you?
Normally all PHP scripts just use the same username and password for the database. You create a "web user" that's used in the scripts. I don't know if you don't want to / can't do this.
Just a simple script like this:
<? MySQL_connect("localhost","user","password"); MySQL_select_db("db_name"); ?>
Name that database.php and include it at the beginning of every script and you've got a database connection in every script.
---John Holmes...
> -----Original Message-----
> From: Peter Goggin [mailto:pgoggin
smartchat.net.au]
> Sent: Sunday, June 02, 2002 9:54 AM
> To: holmes072000
charter.net; php-general
lists.php.net
> Subject: Re: [PHP] Apache, html, php and global variables
>
> I certainly read your reply and tried it with the session_start as the
> first
> line of the php secion. I have since remove the HTML etc. The script
> appears to work with out error .
>
> I was able to set session vars etc and the script completed with out
error
> and the session vars could be printed out at the end of the script.
>
> I then called another php script from my menu frame and was not able
to
> find
> the _session vars which showed as blanks. I put the session_start() as
> first
> line of php block but this still did not make it possible to read the
> session vars.
>
> Do I need to use names sessions or what? Is there some setting that
is
> required in the php.ini or apache to make this work?
>
>
> As I stated at the beigining of the e-mail saga what i want to be able
to
> do
> is to set global variables which will be available to any php script.
In
> particular i want to ensure that each user has an individual
connection to
> data abse and that this is maintained through out the session. I have
set
> the connection up to use the mysql_pconnect function, but I still need
to
> reconnect in every script which uses the database. I therefore need
to be
> able to caryy the username/password from onepage to the next.
>
> Is the start_session and session variables the corect way to do this
or is
> there a better way?
>
> Regards
>
> Peter Goggin
> ----- Original Message -----
> From: "John Holmes" <holmes072000
charter.net>
> To: "'Peter Goggin'" <pgoggin
smartchat.net.au>; <php-
> general
lists.php.net>
> Sent: Sunday, June 02, 2002 3:31 PM
> Subject: RE: [PHP] Apache, html, php and global variables
>
>
> > Did you read my reply at all? Call session_start() before any output
to
> > the browser.
> >
> > ---John Holmes...
> >
> > > -----Original Message-----
> > > From: Peter Goggin [mailto:pgoggin
smartchat.net.au]
> > > Sent: Sunday, June 02, 2002 1:20 AM
> > > To: holmes072000
charter.net; php-general
lists.php.net
> > > Subject: Re: [PHP] Apache, html, php and global variables
> > >
> > > My script is:
> > > <html>
> > > <body>
> > > <?php
> > > session_start();
> > > printf("<P> loggin on as ");
> > > printf ("<P>user name: ");
> > > printf ($HTTP_POST_VARS['User']);
> > > printf ("<P>Password: ");printf ($HTTP_POST_VARS['Password']);
> > > printf ("<P>");
> > >
> > >
> > > /* Connecting, selecting database */
> > > $link = mysql_pconnect("localhost", $HTTP_POST_VARS['User'],
> > > $HTTP_POST_VARS['Password'])
> > > or die("Could not connect");
> > > print "Connected successfully<P>";
> > > printf ("<BR>");
> > > print "Setting Global variables<BR>";
> > > $_SESSION_VARS["dbauser"]=($HTTP_POST_VARS['User']);
> > > $_SESSION_VARS["dbapassword"]=($HTTP_POST_VARS['Password']);
> > > printf ($_SESSION_VARS["dbauser"]);
> > > printf ("<BR>");
> > > printf ($_SESSION_VARS["dbapassword"],"<BR>");
> > > ?>
> > > <P>
> > > </body>
> > > </html>
> > > The errors I get are:
> > > Warning: Cannot send session cookie - headers already sent by
(output
> > > started at c:\usr\www\my-domain\databaselogin.php:3) in
> > > c:\usr\www\my-domain\databaselogin.php on line 4
> > >
> > > Warning: Cannot send session cache limiter - headers already sent
> > (output
> > > started at c:\usr\www\my-domain\databaselogin.php:3) in
> > > c:\usr\www\my-domain\databaselogin.php on line 4
> > >
> > > loggin on as
> > >
> > > user name: stampuser
> > >
> > > Password: vantwest
> > >
> > > Connected successfully
> > >
> > >
> > > Obviously I have something not configured correctly, or I am
calling
> > the
> > > function in the wrong place. Any advice on how to overcome this
would
> > be
> > > very useful.
> > >
> > >
> > > Regards
> > >
> > >
> > > Peter Goggin
> > >
> > > ----- Original Message -----
> > > From: "John Holmes" <holmes072000
charter.net>
> > > To: "'Peter Goggin'" <pgoggin
smartchat.net.au>; <php-
> > > general
lists.php.net>
> > > Sent: Sunday, June 02, 2002 12:09 AM
> > > Subject: RE: [PHP] Apache, html, php and global variables
> > >
> > >
> > > > Sessions use cookies, which use headers, which have to be sent
> > before
> > > > any output. <html> is output. So, put session_start() before
that.
> > > >
> > > > <?
> > > > Session_start();
> > > >
> > > > ...
> > > >
> > > > ?>
> > > > <html>
> > > > <body>
> > > > ...
> > > >
> > > > Where are you putting dbauser and dbapassword into the session?
> > > >
> > > > Your sessions still aren't going to work because the
> > session.save_path
> > > > isn't set correctly in your PHP.ini. Set it to a directory on
your
> > > > computer that the web server has access to write to.
> > > >
> > > > ---John Holmes...
> > > >
> > > > > -----Original Message-----
> > > > > From: Peter Goggin [mailto:pgoggin
smartchat.net.au]
> > > > > Sent: Saturday, June 01, 2002 9:54 AM
> > > > > To: holmes072000
charter.net; php-general
lists.php.net
> > > > > Subject: Re: [PHP] Apache, html, php and global variables
> > > > >
> > > > > I am not clear what you mean by this. I have set
session_start()
> > on in
> > > > the
> > > > > php script that logs onto the database initially. i then call
a
> > test
> > > > php
> > > > > script from a button on the menu frame. This is the output it
> > gives:
> > > > >
> > > > > Test php variables
> > > > >
> > > > > Warning: Cannot send session cookie - headers already sent by
> > (output
> > > > > started at c:\usr\www\my-domain\maintenance.php:4) in
> > > > > c:\usr\www\my-domain\maintenance.php on line 5
> > > > >
> > > > > Warning: Cannot send session cache limiter - headers already
sent
> > > > (output
> > > > > started at c:\usr\www\my-domain\maintenance.php:4) in
> > > > > c:\usr\www\my-domain\maintenance.php on line 5
> > > > >
> > > > > Warning: open(/tmp\sess_593732809e269f91e78e7406d4a22808,
O_RDWR)
> > > > failed:
> > > > > No
> > > > > such file or directory (2) in
c:\usr\www\my-domain\maintenance.php
> > on
> > > > line
> > > > > 5
> > > > > Test of global variables
> > > > > DBA USER:
> > > > > DBA Password;
> > > > > Warning: open(/tmp\sess_593732809e269f91e78e7406d4a22808,
O_RDWR)
> > > > failed:
> > > > > No
> > > > > such file or directory (2) in Unknown on line 0
> > > > >
> > > > > Warning: Failed to write session data (files). Please verify
that
> > the
> > > > > current setting of session.save_path is correct (/tmp) in
Unknown
> > on
> > > > line
> > > > > 0
> > > > >
> > > > >
> > > > > The script is:
> > > > > <HTML>
> > > > > <BODY>
> > > > > Test php variables<BR>
> > > > > <?php
> > > > > session_start();
> > > > > printf ("Test of global variables<BR>");
> > > > > printf ("DBA USER: ",$_SESSION_VARS["dbauser"],"<BR>");
> > > > > printf ("<BR>");
> > > > > printf ("DBA Password;
> > ",$_SESSION_VARS["dbapassword"],"<BR>");
> > > > > ?>
> > > > > </BODY>
> > > > > </HTML>
> > > > >
> > > > > Is there a problem with how I am using sessiot_start, or is
there
> > a
> > > > php
> > > > > config problem?
> > > > >
> > > > > Regards
> > > > >
> > > > > Peter Goggin
> > > > >
> > > > > ----- Original Message -----
> > > > > From: "John Holmes" <holmes072000
charter.net>
> > > > > To: "'Peter Goggin'" <pgoggin
smartchat.net.au>; <php-
> > > > > general
lists.php.net>
> > > > > Sent: Saturday, June 01, 2002 2:04 PM
> > > > > Subject: RE: [PHP] Apache, html, php and global variables
> > > > >
> > > > >
> > > > > > You still have to connect to a database every time a script
is
> > run,
> > > > > > whether it's loaded in a frame or run by itself. If you
start a
> > > > session
> > > > > > and save the username and password in it, then you can use
that
> > > > login
> > > > > > and password on every other page that you call
session_start()
> > on.
> > > > > >
> > > > > > ---John Holmes...
> > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Peter Goggin [mailto:pgoggin
smartchat.net.au]
> > > > > > > Sent: Friday, May 31, 2002 11:12 PM
> > > > > > > To: php-general
lists.php.net
> > > > > > > Subject: Re: [PHP] Apache, html, php and global variables
> > > > > > >
> > > > > > > I am not certain how this helps me, since it appears the
data
> > is
> > > > only
> > > > > > > carried to pages called directly from where it is set.
The
> > page
> > > > where
> > > > > > the
> > > > > > > user logs onto the database does not link to other pages.
This
> > is
> > > > done
> > > > > > > from
> > > > > > > the top frame of the form. The top frame of the inital
page
> > > > contains
> > > > > > the
> > > > > > > menu, one option of which is to log onto the data base to
> > start a
> > > > > > session.
> > > > > > > The user will then select another page from the top form.
> > > > > > >
> > > > > > > This new page is displayed in the bottom frame of the
intial
> > page,
> > > > and
> > > > > > > there
> > > > > > > may be futher links within this page on the bottom
> > fram.Generally
> > > > > > however
> > > > > > > main navigation is from the top frame which remains in
place
> > > > through
> > > > > > out.
> > > > > > > What I wabt to do is to have the login information
available
> > at
> > > > all
> > > > > > times
> > > > > > > once the user is logged in, nomattar how the current page
is
> > > > called.
> > > > > > >
> > > > > > > Is this possible?
> > > > > > >
> > > > > > > If so how is this done?
> > > > > > >
> > > > > > >
> > > > > > > ----- Original Message -----
> > > > > > > From: "Stuart Dallas" <stuart
sharedserver.net>
> > > > > > > To: <php-general
lists.php.net>
> > > > > > > Sent: Saturday, June 01, 2002 11:56 AM
> > > > > > > Subject: Re: [PHP] Apache, html, php and global variables
> > > > > > >
> > > > > > >
> > > > > > > > On Saturday, June 1, 2002 at 2:42:40 AM, you wrote:
> > > > > > > > > Is there any way of caryying the login information
from
> > one
> > > > web
> > > > > > page
> > > > > > > to
> > > > > > > the
> > > > > > > > > next in global variables so that the username and
password
> > > > entered
> > > > > > in
> > > > > > > the
> > > > > > > > > login screen is available to all other web pages in
the
> > site
> > > > or do
> > > > > > I
> > > > > > > have to
> > > > > > > > > ask the user to re-enter this information at every
screen?
> > > > > > > >
> > > > > > > > Sessions: http://www.php.net/session
> > > > > > > >
> > > > > > > > --
> > > > > > > > Stuart
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > > PHP General Mailing List (http://www.php.net/)
> > > > > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > PHP General Mailing List (http://www.php.net/)
> > > > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > > >
> > > > > >
> > > > > > --
> > > > > > PHP General Mailing List (http://www.php.net/)
> > > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > > >
> > > > > >
> > > >
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > > >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
attached mail follows:
On Sunday, June 2, 2002 at 2:53:30 PM, you wrote: > I certainly read your reply and tried it with the session_start as the first > line of the php secion. I have since remove the HTML etc. The script > appears to work with out error .
session_start must be called before any output in the script, not just in the PHP section. The easiest way to do this is to have the following as the first line in each script...
<?php start_session(); ?>
> I was able to set session vars etc and the script completed with out error > and the session vars could be printed out at the end of the script.
> I then called another php script from my menu frame and was not able to find > the _session vars which showed as blanks. I put the session_start() as first > line of php block but this still did not make it possible to read the > session vars.
Where is the session started? In the frameset page, or in one of the frames? Basically, a link to a page that uses the session should be created by a script that also calls start_session().
> Do I need to use names sessions or what? Is there some setting that is > required in the php.ini or apache to make this work?
I think your main problem is that you are not using the correct name for the session array. You are using $_SESSION_VARS which is a mix between the two options which are $HTTP_SESSION_VARS and $_SESSION. $_SESSION is the one you should be using since $HTTP_SESSION_VARS is deprecated.
> Is the start_session and session variables the corect way to do this or is > there a better way?
Not really. Sessions are the established way of persisting data across page requests.
-- Stuart
attached mail follows:
> whenever a URL like > mysite.com/thumbnails/funny/4 > i called the thumbnails.php is excuted, in which you
I think if you call it thumbnails.php it won't work. however if the script is simply called thumbnails then it'll work.of course you then must make sure that 'thumbnails' is parsed as php.do this with a .htaccess file :
<Files thumbnails> ForceType application/x-httpd-php </Files>
----- Original Message -----
From: "Andrew Brampton" <andrew
bramp.freeserve.co.uk>
To: <scott
moddb.com>; <php-general
lists.php.net>
Sent: Sunday, June 02, 2002 1:20 PM
Subject: Re: [PHP] Smart URLs
> You can do this with just PHP, but I think php must be installed as a
> module.
> Basically place a file called thumbnails.php in your site route, then
> whenever a URL like
> mysite.com/thumbnails/funny/4
> i called the thumbnails.php is excuted, in which you chop up the URL, and
> find all your varibles...
>
> Here is a example of some URL chopping (some code I stole from my source)
> /*
> Sample URLs:
> /s/1/2/SchoolName/StudentName/ -Shows Student Page (with ID 2)
> /s/1/0/SchoolName/ -Shows Students At School (with school ID 1)
> /s/1/2/ -would work as well (name in URL for search engines)
> /s/1/0/ -would work as well
> /s/ -Shows Schools
> */
>
> $url_array=explode("/",$REQUEST_URI); //BREAK UP THE URL PATH
> // USING '/' as delimiter
> if ($url_array[1] == 's')
> {
> if (isSet($url_array[2]))
> $url_sID=$url_array[2]; //School ID
> if (isSet($url_array[3]))
> $url_stID=$url_array[3]; //Student ID
> if (isSet($url_array[4]))
> $url_sName=$url_array[4]; //School Name (not used)
> if (isSet($url_array[5]))
> $url_stName=$url_array[5]; //Student Name (not used)
> }
> /*
>
> There was a article on phpbuilder.com that explains the benefits and
> pitfalls of this idea... Here is the URL:
> http://www.phpbuilder.com/columns/tim19990117.php3 and I think there was a
> follow up article as well
>
> Enjoy
> Andrew
>
> ----- Original Message -----
> From: "Scott 'INtense!' Reismanis" <areisman
bigpond.net.au>
> To: <php-general
lists.php.net>
> Sent: Monday, June 03, 2002 5:28 AM
> Subject: [PHP] Smart URLs
>
>
> > Hey all,
> >
> > I was recently trying my luck at dabbling in some mod_rewrite
> > stuff, and I have run into numerious errors. Basically my aim is to
> > re-write my sites URLs so instead of being say,
> > mysite.com/thumbnails?type=funny&gallery=4 the URL is neat, similar to
> > many sites who would have something like mysite.com/thumbnails/funny/4
> >
> > What ways are there of achieving this (excluding, redirecting the URL
> > and creating the page say index.htm automatically)? I have tried
> > mod_rewrite for two days solid to no avail. I am not sure if it is my
> > poor coding or the fact that I am running apache2 on a Windows platform
> > which are said not to support such a module well. If any alternatives
> > could be proposed or even better someone could suggest a mod_rewrite
> > routine which would transparently transform any url like
> > mysite.com/whatever/4/6 to mysite.com/whatever.php it would be greatly
> > appreciated. So far the rewrite you see below will work with
> > mysite.com/whatever/ however the minute you add something onto the end
> > i.e. mysite.com/whatever/4/ it will raise the error "Premature end of
> > script headers: php.exe", instead of loading whatever.php as intended.
> >
> > RewriteEngine On
> > Options +FollowSymlinks
> > RewriteBase /
> > RewriteRule ^/(.+)/(.+) $1.php [L]
> >
> > Thanks for your time and hopefully someone understands what I am trying
> > to say :), and as always any suggestions at all would be awesome!
> >
> > Regards,
> >
> >
> > Scott 'INtense!' Reismanis
> > Mod Database System Administrator
> > scott
moddb.com
> > http://www.moddb.com/ - "Every Game, Every Mod, One
> > Site... Go Figure!"
> >
> >
> >
> >
> > --
> > 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:
Hey try it, it works when are running the PHP Module in apache. I have a server with proxy.php yet I access it via myserver.com/proxy/whatever and it works with no special changes to the config files.
Andrew
----- Original Message -----
From: "Adrian Murphy" <adrian.murphy
2020tourism.com>
To: "Andrew Brampton" <andrew
bramp.freeserve.co.uk>; <scott
moddb.com>;
<php-general
lists.php.net>
Sent: Sunday, June 02, 2002 3:24 PM
Subject: Re: [PHP] Smart URLs
> > whenever a URL like
> > mysite.com/thumbnails/funny/4
> > i called the thumbnails.php is excuted, in which you
>
> I think if you call it thumbnails.php it won't work.
> however if the script is simply called thumbnails then it'll
> work.of course you then must make sure that 'thumbnails'
> is parsed as php.do this with a .htaccess file :
>
> <Files thumbnails>
> ForceType application/x-httpd-php
> </Files>
>
> ----- Original Message -----
> From: "Andrew Brampton" <andrew
bramp.freeserve.co.uk>
> To: <scott
moddb.com>; <php-general
lists.php.net>
> Sent: Sunday, June 02, 2002 1:20 PM
> Subject: Re: [PHP] Smart URLs
>
>
> > You can do this with just PHP, but I think php must be installed as a
> > module.
> > Basically place a file called thumbnails.php in your site route, then
> > whenever a URL like
> > mysite.com/thumbnails/funny/4
> > i called the thumbnails.php is excuted, in which you chop up the URL,
and
> > find all your varibles...
> >
> > Here is a example of some URL chopping (some code I stole from my
source)
> > /*
> > Sample URLs:
> > /s/1/2/SchoolName/StudentName/ -Shows Student Page (with ID 2)
> > /s/1/0/SchoolName/ -Shows Students At School (with school ID 1)
> > /s/1/2/ -would work as well (name in URL for search engines)
> > /s/1/0/ -would work as well
> > /s/ -Shows Schools
> > */
> >
> > $url_array=explode("/",$REQUEST_URI); //BREAK UP THE URL PATH
> > // USING '/' as delimiter
> > if ($url_array[1] == 's')
> > {
> > if (isSet($url_array[2]))
> > $url_sID=$url_array[2]; //School ID
> > if (isSet($url_array[3]))
> > $url_stID=$url_array[3]; //Student ID
> > if (isSet($url_array[4]))
> > $url_sName=$url_array[4]; //School Name (not used)
> > if (isSet($url_array[5]))
> > $url_stName=$url_array[5]; //Student Name (not used)
> > }
> > /*
> >
> > There was a article on phpbuilder.com that explains the benefits and
> > pitfalls of this idea... Here is the URL:
> > http://www.phpbuilder.com/columns/tim19990117.php3 and I think there was
a
> > follow up article as well
> >
> > Enjoy
> > Andrew
> >
> > ----- Original Message -----
> > From: "Scott 'INtense!' Reismanis" <areisman
bigpond.net.au>
> > To: <php-general
lists.php.net>
> > Sent: Monday, June 03, 2002 5:28 AM
> > Subject: [PHP] Smart URLs
> >
> >
> > > Hey all,
> > >
> > > I was recently trying my luck at dabbling in some mod_rewrite
> > > stuff, and I have run into numerious errors. Basically my aim is to
> > > re-write my sites URLs so instead of being say,
> > > mysite.com/thumbnails?type=funny&gallery=4 the URL is neat, similar to
> > > many sites who would have something like mysite.com/thumbnails/funny/4
> > >
> > > What ways are there of achieving this (excluding, redirecting the URL
> > > and creating the page say index.htm automatically)? I have tried
> > > mod_rewrite for two days solid to no avail. I am not sure if it is my
> > > poor coding or the fact that I am running apache2 on a Windows
platform
> > > which are said not to support such a module well. If any alternatives
> > > could be proposed or even better someone could suggest a mod_rewrite
> > > routine which would transparently transform any url like
> > > mysite.com/whatever/4/6 to mysite.com/whatever.php it would be greatly
> > > appreciated. So far the rewrite you see below will work with
> > > mysite.com/whatever/ however the minute you add something onto the end
> > > i.e. mysite.com/whatever/4/ it will raise the error "Premature end of
> > > script headers: php.exe", instead of loading whatever.php as intended.
> > >
> > > RewriteEngine On
> > > Options +FollowSymlinks
> > > RewriteBase /
> > > RewriteRule ^/(.+)/(.+) $1.php [L]
> > >
> > > Thanks for your time and hopefully someone understands what I am
trying
> > > to say :), and as always any suggestions at all would be awesome!
> > >
> > > Regards,
> > >
> > >
> > > Scott 'INtense!' Reismanis
> > > Mod Database System Administrator
> > > scott
moddb.com
> > > http://www.moddb.com/ - "Every Game, Every Mod, One
> > > Site... Go Figure!"
> > >
> > >
> > >
> > >
> > > --
> > > 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:
For tips on doing these things, read this faqt:
http://www.faqts.com/knowledge_base/view.phtml/aid/124
Regards, Philip Olson
On Sun, 2 Jun 2002, Andrew Brampton wrote:
> Hey try it, it works when are running the PHP Module in apache.
> I have a server with proxy.php yet I access it via
> myserver.com/proxy/whatever and it works with no special changes to the
> config files.
>
> Andrew
> ----- Original Message -----
> From: "Adrian Murphy" <adrian.murphy
2020tourism.com>
> To: "Andrew Brampton" <andrew
bramp.freeserve.co.uk>; <scott
moddb.com>;
> <php-general
lists.php.net>
> Sent: Sunday, June 02, 2002 3:24 PM
> Subject: Re: [PHP] Smart URLs
>
>
> > > whenever a URL like
> > > mysite.com/thumbnails/funny/4
> > > i called the thumbnails.php is excuted, in which you
> >
> > I think if you call it thumbnails.php it won't work.
> > however if the script is simply called thumbnails then it'll
> > work.of course you then must make sure that 'thumbnails'
> > is parsed as php.do this with a .htaccess file :
> >
> > <Files thumbnails>
> > ForceType application/x-httpd-php
> > </Files>
> >
> > ----- Original Message -----
> > From: "Andrew Brampton" <andrew
bramp.freeserve.co.uk>
> > To: <scott
moddb.com>; <php-general
lists.php.net>
> > Sent: Sunday, June 02, 2002 1:20 PM
> > Subject: Re: [PHP] Smart URLs
> >
> >
> > > You can do this with just PHP, but I think php must be installed as a
> > > module.
> > > Basically place a file called thumbnails.php in your site route, then
> > > whenever a URL like
> > > mysite.com/thumbnails/funny/4
> > > i called the thumbnails.php is excuted, in which you chop up the URL,
> and
> > > find all your varibles...
> > >
> > > Here is a example of some URL chopping (some code I stole from my
> source)
> > > /*
> > > Sample URLs:
> > > /s/1/2/SchoolName/StudentName/ -Shows Student Page (with ID 2)
> > > /s/1/0/SchoolName/ -Shows Students At School (with school ID 1)
> > > /s/1/2/ -would work as well (name in URL for search engines)
> > > /s/1/0/ -would work as well
> > > /s/ -Shows Schools
> > > */
> > >
> > > $url_array=explode("/",$REQUEST_URI); //BREAK UP THE URL PATH
> > > // USING '/' as delimiter
> > > if ($url_array[1] == 's')
> > > {
> > > if (isSet($url_array[2]))
> > > $url_sID=$url_array[2]; //School ID
> > > if (isSet($url_array[3]))
> > > $url_stID=$url_array[3]; //Student ID
> > > if (isSet($url_array[4]))
> > > $url_sName=$url_array[4]; //School Name (not used)
> > > if (isSet($url_array[5]))
> > > $url_stName=$url_array[5]; //Student Name (not used)
> > > }
> > > /*
> > >
> > > There was a article on phpbuilder.com that explains the benefits and
> > > pitfalls of this idea... Here is the URL:
> > > http://www.phpbuilder.com/columns/tim19990117.php3 and I think there was
> a
> > > follow up article as well
> > >
> > > Enjoy
> > > Andrew
> > >
> > > ----- Original Message -----
> > > From: "Scott 'INtense!' Reismanis" <areisman
bigpond.net.au>
> > > To: <php-general
lists.php.net>
> > > Sent: Monday, June 03, 2002 5:28 AM
> > > Subject: [PHP] Smart URLs
> > >
> > >
> > > > Hey all,
> > > >
> > > > I was recently trying my luck at dabbling in some mod_rewrite
> > > > stuff, and I have run into numerious errors. Basically my aim is to
> > > > re-write my sites URLs so instead of being say,
> > > > mysite.com/thumbnails?type=funny&gallery=4 the URL is neat, similar to
> > > > many sites who would have something like mysite.com/thumbnails/funny/4
> > > >
> > > > What ways are there of achieving this (excluding, redirecting the URL
> > > > and creating the page say index.htm automatically)? I have tried
> > > > mod_rewrite for two days solid to no avail. I am not sure if it is my
> > > > poor coding or the fact that I am running apache2 on a Windows
> platform
> > > > which are said not to support such a module well. If any alternatives
> > > > could be proposed or even better someone could suggest a mod_rewrite
> > > > routine which would transparently transform any url like
> > > > mysite.com/whatever/4/6 to mysite.com/whatever.php it would be greatly
> > > > appreciated. So far the rewrite you see below will work with
> > > > mysite.com/whatever/ however the minute you add something onto the end
> > > > i.e. mysite.com/whatever/4/ it will raise the error "Premature end of
> > > > script headers: php.exe", instead of loading whatever.php as intended.
> > > >
> > > > RewriteEngine On
> > > > Options +FollowSymlinks
> > > > RewriteBase /
> > > > RewriteRule ^/(.+)/(.+) $1.php [L]
> > > >
> > > > Thanks for your time and hopefully someone understands what I am
> trying
> > > > to say :), and as always any suggestions at all would be awesome!
> > > >
> > > > Regards,
> > > >
> > > >
> > > > Scott 'INtense!' Reismanis
> > > > Mod Database System Administrator
> > > > scott
moddb.com
> > > > http://www.moddb.com/ - "Every Game, Every Mod, One
> > > > Site... Go Figure!"
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
Hi there,
I am having trouble to get a php installations working on suse72 with following configure command:
./configure' '--with-gd=/home/andy/sw/gd-2.0.1' '--with-freetype=/usr/lib' '--enable-gd-native-ttf' '--enable-gd-imgstrttf' '--with-jpeg-dir=/usr' '--with-png-dir=/usr/lib' '--with-zlib' '--with-apxs=/usr/local/apache/bin/apxs' '--with-ftp' '--with-mysql' '--with-pdflib' '--with-lmap' '--with-gettext=/usr/local/bin' '--with-xml'
Everything is working except freetype, imap, ftp
The php page tells for imap to install a client from washington university, but is this something like cypress? I am not familar to imap clients, just want to get new email adresses running on this system. PHP page tells as follows:
To get these functions to work, you have to compile PHP with --with-imap. That requires the c-client library to be installed. Grab the latest version from ftp://ftp.cac.washington.edu/imap/ and compile it.
Then copy c-client/c-client.a to /usr/local/lib/libc-client.a or some other directory on your link path and copy c-client/*.h to /usr/local/include or some other directory in your include path.
Huomaa: Depending how the c-client was configured, you might also need to add --with-imap-ssl=/path/to/openssl/ and/or --with-kerberos into the PHP configure line
Do I need to get this c library too? And cypress? How about ftp and freetype?
Thanx for any help,
Andy
attached mail follows:
You have to define the constants on each page. The second page doesn't know what S_USER, S_USER_ID, or S_USER_NAME are...unless you define them again.
---John Holmes...
> -----Original Message-----
> From: Michal Dvoracek [mailto:michal.dvoracek
capitol.cz]
> Sent: Sunday, June 02, 2002 3:59 AM
> To: php-general
lists.php.net
> Subject: [PHP] php sessions
>
> Hello,
>
> i'm using sessions in my application but i found something strange.
>
> when creating new session:
>
> define('S_USER', 0);
> define('S_USER_ID', 0);
> define('S_USER_NAME', 1);
>
> session_start();
> $_SESSION[S_USER][S_USER_ID] = 1;
> $_SESSION[S_USER][S_USER_NAME] = 'Michal';
>
> when redirect on next page - session is empty but when a change first
> define to:
> define('S_USER', 'user');
>
> everything works ok.
>
> So in session isn't possible use numeric indexes ?
>
> Regards,
> Michal Dvoracek michal.dvoracek
capitol.cz
>
> Sorry if this question was here answered.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Michal Dvoracek wrote:
>when creating new session: > >define('S_USER', 0); >define('S_USER_ID', 0); >define('S_USER_NAME', 1); > >session_start(); >$_SESSION[S_USER][S_USER_ID] = 1; >$_SESSION[S_USER][S_USER_NAME] = 'Michal'; >
Hm, you're defining a session variable called 0? Because PHP will translate the [S_USER] to [0] because S_USER is a constant defined as 0.
PHP doesn't allow variables to start with a digit, and I don't think it will work in this case either.
attached mail follows:
Hi,
I am compiling PHP 4.2.0 on a RedHat 7.1 system with mnogosearch 3.2.3. I am running into a problem that I have not seen on my other RedHat systems with the same configuration (except Redhat 7.2 instead of 7.1), and that is that the link does not work because there are some symbols that are multiply defined. Specifically, ftp_login. The linker tells me that the symbol was first definied in mnogosearch-3.2.3/src/ftp.c, and also found in php-4.2.0/ext/ftp/ftp.c (the are other ftp_xx functions multiply defined also, e.g. ftp_close, ftp_list, same files).
If I remove --ftp_enable from my config then there is no error. I cannot figure out how to have ftp support in PHP and mnogosearch also! This does not occur when building PHP on my other RedHat system, where both --enable-ftp and --with-mnogosearch=/usr/local/mnogosearch are used and the linker is happy.
Can anyone give some advice? Has anyone encountered the same problem?
Thanks, I'm stuck!
Rich
attached mail follows:
Hi list,
Sorry if this is a off-topic, but I really don't know where to begin. I have a mysql database with about 20.000 records, now I need to build a statistics panel to show for example how many of this record are male, female, lives in determinated city, school graduation etc, everything grouped by sex and alone too, present the respectives percentages etc... How do I begin??? Can someone help??
thank's in advance
Rodrigo Peres
attached mail follows:
Look into cross-tab queries (I think that's what they are called). There is a good article on Devshed.com about it. You can do a query like this
SELECT SUM(IF(Gender='M'),1,0)) AS Male, SUM(IF(Gender='F',1,0)) AS Female FROM table
That'll give you two columns, one named Male, one named Female, in the result set. The result set will have one row, containing the number of males in the database in the Male column, the number of females in the database in the second.
You could probably do the majority of your "statistic" queries this way.
---John Holmes...
> -----Original Message-----
> From: Rodrigo Peres [mailto:rperes
mac.com]
> Sent: Sunday, June 02, 2002 2:02 PM
> To: php-general
lists.php.net
> Subject: [PHP] php to generate statiscs
>
> Hi list,
>
> Sorry if this is a off-topic, but I really don't know where to begin.
I
> have a mysql database with about 20.000 records, now I need to build a
> statistics panel to show for example how many of this record are male,
> female, lives in determinated city, school graduation etc, everything
> grouped by sex and alone too, present the respectives percentages
etc...
> How do I begin??? Can someone help??
>
> thank's in advance
>
> Rodrigo Peres
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
"Michael Davey" <mikey
splatted.net> wrote in message
news:20020601113403.70543.qmail
pb1.pair.com...
> You could give the button the same name in each form - only the fields in > between the <form</form> tags is actually submitted, then put a hidden field > in the form that uniquely identifies the data being submitted. > > Just a thought... it is what I usually do...
Won't that treat all radio buttons on the page as one group, instead of being separate groups for each form?
-- -------------------------------------------- _ _ o o Jason Teagle < jasonteagster.co.uk v --------------------------------------------
attached mail follows:
> Won't that treat all radio buttons on the page as one group, instead of > being separate groups for each form?
No - the <form></form> tags "enclose" the data that is being submitted - nothing outside of the tags will reach the script that handles the request.
Mikey
attached mail follows:
Hi,
I'm a newbie, so please have mercy on my silliness...
I've checked my formats, and can't seem to understand why I can connect to the db, but not select the db that I want to use. The following code always returns the "Couldn't select database" error.
If I use the mysql monitor, I can select the database directly without any problems.
Could someone point out what I'm missing?
<?
$db_name="mydb";
$table_name="my_table";
$connection =
mysql_connect("localhost", "user", "password") or die ("Couldn't connect.");
$db =
mysql_select_db($db_name) or die ("Couldn't select database");
?>
Regards,
Carol
attached mail follows:
Do some error checking. You're turning off all the errors produced by the mysql statements, so how are you supposed to know what's wrong?
You could also try:
$db = mysql_select_db($db_name) or exit(mysql_error());
I'm not sure if mysql_error works for selecting the db, but it couldn't hurt to try :-)
Cheers,
# Nathan
----- Original Message -----
From: "PossumPal" <possumpal
hotmail.com>
To: <php-general
lists.php.net>
Sent: Sunday, June 02, 2002 12:40 PM
Subject: [PHP] mysql_select_db problem
Hi,
I'm a newbie, so please have mercy on my silliness...
I've checked my formats, and can't seem to understand why I can connect to the db, but not select the db that I want to use. The following code always returns the "Couldn't select database" error.
If I use the mysql monitor, I can select the database directly without any problems.
Could someone point out what I'm missing?
<?
$db_name="mydb";
$table_name="my_table";
$connection =
mysql_connect("localhost", "user", "password") or die ("Couldn't connect.");
$db =
mysql_select_db($db_name) or die ("Couldn't select database");
?>
Regards,
Carol
attached mail follows:
After playing around with this further, here is more functional pseudo-code ... Primary change in the placement and method of the waidpid routine.
I'm still open to comments on this ... Otherwise, I hope this snippet is useful to someone! : )
// run forever if necessary set_time_limit(0);
// detatch from the controlling terminal if (!posix_setsid()) { die('could not detach from terminal'); }
// setup signal handlers pcntl_signal(SIGTERM, "sig_handler"); pcntl_signal(SIGHUP, "sig_handler");
// loop forever waiting on jobs while(1) {
// check queue for pending jobs // (db lookup omitted, let's assume jobs are waiting) $jobs_waiting = true; if($jobs_waiting) { $pid = pcntl_fork(); if($pid == -1) { die('could not fork'); } else if ($pid) { // parent } else { // child // perform task on jobs waiting // when job(s) complete, quit exit(); } }
// call waitpid to collect children that // have already terminated $tpid = pcntl_waitpid(-1,$status,WNOHANG); //verbose output //if($tpid > 0) echo "Parent collected child $tpid\n";
// wait two seconds before checking queue again sleep(2); unset($jobs_waiting); } function sig_handler($signo) { // blah blah }
-Clay
> From: Clay Loveless <clay
killersoft.com>
> Date: Sat, 01 Jun 2002 12:38:18 -0700
> To: PHP-General <php-general
lists.php.net>
> Subject: [PHP] pcntl functions for task manager - comments?
>
> I'm experimenting with PHP's pcntl_* functions using the PHP cgi ... I've
> never written a daemon before, and there doesn't seem to be a lot of
> information out there about how to do this with the pcntl functions.
>
> So, I've read what I can find on the subject as it deals with UNIX
> programming. The goal is a script that will run forever, checking a "job
> queue" ... If jobs are waiting, use pcntl_fork() to handle the jobs.
>
> To this end, I've come up with this pseudo-code ... Before going WAY off in
> this direction, I'd like to submit this for comments by those who've had
> more experience with this sort of thing.
>
> ------------------
> // run forever if necessary
> set_time_limit(0);
>
> // detatch from the controlling terminal
> if (!posix_setsid()) {
> die('could not detach from terminal');
> }
>
> // setup signal handlers
> pcntl_signal(SIGTERM, "sig_handler");
> pcntl_signal(SIGHUP, "sig_handler");
>
> // loop forever waiting on jobs
> while(1) {
>
> // check queue for pending jobs
> // (db lookup omitted, let's assume jobs are waiting)
> $jobs_waiting = true;
>
> if($jobs_waiting) {
>
> $pid = pcntl_fork();
> if($pid == -1) {
> die('could not fork');
> } else if ($pid) {
>
> // parent
> // call waitpid to reap children that
> // have already terminated
> do {
> $tpid = pcntl_waitpid(-1,$status,WNOHANG);
> if($tpid == -1)
> die('error occurred while waiting for child');
> } while (!$tpid);
>
> } else {
> // child
> // perform task on jobs waiting
>
> // when job(s) complete, quit
> exit();
> }
>
> }
> // wait two seconds before checking queue again
> sleep(2);
> unset($jobs_waiting);
> }
>
> function sig_handler($signo) {
> // blah blah
> }
> --------------------
>
>
> I am open to suggestions or comments on this approach! Please let me know if
> you think this looks nuts.
>
> Thanks,
> Clay
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
Hi Justin:
On Sun, Jun 02, 2002 at 02:13:40PM +1000, Justin French wrote:
>
> (anything)
(anything) followed by 1 or more (.anything)
So, what ereg expressions have you tried thus far? It's far cooler to come to the list saying, "I tried x, and it's generating error y, does anyone have an idea?"
--Dan
--
PHP classes that make web design easier
SQL Solution | Layout Solution | Form Solution
sqlsolution.info | layoutsolution.info | formsolution.info
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
attached mail follows:
Justin French wrote:
>my aim will be to strip out anything that doesn't at least LOOK like like an >email address. >
Well, instead of coming up with some "clever" regexp, I'd suggest to completely dump syntax checks. Instead, I only check if the host has a MX entry associated. If not, then this host either does not exist, or mails wouldn't get through. At any rate, it's not a valid adress.
attached mail follows:
Ok, this did not work, but I have a new idea. From the top....
1)Read in the csv file, take the first 18 records and insert them into a temp db. Ie: $output = array_slice ($fields, 0, 17);
2)Then do a count on the line to see how many records are after 17 and somehow loop through them 34 at a time.
It is easy if there is only one set, but I am not sure how to take the remaining elements in the array and break them out 34 at a time until I reach the end of the line.
Help, my head hurts and I have a habit of over thinking :)
-Scott
-----Original Message-----
From: Mark Heintz PHP Mailing Lists [mailto:heintzphp
mail.groupm7.com]
Sent: Friday, May 31, 2002 4:43 PM
To: Scott
Cc: php-general
lists.php.net
Subject: Re: [PHP] Re: Parsing file's
You may have been heading in the right direction originally with array_slice... This is off the top of my head, I don't guaruntee it will work...
$start = 34; $interval = 15; $max = 303; // hop across orig. array 15 columns at a time for($offset = $start; $offset < $max && isset($array[$offset]); $offset += $interval){ // slice off $interval many columns starting at $offset $sub_array = array_slice($array, $i, $interval); // handle your $interval many key-value pairs foreach ($sub_array as $key => $value){ $policyWriter = "$quoteKey|$key|$value"; // ... } }
mh.
attached mail follows:
Hey Everyone,
Been going through the manual and the book "PHP BlackBook" and am totally confused about sessions.
Searched google and found a couple of places that seem to be offering lessons but dont know which is good as there are so many results.....
Has anybody here used an online turoral that they feel is good for a newbie or has done wonders in helping you on when you were learning php? if so please send me the website name / URL.
Something that will take me baby steps.....:-0)
Thanks in advance. -Ryan.
attached mail follows:
sitepoint.com has a nice one on restricting pages with login/sessions, etc by Kevin Yank.
Justin French
on 03/06/02 8:38 PM, r (r
jumac.com) wrote:
> Hey Everyone, > > Been going through the manual and the book "PHP BlackBook" and am totally > confused about sessions. > > Searched google and found a couple of places that seem to be offering > lessons but dont know which is good as there are so many results..... > > Has anybody here used an online turoral that they feel is good for a newbie > or has done wonders in helping you on when you were learning php? if so > please send me the website name / URL. > > Something that will take me baby steps.....:-0) > > Thanks in advance. > -Ryan. >
attached mail follows:
> Has anybody here used an online turoral that they feel is > good for a newbie or has done wonders in helping you on when > you were learning php? if so please send me the website name / URL.
http://www.devshed.com/Server_Side/PHP/UserAuth/page1.html
I found this one quite good - not so much sessions by themselves but rather a practical application that works and that gave me something to play around with.
CYA, Dave
attached mail follows:
At 08:32 AM 6/3/2002 +1000, Justin French posted the following... >sitepoint.com has a nice one on restricting pages with login/sessions, etc >by Kevin Yank.
http://www.WebmasterBase.com/article/319
Is that the one you're referring to, Justin? It seems pretty good.. :)
Glenn
--- The original portions of this message are the copyright of the author (c)1998-2002 Glenn E. Sieb. ICQ UIN: 300395 IRC Nick: Rainbear "All acts of Love and Pleasure are Her rituals"-Charge of the Goddess
attached mail follows:
YES
It's been the basis of everything I've done so far with sessions.
Justin
on 03/06/02 9:05 AM, Glenn Sieb (rainbear
optonline.net) wrote:
> At 08:32 AM 6/3/2002 +1000, Justin French posted the following... >> sitepoint.com has a nice one on restricting pages with login/sessions, etc >> by Kevin Yank. > > > http://www.WebmasterBase.com/article/319 > > Is that the one you're referring to, Justin? It seems pretty good.. :) > > Glenn
attached mail follows:
The next time I stare at something so long I can't think straight remind me to take a walk and pull out Rasmus' book! Page 121 array_chunk is my friend!
Code is ugly, but I am smiling now! Thank you everyone!
$policy = array_slice ($fields, 18, $lineCount); // I am taking the array from position 18 to the end $chunks = array_chunk ($policy, 34); // Using array_chunk I break the array into pieces of 34 foreach ($chunks as $key => $value){ print_r($chunks); sleep(5); } // The sleep is for me to watch it fly by the screen :)
Thanks again everyone.
-Scott
-----Original Message-----
From: Scott [mailto:scott
scottah.com]
Sent: Sunday, June 02, 2002 4:57 PM
To: 'Mark Heintz PHP Mailing Lists'
Cc: php-general
lists.php.net
Subject: RE: [PHP] Re: Parsing file's
Ok, this did not work, but I have a new idea. From the top....
1)Read in the csv file, take the first 18 records and insert them into a temp db. Ie: $output = array_slice ($fields, 0, 17);
2)Then do a count on the line to see how many records are after 17 and somehow loop through them 34 at a time.
It is easy if there is only one set, but I am not sure how to take the remaining elements in the array and break them out 34 at a time until I reach the end of the line.
Help, my head hurts and I have a habit of over thinking :)
-Scott
-----Original Message-----
From: Mark Heintz PHP Mailing Lists [mailto:heintzphp
mail.groupm7.com]
Sent: Friday, May 31, 2002 4:43 PM
To: Scott
Cc: php-general
lists.php.net
Subject: Re: [PHP] Re: Parsing file's
You may have been heading in the right direction originally with array_slice... This is off the top of my head, I don't guaruntee it will work...
$start = 34; $interval = 15; $max = 303; // hop across orig. array 15 columns at a time for($offset = $start; $offset < $max && isset($array[$offset]); $offset += $interval){ // slice off $interval many columns starting at $offset $sub_array = array_slice($array, $i, $interval); // handle your $interval many key-value pairs foreach ($sub_array as $key => $value){ $policyWriter = "$quoteKey|$key|$value"; // ... } }
mh.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
I've noticed that many people on the list code in 'pure' php, i.e.
<? print "<input type='text' name='fname' size='50'>";
// etc ?>
Since most of my code is a mixture (the early stuff is 'mixed' html + php), I've been wondering why code in 'pure' php? Is there some compelling reason (that I'm unaware of) for doing so? Should I rewrite all my earlier code into its 'pure' form? If so, what do I do with the '<! DOCTYPE . . . > statement -- put it in quotes too?
I would like to understand the reasons for writing code in this manner, when all my code works fine, displays great: am I missing something important here? Btw, I use the 'php' ending for all file names.
Your thoughts, opinions and suggestions would be greatly appreciated -- I'd like to do what is best.
Tia, Andre
-- Please pray the Holy Rosary to end the holocaust of abortion. Remember in your prayers the Holy Souls in Purgatory.May God bless you abundantly in His love! For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/
attached mail follows:
No *real* reason - just two not-so-important ones:
1. Clarity Please compare these two: ------ "MIXED" <td bgcolor="<?php echo $td_col; ?>" class="<?php echo $prefclass; ?>"> <?php $fldcontent=$myrow[0]?$myrow[0]:"no data"; ?> <input type="text" name="fname" size="50" value="<?php echo $fldcontent; ?>"> </td>
------ "PURE" <?php echo("<td bgcolor='$td_col' class='$prefclass'>\n"); $fldcontent=$myrow[0]?$myrow[0]:"no data"; echo("<input type='text' name='fname' size='50' value='$fldcontent'>\n"); ?>
The second is much easier to read and understand, you must agree.
2. Speed There's an urban legend saying that switching php tags on and off would slow parsing down. I don't know if that's true and try to write "pure" php as you call it due to the first reason.
Bogdan
Andre Dubuc wrote:
>I've noticed that many people on the list code in 'pure' php, i.e. > ><? >print "<input type='text' name='fname' size='50'>"; > >// etc >?> > >Since most of my code is a mixture (the early stuff is 'mixed' html + php), >I've been wondering why code in 'pure' php? Is there some compelling reason >(that I'm unaware of) for doing so? Should I rewrite all my earlier code into >its 'pure' form? If so, what do I do with the '<! DOCTYPE . . . > statement >-- put it in quotes too? > >I would like to understand the reasons for writing code in this manner, when >all my code works fine, displays great: am I missing something important >here? Btw, I use the 'php' ending for all file names. > >Your thoughts, opinions and suggestions would be greatly appreciated -- I'd >like to do what is best. > >Tia, >Andre > > >
attached mail follows:
Thanks Bogdan,
That's what I thought, but I was beginning to feel 'guilty' the more I understood php. It seems to me, from my limited experience, that there's much mor chance for error using 'pure' php (as in forgetting ' or " or closing with ; -- but . . .
Actually I've found that the 'mixed' is easier to read and understand -- less quotes, less 'print' to read with every line. But that's just personal taste on my part.
While I'm at it, I've also noticed that coders tend to integrate 'result' pages with the 'calling' page. (That is, I have a text input, and use a php function to verify it on the same page). I've tended to keep them separate for de-bugging purposes. Should I consider re-writing them as well?
Regards, Andre
On Sunday 02 June 2002 08:16 pm, you wrote: > No *real* reason - just two not-so-important ones: > > 1. Clarity > Please compare these two: > ------ "MIXED" > <td bgcolor="<?php echo $td_col; ?>" class="<?php echo $prefclass; ?>"> > <?php $fldcontent=$myrow[0]?$myrow[0]:"no data"; ?> > <input type="text" name="fname" size="50" value="<?php echo $fldcontent; > ?>"> > </td> > > ------ "PURE" > <?php > echo("<td bgcolor='$td_col' class='$prefclass'>\n"); > $fldcontent=$myrow[0]?$myrow[0]:"no data"; > echo("<input type='text' name='fname' size='50' value='$fldcontent'>\n"); > ?> > > The second is much easier to read and understand, you must agree. > > 2. Speed > There's an urban legend saying that switching php tags on and off would > slow parsing down. I don't know if that's true and try to write "pure" > php as you call it due to the first reason. > > Bogdan > > Andre Dubuc wrote: > >I've noticed that many people on the list code in 'pure' php, i.e. > > > ><? > >print "<input type='text' name='fname' size='50'>"; > > > >// etc > >?> > > > >Since most of my code is a mixture (the early stuff is 'mixed' html + > > php), I've been wondering why code in 'pure' php? Is there some > > compelling reason (that I'm unaware of) for doing so? Should I rewrite > > all my earlier code into its 'pure' form? If so, what do I do with the > > '<! DOCTYPE . . . > statement -- put it in quotes too? > > > >I would like to understand the reasons for writing code in this manner, > > when all my code works fine, displays great: am I missing something > > important here? Btw, I use the 'php' ending for all file names. > > > >Your thoughts, opinions and suggestions would be greatly appreciated -- > > I'd like to do what is best. > > > >Tia, > >Andre
-- Please pray the Holy Rosary to end the holocaust of abortion. Remember in your prayers the Holy Souls in Purgatory.May God bless you abundantly in His love! For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/
attached mail follows:
On Sunday 02 June 2002 08:13 pm, you wrote: > On Sun, Jun 02, 2002 at 07:55:09PM -0400, Andre Dubuc wrote: > > I've noticed that many people on the list code in 'pure' php, i.e. > > > > <? > > print "<input type='text' name='fname' size='50'>"; > > > > // etc > > ?> > > > > Since most of my code is a mixture (the early stuff is 'mixed' html + > > php), I've been wondering why code in 'pure' php? Is there some > > compelling reason (that I'm unaware of) for doing so? Should I rewrite > > all my earlier code into its 'pure' form? If so, what do I do with the > > '<! DOCTYPE . . . > statement -- put it in quotes too? > > > > I would like to understand the reasons for writing code in this manner, > > when all my code works fine, displays great: am I missing something > > important here? Btw, I use the 'php' ending for all file names. > > > > Your thoughts, opinions and suggestions would be greatly appreciated -- > > I'd like to do what is best. > > > > Tia, > > Andre > > ---end quoted text--- > > I don't know, but i prefer coding in mixed way.. to avoid excessive > escaping at html tags and other.. > > []'s
Thanks Marcelo,
Precisely my feelings as well. Looks cleaner since I can spot the divisions quite readily (no "print . . . ;" in the code).
Regards, Andre
-- Please pray the Holy Rosary to end the holocaust of abortion. Remember in your prayers the Holy Souls in Purgatory.May God bless you abundantly in His love! For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/
attached mail follows:
I'm not sure what you mean... Is it checking that you fill in the correct values via PHP or that the submission works - or something else?
Bogdan
Andre Dubuc wrote:
>Thanks Bogdan, > >That's what I thought, but I was beginning to feel 'guilty' the more I >understood php. It seems to me, from my limited experience, that there's much >mor chance for error using 'pure' php (as in forgetting ' or " or closing >with ; -- but . . . > >Actually I've found that the 'mixed' is easier to read and understand -- less >quotes, less 'print' to read with every line. But that's just personal taste >on my part. > >While I'm at it, I've also noticed that coders tend to integrate 'result' >pages with the 'calling' page. (That is, I have a text input, and use a php >function to verify it on the same page). I've tended to keep them separate >for de-bugging purposes. Should I consider re-writing them as well? > >Regards, >Andre > >On Sunday 02 June 2002 08:16 pm, you wrote: > > >>No *real* reason - just two not-so-important ones: >> >>1. Clarity >>Please compare these two: >>------ "MIXED" >><td bgcolor="<?php echo $td_col; ?>" class="<?php echo $prefclass; ?>"> >><?php $fldcontent=$myrow[0]?$myrow[0]:"no data"; ?> >><input type="text" name="fname" size="50" value="<?php echo $fldcontent; >>?>"> >></td> >> >>------ "PURE" >><?php >> echo("<td bgcolor='$td_col' class='$prefclass'>\n"); >> $fldcontent=$myrow[0]?$myrow[0]:"no data"; >> echo("<input type='text' name='fname' size='50' value='$fldcontent'>\n"); >>?> >> >>The second is much easier to read and understand, you must agree. >> >>2. Speed >>There's an urban legend saying that switching php tags on and off would >>slow parsing down. I don't know if that's true and try to write "pure" >>php as you call it due to the first reason. >> >>Bogdan >> >>Andre Dubuc wrote: >> >> >>>I've noticed that many people on the list code in 'pure' php, i.e. >>> >>><? >>>print "<input type='text' name='fname' size='50'>"; >>> >>>// etc >>>?> >>> >>>Since most of my code is a mixture (the early stuff is 'mixed' html + >>>php), I've been wondering why code in 'pure' php? Is there some >>>compelling reason (that I'm unaware of) for doing so? Should I rewrite >>>all my earlier code into its 'pure' form? If so, what do I do with the >>>'<! DOCTYPE . . . > statement -- put it in quotes too? >>> >>>I would like to understand the reasons for writing code in this manner, >>>when all my code works fine, displays great: am I missing something >>>important here? Btw, I use the 'php' ending for all file names. >>> >>>Your thoughts, opinions and suggestions would be greatly appreciated -- >>>I'd like to do what is best. >>> >>>Tia, >>>Andre >>> >>> > > >
attached mail follows:
However...
From the point of view of someone who has worked in a company where diesign is separated from development, it is much better to have separate files with HTML templates with special markers (in the library I use, it is HTML comments <!--element_to_replace-->) so that the two processes are adequately separated.
When all of the HTML is embedded in PHP staements, minor changes to HTML layout involve a PHP developer, whereas with template based strategies all they have to do is change the template.
I believe that 'smarty' is the "approved" template libray, but there are several other worth investigating.
Mikey
"Bogdan Stancescu" <mgv
fx.ro> wrote in message
news:3CFAB54A.7040109
fx.ro...
> No *real* reason - just two not-so-important ones:
>
> 1. Clarity
> Please compare these two:
> ------ "MIXED"
> <td bgcolor="<?php echo $td_col; ?>" class="<?php echo $prefclass; ?>">
> <?php $fldcontent=$myrow[0]?$myrow[0]:"no data"; ?>
> <input type="text" name="fname" size="50" value="<?php echo $fldcontent;
> ?>">
> </td>
>
> ------ "PURE"
> <?php
> echo("<td bgcolor='$td_col' class='$prefclass'>\n");
> $fldcontent=$myrow[0]?$myrow[0]:"no data";
> echo("<input type='text' name='fname' size='50'
value='$fldcontent'>\n");
> ?>
>
> The second is much easier to read and understand, you must agree.
>
> 2. Speed
> There's an urban legend saying that switching php tags on and off would
> slow parsing down. I don't know if that's true and try to write "pure"
> php as you call it due to the first reason.
>
> Bogdan
>
> Andre Dubuc wrote:
>
> >I've noticed that many people on the list code in 'pure' php, i.e.
> >
> ><?
> >print "<input type='text' name='fname' size='50'>";
> >
> >// etc
> >?>
> >
> >Since most of my code is a mixture (the early stuff is 'mixed' html +
php),
> >I've been wondering why code in 'pure' php? Is there some compelling
reason
> >(that I'm unaware of) for doing so? Should I rewrite all my earlier code
into
> >its 'pure' form? If so, what do I do with the '<! DOCTYPE . . . >
statement
> >-- put it in quotes too?
> >
> >I would like to understand the reasons for writing code in this manner,
when
> >all my code works fine, displays great: am I missing something important
> >here? Btw, I use the 'php' ending for all file names.
> >
> >Your thoughts, opinions and suggestions would be greatly appreciated --
I'd
> >like to do what is best.
> >
> >Tia,
> >Andre
> >
> >
> >
>
>
>
attached mail follows:
That's what I meant. I was referring to verification/validation scripts for user inputs. I've made a separate page that runs these routines. I have a feeling I should have incorporated them on the user input page . . . but does it really amtter if they're on another page?
Andre
On Sunday 02 June 2002 08:32 pm, you wrote: > I'm not sure what you mean... Is it checking that you fill in the > correct values via PHP or that the submission works - or something else? > > Bogdan > > Andre Dubuc wrote: > >Thanks Bogdan, > > > >That's what I thought, but I was beginning to feel 'guilty' the more I > >understood php. It seems to me, from my limited experience, that there's > > much mor chance for error using 'pure' php (as in forgetting ' or " or > > closing with ; -- but . . . > > > >Actually I've found that the 'mixed' is easier to read and understand -- > > less quotes, less 'print' to read with every line. But that's just > > personal taste on my part. > > > >While I'm at it, I've also noticed that coders tend to integrate 'result' > >pages with the 'calling' page. (That is, I have a text input, and use a > > php function to verify it on the same page). I've tended to keep them > > separate for de-bugging purposes. Should I consider re-writing them as > > well? > > > >Regards, > >Andre > > > >On Sunday 02 June 2002 08:16 pm, you wrote: > >>No *real* reason - just two not-so-important ones: > >> > >>1. Clarity > >>Please compare these two: > >>------ "MIXED" > >><td bgcolor="<?php echo $td_col; ?>" class="<?php echo $prefclass; ?>"> > >><?php $fldcontent=$myrow[0]?$myrow[0]:"no data"; ?> > >><input type="text" name="fname" size="50" value="<?php echo $fldcontent; > >>?>"> > >></td> > >> > >>------ "PURE" > >><?php > >> echo("<td bgcolor='$td_col' class='$prefclass'>\n"); > >> $fldcontent=$myrow[0]?$myrow[0]:"no data"; > >> echo("<input type='text' name='fname' size='50' > >> value='$fldcontent'>\n"); ?> > >> > >>The second is much easier to read and understand, you must agree. > >> > >>2. Speed > >>There's an urban legend saying that switching php tags on and off would > >>slow parsing down. I don't know if that's true and try to write "pure" > >>php as you call it due to the first reason. > >> > >>Bogdan > >> > >>Andre Dubuc wrote: > >>>I've noticed that many people on the list code in 'pure' php, i.e. > >>> > >>><? > >>>print "<input type='text' name='fname' size='50'>"; > >>> > >>>// etc > >>>?> > >>> > >>>Since most of my code is a mixture (the early stuff is 'mixed' html + > >>>php), I've been wondering why code in 'pure' php? Is there some > >>>compelling reason (that I'm unaware of) for doing so? Should I rewrite > >>>all my earlier code into its 'pure' form? If so, what do I do with the > >>>'<! DOCTYPE . . . > statement -- put it in quotes too? > >>> > >>>I would like to understand the reasons for writing code in this manner, > >>>when all my code works fine, displays great: am I missing something > >>>important here? Btw, I use the 'php' ending for all file names. > >>> > >>>Your thoughts, opinions and suggestions would be greatly appreciated -- > >>>I'd like to do what is best. > >>> > >>>Tia, > >>>Andre
-- Please pray the Holy Rosary to end the holocaust of abortion. Remember in your prayers the Holy Souls in Purgatory.May God bless you abundantly in His love! For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/
attached mail follows:
I would ask the question "How much HTML before you break out of PHP and into HTML". My answer is "any". Surely you're making the engine work just to echo stuff out? But are you asking for more by making it jump in and out between all those tags?!
Short tags ...
<td bgcolor="<?=$td_col?>" class="<?=$prefclass?>">
... easier to read in Mixed? I think so.
Also, "pure" coding breaks the HTML syntax coloring in my text editor!
Simon
> Thanks Bogdan, > > That's what I thought, but I was beginning to feel 'guilty' the more I > understood php. It seems to me, from my limited experience, that there's much > mor chance for error using 'pure' php (as in forgetting ' or " or closing > with ; -- but . . . > > Actually I've found that the 'mixed' is easier to read and understand -- less > quotes, less 'print' to read with every line. But that's just personal taste > on my part. > > While I'm at it, I've also noticed that coders tend to integrate 'result' > pages with the 'calling' page. (That is, I have a text input, and use a php > function to verify it on the same page). I've tended to keep them separate > for de-bugging purposes. Should I consider re-writing them as well? > > Regards, > Andre > > On Sunday 02 June 2002 08:16 pm, you wrote: >> No *real* reason - just two not-so-important ones: >> >> 1. Clarity >> Please compare these two: >> ------ "MIXED" >> <td bgcolor="<?php echo $td_col; ?>" class="<?php echo $prefclass; ?>"> >> <?php $fldcontent=$myrow[0]?$myrow[0]:"no data"; ?> >> <input type="text" name="fname" size="50" value="<?php echo $fldcontent; >> ?>"> >> </td> >> >> ------ "PURE" >> <?php >> echo("<td bgcolor='$td_col' class='$prefclass'>\n"); >> $fldcontent=$myrow[0]?$myrow[0]:"no data"; >> echo("<input type='text' name='fname' size='50' value='$fldcontent'>\n"); >> ?> >> >> The second is much easier to read and understand, you must agree. >> >> 2. Speed >> There's an urban legend saying that switching php tags on and off would >> slow parsing down. I don't know if that's true and try to write "pure" >> php as you call it due to the first reason. >> >> Bogdan >> >> Andre Dubuc wrote: >>> I've noticed that many people on the list code in 'pure' php, i.e. >>> >>> <? >>> print "<input type='text' name='fname' size='50'>"; >>> >>> // etc >>> ?> >>> >>> Since most of my code is a mixture (the early stuff is 'mixed' html + >>> php), I've been wondering why code in 'pure' php? Is there some >>> compelling reason (that I'm unaware of) for doing so? Should I rewrite >>> all my earlier code into its 'pure' form? If so, what do I do with the >>> '<! DOCTYPE . . . > statement -- put it in quotes too? >>> >>> I would like to understand the reasons for writing code in this manner, >>> when all my code works fine, displays great: am I missing something >>> important here? Btw, I use the 'php' ending for all file names. >>> >>> Your thoughts, opinions and suggestions would be greatly appreciated -- >>> I'd like to do what is best. >>> >>> Tia, >>> Andre
attached mail follows:
Thanks Michael,
Point well-made. I suppose doing it the mixed way might have repercussions later on if/when the site grows. Perhaps while the code is still fresh in my mid, it might be worth the effort to separate it.
However, for a good part of the site, I've used CSS for appearance details, and controlling a lot of stuff that changes from page-to-page. It's very easy to change all or some of the pages from the CSS scripts. But, for the most part, not much of the actual php scripts COULD change, so that's why I've never bothered to separate html from php. Perhaps I wrong, but . . .
Regards, Andre
On Sunday 02 June 2002 08:36 pm, you wrote:
> However...
>
> From the point of view of someone who has worked in a company where diesign
> is separated from development, it is much better to have separate files
> with HTML templates with special markers (in the library I use, it is HTML
> comments <!--element_to_replace-->) so that the two processes are
> adequately separated.
>
> When all of the HTML is embedded in PHP staements, minor changes to HTML
> layout involve a PHP developer, whereas with template based strategies all
> they have to do is change the template.
>
> I believe that 'smarty' is the "approved" template libray, but there are
> several other worth investigating.
>
> Mikey
> "Bogdan Stancescu" <mgv
fx.ro> wrote in message
> news:3CFAB54A.7040109
fx.ro...
>
> > No *real* reason - just two not-so-important ones:
> >
> > 1. Clarity
> > Please compare these two:
> > ------ "MIXED"
> > <td bgcolor="<?php echo $td_col; ?>" class="<?php echo $prefclass; ?>">
> > <?php $fldcontent=$myrow[0]?$myrow[0]:"no data"; ?>
> > <input type="text" name="fname" size="50" value="<?php echo $fldcontent;
> > ?>">
> > </td>
> >
> > ------ "PURE"
> > <?php
> > echo("<td bgcolor='$td_col' class='$prefclass'>\n");
> > $fldcontent=$myrow[0]?$myrow[0]:"no data";
> > echo("<input type='text' name='fname' size='50'
>
> value='$fldcontent'>\n");
>
> > ?>
> >
> > The second is much easier to read and understand, you must agree.
> >
> > 2. Speed
> > There's an urban legend saying that switching php tags on and off would
> > slow parsing down. I don't know if that's true and try to write "pure"
> > php as you call it due to the first reason.
> >
> > Bogdan
> >
> > Andre Dubuc wrote:
> > >I've noticed that many people on the list code in 'pure' php, i.e.
> > >
> > ><?
> > >print "<input type='text' name='fname' size='50'>";
> > >
> > >// etc
> > >?>
> > >
> > >Since most of my code is a mixture (the early stuff is 'mixed' html +
>
> php),
>
> > >I've been wondering why code in 'pure' php? Is there some compelling
>
> reason
>
> > >(that I'm unaware of) for doing so? Should I rewrite all my earlier code
>
> into
>
> > >its 'pure' form? If so, what do I do with the '<! DOCTYPE . . . >
>
> statement
>
> > >-- put it in quotes too?
> > >
> > >I would like to understand the reasons for writing code in this manner,
>
> when
>
> > >all my code works fine, displays great: am I missing something important
> > >here? Btw, I use the 'php' ending for all file names.
> > >
> > >Your thoughts, opinions and suggestions would be greatly appreciated --
>
> I'd
>
> > >like to do what is best.
> > >
> > >Tia,
> > >Andre
-- Please pray the Holy Rosary to end the holocaust of abortion. Remember in your prayers the Holy Souls in Purgatory.May God bless you abundantly in His love! For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/
attached mail follows:
> I've noticed that many people on the list code in 'pure' php, i.e. > > <? > print "<input type='text' name='fname' size='50'>"; > > // etc > ?>
Personally, it depends on what I'm doing. I find that excessive use of <? And ?> in my code gets distracting so if I need a lot of php code I will usually put the straight html into echo/print strings. If I'm doing something that is predominantly html with only a few php variables or some such then I'll do it mostly in html.
Often if there's just a php code block I'll move it into an include and then just include it in normal html. This helps readability and lets me separate some of the layout aspects from the code logic aspects.
In the end if it's valid it will work. My only real decision is based on readability for my own purposes.
CYA, Dave
attached mail follows:
No, it doesn't - just go with whatever's simpler for you... and with what matches your application better - I don't think this does matter at all.
Bogdan
Andre Dubuc wrote:
>That's what I meant. I was referring to verification/validation scripts for >user inputs. I've made a separate page that runs these routines. I have a >feeling I should have incorporated them on the user input page . . . but >does it really amtter if they're on another page? > >Andre > >On Sunday 02 June 2002 08:32 pm, you wrote: > > >>I'm not sure what you mean... Is it checking that you fill in the >>correct values via PHP or that the submission works - or something else? >> >>Bogdan >