OSEC

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 9 May 2003 08:58:18 -0000 Issue 2046

php-general-digest-helplists.php.net
Date: Fri May 09 2003 - 03:58:18 CDT


php-general Digest 9 May 2003 08:58:18 -0000 Issue 2046

Topics (messages 146912 through 146983):

Read A Text File With Paging
        146912 by: Jerry Alan Braga

Re: variables wont' carry over to the next page
        146913 by: R'twick Niceorgaw

Re: MySql question
        146914 by: Jason Wong
        146915 by: Sparky Kopetzky
        146917 by: Jason Wong
        146919 by: sysadmin.saginawcontrol.com

Re: Zend encoding and security
        146916 by: Greg Donald

PHP5 Resources
        146918 by: Ryan Sarver
        146943 by: Justin French

Re: MySql question (additional info)
        146920 by: Sparky Kopetzky
        146921 by: Cal Evans
        146968 by: Joel Rees

Connections to two databases in the same script
        146922 by: Chris Cameron
        146927 by: Kevin Stone

Re: newbie question on PHP and PostgreSQL
        146923 by: m

reminder needed please...
        146924 by: Ryan A
        146926 by: Ernest E Vogelsinger
        146928 by: Kevin Stone
        146929 by: Ryan A
        146934 by: Pablo
        146956 by: Jennifer Goodie

Re: PHP newbie: I love it, but...
        146925 by: Miles Thompson
        146979 by: Marco Schuler

How to avoid maximum time
        146930 by: Nico Jansen - NiRo IT Consultants B.V.
        146933 by: Ernest E Vogelsinger
        146936 by: aaron lake
        146938 by: daniel.electroteque.org
        146940 by: Nico Jansen - NiRo IT Consultants B.V.

Re: PHP & Java, calling a static method
        146931 by: Chris McCluskey

[Newbie] Questions...
        146932 by: The Head Sage
        146935 by: Ernest E Vogelsinger
        146937 by: The Head Sage
        146939 by: Leif K-Brooks

Timestamps
        146941 by: The Head Sage
        146948 by: Justin French
        146962 by: Tom Rogers

Re: Global Interference
        146942 by: Justin French

unset array element in an object
        146944 by: xpto

looping over field, keyword arrays to generate sql
        146945 by: Joseph Blythe
        146980 by: James

Re: Quick session var ?
        146946 by: Justin French
        146947 by: Justin French

Which way is better?
        146949 by: Ben Cheng
        146951 by: Joseph Blythe
        146953 by: Justin French
        146955 by: Greg Donald
        146957 by: Justin French
        146967 by: Peter Schoenster
        146969 by: Justin French

Re: SESSIONS HELP
        146950 by: Jennifer Goodie

referrer
        146952 by: Ryan A
        146974 by: Jason Wong

Re: How to preserve instance of class within sessions ???
        146954 by: Jennifer Goodie

formatting sporadic date formats from access
        146958 by: daniel.electroteque.org
        146959 by: Joseph Blythe
        146970 by: Joseph Blythe

Re: Counter
        146960 by: John Hicks
        146961 by: Jennifer Goodie

text version of hit counter...
        146963 by: Prince
        146964 by: Justin French

$_SESSION issues
        146965 by: Shawn McKenzie
        146966 by: Shawn McKenzie

What is the diferent with request and include?
        146971 by: Rommel Samanez

variables in not working in next page
        146972 by: christian tischler
        146973 by: Martin Towell
        146977 by: christian tischler
        146981 by: James

Start up with ClibPDF functions
        146975 by: Sephiroth
        146976 by: Jason Wong
        146978 by: Sephiroth
        146982 by: Sephiroth

Button Creation Backfiring
        146983 by: Chris Blake

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


I am trying to read text files using a Previous Next style. Does anyone have
a sample of doing this ?

attached mail follows:


Hi Philip,
please reply to the list since

1. I didn't ask the question. I marely answered to another post. So now the
original poster will never know about your reply.

2. It may help some one else on the list.

R'twick
----- Original Message -----
From: "Philip Olson" <philipcornado.com>
To: "R'twick Niceorgaw" <publicutkalika.net>
Sent: Thursday, May 08, 2003 4:42 PM
Subject: Re: [PHP] Re: variables wont' carry over to the next page

>
> Read this:
>
> http://www.php.net/variables.external
>
> It will tell you exactly how to do it and keep
> in mind that your setup now has the PHP directive
> register_globals off.
>
> Regards,
> Philip
>
>
>
>
>

attached mail follows:


On Friday 09 May 2003 04:48, Sparky Kopetzky wrote:

> Does this mean that MySql access is NOT installed on the PHP 4.0.3 on my
> Apache server??

Yes.

> Fatal error: Call to undefined function: mysql_connect() in

Searching the archives on the above error would have told you that.

> If so, can I correct it some way other than completely recompiling Apache,
> which I neither have time not the skills to do??

Depends on how php was installed. Again, refer to the archives for the various
solutions.

--
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
------------------------------------------
/*
Blow it out your ear.
*/

attached mail follows:


Searched the archives and received no hits on the search. Now what?

Sparky

----- Original Message -----
From: Jason Wong <php-generalgremlins.biz>
To: <php-generallists.php.net>
Sent: Thursday, May 08, 2003 14:50
Subject: Re: [PHP] MySql question

> On Friday 09 May 2003 04:48, Sparky Kopetzky wrote:
>
> > Does this mean that MySql access is NOT installed on the PHP 4.0.3 on my
> > Apache server??
>
> Yes.
>
> > Fatal error: Call to undefined function: mysql_connect() in
>
> Searching the archives on the above error would have told you that.
>
> > If so, can I correct it some way other than completely recompiling
Apache,
> > which I neither have time not the skills to do??
>
> Depends on how php was installed. Again, refer to the archives for the
various
> solutions.
>
> --
> 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
> ------------------------------------------
> /*
> Blow it out your ear.
> */
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

attached mail follows:


On Friday 09 May 2003 05:04, Sparky Kopetzky wrote:
> Searched the archives and received no hits on the search. Now what?

What exactly did you search for?

And, if you're using the archives at marc.theaimsgroup.com which of the words
from your search term did the search interface actually search for? Bearing
in mind that the search interface limits the length of your search term and
also it does not understand the underscore.

Being creative, I searched for "Call to undefined function mysql" and got
*plenty* of useful posts.

And don't forget google.

--
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
------------------------------------------
/*
Do not underestimate the power of the Force.
*/

attached mail follows:


You don't have to recompile Apache, you should just be able to
recompile PHP and you should be good to go...

-----Original Message-----
From: Sparky Kopetzky [mailto:sparkykblackmesa-isp.net]
Sent: Thursday, May 08, 2003 4:05 PM
To: php-generallists.php.net
Subject: Re: [PHP] MySql question

Searched the archives and received no hits on the search. Now what?

Sparky

----- Original Message -----
From: Jason Wong <php-generalgremlins.biz>
To: <php-generallists.php.net>
Sent: Thursday, May 08, 2003 14:50
Subject: Re: [PHP] MySql question

> On Friday 09 May 2003 04:48, Sparky Kopetzky wrote:
>
> > Does this mean that MySql access is NOT installed on the PHP 4.0.3
on my
> > Apache server??
>
> Yes.
>
> > Fatal error: Call to undefined function: mysql_connect() in
>
> Searching the archives on the above error would have told you that.
>
> > If so, can I correct it some way other than completely recompiling
Apache,
> > which I neither have time not the skills to do??
>
> Depends on how php was installed. Again, refer to the archives for the
various
> solutions.
>
> --
> 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
> ------------------------------------------
> /*
> Blow it out your ear.
> */
>
>
> --
> 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:


> http://www.turcksoft.com/en/e_mmc.htm

Hey.. just wanted to say thanks for the URL. I just installed Turck MMCache
and the speed-up is fairly noticable. The included stats/control page shows
lots of "usage" :)

As a side note I upgraded to MySQL 4 last night and configured query caching.
Today my site is lots faster and server load is a bit lower.

--
Greg Donald
http://destiney.com/

attached mail follows:


Anyone know of a good site that is a resource for PHP5 development. I am
beginning a project that we are going to use PHP5 on, but wanted to have a
decent reference of the new features and how to utilize them.

Thanks, Ryan

attached mail follows:


Have you checked the archives? The feature set is requested every couple of
days:
http://marc.theaimsgroup.com/?l=php-general&w=2&r=1&s=PHP5&q=t

Did you check Zend? There's some notes there about the new features
http://www.zend.com/zend/future.php

But I think if you're looking for a manual, or even anything concrete, maybe
it's a little too early... Really, there's no Beta or even Alpha download on
php.net, so it's fair to say a LOT could change ALL THE TIME.

The other place you could have a dig is cvs.php.net, to see if there's any
documentation there, but I have no idea if that is a good idea, or if you'll
find anything you want.

Justin

on 09/05/03 8:23 AM, Ryan Sarver (ryanexit33.net) wrote:

> Anyone know of a good site that is a resource for PHP5 development. I am
> beginning a project that we are going to use PHP5 on, but wanted to have a
> decent reference of the new features and how to utilize them.
>
> Thanks, Ryan
>
>

attached mail follows:


It's me again...

Ok. PHP is compiled with MySql installed according to phpinfo().

Configure Command './configure' '--host=i686-pc-linux-gnu'
'--build=i686-pc-linux-gnu' '--target=i386-redhat-linux-gnu'
'--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin'
'--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share'
'--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec'
'--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man'
'--infodir=/usr/share/info' '--prefix=/usr' '--with-config-file-path=/etc'
'--enable-force-cgi-redirect' '--disable-debug' '--enable-pic'
'--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-db3'
'--with-curl' '--with-dom=/usr' '--with-exec-dir=/usr/bin'
'--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd'
'--enable-gd-native-ttf' '--with-ttf' '--with-gdbm' '--with-gettext'
'--with-ncurses' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr'
'--with-openssl' '--with-png' '--with-pspell' '--with-regex=system'
'--with-xml' '--with-expat-dir=/usr' '--with-zlib' '--with-layout=GNU'
'--enable-bcmath' '--enable-exif' '--enable-ftp' '--enable-magic-quotes'
'--enable-safe-mode' '--enable-sockets' '--enable-sysvsem'
'--enable-sysvshm' '--enable-discard-path' '--enable-track-vars'
'--enable-trans-sid' '--enable-yp' '--enable-wddx' '--without-oci8'
'--with-pear=/usr/share/pear' '--with-imap=shared' '--with-imap-ssl'
'--with-kerberos=/usr/kerberos' '--with-ldap=shared'***********>>
'--with-mysql=shared,/usr'<<************** '--with-pgsql=shared'
'--with-snmp=shared,/usr' '--with-snmp=shared' '--enable-ucd-snmp-hack'
'--with-unixODBC=shared' '--enable-memory-limit' '--enable-bcmath'
'--enable-shmop' '--enable-versioning' '--enable-calendar' '--enable-dbx'
'--enable-dio' '--enable-mcal' '--with-apxs2=/usr/sbin/apxs'

My php.ini section for mysql is:
; Default port number for mysql_connect(). If unset, mysql_connect() will
use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order). Win32 will only
look
; at MYSQL_PORT.
mysql.default_port = 3306

; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
mysql.default_socket =

; Default host for mysql_connect() (doesn't apply in safe mode).
mysql.default_host = development.blackmesa-isp.net

; Default user for mysql_connect() (doesn't apply in safe mode).
mysql.default_user =

The php code to access mysql:
$user = 'developer';
$pass = 'password';
$host = 'development.blackmesa-isp.net';

$db = mysql_connect($host, $user, $pass);

Now, I'm trying to access mysql on a different server than the web server.
'development' is a temporary Windows machine for development. Only thing I
can think of that is causing the problem is the host string is wrong.

Appreciate any help on this.

Robin 'Sparky' Kopetzky

attached mail follows:


Sparky,

Yes, your host must point to either the name or the ip address of the
server.
Also, make sure the userhost and database exist on the new server.

=C=
* Cal Evans
* http://www.christianperformer.com
* Stay plugged into your audience
* The measure of a programmer is not the number of lines of code he writes
but the number of lines he does not have to write.
*

>
> Now, I'm trying to access mysql on a different server than the web server.
> 'development' is a temporary Windows machine for development. Only thing I
> can think of that is causing the problem is the host string is wrong.
>
> Appreciate any help on this.
>
> Robin 'Sparky' Kopetzky
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


> Now, I'm trying to access mysql on a different server than the web server.
> 'development' is a temporary Windows machine for development. Only thing I
> can think of that is causing the problem is the host string is wrong.

I've had my best luck with numerical host strings, but I think that is
mostly due to the structure of the internal network.

You might try checking your permissions tables in the mysql database.
One thing I had problems with was getting the quoting right on the grant
statement. First time, I ended up with the host name in with the user
name, which of course would match nothing. After I fixed it by hand I
was able to get in with no problems.

HTH

--
Joel Rees <joelalpsgiken.gr.jp>

attached mail follows:


I have a PHP script that needs to talk to two different databases (in
MSSQL) at the same time. Now, I thought this was possible with two
different link identifiers, but that doesn't seem to be the case.

I made a simplified script that has this behaviour:

<?php
        /* Database */
        $cDBHost = "DEVELOPER";
        $cDBUser = "user";
        $cDBPass = "password";
        $cDBMain = "wft_main";

        /* PC PUMP CONFIGURATION */

        /* Database */
        $cDBPCPump = "wft_pcpump";

        /* Simply connect to the database */
        $dMainConnect = mssql_connect($cDBHost, $cDBUser, $cDBPass);
        /* Select the wft_main database */
        mssql_select_db($cDBMain, $dMainConnect);

        $dPCPumpConnect = mssql_connect($cDBHost, $cDBUser, $cDBPass);
        /* Select the wft_main database */
        mssql_select_db($cDBPCPump, $dPCPumpConnect);

        mssql_query("SELECT * FROM membership", $dMainConnect);
        mssql_query("SELECT * FROM manufacture", $dPCPumpConnect);

        print("Finished");
?>

This errors with:

Warning: mssql_query() [function.mssql-query]: message: Invalid object
name 'membership'. (severity 16) in c:\inetpub\wwwroot\test.php on line 22

Warning: mssql_query() [function.mssql-query]: Query failed in
c:\inetpub\wwwroot\test.php on line 22
Finished

So, am I wrong in expecting this to work? Did I do something wrong?

Running Win2k, IIS, MSSQL 7 (MSDE) and PHP 4.3.1. And yes I'm certain both
those tables exist (in their respective DB).

Thanks,
Chris

attached mail follows:


----- Original Message -----
From: "Chris Cameron" <chrisupnix.com>
To: <php-generallists.php.net>
Sent: Thursday, May 08, 2003 3:49 PM
Subject: [PHP] Connections to two databases in the same script

> I have a PHP script that needs to talk to two different databases (in
> MSSQL) at the same time. Now, I thought this was possible with two
> different link identifiers, but that doesn't seem to be the case.
>
> I made a simplified script that has this behaviour:
>
> <?php
> /* Database */
> $cDBHost = "DEVELOPER";
> $cDBUser = "user";
> $cDBPass = "password";
> $cDBMain = "wft_main";
>
> /* PC PUMP CONFIGURATION */
>
> /* Database */
> $cDBPCPump = "wft_pcpump";
>
> /* Simply connect to the database */
> $dMainConnect = mssql_connect($cDBHost, $cDBUser, $cDBPass);
> /* Select the wft_main database */
> mssql_select_db($cDBMain, $dMainConnect);
>
> $dPCPumpConnect = mssql_connect($cDBHost, $cDBUser, $cDBPass);
> /* Select the wft_main database */
> mssql_select_db($cDBPCPump, $dPCPumpConnect);
>
> mssql_query("SELECT * FROM membership", $dMainConnect);
> mssql_query("SELECT * FROM manufacture", $dPCPumpConnect);
>
> print("Finished");
> ?>
>
> This errors with:
>
> Warning: mssql_query() [function.mssql-query]: message: Invalid object
> name 'membership'. (severity 16) in c:\inetpub\wwwroot\test.php on line 22
>
> Warning: mssql_query() [function.mssql-query]: Query failed in
> c:\inetpub\wwwroot\test.php on line 22
> Finished
>
>
> So, am I wrong in expecting this to work? Did I do something wrong?
>
> Running Win2k, IIS, MSSQL 7 (MSDE) and PHP 4.3.1. And yes I'm certain both
> those tables exist (in their respective DB).
>
> Thanks,
> Chris

It's an interesting question but I don't think you can open two simultaneous
connections to the same db server. You may have to reorder your code so
that it works with just one connection...

/* Connect to the mssql server*/
$dbConnect = mssql_connect($cDBHost, $cDBUser, $cDBPass);

/* Select the wft_main database */
mssql_select_db($cDBMain, $dbConnect);
$result_main = mssql_query("SELECT * FROM membership", $dbConnect);

/* Select the wft_pcpump database */
mssql_select_db($cDBPCPump, $dbConnect);
$result_pcpump = mssql_query("SELECT * FROM manufacture", $dbConnect);

-Kevin

attached mail follows:


Hey All,

I figured it out. PHP apparently doesn't requrie you to add the optional
parameter in pg_fetch_array of the array pointer position. By just adding
this $j to that function, it cleared it up nicely.

HTH,

-m

//-------------------------------------------------------begin fixed it
thusly
 for($j=0; $j < $rowcount; $j++) {

  $row = pg_fetch_array($sch_result, $j);
  //check each possible day in month agains each result
  echo $row["bandname"] . ', ';

 }
 pg_result_seek($sch_result, 0);
//-------------------------------------------------------finish fixed it
thusly

"M" <mcloneycasas.org> wrote in message
news:20030508175407.17212.qmailpb1.pair.com...
> Hey All,
>
> I'm hoping you may have seen this or may at least know of a
> newsgroup/website I can hit that might help me explain why this is
> happening...
>
> Here's the scenario. I'm connecting to a PostgreSQL database and grabbing
> all the schedule results for a given month. Then I'm looping over those
> results. There are actually a ton of stupid loops going on... but the
weird
> thing is that after I go through the list once and then go back to the top
> of the result set, the first value in the array (from the query) seems to
> disappear!? Any clues?
>
> I know that this code only prints the names of all bands for every day in
> the schedule. My next task is to try to figure out how to match the date
> associated with a row with the date that's being constructed in the loop.
> But if anyone has any suggestions on that, it's just a bonus.
>
> My comments below will detail my madness. Thanks in advance for any
> suggestions!
>
>
> Cheers,
>
> -m
>
> Here's the code, essentailly:
>
> <?php
>
> //-------------------------------database connection start
>
> // Connecting, selecting database
>
> include('database_connecter.php');
>
> //-------------------------------database connection end
>
> //-------------------------------see if the month and/or year have been
> passed through the URL string
>
> //-------------------------------begin set month and year variables
> accordingly
>
> $qry_string = $_SERVER['QUERY_STRING'];
>
> parse_str($qry_string);
>
> if ($month < 1 OR $month > 12) {
>
> unset($month); }
>
>
> if ($year < 1999 OR $month > 2099) {
>
> unset($month); }
>
> if (!isset($month)) {
>
> $month = date("m");
>
> }
>
> if (!isset($year)) {
>
> $year = date("Y");
>
> }
>
> $month_year = date(F) . ' ' . date(Y);
>
> //-------------------------------end set month and year variables
> accordingly
>
> print "<!--Connected successfully-->";
>
> //-------------------------------head information
>
> print '<head><title>' . $month_year . ' at The Casbah</title></head>';
>
> //-------------------------------begin construct query to pull bands and
> shows from database
>
> $sql = 'select bandname, showdate from bands inner join bandshow on
> bands.bandid ';
>
> $sql = $sql . ' = bandshow.bandid inner join shows on bandshow.showid =
> shows.showid ';
>
> $sql = $sql . ' where bandshow.venueid = 1 and extract(month from
showdate)
> = ' . $month ;
>
> $sql = $sql . ' order by shows.showdate, bandshow.bandorder';
>
> //-------------------------------begin construct query to pull bands and
> shows from database
>
> $sch_result = pg_query($connection, $sql)
>
> or die("Failed to grab schedule");
>
>
> $rowcount = pg_num_rows($sch_result);
>
> echo "<BR>";
>
> echo "total of $rowcount band/show records in this month's schedule";
>
> echo "<BR>";
>
> echo "<table border=1>";
>
> $numDaysInMonth = date("t", mktime(0, 0, 0, $month, 1, $year));
>
> //-------------------------------loop number of times as days in current
> month
>
> //-------------------------------I know that this isn't perfect yet, but
> it's just weird
>
> //-------------------------------because after I run through this once and
> reset the
>
> //-------------------------------result witht he pg_result_seek command,
it
> seems to lose
>
> //-------------------------------a value from the array. I think the array
> is still the same size
>
> //-------------------------------as it was before but maybe there's a
better
> way to do this?
>
> for ($i=0; $i < $numDaysInMonth; $i++) {
>
> echo '<tr><td>' . date("D", mktime(0, 0, 0, $month, ($i+1), $year)) . ' '
.
> ($i+1) . ' ' . '</td>';
>
> echo '<td>';
>
> //loop over result set
>
> for($j=0; $j < $rowcount; $j++) {
>
>
> $row = pg_fetch_array($sch_result);
>
> //check each possible day in month agains each result
>
> echo $row["bandname"] . ', ';
>
> }
>
> //reset($row);
>
> pg_result_seek($sch_result, 0);
>
> echo '</td></tr>';
>
> }
>
> echo "</table>";
>
> ?>
>
>

attached mail follows:


Hi,
Sometime back i wrote to the list asking how I can find out from which
domain the data was posted and someone gave me a URL on info where i could
find out the domain and lots more like the parameters...
unfortunately I like a doofus have lost it and have tried searching on the
list with the keywords
Host,URL,ryan and lots more but just cant find it....can somebody tell me
what it was please?
Thanks, (again)
-Ryan

attached mail follows:


At 00:25 09.05.2003, Ryan A said:
--------------------[snip]--------------------
>Hi,
>Sometime back i wrote to the list asking how I can find out from which
>domain the data was posted and someone gave me a URL on info where i could
>find out the domain and lots more like the parameters...
>unfortunately I like a doofus have lost it and have tried searching on the
>list with the keywords
>Host,URL,ryan and lots more but just cant find it....can somebody tell me
--------------------[snip]--------------------

Possibly $_SERVER['HTTP_REFERER']?

--
>O Ernest E. Vogelsinger
   (\) ICQ #13394035
    ^ http://www.vogelsinger.at/

attached mail follows:


----- Original Message -----
From: "Ryan A" <ryanjumac.com>
To: <php-generallists.php.net>
Sent: Thursday, May 08, 2003 4:25 PM
Subject: [PHP] reminder needed please...

> Hi,
> Sometime back i wrote to the list asking how I can find out from which
> domain the data was posted and someone gave me a URL on info where i could
> find out the domain and lots more like the parameters...
> unfortunately I like a doofus have lost it and have tried searching on the
> list with the keywords
> Host,URL,ryan and lots more but just cant find it....can somebody tell me
> what it was please?
> Thanks, (again)
> -Ryan

Are you looking for this?
http://www.php.net/manual/en/reserved.variables.php#reserved.variables.serve
r

Just remember the keyword "Super Global" and do a search on php.net under
documentation.

- Kevin

attached mail follows:


Hey guys,
Thanks for replying.

I *think* this is the one but am not sure.

http://si.php.net:8888/manual/en/function.parse-url.php

Tell me if you know of a better alternative.

Basically I want to make sure that the request came from
https://2checkout.com
so i can do this:
if( yes )
{grant access}
elseif (no)
 {politely decline...}

Cheers,
-Ryan

----- Original Message -----
From: "Ernest E Vogelsinger" <ernestvogelsinger.at>
To: "Ryan A" <ryanjumac.com>
Cc: <php-generallists.php.net>
Sent: Friday, May 09, 2003 12:52 AM
Subject: Re: [PHP] reminder needed please...

> At 00:25 09.05.2003, Ryan A said:
> --------------------[snip]--------------------
> >Hi,
> >Sometime back i wrote to the list asking how I can find out from which
> >domain the data was posted and someone gave me a URL on info where i
could
> >find out the domain and lots more like the parameters...
> >unfortunately I like a doofus have lost it and have tried searching on
the
> >list with the keywords
> >Host,URL,ryan and lots more but just cant find it....can somebody tell me
> --------------------[snip]--------------------
>
> Possibly $_SERVER['HTTP_REFERER']?
>
>
> --
> >O Ernest E. Vogelsinger
> (\) ICQ #13394035
> ^ http://www.vogelsinger.at/
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


On 05/08/2003 6:13 PM, Ryan A (ryanjumac.com) wrote:

> I *think* this is the one but am not sure.
>
> http://si.php.net:8888/manual/en/function.parse-url.php
>
> Tell me if you know of a better alternative.

It sounds more like you want HTTP_REFERER.

> Basically I want to make sure that the request came from
> https://2checkout.com
> so i can do this:
> if( yes )
> {grant access}
> elseif (no)
> {politely decline...}

Assuming you mean HTTP_REFERER, I hope you don't do this as not all browsers
send it. Instead you may want to consider something more along these lines:

if ((HTTP_REFERER is what you want) OR (HTTP_REFERER is not set)) {
 grant access
}

else {
 politely decline
}

You really don't want to rely on HTTP_REFERER.

Pablo

attached mail follows:


> Hi,
> Sometime back i wrote to the list asking how I can find out from which
<cut>
> unfortunately I like a doofus have lost it and have tried searching on the
> list with the keywords
> Host,URL,ryan and lots more but just cant find it....can somebody tell me
> what it was please?

Here is an archive search listing all posts with you as the author.
http://marc.theaimsgroup.com/?a=105015613300003&r=1&w=2

Hope that helps.

attached mail follows:


Jean,

Does your ISP have all error reporting turned off? Some do.
Or, if it's a server under your control you can set eror reporting levels
in php.ini.

Here are a couple of suggestions:

1. Manual - error reporting
section: http://ca3.php.net/manual/en/ref.errorfunc.php
2. Use of the phpinfo(); function
3. Custom .htaccess file in your web site's home directory. This turns on
error reporting:
                 php_flag display_errors on
Save the above line in a file named htaccess, upload it to the directory
where you are running PHP scripts and rename it to .htaccess. It will
"disappear", but Apache will then return errors generated when PHP scripts
are parsed.

And, I've assumed a *nix host running Apache. If your host is running IIS
I'm certain someone else on the list can help.

BTW, your ISP should also be able to assist with these questions.

Cheers - Miles Thompson

At 08:32 AM 5/8/2003 -0700, Jean wrote:

> PHP is a very nice language. Been about a week reading O'Reilly & writing
>my first program. Making some fast progress. But, as I embellish my
>program, I am beginning to run into trouble. I am finding PHP to be
>extremely difficult to debug. There's a limit to embedding echo to check
>the program flow. Then, there are times when the browser shows absolutely
>nothing. Browser's Show Source Code lists next to nothing; I assume this is
>because the interpreter hung on a missing brace or something and outputted
>nothing! Until I become good at spotting my errors, I've got to find a
>debugging tool. Any words of wisdom would be appreciated.
>
>Jean
>
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

attached mail follows:


Hi Jean,

Am Sonntag, 8. Juni 2003 um 08:26 schrieb Jean Jean:

> PHP is a very nice language. Been about a week reading O'Reilly & writing
> my first program. Making some fast progress. But, as I embellish my
> program, I am beginning to run into trouble. I am finding PHP to be
> extremely difficult to debug. There's a limit to embedding echo to check
> the program flow. Then, there are times when the browser shows absolutely
> nothing. Browser's Show Source Code lists next to nothing; I assume this is
> because the interpreter hung on a missing brace or something and outputted
> nothing! Until I become good at spotting my errors, I've got to find a
> debugging tool. Any words of wisdom would be appreciated.

> Jean

I am using Komodo. It offers a quite comfortable debugger for php. There's a
lot of other features for only about 30$.

Check out

http://www.activestate.com/Products/Komodo/

--
Cheers
Marco Schuler mailto:marco.schulerscopein.ch

attached mail follows:


Hello PHP gurus,

Is there a way to avoid the maximum execution time from PHP ?

Thanx

attached mail follows:


At 02:16 09.05.2003, Nico Jansen - NiRo IT Consultants B.V. said:
--------------------[snip]--------------------
>Hello PHP gurus,
>
>Is there a way to avoid the maximum execution time from PHP ?
>
>Thanx
--------------------[snip]--------------------

set_time_limit() http://www.php.net/manual/en/function.set-time-limit.php
is the function you need.

Be aware that this is only of marginal help if your PHP script is called by
a webserver - they usually have a time limit for a page to execute as well
(30secs the most). This function is used best when running from the command
line, as a cron job, for example.

--
>O Ernest E. Vogelsinger
   (\) ICQ #13394035
    ^ http://www.vogelsinger.at/

attached mail follows:


just use this in your script - will override php.ini settings

$extime = 120; //seconds change as desired
ini_set("max_execution_time", $extime);

"Nico Jansen - Niro It Consultants B.V." <nicojansenniro-it.nl> wrote in
message news:008c01c315c0$461f8200$9900000aNJVAIO...
> Hello PHP gurus,
>
> Is there a way to avoid the maximum execution time from PHP ?
>
> Thanx
>

attached mail follows:


does this not work for u ? set_time_limit (1000) ;
> just use this in your script - will override php.ini settings
>
> $extime = 120; //seconds change as desired
> ini_set("max_execution_time", $extime);
>
> "Nico Jansen - Niro It Consultants B.V." <nicojansenniro-it.nl> wrote
> in message news:008c01c315c0$461f8200$9900000aNJVAIO...
>> Hello PHP gurus,
>>
>> Is there a way to avoid the maximum execution time from PHP ?
>>
>> Thanx
>>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

attached mail follows:


Thanx

----- Original Message -----
From: "Ernest E Vogelsinger" <ernestvogelsinger.at>
To: "Nico Jansen - NiRo IT Consultants B.V." <nicojansenniro-it.nl>
Cc: "php mailing list" <php-generallists.php.net>
Sent: Friday, May 09, 2003 12:24 AM
Subject: Re: [PHP] How to avoid maximum time

> At 02:16 09.05.2003, Nico Jansen - NiRo IT Consultants B.V. said:
> --------------------[snip]--------------------
> >Hello PHP gurus,
> >
> >Is there a way to avoid the maximum execution time from PHP ?
> >
> >Thanx
> --------------------[snip]--------------------
>
> set_time_limit() http://www.php.net/manual/en/function.set-time-limit.php
> is the function you need.
>
> Be aware that this is only of marginal help if your PHP script is called
by
> a webserver - they usually have a time limit for a page to execute as well
> (30secs the most). This function is used best when running from the
command
> line, as a cron job, for example.
>
>
> --
> >O Ernest E. Vogelsinger
> (\) ICQ #13394035
> ^ http://www.vogelsinger.at/
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


My reply, below...

-----Original Message-----
From: Wendy [mailto:OpenSourceAZcox.net]
Sent: Wednesday, May 07, 2003 7:02 PM
To: Chris McCluskey
Cc: php-generallists.php.net
Subject: RE: [PHP] PHP & Java, calling a static method

On Wed, 2003-05-07 at 14:44, Chris McCluskey wrote:
> Ah ha!! Ok, I thought you would be re-writing everything in PHP.
Which
> would work out perfectly. By what you have said I would guess that if
> you can't call it as
> $myObject = new Java( "Object.staticMethod()" );
> you might be SOL. And I'm guessing you've tried:
> $myObject = new Java( "Object" );
> $myObject->staticMethod();
> right? That would be my next best guess.

Nothing works. :( I do have a workaround, it just means exposing the
database a little more than I wanted to. I may rewrite the Java layer
to work better with PHP. But I don't think this is an unreasonable
request, it just sounds like something whoever wrote the Java extension
didn't have a need for. So where are they hiding so I can talk to them?

Hiding? Hmm.. not sure. My personal experience with the PHP folks is
if they do something they generally do it right, leading me to belive
that there is a way to do this in PHP, I'm just not sure off the top of
my head.

I assume you mean rewriting the java layer to work without static
methods? I'm thinking you're right, that would solve your problem.

> Personally, I've kept my java work with my java work and my php work
> with my php work. If you have a lot of code already in java you might
> want to look into JSP/J2EE if you haven't already.

I'm a Java programmer first, Servlets/JSP/Struts, the whole nine yards
on the server side. There is a Java API to my database (IBM's UniData)
and I've written a data access layer in Java. Now I have a need to
access the database from a website that's all PHP. So... I can't write
the Java classes in PHP, and I can't drag the website over to Java.

The database also has a C API, and I'm now wondering if that might not
be a better way in rather than going through Java. Or is it six of one,
half dozen of the other?

Haha, that's a good comparison. I guess in c, you could create a COM
object (assuming you are running on a windows box) and use new COM() in
PHP. But once you go through all that, you could be left with the same
problem. I think if I were you I would remove the static methods, (or
rather, rewrite them to work non statically), or re-write the thing in
PHP (yeah, go with door number 2, whoo hoo!)

=)

Thanks again for your response!

Glad to help.

--
Wendy Smoak
Chandler, AZ

attached mail follows:


Hey,

I've read the manual entry on preg_replace() and i've used google for help but i'm still confused as it all looks horribly complicated..

What i want to do is when a user submits a quote for example "<TheHeadSage> lol" i want to remove the <>'s and replace them with &lt; and &gt; so they display properly on a webpage. How would i go about this using preg_replace() or another function like it?

Also, my second question which ties into the whole quote thing, how do i select random rows from a MySQL database? So i can get a random quote every time the user reloads the page or a new visitor arrives.

Thanks again,
Daniel "TheHeadSage" Spain

attached mail follows:


At 01:20 09.05.2003, The Head Sage said:
--------------------[snip]--------------------
>I've read the manual entry on preg_replace() and i've used google for help
>but i'm still confused as it all looks horribly complicated..
>
>What i want to do is when a user submits a quote for example "<TheHeadSage>
>lol" i want to remove the <>'s and replace them with &lt; and &gt; so they
>display properly on a webpage. How would i go about this using
>preg_replace() or another function like it?

RE's are a quite fine thing when you look at what you're really going to
do. Having your example I'd say you want to replace any (sub)string
starting with '<', having one or more alphanumeric characters, and ending
in '>', with '&lt;' + whatever_in_between + '&gt;'.

Ok, this is the regex for it:
    $string = preg_replace('/<([a-z0-9]+?)>/i', '&lt;$1&gt;', $string);

This regex explained:
    < beginning with a '<'
    ( open a group
     next char is a ''
    [a-z0-9]+? one or more of the characters between [],
                    but stop matching when encountering the next:
    ) end this group
> pattern must end with a '>'

and replace it with
    &lt; as-is
    $1 the first group from the previous regex
    &gt; as-is

The 'i' modifier of the regex tells preg to do a case-insensitive match.

The '?' after the character set tells preg to do a non-greedy match. By
default preg is greedy, that is it matches as much characters as possible.
While this is meaningless in this example (a '>' would terminate the match
anyway because it is not contained within the character set), having this
charset '.+' (one or more of _any_ character) will make it work. As an example:

Using '/<(.+)>/'

Matching against 'I saw <AWhiteShark> <or> <some other> fish' will result in
'I saw &lt;AWhiteShark> <or> <some other&gt; fish'.

Using '/<(.+?)>/'

will correctly produce 'I saw &lt;AWhiteShark&gt; &lt;or&gt; &lt;some
other&gt; fish'.

Hope this helps.
     

--
>O Ernest E. Vogelsinger
   (\) ICQ #13394035
    ^ http://www.vogelsinger.at/

attached mail follows:


Thanks for explaining it to me, you've cleared up a lot of confusion. Some
of the entries might have an ! or + instead of an , most of the time they
dont have symbols.
 (As you can probably guess, these quotes are from IRC)

if i change "$string = preg_replace('/<([a-z0-9]+?)>/i', '&lt;$1&gt;',
$string);"
to
"$string = preg_replace('/<([a-z0-9]+?)>/i', '&lt;$1&gt;', $string);"
would i be able to include the possibilities <!TheHeadSage>, <THS>, <+THS>
and <ths>?

attached mail follows:


The Head Sage wrote:

>Hey,
>
Hey.

>I've read the manual entry on preg_replace() and i've used google for help but i'm still confused as it all looks horribly complicated..
>
That's because of the complex things you can do with it. If you don't
need regex, use str_replace() or similar.

>What i want to do is when a user submits a quote for example "<TheHeadSage> lol" i want to remove the <>'s and replace them with &lt; and &gt; so they display properly on a webpage. How would i go about this using preg_replace() or another function like it?
>
Use htmlspecialchars() or htmlentities().

>Also, my second question which ties into the whole quote thing, how do i select random rows from a MySQL database? So i can get a random quote every time the user reloads the page or a new visitor arrives.
>
Use a query like SELECT * FROM table ORDER BY RAND().

>Thanks again,
>
You're welcome.

--
The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.

attached mail follows:


Hello all,

I've got a slight problem with timestamps... The server hosting my website is GMT -0500 while i am GMT +1000, how do i alter the timestamps generated by the server to reflect my timezone, so it looks like i'm posting news updates at 2pm instead of 4am in the morning?

Thanks

attached mail follows:


Simple answer:

subtract x seconds from, or add x seconds to, the timestamp to correct it.

Justin

on 09/05/03 11:12 AM, The Head Sage (theheadsagemanga-sketchbook.org)
wrote:

> Hello all,
>
> I've got a slight problem with timestamps... The server hosting my website is
> GMT -0500 while i am GMT +1000, how do i alter the timestamps generated by the
> server to reflect my timezone, so it looks like i'm posting news updates at
> 2pm instead of 4am in the morning?
>
> Thanks

attached mail follows:


Hi,

Friday, May 9, 2003, 10:12:56 AM, you wrote:
THS> Hello all,

THS> I've got a slight problem with timestamps... The server hosting my website is GMT -0500 while i am GMT +1000, how do i alter the timestamps generated by the server to reflect my timezone, so it
THS> looks like i'm posting news updates at 2pm instead of 4am in the morning?

THS> Thanks

Put this at the top of your page:

putenv('TZ=Australia/Brisbane');

--
regards,
Tom

attached mail follows:


on 09/05/03 3:54 AM, caspar kennerdale (casparthetuckshop.com) wrote:

> I have a form posting values from its text fields to a switch constructor.
> it posts to
>
> $_SERVER['PHP_SELF']."?action=Test
>
> In the switch 'Test' I want to echo the variable I have posted.
>
> I assumed I would print them out such as this-
>
> echo $GLOBALS['Font']; // Font being the name of the variable

If you want to echo a value of a form element that you POSTed to the current
script, and you have register globals off, then you need to call it as
$_POST['postedVarName'].

FWIW, you would find the URL var "Test" in $_GET['Test'].

I have code which is completely register globals off, and I don't use the
$GLOBALS array very often at all, if ever.

Justin

attached mail follows:


Hi all,
I have a problem to unset an array element in an object
example:
class teste
{
  var $teste;
  var $teste1;
  var $arr;

  function teste($wparam,$wparam2)
  {
   $this->teste = $wparam;
   $this->teste1 = $wparam2;
   $this->arr = array();
  }

  function arr_add($wchave,$valor)
  {
   $this->$wchave = array($valor, 0);
  }

  function arr_rem($wchave)
  {
   // unset($this->arr[$wchave]); //I have tried this
   // $this->unset($arr[$wchave]); //or this, but is not working
  }

}

   Can any one help me?
   Bests,

attached mail follows:


Hey everyone,

Was wondering if anyone could point me to a algorithm to loop through two
arrays one being a list of keywords and the other a list of field names to
generate part of an sql statement like:

$sql .= $field " LIKE '%" . $word . "%' OR "

Have looked at many search scripts and classes but none really have this
part the way I would like it thought maybe someone may alreday have this or
could point me to a good example?

Any help appreciated,

Regards,

Joseph Blythe

attached mail follows:


$fieldWordArray = Array("keyName"=>"keyValue","otherName"=>"otherValue");
foreach ($fieldWordArray as $key=>$value){
    $sqlExtension .= "$key LIKE '%$value%' OR ";
}
$sqlExtension = substr($sqlExtension,0,strlen($sqlExtension)-4);

"Joseph Blythe" <josephoptcom.net.au> wrote in message
news:001801c315c4$33b1a7c0$3500a8c0ws53...
> Hey everyone,
>
> Was wondering if anyone could point me to a algorithm to loop through two
> arrays one being a list of keywords and the other a list of field names to
> generate part of an sql statement like:
>
> $sql .= $field " LIKE '%" . $word . "%' OR "
>
> Have looked at many search scripts and classes but none really have this
> part the way I would like it thought maybe someone may alreday have this
or
> could point me to a good example?
>
> Any help appreciated,
>
> Regards,
>
> Joseph Blythe
>

attached mail follows:


To clarify,

All session vars are currently available in both the $HTTP_SESSION_VARS and
$_SESSION arrays. Whilst $HTTP_SESSION_VARS is deprecated, it still works.

So, regardless of whether register globals is on or off, you can always
refer to the session vars through these arrays.

$_SESSION is only available as of 4.1, so the simple answer to your problem
(IF you want to remain fully backward compatible) is to continue using the
$HTTP_SESSION_VARS array.

This rules out using the $_SESSION array at all, and means you still need to
use session_register().

I'd be a little concerned here that you're placing a higher priority on
backward compatibility rather than forward compatibility, since
$HTTP_SESSION_VARS is deprecated, and may disappear from a future version of
PHP.

If you're looking for a solution which uses $_SESSION where possible, and
$HTTP_SESSION_VARS where not possible, then I think you're in for a lot of
work, although I haven't thought about it all too much :)

The only hint I can give you without typing for another 10 minutes is to
look at phpversion() :)

Justin

on 09/05/03 3:13 AM, Shawn McKenzie (nospammckenzies.net) wrote:

> I am just starting to learn sessions in PHP and have a quick question (yes I
> have read all of the relevent docs but am still confused on several points).
>
> My goal is to write a script that is usable in newer and older vers of PHP
> wheteher register_globals is on or off.
>
> session_register() puts a $var in the session and if register_globals=on it
> will be extracted and available as $var on the next page after
> session_start? if register_globals=off it will be available via
> $HTTP_SESSION_VARS?
>
> With register_globals=off on newer PHP versions I should use $_SESSION to
> set and get session $vars? With register_globals=on the $vars from
> $_SESSION are extracted?
>
> Any pointers on what would be a flexible way to handle sessions regardless
> of PHP version or register_globals would be very helpfull.
>
> Thanks!
> Shawn
>
>
>
>

attached mail follows:


on 09/05/03 3:49 AM, Shawn McKenzie (nospammckenzies.net) wrote:

> O.K. is it safe to assume that if I require 4.1.0+ that I can use $_SESSION
> whether register_globals is on or off and NOT ever use session_register???

Yes. This is what I do.

You can even FORCE rg to off with a .htacess file, just use the $_SESSION
array, and require PHP >= 4.1.0.

Justin

attached mail follows:


Is it better to code this way:

<?
if ($option == 1) {
        echo "Blah blah.";
}
?>

or:

<? if ($option == 1) { ?>
        Blah blah.
<? } ?>

Is there a performance difference or just a matter of readability?

-Ben

attached mail follows:


Personally I hate breaking in and out of php and html as it is a lot better
to seperate presentation from the logic, with the one exception we use
dreamweaver mx to build all our sites and make use of its templates so that
other people can add the static content, with careful consideration it can
be quite useful to be able to see the images, tables etc.. even if logical
operators are involved dreamweaver mx has alot better support for this now )

Regards,

Joseph
-----Original Message-----
From: Ben Cheng [mailto:kenshinmac.com]
Sent: Friday, 9 May 2003 10:30 AM
To: php-generallists.php.net
Subject: [PHP] Which way is better?

Is it better to code this way:

<?
if ($option == 1) {
        echo "Blah blah.";
}
?>

or:

<? if ($option == 1) { ?>
        Blah blah.
<? } ?>

Is there a performance difference or just a matter of readability?

-Ben

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

attached mail follows:


The difference is neglegable, and the general consensus of the list (which
I've been on for around 3 years) seems to be "whatever you're more
comfortable with, and whichever makes more sense.

For me, I attempt to stay in PHP whenever possible, but sometimes it makes
more sense to go back to html, like a 20 line table, or something with lots
of quotes which in turn need escaping, which in turn make things unreadable,
eg:

<?
if($foo) {
    echo "<a href=\"javascript('foo({$somevar}')\" target=\"_blank\">Click
\"here\"</a>";
}
?>

is much easier for ME to read as:

<? if($foo) { ?>
<a href="javascript('foo(<?=$somevar?>')" target="_blank">Click "here"</a>
<? } ?>

Do whatever you think makes your code:

a) faster to write
b) easier to read
c) easier to maintain

... and don't worry about the tiny tiny difference in performance, if any.

Justin French

on 09/05/03 12:00 PM, Ben Cheng (kenshinmac.com) wrote:

> Is it better to code this way:
>
> <?
> if ($option == 1) {
> echo "Blah blah.";
> }
> ?>
>
> or:
>
> <? if ($option == 1) { ?>
> Blah blah.
> <? } ?>
>
> Is there a performance difference or just a matter of readability?
>
> -Ben
>

attached mail follows:


> For me, I attempt to stay in PHP whenever possible, but sometimes it makes
> more sense to go back to html, like a 20 line table, or something with lots
> of quotes which in turn need escaping, which in turn make things unreadable,
> eg:
>
> <?
> if($foo) {
> echo "<a href=\"javascript('foo({$somevar}')\" target=\"_blank\">Click
> \"here\"</a>";
> }
> ?>

I'd use heredoc syntax:

<?php

$var = true;

$html = <<<EOF
<a href="link.php?var=$var">Click here</a>
EOF;

echo $html;

?>

No escaping any quotes and you can toss variables in there as well.

--
Greg Donald
http://destiney.com/

attached mail follows:


on 09/05/03 12:33 PM, Greg Donald (destineydestiney.com) wrote:
 
> I'd use heredoc syntax:

Which proves my point -- it's all about preference. I personally dislike
heredocs, because of the sctrict nature of how the last line must not be
indented, etc etc.

Justin

attached mail follows:


On Thu, 2003-05-08 at 19:59, Justin French wrote:
> on 09/05/03 12:33 PM, Greg Donald (destineydestiney.com) wrote:
>
> > I'd use heredoc syntax:
>
> Which proves my point -- it's all about preference. I personally dislike
> heredocs, because of the sctrict nature of how the last line must not be
> indented, etc etc.

and for short scripts I perfer heredoc but anything else goes through
smarty.php.net

Perl has a nice feature where you can choose your delimiter

print q| anything but a pipe unless escaped but when do you use them,
this string is not interpolated, like a single quote|;

print qq|same but will be interpolated|;

and of course for some reason there are people in Perl who don't like
that but escaping things drives me nuts.

If you've been doing web app work for awhile you'll realize the one true
rule is everything will change and will your code be easy to change or
not? Will even you be able to read it later? Your boss will not want to
do a re-write. I always write for ease of evolution, if writing for
speed write closer to the machine other than the obvious, imho.

Peter

attached mail follows:


on 09/05/03 3:07 PM, Peter Schoenster (peterschoenster.com) wrote:
 
> If you've been doing web app work for awhile you'll realize the one true
> rule is everything will change and will your code be easy to change or
> not? Will even you be able to read it later? Your boss will not want to
> do a re-write. I always write for ease of evolution, if writing for
> speed write closer to the machine other than the obvious, imho.

I am my own boss, have being doing this for 3-4 years, and have what has
proven to be a robust, adaptable code base. It hasn't required any major
overhauls, and has stood up well faced with some very unexpected client
requests, changes and modules.

*I* personally find my coding style is easy to maintain, easy to read, etc
etc, having spent hundreds of hours working with it. You may not, but that
shouldn't imply that yours is the best solution to a problem.

Isn't that why the PHP developers gave us MANY different ways to print
output? So that each individual can work in a way that best suits them.

Justin

attached mail follows:


> >>
> >> Jennifer,
> >> You do have a valid point in regards to saving and closing the
> >> session. BUT
> >> if I close the session, then what will happen when I try to access the
> >> session variables on the following page.
> --------------------[snip]--------------------
>
> Jennifer,
>
> there might be a valid point in using session_write_close() just before
> sending a header('Location: foo.php');.

Yeah, that is why in my previous answer to his question I told him to use
it. But then the response was to ask "Well, if I close my session, how do I
access it on the next page." Since I had pointed him to the manual section
on sessions in my previous post this sort of caused me to throw my hands up
in despair and give a "RTFM" manual response. I don't really have time to
waste trying to explain sessions to someone who won't do basic research for
themselves, as I am sure you don't either. I don't mind sharing the
knowledge that I have gained from years of programming in PHP with others, I
know how to do a lot of stuff that other people don't (such as use sessions,
apparently), but it does get exasperating when someone asks something that
they could have learned themselves from reading a page you sent them to,
especially when you just pointed them to the page not 5 minutes before.

attached mail follows:


Hi,
Is there ANY way to get from where the client is coming and then compare it
to get a true/false result *without*
using http refferer?
I just checked and http referrer is not working on my domain...and i need to
make sure the client is coming from https://2checkout.com as I am offering
instant downloads...

If you have any ideas I am all ears.

Cheers,
-Ryan

attached mail follows:


On Friday 09 May 2003 09:12, Ryan A wrote:

> Is there ANY way to get from where the client is coming and then compare it
> to get a true/false result *without*
> using http refferer?

No.

> I just checked and http referrer is not working on my domain...

Never rely on http referrer for 'security' checks -- it can be easily set to
whatever the client chooses.

Where is your site? Are the downloads worth having? If so, I'll grab some for
free ;-)

> and i need
> to make sure the client is coming from https://2checkout.com as I am
> offering instant downloads...

Most payment gateways gives you instant verification on whether a transaction
has succeeded. Use that to determine whether or not to grant download.

--
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 strong conviction that something must be done is the parent of many
bad measures.
                -- Daniel Webster
*/

attached mail follows:


> First of all, read the manual pages on sessions thoroughly.
<cut>
> And yes, you _can_ make objects session persistent, PROVIDED that the
> necessary class definitions are loaded/included/defined _before_ the
> session gets reconstructed.
<cut>
> If however you would put session_start() before the class definition, or
> have session.auto_start enabled in php.ini, this cannot work -
> PHP needs to know the class definition when reconstructing an object from
session data.
> If this is missing it will resort to a default class where all data
> properties are preserved, but of course no methods are available.

Also look into the magic functions. __wakeup and __sleep
http://www.php.net/manual/en/language.oop.magic-functions.php

If you put these methods in your object PHP will clean up the object upon
serialization and setup things you need upon unserializing. I usually have
__sleep close off all of my connections, store any state data I want on the
next page, and clean out any members I don't want to persist. Then I have
__wakeup re-establish database connections and anything else I need
re-established since the constructor won't be called. I hope this helps a
little. To tell the truth, I only started using them because the manual
said they were magic.

attached mail follows:


hi guys i am trying to transform dodgy sporadic date formats from access to
a standard mysql form , here is an example of my headache

Fri Jan 5 16:40 1996

what can i do to format this properly notice the year is at the end do
strtotime wont work :\ sometimes the year is in the right place

attached mail follows:


If you are importing via an export (csv for expample) from access I found it
easier to just format the exports date format to mysql's format.

Regards,

Joseph

-----Original Message-----
From: danielelectroteque.org [mailto:danielelectroteque.org]
Sent: Friday, 9 May 2003 11:32 AM
To: php-generallists.php.net
Subject: [PHP] formatting sporadic date formats from access

hi guys i am trying to transform dodgy sporadic date formats from access to
a standard mysql form , here is an example of my headache

Fri Jan 5 16:40 1996

what can i do to format this properly notice the year is at the end do
strtotime wont work :\ sometimes the year is in the right place

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

attached mail follows:


Oops yes sorry I cc'ed wrong list :)

I guess I believed this was an mysql/access problem and would be better
dicussed on another listserver, I also didnt realise it was a non-standard
free text date, I guess you could write a macro in access to re-format the
date so it may be inserted as mysql date. Access is hardly my area of
expertise as I only usually export data from it this is why I responded as I
had a simular problem with its date format.

Glad you sorted it out.

Regards,

Joseph

-----Original Message-----
From: danielelectroteque.org [mailto:danielelectroteque.org]
Sent: Friday, 9 May 2003 3:01 PM
To: josephoptcom.net.au
Subject: RE: [PHP] formatting sporadic date formats from access

firstly did i not reply offlist , and how did i get on the pear list u just
cc'd back to ?

anyway becuase its a non standard freetext date format the export didnt
format it which is why i was asking i already selected that, anyway i
soughted out my problemo i was terminating the line with \n not \r :\
> This is hardly the list for access discussions but I will on this
> occasion finish the thread, you may contact me privately if you wish if
> you have any problems although as I was typing this the boss is on my
> back to finish a quote what's new though :)
>
> I will assume you have a copy of access 2000
>
> 1) open up the .mdb file and select the table you wish to export, on
> the "File menu choose export and choose text format (.csv)
> 2) The default options are fine on first page of the export wizard but
> you must go to the advanced options and adjust the date format options
> to mysql's default date format which is yyyy-mm-dd so:
>
> Date order = "YMD"
> Date delimiter = "-"
> 4 digit years = true
> Leading Zeros in dates = true
>
> I think that's about it finish the export and that should be okay to
> import into mySQL
>
> Hope this helps,
>
> Joseph
> -----Original Message-----
> From: danielelectroteque.org [mailto:danielelectroteque.org]
> Sent: Friday, 9 May 2003 12:10 PM
> To: josephoptcom.net.au
> Subject: RE: [PHP] formatting sporadic date formats from access
>
>
> how can i do this ?
>
>> If you are importing via an export (csv for expample) from access I
>> found it easier to just format the exports date format to mysql's
>> format.
>>
>> Regards,
>>
>> Joseph
>>
>> -----Original Message-----
>> From: danielelectroteque.org [mailto:danielelectroteque.org]
>> Sent: Friday, 9 May 2003 11:32 AM
>> To: php-generallists.php.net
>> Subject: [PHP] formatting sporadic date formats from access
>>
>>
>> hi guys i am trying to transform dodgy sporadic date formats from
>> access to a standard mysql form , here is an example of my headache
>>
>> Fri Jan 5 16:40 1996
>>
>> what can i do to format this properly notice the year is at the end do
>> strtotime wont work :\ sometimes the year is in the right place
>>
>>
>>
>> --
>> 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:


Shaun--

7000 per day is about once every 12 seconds.

You should be able to use PHP to calculate a starting number for a page based on the current timestamp.

Then use Javascript on the page to increment the count once every twelve seconds.

--John

On Thursday 08 May 2003 09:12 am, Shaun wrote:
> Hi,
>
> I have a client who wants a counter on their site showing
> a number which rises by 7000 a day and visibly clocks up
> whilst a user is on the site. This is meant to show the
> number of products they sell a a day. I'm just not sure
> how this would work though, would i have to store the
> ammount in a database, how would it increment whilst no
> one is one the site.
>
> Thanks for your help

attached mail follows:


If it is not a real counter and truly needs to just be a number that
increments once every 12 seconds from a given start point you could just do
something like this

<?php
DEFINE ('START_TIME', '1052446787');
$now = time();
$hits = floor(($now - START_TIME)/12);
echo $hits;
?>

No specific reason for using the define except that the number is a
constant. You could just use a variable if you wanted. I think I'm getting
a little loopy from staring at a monitor all day.

> -----Original Message-----
> From: John Hicks [mailto:frappyjohngulfbridge.net]
> Sent: Thursday, May 08, 2003 7:11 PM
> To: Shaun; php-generallists.php.net
> Subject: Re: [PHP] Counter
>
>
> Shaun--
>
> 7000 per day is about once every 12 seconds.
>
> You should be able to use PHP to calculate a starting number for
> a page based on the current timestamp.
>
> Then use Javascript on the page to increment the count once every
> twelve seconds.
>
> --John
>
>
> On Thursday 08 May 2003 09:12 am, Shaun wrote:
> > Hi,
> >
> > I have a client who wants a counter on their site showing
> > a number which rises by 7000 a day and visibly clocks up
> > whilst a user is on the site. This is meant to show the
> > number of products they sell a a day. I'm just not sure
> > how this would work though, would i have to store the
> > ammount in a database, how would it increment whilst no
> > one is one the site.
> >
> > Thanks for your help

attached mail follows:


hi

i was wondering how to make a text version of a hit counter with php?

any ideas on how to do this?

tnx

attached mail follows:


Not only has this been asked and answered on the list many many many times
before (did you search the archives???), but it's also listed as a tutorial
on nearly every PHP site!

Hmmmm -- what about a google search???
http://www.google.com.au/search?q=php+text+counter&ie=ISO-8859-1&hl=en&meta=

Plenty there too!

Justin

attached mail follows:


I need some clarification here please. Maybe not the greatest thing to do,
but I'm just testing and this shows contradictory results in the piece that
doesn't work..

This works:

page1.php
session_start();
$test = "Test stuff";
$_SESSION['GLOBALS'];

page2.php
session_start();
$var = "test";
$$var = $_SESSION[$var];
echo $test; //outputs: Test stuff

This doesn't work:

page2.php
session_start();
foreach($_SESSION as $var => $val) {
            $$var = $val;
            echo $var; //output: many keys but NEVER test
}
echo $test; //gives Notice: Undefined variable: test
print_r($_SESSION); //outputs: many keys including [test] => 'Test stuff'

if(array_key_exists("test", $_SESSION)) {
            echo "TEST FOUND"; //outputs: TEST FOUND
}

What gives? TIA
-Shawn

attached mail follows:


Actually page1.php $_SESSION['GLOBALS']; should be:

foreach($GLOBALS as $var => $val) {
            $_SESSION[$var] = $val;
}

"Shawn McKenzie" <nospammckenzies.net> wrote in message
news:20030509041530.58839.qmailpb1.pair.com...
> I need some clarification here please. Maybe not the greatest thing to
do,
> but I'm just testing and this shows contradictory results in the piece
that
> doesn't work..
>
> This works:
>
> page1.php
> session_start();
> $test = "Test stuff";
> $_SESSION['GLOBALS'];
>
> page2.php
> session_start();
> $var = "test";
> $$var = $_SESSION[$var];
> echo $test; //outputs: Test stuff
>
> This doesn't work:
>
> page2.php
> session_start();
> foreach($_SESSION as $var => $val) {
> $$var = $val;
> echo $var; //output: many keys but NEVER test
> }
> echo $test; //gives Notice: Undefined variable: test
> print_r($_SESSION); //outputs: many keys including [test] => 'Test stuff'
>
> if(array_key_exists("test", $_SESSION)) {
> echo "TEST FOUND"; //outputs: TEST FOUND
> }
>
> What gives? TIA
> -Shawn
>
>

attached mail follows:


attached mail follows:


I try to retrieve some data from mysql database and display it an page 1.
This page should have one field, say the username, displayed as a link. I
also define avariable $member=$username, which works fine on page 1 but will
not be available on page 2 which then should get all information about this
user from the database.

Everything else works fine, it's just the variable $members is not available
for page 2.

I tried to make the variable global - no success.

Do I need a form to "hand over" a variable o the next page?

I hope you get what I am trying to do. Please help.

Christian

attached mail follows:


page1.html:
<a href="page2.html?member=<?= $username; ?>">link</a>

This should work if you have register_globals=on
page2.html:
Member = <?= $member; ?>

Or you can try this
page2.html:
Member = <?= $_GET['member']; ?>

-----Original Message-----
From: christian tischler [mailto:christiantischler.co.uk]
Sent: Friday, May 09, 2003 4:36 PM
To: php-generallists.php.net
Subject: [PHP] variables in not working in next page

I try to retrieve some data from mysql database and display it an page 1.
This page should have one field, say the username, displayed as a link. I
also define avariable $member=$username, which works fine on page 1 but will
not be available on page 2 which then should get all information about this
user from the database.

Everything else works fine, it's just the variable $members is not available
for page 2.

I tried to make the variable global - no success.

Do I need a form to "hand over" a variable o the next page?

I hope you get what I am trying to do. Please help.

Christian

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

attached mail follows:


Thanks but doesn't seem to work.

When I use a form it works but I hate the way it looks, so I would like to
have the username displayed as a link.

Christian.

"Martin Towell" <martin.towellworld.net> wrote in message
news:6416776FCC55D511BC4E0090274EFEF5082070A1exchange.world.net...
> page1.html:
> <a href="page2.html?member=<?= $username; ?>">link</a>
>
> This should work if you have register_globals=on
> page2.html:
> Member = <?= $member; ?>
>
> Or you can try this
> page2.html:
> Member = <?= $_GET['member']; ?>
>
> -----Original Message-----
> From: christian tischler [mailto:christiantischler.co.uk]
> Sent: Friday, May 09, 2003 4:36 PM
> To: php-generallists.php.net
> Subject: [PHP] variables in not working in next page
>
>
> I try to retrieve some data from mysql database and display it an page 1.
> This page should have one field, say the username, displayed as a link. I
> also define avariable $member=$username, which works fine on page 1 but
will
> not be available on page 2 which then should get all information about
this
> user from the database.
>
> Everything else works fine, it's just the variable $members is not
available
> for page 2.
>
> I tried to make the variable global - no success.
>
> Do I need a form to "hand over" a variable o the next page?
>
> I hope you get what I am trying to do. Please help.
>
> Christian
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

attached mail follows:


Give us a code sample.

"Christian Tischler" <christiantischler.co.uk> wrote in message
news:20030509071016.53327.qmailpb1.pair.com...
> Thanks but doesn't seem to work.
>
> When I use a form it works but I hate the way it looks, so I would like to
> have the username displayed as a link.
>
> Christian.
>
> "Martin Towell" <martin.towellworld.net> wrote in message
> news:6416776FCC55D511BC4E0090274EFEF5082070A1exchange.world.net...
> > page1.html:
> > <a href="page2.html?member=<?= $username; ?>">link</a>
> >
> > This should work if you have register_globals=on
> > page2.html:
> > Member = <?= $member; ?>
> >
> > Or you can try this
> > page2.html:
> > Member = <?= $_GET['member']; ?>
> >
> > -----Original Message-----
> > From: christian tischler [mailto:christiantischler.co.uk]
> > Sent: Friday, May 09, 2003 4:36 PM
> > To: php-generallists.php.net
> > Subject: [PHP] variables in not working in next page
> >
> >
> > I try to retrieve some data from mysql database and display it an page
1.
> > This page should have one field, say the username, displayed as a link.
I
> > also define avariable $member=$username, which works fine on page 1 but
> will
> > not be available on page 2 which then should get all information about
> this
> > user from the database.
> >
> > Everything else works fine, it's just the variable $members is not
> available
> > for page 2.
> >
> > I tried to make the variable global - no success.
> >
> > Do I need a form to "hand over" a variable o the next page?
> >
> > I hope you get what I am trying to do. Please help.
> >
> > Christian
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


Hi,
  Is there anyone have experiences about using ClibPDF functions?

  the following example don't work with my machine...

<?php
$cpdf = cpdf_open(0);

cpdf_page_init($cpdf, 1, 0, 595, 842, 1.0);
cpdf_add_outline($cpdf, 0, 0, 0, 1, "Page 1");
cpdf_begin_text($cpdf);
cpdf_set_font($cpdf, "Times-Roman", 30, "WinAnsiEncoding");
cpdf_text($cpdf, "Times Roman outlined", 50, 750);
cpdf_end_text($cpdf);
cpdf_finalize($cpdf);

Header("Content-type: application/pdf");
cpdf_output_buffer($cpdf);
cpdf_close($cpdf);
?>

Linux with Apache HTTP Server:
PHP/4.1.2
cpdf/2.02-r1-0 => from www.fastio.com

phpinfo() display CPDF Support enabled

regards,
Sepho

attached mail follows:


On Friday 09 May 2003 15:12, Sephiroth wrote:

> Is there anyone have experiences about using ClibPDF functions?

I don't have any experience using ClibPDF functions, BUT ...

> the following example don't work with my machine...

... if you say *how* it doesn't work then maybe someone who does have
experience with it will be better able to help.

--
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
------------------------------------------
/*
tax office, n.:
        Den of inequity. <