php-general Digest 16 Feb 2001 09:20:42 -0000 Issue 515

Topics (messages 39981 through 40119):

Re: Debugger, Debugger and Debugger
        39981 by: Toby Butzon
        40119 by: Thies C. Arntzen

Re: deleting cart items on session expire
        39982 by: Jason Brooke
        40000 by: Joseph H Blythe

Re: javascript in PHP statement
        39983 by: Michael Hall
        39990 by: DanO

run safe_mysqld from php code *urgent*
        39984 by: Student Center
        39998 by: Jon Snell

regex
        39985 by: Jerry Lake

Code Optimizer
        39986 by: Joe Sheble aka Wizaerd
        40052 by: Richard Lynch

ob_gzhandler and shtml files
        39987 by: Maciek Uhlig
        40007 by: Chris Lee

Getting LDAPS to work
        39988 by: John Hallam

Using PHP from the command line
        39989 by: Diego Fulgueira
        39991 by: Joe Stump
        39996 by: Joe Stump

PHP and cookies and/or headers
        39992 by: Jeremy Gillies
        40005 by: Chris Lee
        40053 by: Richard Lynch

Win32 extensions ---  complete confusion
        39993 by: Michael Hall
        40010 by: Phillip Bow

Re: Generate XML files
        39994 by: szii.sziisoft.com

Passing variables to a scripting engine... (like php)
        39995 by: Diego Fulgueira
        39997 by: Jon Snell
        40001 by: Diego Fulgueira

Re: [PHP-WIN] Bug in mktime-function ?
        39999 by: Ignatius Teo

Oracle + Classes strangeness...
        40002 by: James Atkinson

Run MySQL with COM?
        40003 by: Jeff Oien
        40054 by: Richard Lynch
        40059 by: Jeff Oien

Problems reformatting Unix timestamp with strftime
        40004 by: Steven Hirschorn
        40006 by: eschmid+sic.s.netic.de
        40009 by: Steven Hirschorn
        40012 by: eschmid+sic.s.netic.de
        40057 by: Rog
        40058 by: Steven Hirschorn
        40118 by: Steven Hirschorn

the best so far
        40008 by: Christian Dechery
        40056 by: Richard Lynch

Re: Editor with line counter for WIN95
        40011 by: David Robley
        40013 by: Jeff Oien
        40105 by: Ankur Verma

Re: Forms
        40014 by: Meir kriheli

checking to see if value is a integer from a form text field
        40015 by: Joseph H Blythe
        40016 by: Jason Murray
        40055 by: Richard Lynch

Re: cgi execution w/php failing
        40017 by: Richard Lynch

Re: building binary data structures
        40018 by: Richard Lynch

Re: checkbocks, arrays and more
        40019 by: Richard Lynch

Re: jpeg parsing
        40020 by: Richard Lynch

Re: A way to duplicate data across databases
        40021 by: Richard Lynch

Re: Building php4.0.4pl1 with mysql 3.23.32
        40022 by: Richard Lynch

Re: Problems installing PHP 4.0.4pl1 on RedHat 6.2
        40023 by: Richard Lynch

Re: column into array?
        40024 by: Richard Lynch

Re: COM vs ???
        40025 by: Richard Lynch

Re: Fatal Error!
        40026 by: Richard Lynch

Re: Apache/mod_rewrite for User Tracking
        40027 by: Richard Lynch

Re: ssl
        40028 by: Richard Lynch

Re: Newbie dummy questions..... error messages
        40029 by: Richard Lynch

Re: LOCK TABLES x COMMIT/ROLLBACK
        40030 by: Richard Lynch
        40060 by: Nuno Silva

Re: sorting a csv text file in PHP
        40031 by: Richard Lynch

Re: session_register()
        40032 by: Richard Lynch

Re: Setting Enviromental variables
        40033 by: Richard Lynch

Re: empty form field => pgsql NULL gracefully how?
        40034 by: Richard Lynch

Re: Short tags - proper name?
        40035 by: Richard Lynch

Re: Still can't talk to the Oracle
        40036 by: Richard Lynch

Re: ezmlm response (fwd)
        40037 by: Richard Lynch

Re: mail not sending to multiple address
        40038 by: Richard Lynch

Re: charactersets
        40039 by: Richard Lynch
        40064 by: Maxim Maletsky

Re: download prompt not woking on macintosh
        40040 by: Richard Lynch

Re: fsockopen timeout not working
        40041 by: Richard Lynch

Re: PHP and PGP
        40042 by: Richard Lynch

Re: uploading files
        40043 by: Richard Lynch

Re: (roberto)Standar of modules of PHP3 ...how i can make a extension in C/c++ for 
this version?
        40044 by: Richard Lynch

Re: list only checkbox-marked records on a new page
        40045 by: Richard Lynch

Re: realpath() problem....
        40046 by: Richard Lynch

Re: SMTP
        40047 by: Richard Lynch

Re: Help with session
        40048 by: Richard Lynch

Re: Best Remote Php/Mysql host
        40049 by: Richard Lynch

Re: MS SQL and Date Fields
        40050 by: Richard Lynch

Re: $HTTP_POST_VARS
        40051 by: Richard Lynch

TCP/IP Server Question
        40061 by: JCampbell

what is quicker...
        40062 by: Bojan Gajic
        40063 by: Mark Charette

Re: strange behavior of mysql & php
        40065 by: Maxim Maletsky

Re: apache & php
        40066 by: Maxim Maletsky

Re: pro's and con's of storing images
        40067 by: Maxim Maletsky
        40090 by: Andrew Hill
        40092 by: Maxim Maletsky

Re: re:linebreak
        40068 by: Maxim Maletsky

Re: PHP globals aren't really globals
        40069 by: Maxim Maletsky

Re: PHP Editors
        40070 by: Maxim Maletsky
        40080 by: Maxim Maletsky
        40102 by: John Monfort
        40115 by: Dallas Kropka
        40116 by: Maxim Maletsky

Re: $PHP_SELF in Netscape PART 2
        40071 by: Maxim Maletsky
        40072 by: Maxim Maletsky

Re: Help Work with files
        40073 by: Maxim Maletsky

Re: need better solution
        40074 by: Maxim Maletsky
        40077 by: Maxim Maletsky

Re: date maniplations
        40075 by: Maxim Maletsky

Re: Why???
        40076 by: Maxim Maletsky
        40078 by: Maxim Maletsky

Re: @ Scope
        40079 by: Maxim Maletsky

Re: require('asdf')
        40081 by: Maxim Maletsky

Re: Qoute problem
        40082 by: Maxim Maletsky

Re: Access my script
        40083 by: Maxim Maletsky

Re: Passing vars
        40084 by: Maxim Maletsky
        40094 by: Andrew Hill

Re: ereg problem
        40085 by: Maxim Maletsky

Re: Environment Variables ???
        40086 by: Maxim Maletsky

Re: Structuring large PHP programs
        40087 by: Maxim Maletsky

Re: Restrict access per IP Address
        40088 by: Maxim Maletsky

About to update
        40089 by: Joseph H Blythe

Searching Archives
        40091 by: Jonathan Sharp
        40093 by: Maxim Maletsky

Newbie User Def Function Question
        40095 by: Jeff Oien
        40097 by: Jonathan Sharp

can we load mssql image file from php ?
        40096 by: codemake

True || False ?
        40098 by: Jonathan Sharp
        40101 by: Toby Butzon
        40107 by: Maxim Maletsky
        40108 by: Maxim Maletsky

Is this potentially a problem?
        40099 by: Michael

menu / navigation class
        40100 by: scottrus.ipass.net

Re: Compiling PHP for Apache.
        40103 by: Ankur Verma

HTML Coding in mySQL field
        40104 by: Thomas Edison Jr.
        40106 by: Steve Werby
        40114 by: Maxim Maletsky

can we select image field from mssql use php
        40109 by: codemake
        40110 by: Jaxon

form variables showing blank but query shows non-blank ??
        40111 by: Andre Bajew
        40112 by: Maxim Maletsky

Re: Where is Regex List of Operators?
        40113 by: Ted Goranson

Re: File_exists function question.
        40117 by: Ben Peter

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


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


I've read that several times... so does that mean now the only debugger
for PHP4 is the Zend one?

--toby

Chris Lee wrote:
> 
> You must be viewing old documentation.
> 
> http://php.net/manual/en/debugger.php
> 
> clearly states that debugger, ie debugger_on() support is in php3 only, not
> in php4.
> 
> Your not out of luck though, you could still use the Zend Debugger, the Zend
> boys seem to be quite eager to improve its current quallity.
> 
> http://zend.com/store/products/ide-test-drive.php
> 
> --
> 
> Chris Lee
> Mediawaveonline.com
> 
> em. [EMAIL PROTECTED]
> 
> ph. 250.377.1095
> ph. 250.376.2690
> fx. 250.554.1120
> 
> "Ricardo D'Aguiar" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hi,
> >
> > Problem:
> > I'm trying put to work the debugger in php4.0.4pl1(Red Hat Distribution),
> I
> > change my php.ini file to enable the debugger but when try to use in a
> simple
> > script I get the following error:
> >
> > Fatal error: Call to undefined function: debugger_on() in
> > /var/www/html/php/dbg.php on line 2
> >
> > Questions:
> > 1º Do I need some sort of extension (something like  xxx.so) to activate
> the
> > debugger?
> >
> > 2º In php documentation (Chapter: Using the Debugger) says:
> >      Set up a TCP listener on that port somewhere (for example
> socket -l -s 1400
> > on UNIX).
> >
> >      I don't have that "socket" command in Linux/Unix, what is this?
> >      What this means?
> >
> > 3º I need to debug my script what is the best way to do that?
> >      (I tried the "Zend IDE Test Drive" but after 30 days is not for free
> and
> > can't put to work the "The DBG PHP Debugger").
> >
> > 4º What is the difference between Zend debugger, Dmitri Dmitrienko PHP
> debugger
> > (seen link below) and the 'internal' PHP debugger?
> >
> > Thanks, (Sorry for the bad english)
> >
> >
> >
> > Additional Information:
> >
> > PHP version: PHP Version 4.0.4pl1- Red Hat distribution
> > O.S. - Red Hat 7.0
> >
> > Compiled options (PHP) extract from phpinfo():
> > './configure' '--prefix=/usr' '--with-config-file-path=/etc'
> '--disable-debug'
> > '--enable-pic' '--enable-shared' '--enable-inline-optimization'
> > '--with-apxs=/usr/sbin/apxs' '--with-exec-dir=/usr/bin'
> '--with-regex=system'
> > '--with-gettext' '--with-gd' '--with-jpeg-dir=/usr' '--with-png'
> '--with-zlib'
> > '--with-db2' '--with-db3' '--with-gdbm' '--enable-debugger'
> > '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets'
> > '--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' '--enable-yp'
> > '--enable-ftp' '--enable-wddx' '--without-mysql' '--without-oracle'
> > '--without-oci8' '--with-xml'
> >
> > Simple Script to test the debugger:
> > <?php
> >     debugger_on(localhost);
> >
> >     $var = 1;
> >
> >     if ($var == 1 ) {
> >         echo "VAR is 1";
> >     } else {
> >         echo "VAR is not 1";
> >     }
> > ?>
> >
> > PHP.INI file (Revelant parts):
> > #Extension actived
> > extension=imap.so
> > extension=ldap.so
> > extension=pgsql.so
> >
> > [Debugger]
> > debugger.host   =       localhost
> > debugger.port   =       7869
> > debugger.enabled        =       true
> >
> > Dmitri Dmitrienko PHP Debugger:
> > http://dd.cron.ru/dbg/
> > +++++++++++++++++++++++++++++++
> > Ricardo D'Aguiar
> > MemoSis - Sistemas Informáticos
> > Portugal
> > +++++++++++++++++++++++++++++++
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]




On Thu, Feb 15, 2001 at 04:22:04PM -0500, Toby Butzon wrote:
> I've read that several times... so does that mean now the only debugger
> for PHP4 is the Zend one?

    there's http://dd.cron.ru






> However, there's no necessity to have the cgi version if you already have
> the modular version.  All that is needed is to call the appropriate script
> using a tool such as 'wget'.  This can be done manually or from cron as
> appropriate.
>
> Billy

No there's not - I think that goes without saying though.

But while you're compiling Php anyway, why not re-run ./configure without the
'--with-apache' and add an '--enable-discard-path' and type 'make; make
install' - then you can use this awesome tool from the command line without
having to invoke a http request to your webserver usng a third-party tool.

jason







Thanks all,

This gives me a good start, I think I will just get cron to do it at a certain time of 
day, the only problem is trying to tell which sessions have expired as the database is 
not going to know this.

Regards

Joseph





> I am new to php and I am wondering if it is possible to use a javascript
> variable in a php statement for example:
> 
> // create sql statement
> 
>               $sql = "select * from main where businesstype = "consultancy" and
> top.upper.villagename = != "0";";

As far as I know, no. Unless "top.upper.villagename" is a field in your
database and the rest is that field's contents (couldn't be ... too many
unescaped double quotes and semicolons). Nope, SQL statements don't work
like that and can only refer directly to data in a database, not php or
any other variables.

You might consider using if statements something like this:

if ($top.upper.villagename != '0') {
        $sql = "SELECT * FROM main WHERE business = 'consultancy'";
}


Hope this helps

Mick






note that javascript and PHP CANNOT interact natively on the same page...one
is client side and one is server side.

you can pass variables between the two in an HTTP request, however.

page1.php:

<script type=javascript>
function makeSqlQuery(businesstype,village) {
var sqlQuery;
        sqlQuery = "SELECT * FROM MAIN WHERE BUSINESSTYPE="
                        + businesstype +
                        " AND VILLAGE="
                        + village
location = "php2.php?sqlQuery=" + sqlQuery;
}
</script>
<form name=thisform>
<select name=businesstype>
</select>
<select name=village>
</select>
<input type=button
onclick="makeSqlQuery(thisform.businesstype,thisform.village)">
</form>

--

this is a silly way to do it, however, and you should just pass the
variables themselves and construct and run the query in a new request using
php.

you use the same page with control structures on it.

DanO


-----Original Message-----
From: Michael Hall [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 15, 2001 12:06 PM
To: Matt Davis
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] javascript in PHP statement



> I am new to php and I am wondering if it is possible to use a javascript
> variable in a php statement for example:
>
> // create sql statement
>
>               $sql = "select * from main where businesstype = "consultancy" and
> top.upper.villagename = != "0";";

As far as I know, no. Unless "top.upper.villagename" is a field in your
database and the rest is that field's contents (couldn't be ... too many
unescaped double quotes and semicolons). Nope, SQL statements don't work
like that and can only refer directly to data in a database, not php or
any other variables.

You might consider using if statements something like this:

if ($top.upper.villagename != '0') {
        $sql = "SELECT * FROM main WHERE business = 'consultancy'";
}


Hope this helps

Mick


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]





hey guys,
    in order to restart my mysql server i'd like to run safe_mysqld from my
php file. i have this:

`./usr/local/mysql/bin/safe_mysqld`

however when we check the list of processes, safe_mysqld isnt there. what am
i doing wrong? btw, we've tried taking out the period (.) and running exec()
instead

- noah






This is an issue with user permissions.  You *could* create a world
executable suid script that did executed the command.  PHP would then call
that.  This is dangerous though, and I'd avoid it.

-----Original Message-----
From: Student Center [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 15, 2001 3:45 PM
To: [EMAIL PROTECTED]
Subject: [PHP] run safe_mysqld from php code *urgent*


hey guys,
    in order to restart my mysql server i'd like to run safe_mysqld from my
php file. i have this:

`./usr/local/mysql/bin/safe_mysqld`

however when we check the list of processes, safe_mysqld isnt there. what am
i doing wrong? btw, we've tried taking out the period (.) and running exec()
instead

- noah



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]






is there a way I can make a regex to add a comma
to the beginning of every line of a comma delimited
file ?

Jerry Lake            - [EMAIL PROTECTED]
Web Designer
Europa Communications - http://www.europa.com
Pacifier Online     - http://www.pacifier.com




Is there anything that evaluates PHP code and checks for optimization?  Not 
like the Zend Optimizer, but one that checks for things such as variables 
that were defined but never used, repeated variables, unnecessary 
statements or constructs?  Basically a code cleaner such as C, C++, Java, 
etc all have?

Joseph E. Sheble
[EMAIL PROTECTED]
========================
Wizaerd's Realm
http://www.wizaerd.com





> Is there anything that evaluates PHP code and checks for optimization?
Not
> like the Zend Optimizer, but one that checks for things such as variables
> that were defined but never used, repeated variables, unnecessary
> statements or constructs?  Basically a code cleaner such as C, C++, Java,
> etc all have?

Errr...  That's what the ZendOptimizer does, pretty much...

Or are you looking for one where you see the altered source? -- Dunno where
any of those are, and sometimes the altered source isn't readable enough to
be worth looking at.

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm






Could anybody interested comment the following statement:

Apache doesn't correctly serve .shtml files if ob_gzhandler is enabled (the
output is distorted then).

Not related, perhaps? This is my experience, though. The newest Apache, the
newest PHP.

Just want to hear something before I file a bug.

Maciek





could accually be a browser issue. I know you can not compress an image and
send it accross, even with the proper headers, no broswer seems to
decompress it. try running a sniffer on the connection, make sure the proper
headers are being sent, cut and paste the sniffers output, see if you can
decompress it. maybe its not really being *garbled* maybe the browser just
doesnt know that its supposed to accept and de-compress ssl pages.


--


Chris Lee
Mediawaveonline.com

em. [EMAIL PROTECTED]

ph. 250.377.1095
ph. 250.376.2690
fx. 250.554.1120



""Maciek Uhlig"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Could anybody interested comment the following statement:
>
> Apache doesn't correctly serve .shtml files if ob_gzhandler is enabled
(the
> output is distorted then).
>
> Not related, perhaps? This is my experience, though. The newest Apache,
the
> newest PHP.
>
> Just want to hear something before I file a bug.
>
> Maciek
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






I have got php 4.0.4p1 configured with openssl 0.9.6
and ldap and I'm trying to get an ldap_connect to work
over ldaps as described in the ldap_connect
documentation.

I have no problem connecting using
ldap_connect(hostname) format but I do have a problem
with the URL format. This is what I am doing :-

$Host='ldaps://hostname/';
$ds=ldap_connect($Host);

What is wrong ?? any ideas ??

John

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/




Hi!! I was wondering if anyone knows how to pass parameters to PHP.EXE when
invoked from the command line (DOS prompt).

I know this shouldn't differ too much from the Linux version, so anyone who
has scheduled scripts to run using CRON should have an idea, i guess.

In particular, I don't know how to pass the URL and other parameters needed.

THANKS A LOT!!!
Cheers, Diego.





use $argv and $argc just like C/C++ :O)

--Joe

On Thu, Feb 15, 2001 at 03:50:54PM -0600, Diego Fulgueira wrote:
> Hi!! I was wondering if anyone knows how to pass parameters to PHP.EXE when
> invoked from the command line (DOS prompt).
> 
> I know this shouldn't differ too much from the Linux version, so anyone who
> has scheduled scripts to run using CRON should have an idea, i guess.
> 
> In particular, I don't know how to pass the URL and other parameters needed.
> 
> THANKS A LOT!!!
> Cheers, Diego.
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 

-------------------------------------------------------------------------------
Joe Stump, PHP Hacker, [EMAIL PROTECTED]                                 -o)
http://www.miester.org http://www.care2.com                                 /\\
"It's not enough to succeed. Everyone else must fail" -- Larry Ellison     _\_V
-------------------------------------------------------------------------------





Yeah - like I said ....

php foo.php -url http://www.mydomain.com/myfile.php

in foo.php

echo $argc;    // should be 3
echo $argv[0]; // will be the filename
echo $argv[1]; // will be -url
echo $argv[2]; // will be the url

--Joe


On Thu, Feb 15, 2001 at 04:47:48PM -0600, Diego Fulgueira wrote:
> Yes, but the problem is not to receive the arguments inside PHP.EXE but to
> call PHP.EXE passing it those arguments....
> I was thinking of something like:
> 
> c:\>php c:\mysite\myfile.php -url "http://mydomain.com/myfile.php"
> 
> If you have any ideas.... THANKS A LOT.  DIEGO.
> 
> 
> -----Original Message-----
> From: Joe Stump [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, 15 February, 2001 4:08 PM
> To: Diego Fulgueira
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Using PHP from the command line
> 
> 
> use $argv and $argc just like C/C++ :O)
> 
> --Joe
> 
> On Thu, Feb 15, 2001 at 03:50:54PM -0600, Diego Fulgueira wrote:
> > Hi!! I was wondering if anyone knows how to pass parameters to PHP.EXE
> when
> > invoked from the command line (DOS prompt).
> >
> > I know this shouldn't differ too much from the Linux version, so anyone
> who
> > has scheduled scripts to run using CRON should have an idea, i guess.
> >
> > In particular, I don't know how to pass the URL and other parameters
> needed.
> >
> > THANKS A LOT!!!
> > Cheers, Diego.
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> --
> 
> ----------------------------------------------------------------------------
> ---
> Joe Stump, PHP Hacker,
>                      -o)
> http://www.miester.org http://www.care2.com
> /\\
> "It's not enough to succeed. Everyone else must fail" -- Larry Ellison
> _\_V
> ----------------------------------------------------------------------------
> ---
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 

-- 

-------------------------------------------------------------------------------
Joe Stump, PHP Hacker, [EMAIL PROTECTED]                                 -o)
http://www.miester.org http://www.care2.com                                 /\\
"It's not enough to succeed. Everyone else must fail" -- Larry Ellison     _\_V
-------------------------------------------------------------------------------





Greetings,

Is anyone REALLY familiar with PHP and cookies and/or headers-- I have a
tough nut to crack and it involves three URLs.

Here is the situation, and I really want to avoid using our DB if I can.

I have a main URL that everyone will probably hit - splash page.
www.mainurl.com

>From there, users go into either the french or english version of the site
with two unique URLs...

www.english.com
www.francais.com

I want it so that if users go back to the splash page, it will pick up their
language preference (french or english) and send them to the index page of
either www.english.com or www.francais.com -- depending upon the last
argument set when they were last at the site. So, if they ended on an
english page, they would start at the english index page, but if the
finished on a french page, they would start on the french index page.

The problem with cookies is the fixed URL from which they can be read.
Obviously www.mainurl.com cannot read a cookie set by www.francais.com -- so
how can I over come this.

I suppose I could do it via IP stored in a DB, but even then there is a
problem as people who hide behind one IP -- say a large business -- 
would be stuck using each others' preferences depending upon who used the
site last.

I also do not want the user to have to type in a code word so that the
IP is tagged with a special identifier. I suppose I could use a random
number generated from a time stamp... but I really want to avoid using a DB!
-- mostly for speed and bloat of page size reasons.

Thanks in advance!
Jeremy




Ive done this, our secure server is on a differnt IP/domain name, of course
I still need cookies though.

<?php

 include_once('time.egn');

 if ( isset($HTTP_GET_VARS['PHPSESSID']) )
  session_id($HTTP_GET_VARS['PHPSESSID']);

 if ( isset($HTTP_POST_VARS['PHPSESSID']) )
  session_id($HTTP_POST_VARS['PHPSESSID']);

 session_start();

 if (!isset($HTTP_SESSION_VARS['SessionID']))
 {
  $SessionID = mtime();
  session_register('SessionID');
 }

 if (!isset($PHPSESSID))
  $PHPSESSID = session_id();

 $SID = "PHPSESSID=$PHPSESSID";
?>

All I have todo to set the SessionID ona  different domainname is pass the
PHPSESSID in the url to the new host, and voila I have access to the same
SessionID and other session vars. give it a shot, im sure this will work for
you. if not please give me an email, I will help you.


--


Chris Lee
Mediawaveonline.com

em. [EMAIL PROTECTED]

ph. 250.377.1095
ph. 250.376.2690
fx. 250.554.1120



"Jeremy Gillies" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Greetings,
>
> Is anyone REALLY familiar with PHP and cookies and/or headers-- I have a
> tough nut to crack and it involves three URLs.
>
> Here is the situation, and I really want to avoid using our DB if I can.
>
> I have a main URL that everyone will probably hit - splash page.
> www.mainurl.com
>
> From there, users go into either the french or english version of the site
> with two unique URLs...
>
> www.english.com
> www.francais.com
>
> I want it so that if users go back to the splash page, it will pick up
their
> language preference (french or english) and send them to the index page of
> either www.english.com or www.francais.com -- depending upon the last
> argument set when they were last at the site. So, if they ended on an
> english page, they would start at the english index page, but if the
> finished on a french page, they would start on the french index page.
>
> The problem with cookies is the fixed URL from which they can be read.
> Obviously www.mainurl.com cannot read a cookie set by www.francais.com --
so
> how can I over come this.
>
> I suppose I could do it via IP stored in a DB, but even then there is a
> problem as people who hide behind one IP -- say a large business --
> would be stuck using each others' preferences depending upon who used the
> site last.
>
> I also do not want the user to have to type in a code word so that the
> IP is tagged with a special identifier. I suppose I could use a random
> number generated from a time stamp... but I really want to avoid using a
DB!
> -- mostly for speed and bloat of page size reasons.
>
> Thanks in advance!
> Jeremy
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






In your main page:

<?php
    if (strstr($HTTP_REFERER, 'www.english.com')){
        header("Location: www.english.com");
    }
    elseif (strstr($HTTP_REFERER, 'www.francais.com')){
        header("Location: www.francais.com");
    }
?>

Note:  I usually swap the needle/haystack and have to look them up, but you
probably won't just use strstr anyway, so I didn't.

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: Jeremy Gillies <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Thursday, February 15, 2001 4:00 PM
Subject: [PHP] PHP and cookies and/or headers


> Greetings,
>
> Is anyone REALLY familiar with PHP and cookies and/or headers-- I have a
> tough nut to crack and it involves three URLs.
>
> Here is the situation, and I really want to avoid using our DB if I can.
>
> I have a main URL that everyone will probably hit - splash page.
> www.mainurl.com
>
> From there, users go into either the french or english version of the site
> with two unique URLs...
>
> www.english.com
> www.francais.com
>
> I want it so that if users go back to the splash page, it will pick up
their
> language preference (french or english) and send them to the index page of
> either www.english.com or www.francais.com -- depending upon the last
> argument set when they were last at the site. So, if they ended on an
> english page, they would start at the english index page, but if the
> finished on a french page, they would start on the french index page.
>
> The problem with cookies is the fixed URL from which they can be read.
> Obviously www.mainurl.com cannot read a cookie set by www.francais.com --
so
> how can I over come this.
>
> I suppose I could do it via IP stored in a DB, but even then there is a
> problem as people who hide behind one IP -- say a large business --
> would be stuck using each others' preferences depending upon who used the
> site last.
>
> I also do not want the user to have to type in a code word so that the
> IP is tagged with a special identifier. I suppose I could use a random
> number generated from a time stamp... but I really want to avoid using a
DB!
> -- mostly for speed and bloat of page size reasons.
>
> Thanks in advance!
> Jeremy
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





I'm trying to add PHP's MS SQL functionality to my Windows NT server.

My problem appears to be the extension_dir entry in the PHP.ini.   I've
tried every conceivable way to enter it (the files are actually in
C:\PHP\extensions), using absolute and relative paths, forward slashes,
backslashes, and whatever combinations I can think of.

Each time, I get the same error, which is that it can't load dynamic library
'<whatever path I entered>/php_mssql70.dll'

Can anyone help me?

Michael Hall
Database Engineer
Prairie Fire Web Design
[EMAIL PROTECTED]





Prior to PHP 4.04 there were two dll's(php_mssql65.dll, and php_mssql7.dll I
believe), but as of 4.04 there is only one which is php_mssql.dll.  If you
are using 4.04 then I assume thats your problem.  Otherwise I would suspect
you are trying to set the path where the extension declarations are rather
than where it asks for extensions_dir which should be c:\php\extensions\.
--
phill

""Michael Hall"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm trying to add PHP's MS SQL functionality to my Windows NT server.
>
> My problem appears to be the extension_dir entry in the PHP.ini.   I've
> tried every conceivable way to enter it (the files are actually in
> C:\PHP\extensions), using absolute and relative paths, forward slashes,
> backslashes, and whatever combinations I can think of.
>
> Each time, I get the same error, which is that it can't load dynamic
library
> '<whatever path I entered>/php_mssql70.dll'
>
> Can anyone help me?
>
> Michael Hall
> Database Engineer
> Prairie Fire Web Design
> [EMAIL PROTECTED]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





echo "<SECTION>\n<BLAH VALUE=\"$fromform_value1\">\n<FOOBAR
VALUE=\"$fromform_value2\"></SECTION>";

Reformat as you want, I just didn't want to write multiple "echo" lines.  =P
Or..


<xml>
<SECTION>
<BLAH VALUE="<?php $val?>">
<FOOBAR VALUE="<?php $val2?>"
</SECTION>
</xml>

-Szii

----- Original Message -----
From: Paulo Jan <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 15, 2001 4:05 AM
Subject: [PHP] Generate XML files


> Hi all:
>
> A question tangentially related to the former one. I have seen lots of
> tutorials about how to parse XML files using PHP and generate something
> else (usually HTML) from it, but I haven't seen anything so far about
> generating XML with some specific data.
> Basically, what I want is:
>
> 1) To have a XML file describing the structure of the data, like:
>
> <SECTION>
> <BLAH VALUE="">
> <FOOBAR VALUE="">
> </SECTION>
>
> 2) Receive the values of "BLAH" and "FOOBAR" from, say, a Web form.
> 3) Output an XML file with the values of "BLAH" and "FOOBAR", like:
>
> <SECTION>
> <BLAH VALUE="203">
> <FOOBAR VALUE="666">
> </SECTION>
>
> 4) Store said XML file with the data in a text field in a database.
>
> I suppose that I could use the existing XML parsr functions to parse
> the XML template in 1), and define event handlers that output the
> relevant XML tag with the specific data, like:
>
>
> function startElement($parser, $name, $attribs) {
> $data=$data . "<BLAH VALUE=\"" . $blah . "\">";
> }
>
> (I know that the above is probably wrong; it's just an example).
>
> ...But I'd like to know if there's another way to do the above,
> something more... elegant.
>
>
> Paulo Jan.
> DDnet.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]





Ok. I already posted a question asking how to pass parameters to php.exe
when running it directly from the command prompt. However, i've noticed the
matter is a bit more complex than i had thought. I will reformulate my
question:

How the h--- does any Web Server passes information like the URL being
processed, posted variables, etc, etc, to a scripting engine???

I've noticed it is not through command line arguments... Could it be using
enviroment variables...?

The initial purpose of this was to schedule a script to be executed on a
periodic basis... but know I am very curious!!
Still, i will greatly appreciate workarounds.

THANKS A LOT AGAIN.

Cheers, Diego.





It is sent as text to stdin.

-----Original Message-----
From: Diego Fulgueira [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 15, 2001 4:45 PM
To: Php-General
Subject: [PHP] Passing variables to a scripting engine... (like php)


Ok. I already posted a question asking how to pass parameters to php.exe
when running it directly from the command prompt. However, i've noticed the
matter is a bit more complex than i had thought. I will reformulate my
question:

How the h--- does any Web Server passes information like the URL being
processed, posted variables, etc, etc, to a scripting engine???

I've noticed it is not through command line arguments... Could it be using
enviroment variables...?

The initial purpose of this was to schedule a script to be executed on a
periodic basis... but know I am very curious!!
Still, i will greatly appreciate workarounds.

THANKS A LOT AGAIN.

Cheers, Diego.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]






...But a scripting engine can process A LOT of information (think about how
much information can be sent with a HTML form in posted variables). Apache
and IIS do not call PHP.EXE sending all posted variables inside command line
arguments... So, how do THEY do it???

Thanks a lot for the patience...
Cheers Diego.

Michael Geier WROTE:

you can pass the $ARGV array as command line parameters

/script.php arg1 arg2

script.php
#!/path/to/php -q
<?
if (count($argv) < 2) {
        die ('Please enter correct number of parameters');
}

echo $argv[1] . " | " . $argv[2] . "\n";
?>


JOE STUMP WROTE:

Yeah - like I said ....

php foo.php -url http://www.mydomain.com/myfile.php

in foo.php

echo $argc;    // should be 3
echo $argv[0]; // will be the filename
echo $argv[1]; // will be -url
echo $argv[2]; // will be the url

--Joe

-----Original Message-----
From: Diego Fulgueira [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 15, 2001 4:45 PM
To: Php-General
Subject: [PHP] Passing variables to a scripting engine... (like php)


Ok. I already posted a question asking how to pass parameters to php.exe
when running it directly from the command prompt. However, i've noticed the
matter is a bit more complex than i had thought. I will reformulate my
question:

How the h--- does any Web Server passes information like the URL being
processed, posted variables, etc, etc, to a scripting engine???

I've noticed it is not through command line arguments... Could it be using
enviroment variables...?

The initial purpose of this was to schedule a script to be executed on a
periodic basis... but know I am very curious!!
Still, i will greatly appreciate workarounds.

THANKS A LOT AGAIN.

Cheers, Diego.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]






RE: [PHP-WIN] Bug in mktime-function ?This is the output I get running 4.0.4pl1 or 
3.0.17 on Win98/Apache

Using 3/9/1935
Unix timestamp for this date is -1


Warning: unexpected error in date() in c:\inetpub\wwwdev\staffroot\myscu\date.php on 
line 13
Reconverting... 

What platform r u using?

Ignatius

  -----Original Message-----
  From: Boget, Chris [mailto:[EMAIL PROTECTED]]
  Sent: Friday, 16 February 2001 02:16
  To: 'Ignatius Teo'
  Cc: Php (E-mail)
  Subject: RE: [PHP-WIN] Bug in mktime-function ?


  > Therefore any date on or before 1 Jan 1970 ain't going to 
  > work using mktime or any PHP function which returns a 
  > UNIX timestamp. 

  I'm sorry, but this is wrong.  The following works with no 
  problems whatsoever. 

  <script language="php"> 

    $month = 3; 
    $day   = 9; 
    $year  = 1935; 
    
    echo "Using $month/$day/$year<br>\n"; 
    
    $oldDate = mktime( 0, 0, 0, $month, $day, $year ); 
    
    echo "Unix timestamp for this date is $oldDate<br><br>\n"; 
    
    echo "Reconverting... " . date( "F d, Y", $oldDate ); 

  </script> 



  Chris 





(Note, this is a long email..sorry, lots of code)

Ok, I'm baffled. I'm building a DB abstration class and I've run into
something very strang when creating the Oracle abstraction file.

If I use the following code all works well:

$conn = OCINLogon("user", "password", "SDB");
$stmt = OCIParse("SELECT something FROM here"); // This should return 638
rows.
OCIExecute($stmt);
echo OCIFetchStatement($stmt, $myarray);

It echo's out 638, as it should.

However when I do this:

include("./oracle.php");
$db = new sql_db("SDB", "user", "password");
$db->sql_query("SELECT something FROM here");

echo $db->sql_numrows() . "<br>";

$db->sql_close();

When that runs I get: 574

This is the code in the abstrcation class that matters:
if(!defined("SQL_LAYER")){

define("SQL_LAYER","oracle");

class sql_db {

  var $db_connect_id;
  var $query_result;
  var $row;
  var $stmt;

   //
   // Constructor
   //
   function sql_db($sqlserver, $sqluser, $sqlpassword, $database="",
$persistency=true){

     $this->persistency = $persistency;
     $this->user = $sqluser;
     $this->password = $sqlpassword;
     $this->host = $sqlserver;
     unset($this->stmt);

     if($this->persistency){
       $this->db_connect_id = @OCIPLogon($this->user, $this->password,
$this->server);
     } else {
       $this->db_connect_id = @OCINLogon($this->user, $this->password,
$this->server);
     }
     return $this->db_connect_id;
   }
function sql_query($query="") {
     // Remove any pre-existing queries
     unset($this->query_result);
     if($query != "") {
       if($stmt = OCIParse($this->db_connect_id, $query)) {
         OCIExecute($stmt);
         $this->query_result = $stmt;
       }
     }
     if($this->query_result) {
       return $this->query_result;
     } else {
       return false;
     }
   }
   //
   // Other query methods
   //
   function sql_numrows($query_id = 0) {
     if(!$query_id)
       $query_id = $this->query_result;
     if($query_id) {
       unset($this->rowset);
       $result = OCIFetchStatement($query_id, $this->rowset);
       return $result;
     }
     else {
       return false;
     }
   }

I'm lost as to why this dosan't work correctly...any help would be great.
Thanks :D

- James Atkinson
http://www.phpbb.com





I have a music database for my wife. She's on a client computer
and I have Apache, MySQL, PHP and her database on my computer, 
the server. I always have Apache running but not MySQL. Can I
have a PHP script that would run MySQL using COM? I haven't
looked into COM yet so any resources would be great also.
Jeff Oien




> I have a music database for my wife. She's on a client computer
> and I have Apache, MySQL, PHP and her database on my computer,
> the server. I always have Apache running but not MySQL. Can I
> have a PHP script that would run MySQL using COM? I haven't
> looked into COM yet so any resources would be great also.

I'm not quite understanding why you don't just run MySQL on one computer or
the other, and let both computers connect to MySQL...

Running MySQL through a COM object is like swallowing diamonds so you can...
I'd better stop there, eh?

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm






> > I have a music database for my wife. She's on a client computer
> > and I have Apache, MySQL, PHP and her database on my computer,
> > the server. I always have Apache running but not MySQL. Can I
> > have a PHP script that would run MySQL using COM? I haven't
> > looked into COM yet so any resources would be great also.
> 
> I'm not quite understanding why you don't just run MySQL on one computer or
> the other, and let both computers connect to MySQL...
> 
> Running MySQL through a COM object is like swallowing diamonds so you can...
> I'd better stop there, eh?

Just as a novelty, I thought it would be nice for my wife to be 
able to start MySQL from her computer without having to come
over to my computer. Only my computer has the server and
MySQL. If it would be like swallowing diamonds I would rather
not. :)
Jeff Oien




I've checked this in the PHP documentation and done a scan of the 
archive to try to work out where I am going wrong but have failed. I 
know I could fix this problem by using substrings and processing them, 
but PHP has a simpler function which should work. Shouldn't it?

In my database a record has a timestamp of:
20010213173654

I extract the timestamp with a select statement, and process it with:

strftime("%A, %e %B %Y", $lastmodified)  (where lastmodified is the
variable containing the timestamp)

and it produces the output:
Monday, 18 January 2038

Does anyone know why PHP isn't interpreting the timestamp correctly? I 
can't work out how it could misinterpret the timestamp like this...

Thanks for any help!

-- 
Steven
"Sponges grow in the ocean... that *kills* me. I wonder how much deeper they'd
be if that didn't happen." - Steven Wright




On Fri, Feb 16, 2001 at 12:04:01AM +0000, Steven Hirschorn wrote:

> I've checked this in the PHP documentation and done a scan of the 
> archive to try to work out where I am going wrong but have failed. I 
> know I could fix this problem by using substrings and processing them, 
> but PHP has a simpler function which should work. Shouldn't it?
> 
> In my database a record has a timestamp of:
> 20010213173654
> 
> I extract the timestamp with a select statement, and process it with:
> 
> strftime("%A, %e %B %Y", $lastmodified)  (where lastmodified is the
> variable containing the timestamp)
> 
> and it produces the output:
> Monday, 18 January 2038
> 
> Does anyone know why PHP isn't interpreting the timestamp correctly? I 
> can't work out how it could misinterpret the timestamp like this...

You haven't read the PHP Manual carefully:

http://php.net/mktime
http://php.net/date

-Egon

-- 
http://www.linuxtag.de/
http://php.net/books.php 
http://www.concert-band.de/
http://www.php-buch.de/




On Fri, 16 Feb 2001 at 01:08:58, [EMAIL PROTECTED] writes
>You haven't read the PHP Manual carefully:
>
>http://php.net/mktime
>http://php.net/date

Thanks for the speedy reply! I've tried using:
date("l, jS F Y",$lastmodified)

with the same effect - 20010213173654 becomes
Monday, 18th January 2038. Is there a problem with the way I'm passing 
the timestamp to the date command?

-- 
Steven
"Sponges grow in the ocean... that *kills* me. I wonder how much deeper they'd
be if that didn't happen." - Steven Wright




On Fri, Feb 16, 2001 at 12:32:47AM +0000, Steven Hirschorn wrote:
> On Fri, 16 Feb 2001 at 01:08:58, [EMAIL PROTECTED] writes
> >You haven't read the PHP Manual carefully:
> >
> >http://php.net/mktime
> >http://php.net/date
> 
> Thanks for the speedy reply! I've tried using:
> date("l, jS F Y",$lastmodified)
> 
> with the same effect - 20010213173654 becomes
> Monday, 18th January 2038. Is there a problem with the way I'm passing 
> the timestamp to the date command?

Your timestamp looks bogus. On normal systems this can only be a 32 bit
integer and there will be an overflow at that time.

-Egon

-- 
http://www.linuxtag.de/
http://php.net/books.php 
http://www.concert-band.de/
http://www.php-buch.de/




[EMAIL PROTECTED] wrote:
 >Your timestamp looks bogus. On normal systems this can only be a 32 bit
 >integer and there will be an overflow at that time.

His timestamp is perfectly fine, it's just in the wrong format. His is 
formatted to YearMonthDayHourMinuteSecond and you (and the date function 
for that matter) are assuming a UNIX timestamp of seconds since 1970.

He's probably gotten his timestamp from a database, in which case the 
easiest solution is usually reformat the timestamp when collecting it from 
the database rather than within PHP.

(MySQL) Example :
select UNIX_TIMESTAMP(timestamp);

Then the timestamp will be properly formatted for PHP's date command.

--
                     Visit the Gates Motel webgame:
                     http://www.gameslate.com/gatesmotel/





On Fri, 16 Feb 2001 at 02:03:42, [EMAIL PROTECTED] writes
>> with the same effect - 20010213173654 becomes
>> Monday, 18th January 2038. Is there a problem with the way I'm passing
>> the timestamp to the date command?
>
>Your timestamp looks bogus. On normal systems this can only be a 32 bit
>integer and there will be an overflow at that time.

The timestamp is created within MySQL and means 17:36:54 on 13th 
February 2001. I suppose I was wrong in assuming that this is Unix 
format? In which case, is there a way I can process such a date from 
MySQL directly using a command like strftime() or date()? Or is it an 
uncommon timestamp format to have to process?

If there isn't a way of processing this with a simple command I'll admit 
defeat and use substrings ;-)

Thanks again.
-- 
Steven
"Sponges grow in the ocean... that *kills* me. I wonder how much deeper they'd
be if that didn't happen." - Steven Wright




On Thu, 15 Feb 2001 at 17:57:43, Rog <[EMAIL PROTECTED]> writes
>He's probably gotten his timestamp from a database, in which case the 
>easiest solution is usually reformat the timestamp when collecting it 
>from the database rather than within PHP.
>
>(MySQL) Example :
>select UNIX_TIMESTAMP(timestamp);
>
>Then the timestamp will be properly formatted for PHP's date command.

Hooray! This works, thanks!

-- 
Steven
"Sponges grow in the ocean... that *kills* me. I wonder how much deeper they'd
be if that didn't happen." - Steven Wright




this is the best I got so far, for treating any sql syntax errors as normal 
ERROrs and halting the parsing to report it.

like:

<?php
        define(LN,__LINE__);
        $cn=mysql_connect("databasewhatever");
        $query="bogus meant to trigger error query";
        $rs=mysql_query($query) or qerr(LN,$query);

        function qerr($errline,$query="unspecified")
        {
                $msg="<font face=verdana size=2 color=ff0000><b>SQL Syntax Error:</b> 
'$query'</font><br>\n";
                $msg.="<font face=verdana size=2 color=ff0000>[".mysql_errno()."]" 
".mysql_error()."at $errline</font>";
                die($msg);
        }

?>

anyone has a 'less-code' idea?
I wanted a smaller code on the calls to qerr(), I'd really like to call a 1 
parameter (just the query) function and print the error_msg and the line of 
code (the trickiest)...
is there anyway I can define something as a mask for a function or 
something? I don't know... just having crazy ideas...
this is pretty good as it is.. I just wanted even better...
____________________________
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer





function christians_error_handler($errno, $error, $file, $line, $context){
    $full_debug = 1; #set to 0 for less output.
    echo "Error $errno: $error<BR>\n";
    echo "In: $file, line number $line<BR>\n";
    if ($full_debug){
        print_r($context);
    }
    exit;
}

set_error_handler('christians_error_handler');

$cn=mysql_connect("databasewhatever");
$query="bogus meant to trigger error query";
$rs=mysql_query($query) or trigger_error(mysql_errno(), mysql_error());

Or, the K.I.S.S. solution
$rs = mysql_query($query) or die(mysql_error() . "<BR>\n$query<BR>\n");

Does die() give you a line number? If not, just put it in there.

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: Christian Dechery <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Thursday, February 15, 2001 6:30 PM
Subject: [PHP] the best so far


> this is the best I got so far, for treating any sql syntax errors as
normal
> ERROrs and halting the parsing to report it.
>
> like:
>
> <?php
> define(LN,__LINE__);
> $cn=mysql_connect("databasewhatever");
> $query="bogus meant to trigger error query";
> $rs=mysql_query($query) or qerr(LN,$query);
>
> function qerr($errline,$query="unspecified")
> {
> $msg="<font face=verdana size=2 color=ff0000><b>SQL Syntax Error:</b>
> '$query'</font><br>\n";
> $msg.="<font face=verdana size=2 color=ff0000>[".mysql_errno()."]"
> ".mysql_error()."at $errline</font>";
> die($msg);
> }
>
> ?>
>
> anyone has a 'less-code' idea?
> I wanted a smaller code on the calls to qerr(), I'd really like to call a
1
> parameter (just the query) function and print the error_msg and the line
of
> code (the trickiest)...
> is there anyway I can define something as a mask for a function or
> something? I don't know... just having crazy ideas...
> this is pretty good as it is.. I just wanted even better...
> ____________________________
> . Christian Dechery (lemming)
> . http://www.tanamesa.com.br
> . Gaita-L Owner / Web Developer
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





On Fri, 16 Feb 2001 06:15, Info wrote:
> Notepad, Wordpad and MS Word are my available choices.
>
> Word interpret my PHP so how to inhibit that?
>
> so I can get a line count and get closer to my many newbie errors
> ..OR..
> I need a recommendation of an inexpensive editor.
>
> I am reading digest so please CC or direct mailto:[EMAIL PROTECTED]
>
> Thanks,
>
> Lonnie

This comes up so often it ought to be a FAQ - if you look on the links 
page of your favourite mirror or www.php.net/links.php you'll find a link 
called Editor List to a page with info about lots of editors for all 
sorts of OSes.

-- 
David Robley                        | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet                            | http://auseinet.flinders.edu.au/
            Flinders University, ADELAIDE, SOUTH AUSTRALIA




> This comes up so often it ought to be a FAQ - if you look on the links 
> page of your favourite mirror or www.php.net/links.php you'll find a link 
> called Editor List to a page with info about lots of editors for all 
> sorts of OSes.
> 
> -- 
> David Robley                        | WEBMASTER & Mail List Admin
> RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
> AusEinet                            | http://auseinet.flinders.edu.au/
>             Flinders University, ADELAIDE, SOUTH AUSTRALIA

Here is a review I just submitted to the page you mentioned.
Thanks for the link, I didn't know about PHPEd.

--------- 

ConTEXT is a freeware editor for Windows 9x and NT. It supports 
syntax coloring for PHP and has a split view feature
to simultaneously view and work with more than one file 
at a time. It's light on resources and highly customizable.
http://www.fixedsys.com/context/

I'm not affiliated with ConTEXT in any way. I was looking for a 
secondary editor and found this program had the features I wanted. 
I normally use Homesite but it's a resource hog and doesn't support 
split view for more than one file.
Jeff Oien





www.editplus.com

best regards

Ankur Verma
HCL Technologies
A1CD, Sec -16
Noida, UP
India

----- Original Message ----- 
From: "Info" <[EMAIL PROTECTED]>
To: "Php General" <[EMAIL PROTECTED]>
Sent: Friday, February 16, 2001 1:15 AM
Subject: [PHP] Editor with line counter for WIN95


> Notepad, Wordpad and MS Word are my available choices.  
> 
> Word interpret my PHP so how to inhibit that?
> 
> so I can get a line count and get closer to my many newbie errors
> ..OR..
> I need a recommendation of an inexpensive editor.
> 
> I am reading digest so please CC or direct mailto:[EMAIL PROTECTED]
> 
> Thanks, 
> 
> Lonnie
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]





Hi,

You can also try Manuel Lemos's form class, which can handle all this and 
many more. Check:

http://phpclasses.upperdesign.com/browse.html/package/1

>From the class description:
<snip>
Class that generates HTML forms supporting:
- XHTML compliant output.
- Keyboard navigation support:
* Attachment of labels with activation keys to each form field.
* Tab navigation order index.
- Built-in server side (PHP based) and client side (Javascript 1.0 or better) 
field validation for:
* E-mail address
* Credit card numbers (Visa, Mastercard, American Express, Discover, Diners 
Club, Carte Blanche, enRoute, JCB, any of these or even determined by a 
select field).
* Regular expressions.
* Field not empty.
* Field equal to another (useful for password confirmation fields).
* Field different from another (useful for reminder fields that must not be 
equal to the actual password).
* As set (for check boxes and radio buttons).
* As integer number (with range limitation).
* As floating point number (with range limitation).
* Programmer defined client and server validation functions.
- Ability to stop the user from submiting a form more than once inadvertdly.
- Sub form validation (validate only smaller set of field depending on the 
submit button that was used).
- Composition and generation of the form HTML output with fields displayed as 
fully accessible or in read-only mode.
- Generation of Javascript functions (useful to set to the page ONLOAD event):
* Set the input focus to a field.
* Select the text of a field.
* Set the input focus and select the text of a field.
* Enable and disable input fields
- Automatic capitalization of the text of a field:
* Upper case.
* Lower case.
* Word initials
- Etc.
</snip>

HTH
-- 
Meir Kriheli

  There's someone in my head, but it's not me - Pink Floyd


On Thursday 15 February 2001 01:01, Augusto Cesar Castoldi wrote:
> with the password you can use the funcio srtlen:
>
> $number_of_chars=strlen($password);
>
> Where are the right password? On a database??
>
> In the site http://www.hotscripts.com you'll find a lot of script exemplos
> in PHP and JavaScript to verify if a e-mail typed is right.
>
> Augusto Cesar Castoldi
>
> On Wed, 14 Feb 2001, Brandon Feldhahn wrote:
> > how can i make somthing that nows if there are 6-12 chars in a password
> > field. Also how do you make somthing the know is the password, and the
> > password confermation is the same. And finnally i need a script that
> > know if they filled all the form fields, and one that know if they put
> > and "@" in there e - mial
> >
> > sorry for all the request but i just cant find it anywere and i need a
> > little help to get my buissness going
> >
> > -Thank you for you time
> > Brandon





hey,

I have a strange problem, when a user inputs the quantity into a text input field in a 
cart, I want to be able to test to see if the value is a integer if it isn't then 
default it to 1

if ( !is_int($Qty) ) {
$Qty = 1;
}

Looks ok, should work in theory, but it doesn't if I use this test, the update on the 
database fails, take it out and it works, so if a user was to type "f" in the quantity 
field in the cart and hit update because the quantity field is int(2) in the database 
it will default to 0 which I do not want. I have also tried to set the type before the 
update like so:

$Qty = settype($Qty, "integer");

This also will make the update fail, how would I make sure a user does not type 
characters in the quantity field without using  javascript or ereg stuff to check the 
values? I just want to default the quantity to 1 if a invailid quantity is inputted.

If there is no obvious soulution then I will use a piece of javascript to check the 
field onSubmit for illegal characters and alert the user I guess.

Regards,

Joseph




> I have a strange problem, when a user inputs the quantity 
> into a text input field in a cart, I want to be able to test 
> to see if the value is a integer if it isn't then default it to 1
> 
> if ( !is_int($Qty) ) {
> $Qty = 1;
> }

Off the top of my head (and thus probably hideously wrong), how about:

$ActualQty = ereg_replace("[^0-9]", "", $Qty);
if (intval($ActualQty) <= 0)
{
  $Qty = 1;
}

Here we're removing everything that's NOT between 0 and 9, and then
checking to see if the variable has a value.

Jason




Data coming from a POST or GET is a string, by definition -- A URL just
doens't contain any data type information, and PHP isn't going to sit there
and try to guess what the data type of $x should be.

You'll need to check its validity as an integer by using something like
this:

if (strlen($quantity) && ((int) $quantity == (string) $quantity)) &&
$quantity){
}
else{
    $quantity = 1;
}

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: Joseph H Blythe <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Thursday, February 15, 2001 7:32 PM
Subject: [PHP] checking to see if value is a integer from a form text field


> hey,
>
> I have a strange problem, when a user inputs the quantity into a text
input field in a cart, I want to be able to test to see if the value is a
integer if it isn't then default it to 1
>
> if ( !is_int($Qty) ) {
> $Qty = 1;
> }
>
> Looks ok, should work in theory, but it doesn't if I use this test, the
update on the database fails, take it out and it works, so if a user was to
type "f" in the quantity field in the cart and hit update because the
quantity field is int(2) in the database it will default to 0 which I do not
want. I have also tried to set the type before the update like so:
>
> $Qty = settype($Qty, "integer");
>
> This also will make the update fail, how would I make sure a user does not
type characters in the quantity field without using  javascript or ereg
stuff to check the values? I just want to default the quantity to 1 if a
invailid quantity is inputted.
>
> If there is no obvious soulution then I will use a piece of javascript to
check the field onSubmit for illegal characters and alert the user I guess.
>
> Regards,
>
> Joseph
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





> I've read through the archives and still must be missing something. I
> need to execute a cgi script from php. This seems fairly trivial, but I
> can't get it to work.
>
> the cgi script is clean -- executes from the command line without issue
> and is 755
> from php the follwing is used:
>
>
> chdir("../../cgibin");
> if(is_executable("some.cgi"))
>     virtual("some.cgi");
> else
>     echo "Not executable";
>
> some.cgi is found and is executable but the following occurs when
> attemping to execute via virtual():
>
> Warning: Unable to include 'some.cgi' - request execution failed in
> [path to php page]

1. Are you running PHP as a Module?  If not, and PHP is itself running as a
CGI, virtual() simply cannot be used.  Solution: Use exec() (or system()
or...)

2. Path issues:  Try providing the full path to your CGI from the machine's
root file-system and/or from DOCUMENT_ROOT.  I'm not sure if virtual() uses
the include path, the current directory, or what, but you can never go wrong
with an absolute full pathname.  Well, until you try to move from one server
to another.  But you can get it to work for now, and then try variations on
altering include_path and suchlike later.

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm






> Having written loads of stuff in PHP, I find myself having for the first
> time to generate binary data in memory - I actually need to build a native
> file for a drawing program in memory. The data consists mainly of lists of
> 32bit little endian integers - some signed and some unsigned. I've started
> the work, and am building the data up in a string variable. I know however
> that I am about to get bitten by numeric overflows.
>
> For example if I have a function create_thingy($param1,$param2) where
param1
> is an unsigned 32 bit int, and the top bit is set, then I suspect that php
> will probably represent the number as floating point, and I'll probably
lose
> some precision.
>
> Has anybody been here before and found a good mode of working in the
> unsigned 32bit arena?

BCMATH would work...
If you're already messing around with using strings, you might as well use
BCMATH.
You now know as much about BCMATH as I do...

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm






> coke machine
> vending machine
> atm
> dinner
> public phone

You probably have an "asset_id" field on each of those.

> and someone is inserting a gas station there... and it has two dinners and
> 3 public phones, so he would check the checkboxes referring to these and
> add a little comment to show the number... right?
>
> but how can I pass this to the next page so I can insert in the tables?
> if I only had the checkboxes, it'd be easy like:
>
> <input type=checkbox name="assets[]"> <== for each of them... but how can
I
> add the input type text next to each of the checkboxes and make them
> referrable?

Despite the "Note:" in FAQ 8.1 (grrr!), you *can* use indices in your FORM
NAME attributes if it makes sense to do so.

<?php
    $asset_names[13] = 'Public Restrooms';
    echo "<input type=checkbox name=assets[13]> $asset_names[13] <input
name=quantity[13] size=2><BR>\n";
?>

Your processing script will then have:
$assets[13] and $quantity[13], both referring to Public Restrooms.

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm






>    Hello. I'll keep short. Does any of you guys out there know why
"imagecreatefromjpeg" >cannot open remote files ? I have php-4.0.4pl1-Win32
with default gd lib. All other gd-things >work fine, and I DO have the
access rights to the file.
>
>    "thank you for your cooperation" :)

It probably hasn't had the "remote wrapper" (the stuff that makes fopen()
etc capable of using http:// done to it.

You may be stuck with copying the file to a local /tmp file and dealing with
it there.

Unless, of course, you are a C hacker and want to modify the GD/PHP
functions in PHP to contribute back...

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm







> I'm making a script that generates test sites usíng dummy data stored in
one
> MySql database ("uwebsitebase")
>
> Now, using php-scripting, I'm copying these data to a demo-database
> ("uwebdemo"). The structure is the same - the same tables with the same
> fields. Only difference will be that the copied data should get new
primary
> keys which are auto-incremented. No problem there.
>
> However, the process is tedious. I have tables that contains some 30
fields
> and it's just a bore selecting all fields from one table, and then writing
a
> complete insert statement with all the fields except the PK.
>
> Is there an easier way? Remember 1) It's PHP 2) It's across databases.
>
> I have to script it, since I need the new keys on other places.

Couldn't you just use MySQL dump to dump it all out and suck it back in?...

Perhaps, after dumping it out once, you could find a way to script the
changes you need to the dumped file.

Another option -- I dunno about MySQL, but I think in PostgreSQL you could
maybe alter the database known as "template1".  PostgreSQL pretty much just
copies that database to create a new one.

WARNING:  I've never tried this.  I don't know that this is a supported
feature of PostgreSQL.  You should be very, very diligent and careful if you
try this.

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm






> ./configure' '--with-apache=/root/Apachetoolbox/apache_1.3.17'
> '--enable-gd-imgstrttf' '--with-mysql' '--with-mysql' '--with-pgsql'
> '--with-ldap'

Check your config.log files to see if you are using PHP's builtin MySQL
support, or if it found your MySQL installation.

If it is using the builtin support, you ignored the warning at the end of
the configuration step of PHP at your own peril. :-)
[It was in a nice little ASCII art box, with the usual stuff about licensing
and suchlike.]

Try re-configuring using --with-mysql=/path/to/your/mysql/source/tree

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm






> but when I run make... it says that there is nothing to do

Do a make clean, and rm config.cache and try again.

make clean tells it to start over, and recompile all that stuff it thinks it
already compiled right the first time...

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm






> how can I reference a result set by array index numbers???

> id_field  field
> --------|--------
> 1           first
> 1           second
> 1           third
> 2           fourth
> 2           fifth
>
> how can I do something like this:
>
> $array=mysql_db_query($database, $sql, $link_id);
>
> echo array[0];  file://I want this to print "first"
> echo array[1];  file://I want this to print "second"
>
> I know mysql_fetch_array pulls a ROW into an array, but in this case the
row
> is only one item wide, so I essentially want column results in an indexed
> array.

I don't think you can really do that directly.

Pretty much the whole database concept of row/column is that you want to use
your data the way you set it up in the database in the first place.

You *could* just iterate through your rows and *build* an array:

while(list($item) = mysql_fetch_row($result)){
    $array[] = $item;
}

and use that array for the rest of your program...

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm






> I would like make some componnent on linux wich I can use on php. Like I
> create a COM object on Windows and use it with a asp pages and reuse it in
a
> vb application without code duplicate,.... I would like install PHP on a
> linux and not on a Windows.

Things you need to search for and read up on:

PEAR
http://conf.php.net has samples at the end of some of Rasmus' talks about
how to do this.
But these will only integrate to PHP, not to other software.

DSO -- This is the Un*x moral equivalent of DLLs, so if you want your
Library available to PHP *and* other programs, you'll need to use this.

PS  Don't ask me for more details -- This is pretty much the full extent of
my knowledge.  I know which way to point you, but I've never been down that
road.

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm






> Fatal error: input in flex scanner failed in /var/www/html/gcdb/lang on
> line 1

>         require("lang/".$config_row["Language"]);

Try changing your 'require' to 'include'.

I'm not real clear on the details, but if you are trying to suck in a
variable-based filename, you might as well use 'include' anyway.

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm






> I'm not sure how off-topic this may be, but I'll carry on anyway...

'Sokay, I'll force it back on-topic :-)

> sent back to the page. Before now, I have cookies and IP address for user
> tracking. If someone could accept a cookie (I used a self-referring script
to

Use PHP4's builtin session support.  Save your hair.

It will use cookies for users that accept cookies, and munge your URLs and
FORMs automagically for users that don't accept cookies.

> With IP addresses, you can't record return visits, so it just tracks one
visit.
> With some ISP's they seam to use variying IP addresses, so then each page

Yes.  Large ISPs shuffle client IP's addresses regularly.
Also, users behind firewalls/proxies will be sharing a single IP.
You don't want to use IP for user identification.  It doesn't work.
It's also spoofable by hackers, or so the experts tell me.

> What I would like to do now is track the user with the URL. When someone
calls
> the site, (ether through the front door, or sent back to get an ID), they
are
> given an ID like so: 'KjsiHdbEyu8G645Dus96Sy54GD'. They are then sent to
say,
> http://localhost/KjsiHdbEyu8G645Dus96Sy54GD/home.
>
> Using mod_rewrite, I can then get the tracking var
(KjsiHdbEyu8G645Dus96Sy54GD),
> and rewrite the URL to http://localhost/home, and call the script. I know
this
> is possible. Something like /^\/([a-zA-Z0-9]{80})\/(.*)/$1?$2/ could work
for
> the rewrite rule, but rather than use $HTTP_SERVER_VARS["QUERY_STRING"] to
get
> the var, as I use a GET vars for some functions, could I get a var which
is sent
> to Apache, and then PHP accesses the var from there, and the rest is as
normal?

Use http://localhost/home/KjsiHdbEyu8G645Dus96Sy54GD/ instead.
(IE, swap the userid/file to file/userid)

Throw <?php phpinfo();?> in "home", and you'll see at least one variable you
can tear apart with Regex (or explode, even easier) to get the userid.

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm






> is there anything we should be aware of
> if we like that our php/mysql pages
> are working with an ssl-server ?

Nothing especially related to PHP, really, except what you would do anyway:

Don't be having a bunch of files laying around that you don't know what they
are or what they do or etc.

Your PHP files should all have minimal permissions to make them work.



--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm






> I get the following on one of my pages,
>
> Warning: Use of undefined constant month - assumed 'month' in
>
> This site ran error free before, only after adding "Phorum"
>
> if ($brand == 'nut') {
>
> if (isset($brand)) {
>   if ($brand == 'nut') {
>     $item = "Chris King 2nut Headset";
>   }
> }

Maybe easier to type:

if (isset($brand) && $brand == 'nut'){
    $item = "Chris King 2nut Headset";
}

Phorum must be altering your error_reporting() and not setting it back to
its original value.  Bad!

You can suppress those messages using error_reporting(7) right after you
include the Phorum stuff.  [7?  It used to be 7. Now there's a whole bunch
more flags, and I dunno what the numbers mean any more...]

Maybe error_reporting(E_ALL^E_NOTICE) or something like that...

Anyway, read up on error_reporting.

You may find that it's better, though, to change your php.ini file and get
these warnings all over the place -- You'll find typos in your variable
names easier, for one thing.

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm






> can someone explain me how to use LOCK TABLES to subtitute transactions?
>
> I don't seem to get how this is possible... and I really need this... I
> have a script that updates 4 tables at a time, and I have to be sure all
of
> them are updated, or NONE... I can only see this possible using
> commit/rollback...

I think the idea is this:

1. LOCK TABLES invovled.
2. Get the current values for all records you are about to change.
3. Attempt to make changes.
4. If any of the attempted changes fails, change back the ones that
succeded.*
5. UNLOCK the TABLES

* Or maybe UNLOCK lets you somehow rollback?...
* And if your attempt to undo the changes you already did fails, you'll need
some code to alert a human to straighten out the mess you've made after they
fix whatever is making the code not work in the first place.

You might have an easier time porting to a database that actually supports
transactions... :-)

http://postgresql.org

Or, the latest version of MySQL, but I dunno how stable their transaction
support is yet...

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm






Richard Lynch wrote:

[snip...]

> I think the idea is this:
> 
> 1. LOCK TABLES invovled.
> 2. Get the current values for all records you are about to change.
> 3. Attempt to make changes.
> 4. If any of the attempted changes fails, change back the ones that
> succeded.*

you just can't relie on this... imagine that you stop apache just in the 
middle of the script... or imagine some power outage or some segfault... 
whatever... you manual "rollback" will not succeed :(

the only cenario that a lock can (securelly) replace a transaction is 
when you're UPDATING (_not_ inserting or deleting) only ONE table.




> 5. UNLOCK the TABLES
> 
> * Or maybe UNLOCK lets you somehow rollback?...
> * And if your attempt to undo the changes you already did fails, you'll need
> some code to alert a human to straighten out the mess you've made after they
> fix whatever is making the code not work in the first place.
> 
> You might have an easier time porting to a database that actually supports
> transactions...:-)
> 
> http://postgresql.org


yes, this would be my bet :)



> 
> Or, the latest version of MySQL, but I dunno how stable their transaction
> support is yet...
> 
> --
> Visit the Zend Store at http://www.zend.com/store/
> Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
> Volunteer a little time: http://chatmusic.com/volunteer.htm
> 
> 
> 
Regards,
Nuno Silva






> Hi list,
> I have a csv text file that looks like this:
>
> Mike,1,Monday 12th of February 2001 02:14:09 PM
> Bob,3,Monday 12th of February 2001 02:14:17 PM
> Marry,2,Monday 12th of February 2001 02:16:38 PM
>
> I'm trying to get it to sort by the 2nd value (number
> descending and to show only the top two highest
> scores:
> Like this..
>
> Bob,3,Monday 12th of February 2001 02:14:17 PM
> Marry,2,Monday 12th of February 2001 02:16:38 PM
>
> This is what I have for code now:
>
> // show high scores
> $lines = file("quiz.txt");
> sort($lines);
> for ($ i=0; $i < count ($lines); $i++){
> $thisline = explode(",", $lines[$i]);

You should use that fgetcsv function... if it's in your version.
CSV is *not* simply comma-delimited.
Embedded commas and quote complicate it horribly.

> echo "<br>";
> for($j=0; $j < count($thisline);$j++)

> echo "$thisline[$j]" ;
>
> }
>
> Is this possible to do?
> I'm running linux with php3

It's possible to do, but you are currently sorting by the full line.
So "Bob" will always come before "Mike", no matter what their scores.
You'll need to get them all into a 2-D array with the fgetcsv, and use
http://php.net/usort

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm






> <?
> session_start();

> session_register('email');
> $session = session_id();
> $userid = '$user';

> $sql = "SELECT *
>     FROM users
>     WHERE user='$user' and pass='$pass'";

> if ($num == 1) {
> include "quote2.php";
> }

Unless quote2.php sets $email, you've never set it to anything.

You've probably got their email in $result -- you just need to pull it out
and set it.

$email = mysql_result($result, 0, 'email');






> I know that by using the header you can bring up a standard user
> authenication dialog box, that sets the EVs:
> $PHP_AUTH_USER
> $PHP_AUTH_PW
>
> But is it possible to use a custom form to set these variables manually
for
> site wide useage?

No.

The browser sends those variables on each page hit, and PHP will over-write
your settings with those from the browser.

Use different variable names.

You *can* set environment variables, of course, just don't call 'em
PHP_AUTH_USER.
http://php.net/setenv

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm






> INSERT INTO testtab2
>                 VALUES ( upper('$symbol'), '$two_liner', '$href',
>                          '$full_desc', '$submitter_name',
>          '$submitter_email', CURRENT_TIMESTAMP )
> 
> I hate to muck them up with a bunch of tests for empty vars, which then
> need to be replaced with NULL and have the single quotes ommited, etc. if
> there is some more graceful way?

$foo = strlen($foo) ? "'$foo'" : 'NULL';
.
.
.
$query = "insert into bar (foo,...) values($foo,...)";

-- 
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm






> I was just wondering if there's a "proper" name for what I've been
> calling the "short equals tag" ( <?= ). I'm just curious to see if
> there's actually a name for it or (if not) if somebody has a more
> descriptive name for it.

I call it the "Stop ASP-ers whining about how great <%= is so I can get back
to work" tag.

Guess it's not all that short, nor "proper", unless you have the right
viewpoint... :-)

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm






----- Original Message -----
From: Kristofer Widholm <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Tuesday, February 13, 2001 5:29 PM
Subject: [PHP] Still can't talk to the Oracle


> I'm setting up a back end production system for a television show,
> and have been given space on a development server with PHP 4 and
> Oracle support compiled in (but not the OCI libraries). The Oracle
> admin have given me my user name (let's say ora_user), a TNS name
> (tns_name), and a password (ora_pass).
>
> So I write code as follows...

You may need to set ORACLE_HOME etc in PHP's environment:

SetEnv("ORACLE_HOME=/path/to/oracle/home/dir");
SetEnv("ORACLE_GOD_KNOWS_WHAT_ELSE=/oracle/changes/it/every/release");

> if ($conn=ora_logon("ora_user@tns_name","ora_pass")) {
> echo "SUCCESS ! Connected to database\n";
> } else {
> echo "Failed :-( Could not connect to database\n";
> echo ora_errorcode($conn).": ".ora_error($conn)."<BR>";
> }
>
> In response to this code, I get the following error:
> ORA-12154 "Supplied argument is not a valid Oracle-Connection/Cursor
> resource in ...."
>
>  From reading php.net documentation on ora_logon, it seemed that maybe
> the ORACLE_HOME environment variable simply hadn't been set.
>
> I had the sys admins set it.
>
> And I still get the error.
>
> Any ideas from an experienced PHP/Oracle developer?

Also, if $conn isn't a valid connection, ora_errorcode() probably can't be
used on it.
It's a chicken and egg problem -- Until you have a valid connection, you
can't get the error message about why the connection failed...
Try echo $php_errormsg

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm






>     return ($va1, $var2);

echo $val1, "|", $var2;

Site A will get back whatever B *echos* out.

You may need some other delimiter than "|", depending on your data.

-- 
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm






Try changing all your \n to \r\n.

RFC is \r\n.

Un*x mail programs are smart enough to take \n
Microsoft mail programs are not that smart.

Put in the space after Cc: and before your email.

The space is *required* by some (all?) emailers?

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: "Peter Houchin" <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Tuesday, February 13, 2001 11:25 PM
Subject: [PHP] mail not sending to multiple address


> Can some one please have a look through this and give me a step in the
right
> direction asto why my mail script won't cc or bcc.  I've checked with the
> mail server admin and he said as far as the email server is concerned it
> supports multiple email address.. it will only send  to the $address but
not
> any other address..
>
> /* recipients */
>
> $address .= "$email"  ;//note the comma
>
> // Subject
>
> $subject = "ABC Calculation Results";
>
> file://Body of email
>
> $body = "Thank you $user,\n Your Rental Monthly Figures are as follows:\n
> \n 24 Months = $ $m2 \n 36 Months = $ $m3 \n 48 Months = $ $m4 \n
> Your Quartly Figures are: \n $ $q2 Over 24 Months \n $ $q3 Over 36 Months
\n
> $ $q4 Over 48 Months\n
> \n\n\n\n
> Thank you again from VFSA-eRentals</font>";
>
> file://Where the email is from
>
>
> $headers .= "From: ABC <[EMAIL PROTECTED]>\n";
> $headers .= "X-Sender: <[EMAIL PROTECTED]>\n";
> $headers .= "X-Mailer: PHP\n"; // mailer
> $headers .= "X-Priority: 1\n"; // Urgent message!
> $headers .= "Return-Path: <[EMAIL PROTECTED]>\n";  // Return path for
> errors
>
> /* If you want to send html mail, uncomment the following line */
> file://$headers .= "Content-Type: text/html; charset=iso-8859-1\n"; //
Mime type
>
> $headers .= "cc:[EMAIL PROTECTED]\n"; // CC to
> $headers .= "bcc:[EMAIL PROTECTED]\n"; // BCCs to
>
> file://send the email
>
> $mailsend = mail("$address", "$subject", "$body.", "$headers
\nContent-Type:
> text/plain; charset=iso-8859-1\nContent-Transfer-Encoding: 8bit" );
> print ("$mailsend");
> ?>
>
> Thanks
>
> Peter
>





You'll need to use some way to convert é to &eaccentgrave; or whatever the
HTML Character entity is for that.

And it probably won't work at all inside of a menu or a button, which relies
on the underlying OS, which probably only accepts ASCII.

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: "Dominick Vansevenant" <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Wednesday, February 14, 2001 4:51 AM
Subject: [PHP] charactersets


> Hello,
>
> I am outputting different french accents on my webpages.
>
> They are imported in MySQL and there with a simple select I can see the
> accents are
> in good condition:
>
> e.g.: Adresse lié à un atlas électronique
>
> But when I use PHP to process the label into for example a select box with
> option fields,
> I get something like this:
>
> e.g.: <option value='Adresse li, . un atlas ,lectronique' >Adresse li, .
un
> atlas ,lectronique</option>
>
> I suppose I should change something in MySQl or in the PHP settings, can
> anyone point me to the setting?
>
> Thanks in advance,
>
> Dominick
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





I think you haven't use the proper charset in your HTML header ...

try to simply encode the page in the language you use, it should be the
same.

I am using Japanese characters in here and they work without I ever change
anything in mySQL. However they won't show up in browser unless I encode
them properly.

Cheers,
Maxim Maletsky



-----Original Message-----
From: Dominick Vansevenant [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 14, 2001 7:51 PM
To: [EMAIL PROTECTED]
Subject: [PHP] charactersets


Hello,

I am outputting different french accents on my webpages.

They are imported in MySQL and there with a simple select I can see the
accents are
in good condition:

e.g.: Adresse lié à un atlas électronique

But when I use PHP to process the label into for example a select box with
option fields,
I get something like this:

e.g.: <option value='Adresse li' ... un atlas 'lectronique' >Adresse li' ...
un
atlas 'lectronique</option>

I suppose I should change something in MySQl or in the PHP settings, can
anyone point me to the setting?

Thanks in advance,

Dominick



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




In addition to every header you can find, use:

http://yoursite.com/download.php/foo.jpg?download=foo.jpg

Yes, that extra foo.jpg looks real goofy in there.
PHP will ignore it.
Your web-server will ignore it.
Only really badly broken software products (IE) will say, "Hey, let's
*ignore* all those standards and stuff, and use the URL to decide what to
call the file.  Yeah, that's a good idea!"

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: Sebastian Stadtlich <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Wednesday, February 14, 2001 6:04 AM
Subject: [PHP] download prompt not woking on macintosh


> Hi all
>
> I tried to build a script that displays the 'save-file dialog', because
the
> files that should be downloaded
> are huge 32bit jpeg for printing. the problem is that it works in IE on
PC,
> Netscape on PC and MAC, but
> not in IE on a MAC. the files are jpeg, IE on Mac either tried to open the
> files ( which does not work,
> because they are CYMK), or displayes the filename 'download.php' in the
save
> dialog ....
> PLEASE HELP!!!! our designers can't be the only persons to use Mac on the
> world...
> i tried everycombination of the following headers, but without success...
>
> thanks
> sebastian
>
> code :
>
>         /*
>         header("Content-Type: application/octet-stream");
>         header("Content-Disposition: inline;
> filename=\"".basename($download)."\"");
>         set_time_limit(0);
>         readfile($download) or die ("File nicht gefunden oder sonstiger
> Fehler aufgetreten.");
>         */
>
>           header("Content-Type: application/download\n");
>           header("Content-Disposition: inline; filename=\"$download\"");
>           set_time_limit(0);
>           readfile($download);
> /*
>
>           header("Content-Type: application/download\n");
>           header("Content-Disposition: attachment;
filename=\"$download\"");
>           $fn=fopen("$download" , "r");
>           fpassthru($fn);
> */
>          /*
>            header("Content-Type: doesn/matter\r\n");
>            header("Content-Disposition: filename=$download\r\n\r\n");
>            header("Content-Transfer-Encoding: binary\r\n");
>            readfile($download) or die ("File nicht gefunden oder sonstiger
> Fehler      aufgetreten.");
>          */
>          /*
>            header("Content-Type: doesn/matter\r\n");
>            header("Content-Disposition: filename=$download");
>            header("Content-Transfer-Encoding: binary\r\n");
>            header("Content-Length: ".filesize($download));
>            readfile($download);
>          */
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





Isn't there a set_blocking function you have to call first?...

-- 
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message ----- 
From: Plamen Slavov <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Wednesday, February 14, 2001 8:40 AM
Subject: [PHP] fsockopen timeout not working


> Hi all,
> Does someone know why fsockopen timeout does not work?
> php3 
> $mydata=fsockopen($machine,$port,&$errno,&$errstr,30);
> 
> I think that this function should fail after 30
> seconds, but it just blocks the script.
> 
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail - only $35 
> a year!  http://personal.mail.yahoo.com/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 





Search the mailing list archives for about 2 years ago with my name and
"gpg" as a key.

Then, find the guy who followed up with how to use popen() instead of exec()
for better security.


--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: "Kevin Connolly" <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Wednesday, February 14, 2001 8:35 AM
Subject: [PHP] PHP and PGP


Does anyone know anything about using PGP with PHP pages?
Any tutorials or examples would be much appreciated!!
Thanks,
Kev






> Can you get php to upload an image if you have the direct location of the
> file (ie. c:\bar\foo\bar\foobar.jpg), but the only thing is that I am not

No.  Where the file lives on the user's computer is irrelevant, and you
can't just go snagging it.  If you could, you could go snagging all their
data, and they probably woudn't like that...

> getting this from a form file input with the ENCTYPE of the form set to
> "multipart/form-data".

> I am getting the location from a string that is open
> from a file.

What?...

Are you maybe getting the name of the temp file where it's been stored on
your server?

Use the http://php.net/copy function or that new-fangled copy_uploaded_file
or whatever it is.

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm






Extending PHP3 requires that you read that text file in the source...
apidoc.txt? something like that, and then do whatever it says.

PHP4 has much easier ways to extend the functionality.

Upgrade if you can.

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: "Celestino Roberto Alejandro" <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Wednesday, February 14, 2001 4:23 PM
Subject: [PHP] (roberto)Standar of modules of PHP3 ...how i can make a
extension in C/c++ for this version?


Hello..
..how i can make a extension for this version of PHP3?
..Thanks
:-)






<input type=checkbox name=marked[] value=1 ></TD>...
<input type=checkbox name=marked[] value=2 ></TD>...
<input type=checkbox name=marked[] value=3 ></TD>...


The user shall mark interesting records and upon submitting the form shall
be shown on a new page showing only the marked records.

<?php
    $where = '';
    if (isset($marked)){
        $ids = array();
        while (list(,$id) = each($marked)){
            $ids[] = $id;
        }
        $where = "where id in (" . implode(', ', $ids) . ") ";
    }
    $query = "select blah, blah, blah from whatsit $where ";
?>

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm







> I need some help in using the function
>
> $try = realpath("./filename");
>
> I get a blank page when I try to echo. $try

realpath() doesn't do anything like try to figure out what you handed it
relative to the file system or anything.  It just takes whatever you give it
literally.  The path part of ./filename is pretty much empty.

You probably want to look for a function in the PHP filesystem documentation
section like pwd() or cd() or cwd() that will tell you the current
directory.

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm






I think you *can* use the "for win32 only" stuff on Linux if you want to
send your mail to a different server...

Also, Manuel Lemos' email class will let you spew at any server on port 25,
I think...

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: "Sebastien Le Floc'h" <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Thursday, February 15, 2001 10:35 AM
Subject: [PHP] SMTP


> Hi, on PHP.ini, it's said
>
> [mail function]
> SMTP = localhost ;for win32 only
> sendmail_from = [EMAIL PROTECTED] ;for win32 only
> ;sendmail_path  = ;for unix only, may supply arguments as well (default is
'sendmail -t -i')
>
> Well, my question is : does anyone knows abasic solution to use another
smtp server than localhost (we use sudo, on debian, sendmail is on the sbin
dir and we don't want to move it from here, that's the problem : mail() is
used by nobody and not have rights tu use sendmail, if it's on sbin...)
>
> I know I may implement another php mail() fonction that connect to the
SMTP server I want and says helo....
> But I was wondering it anyone had a better solution
>
> Thanks
> Seb
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





I think you want the session_start() and session_register() calls at the top
of the script, not buried in your if() statements.

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: "Karl J. Stubsjoen" <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Thursday, February 15, 2001 11:36 AM
Subject: [PHP] Help with session


> I have 2 functions on my page, RegisterUser, IsValidUser.
> RegisterUser looks in the querystring to see if you've passed a certain
key
> & value.   If you have it populates a session variable called "ValidUser"
> with a 1.
> All that IsValidUser does, is check to see if the session variable
> "ValidUser" is a 1 or not.
>
> It doesn't work.
> RegisterUser (which sets session variables) is taking place before headers
> are written to the browser.  I'm not gettin errors, but the problem is
that
> ValidUser isn't able to read the session variable for some reason.
>
> Any Ideas?
>
> Here is the code for these 2 functions:
>
> function IsValidUser()
> {
> global $HTTP_SESSION_VARS;
>
> $reslt = 0;
>
>   if (isset($HTTP_SESSION_VARS["ValidUser"]))
>    {
>     if ($HTTP_SESSION_VARS["ValidUser"] == "1")
>      $reslt = 1;
>   }
>   print("ValidUser? " . $HTTP_SESSION_VARS["ValidUser"] . "<br>");
>
> return($reslt);
> }
>
>
> function RegisterUser()
> {
> global $HTTP_SESSION_VARS;
> global $HTTP_GET_VARS;
> $reslt = 0;
>
> if (isset($HTTP_SESSION_VARS["ValidUser"]))
> {
>  if ($HTTP_SESSION_VARS["ValidUser"] == 1)
>  {
>    $reslt = 1;
>  }
> }
>
> if ($reslt=0);
> {
>
>  $Val_User = $HTTP_GET_VARS["fis"];
>
>  if ($Val_User == "1")
>  {
>   $reslt = 1;
>      if (!isset($HTTP_SESSION_VARS["ValidUser"]))
>      {
>     session_start();
>      session_register("ValidUser");
>      $HTTP_SESSION_VARS["ValidUser"] = 1;
>     }
>     else
>     {
>      $HTTP_SESSION_VARS["ValidUser"] = 1;
>     }
>  }
>  else
>  {
>  $reslt = 0;
>  }
> }
> return($reslt);
> }
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





http://hosts.php.net
http://hostbaby.com would be my current recommendation.  Hi Derek!

-- 
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message ----- 
From: "kaab kaoutar" <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Thursday, February 15, 2001 12:34 PM
Subject: [PHP] Best Remote Php/Mysql host


> Hi!
> Can u point me to an excellent php/mysql provider ?
> with whom i can communicate by distance !
> Thanks
> 
> 
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 





MS SQL almost for sure has a way to do this in your SQL, which will be
faster than PHP's mktime() anyway.

You'll have to read the MS SQL docs to find it, though...

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: "James Crowley" <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Thursday, February 15, 2001 1:31 PM
Subject: [PHP] MS SQL and Date Fields


> Hi,
> I have a problem (!). I am using an MS SQL db, which returns a date field.
> How can I format this using the date() function? ie how can I convert the
> date to a Unix timestamp? I know you can use the mktime() function, but in
> which case, how can I get the day/month/year etc from the ms sql date
> field?!
>
> Many thanks,
>
> - James
>
> Editor, VB Web
> ==================
> Web   - http://www.vbweb.co.uk
> Email - [EMAIL PROTECTED]
> ICQ#  - 60612011
> ==================
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





http://php.net/FAQ.php
talks about HTTP_POST_VARS a little...

-- 
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message ----- 
From: Augusto Cesar Castoldi <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Thursday, February 15, 2001 1:44 PM
Subject: [PHP] $HTTP_POST_VARS


>    reset($HTTP_POST_VARS);
>    while (list($key, $val) = each($HTTP_POST_VARS)) {
> file://print "$key - $val<br>";
>       if (substr($key,0,3) == "alt" or substr($key,0,3) == "exc")
> 
> 
> Somebody can explain or indicate any site about this ($HTTP_POST_VARS)?
> 
> It is used to do menu in php. If the name of the button (<input
> type="image" name="back"...>
> 
> then in php I use:
> 
> if ($back_x > 0) {
>   .
>   .
>   .
> }
> 
> Augusto Cesar Castoldi
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 





I was recently looking at the talker example at 
http://www.php.net/manual/en/ref.sockets.php
Does anyone know an example of making this same code for multiple connections. I'd 
love to see any working examples

<Jon> www.PictureArena.com
===============================
The lack of humility before nature thats 
being displayed here staggers me. 
===============================
</Jon> www.PictureArena.com




I have to detect wheater some number can be divided with 100.
About 4M times per day.
So, what is quicker:
1. if($num==fun($num/100)), where fun is round/ceil/floor, or
2. if($num%100), or
3. something else...

$num is int, of course
TIA
bojan





And why, pray tell, son't you determine the quicker of the 1st 2
empirically? It's not very hard to roll & time a loop ... and then you won't
have 10 different people guessing the answer.

Mark C.

"When the unknown is thought to be unknowable, gaps in knowledge are too
readily filled by fancy, so long as the fancy is consistent with faith." --
Sherwin B. Newland, M.D., "The Mysteries Within".
----- Original Message -----
From: "Bojan Gajic" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 15, 2001 9:11 PM
Subject: [PHP] what is quicker...


> I have to detect wheater some number can be divided with 100.
> About 4M times per day.
> So, what is quicker:
> 1. if($num==fun($num/100)), where fun is round/ceil/floor, or
> 2. if($num%100), or
> 3. something else...
>
> $num is int, of course
> TIA
> bojan
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>





Well, If you got it from myPHPadmin then you'll get it from the website as
well.
Both are on the web and using PHP. 

Make sure you have all the passwords right. (Just like in phpmyadmin)

Cheers,
Maxim Maletsky



-----Original Message-----
From: Altaf Shaikh [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 14, 2001 5:49 PM
To: [EMAIL PROTECTED]
Subject: [PHP] strange behavior of mysql & php


Very strange thing happened today. I had a db and a website that was running
fine and wanted to add another mysql db to the account, and when i did the
site no longer connects to the mysql server. I did not change any passwords
or anything else for that matter, simply added a database with a diff name
and then poof. Any suggestions on how to figure out what's going on? I can
get to the original db via phpmyadmin and the data is there. It just wont
connect from the website to the server.

What could be going on?

Al



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Then just follow it.
Read INSTALL file in PHP distribution

Cheers,
Maxim Maletsky



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 14, 2001 9:01 PM
To: [EMAIL PROTECTED]
Subject: [PHP] apache & php


help!

i want to get started!

how do configure Apache to work with PHP?

apparently it is not because my browser will not "find" the test files.php.

please help me to test it.

i am using Mac OS X (pb) so i should follow any Unix procedure ok, i think.

thank you.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




How many times do I have to post it here ...

People, store the graphics (or any other kind of uploaded and not-uploaded
files) our of DBs, put them in some logic way in some directories so they
are easier to use. Not in DB. In DB it will just getting slower. 

UNLESS there is no other solution for a problem you could have. 

my point: whenever it is possible to store the files in folders rather then
DBs - store them so.

Cheers,
Maxim Maletsky



-----Original Message-----
From: Adrian Murphy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 14, 2001 9:12 PM
To: [EMAIL PROTECTED]
Subject: [PHP] pro's and con's of storing images


I'm putting togeather a simple website buider app.
i'm allowing users to upload images.I'm wondering whether i should store
those images in a database or create dirs for each user.the mysql db has a
relatively small capacity but storing them to the db might make it simpler
for me.
also ftp functions don't work on the server and my damn isp keeps fobbing me
off when i ask him to do anything.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




This may be getting off topic, but the only way storing images in a database
DOES make sense is if you are accessing the the database via WebDAV.

.02


Best regards,
Andrew
---------------------------------------
Andrew Hill - OpenLink Software
Director Technology Evangelism
eBusiness Infrastructure Technology
http://www.openlinksw.com

On 2/15/01 10:18 PM, "Maxim Maletsky" <[EMAIL PROTECTED]> wrote:

> How many times do I have to post it here ...
> 
> People, store the graphics (or any other kind of uploaded and not-uploaded
> files) our of DBs, put them in some logic way in some directories so they
> are easier to use. Not in DB. In DB it will just getting slower.
> 
> UNLESS there is no other solution for a problem you could have.
> 
> my point: whenever it is possible to store the files in folders rather then
> DBs - store them so.
> 
> Cheers,
> Maxim Maletsky
> 
> 
> 
> -----Original Message-----
> From: Adrian Murphy [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 14, 2001 9:12 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] pro's and con's of storing images
> 
> 
> I'm putting togeather a simple website buider app.
> i'm allowing users to upload images.I'm wondering whether i should store
> those images in a database or create dirs for each user.the mysql db has a
> relatively small capacity but storing them to the db might make it simpler
> for me.
> also ftp functions don't work on the server and my damn isp keeps fobbing me
> off when i ask him to do anything.
> 





Exactly my point ... when it is needed it is good to use it,

But for an e-commerce site for example, associating graphics with products
it is too stupid to have these in databases.

Just call them like 000025558.gif and in the script <IMG
SRC=\"$usual_folder/$id.gif\"> and it's UP!

That what I try toy make people understand, some think that it is cooler
having graphics in the database, but it is actually a political war between
database maker ... "They support it? then I gotta do so too, or I'll lose
the market..."

Cheers,
Maxim Maletsky



-----Original Message-----
From: Andrew Hill [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 16, 2001 12:41 PM
To: Maxim Maletsky; 'Adrian Murphy'; [EMAIL PROTECTED]
Subject: Re: [PHP] pro's and con's of storing images


This may be getting off topic, but the only way storing images in a database
DOES make sense is if you are accessing the the database via WebDAV.

.02


Best regards,
Andrew
---------------------------------------
Andrew Hill - OpenLink Software
Director Technology Evangelism
eBusiness Infrastructure Technology
http://www.openlinksw.com

On 2/15/01 10:18 PM, "Maxim Maletsky" <[EMAIL PROTECTED]> wrote:

> How many times do I have to post it here ...
> 
> People, store the graphics (or any other kind of uploaded and not-uploaded
> files) our of DBs, put them in some logic way in some directories so they
> are easier to use. Not in DB. In DB it will just getting slower.
> 
> UNLESS there is no other solution for a problem you could have.
> 
> my point: whenever it is possible to store the files in folders rather
then
> DBs - store them so.
> 
> Cheers,
> Maxim Maletsky
> 
> 
> 
> -----Original Message-----
> From: Adrian Murphy [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 14, 2001 9:12 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] pro's and con's of storing images
> 
> 
> I'm putting togeather a simple website buider app.
> i'm allowing users to upload images.I'm wondering whether i should store
> those images in a database or create dirs for each user.the mysql db has a
> relatively small capacity but storing them to the db might make it simpler
> for me.
> also ftp functions don't work on the server and my damn isp keeps fobbing
me
> off when i ask him to do anything.
> 




for the tabs? 

use Regular Expressions to do all that kind of jobs if you really need it:

   $multiplier = 4;
   $text = ereg_replace("\t", str_replace('&nbsp;', $multiplier), $text)

Or simply use our good-old <PRE> tag.

Cheers,
Maxim Maletsky



-----Original Message-----
From: Jens Nedal [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 14, 2001 9:37 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] re:linebreak


Hy there everyone on the board 8), just a new listviewer droppign in.

In case of displaying \n that are stored in a variable or com from a DB or
inptu field you can also use nl2br($var) which automatically converts those
linebreaks to <br> and so get displayed correctly. Though that will not work
for the tabs.

Jens


----------------------------------------------------------------------------
Ostry & Partner                                         http://www.ostry.com
Hietzingerhauptstr. 145 1130 Vienna, Austria              +43 1 877 74 54-18




on 14.02.2001 6:41 Uhr, Steve Werby at [EMAIL PROTECTED] wrote:

> "Deependra B. Tandukar" <[EMAIL PROTECTED]> wrote:
>> I did with <br>. "\r\n" too is not giving a new line.
> 
> Actually "\n" does create a newline.  If you view the source code of the
web
> page from the browser you'll see that it works.  "\n" is not an HTML tag.
> It's not designed to create a newline in the HTML output sent to the
> browser.  As you discovered, the <BR> tag will do that.  Hope that is
clear.
> "\n" is typically used in PHP code so that when one looks at the HTML code
> sent to the browser one doesn't have to look at lines of HTML code that
> contain hundreds upon hundreds of characters.
> 
> --
> Steve Werby
> COO
> 24-7 Computer Services, LLC
> Tel: 804.817.2470
> http://www.247computing.com/
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




I never used 50 of them, but I think there's such a thing as 'register
globals' wchich makes all if the globals become available inside your
funcs......  no idea how to use it ... I feel like I've seen it in someone
else's code ...

correct me if I am wrong ...  

Cheers,
Maxim Maletsky



-----Original Message-----
From: Christian Dechery [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 14, 2001 11:25 PM
To: [EMAIL PROTECTED]
Subject: [PHP] PHP globals aren't really globals


I've been programming in C all my life, and now I just started developing
in PHP and I'm really enjoying it, it has all the missing improvements that
C needed to be more user-likely. 

But one thin I can't get, how can PHP call a variabel global, if it isn't
global.
A global var, is a var defined outside all functions and it's available
to all and altered by all, without having to redefine or call the var again.

In PHP, for a var to be global you have to add a 'global $var' inside the
function u want to use it. THis is not nice, what about if u have a form
with 50 fields and want a function to validate all of them, u have to pass
them all to the function or build a little piece of code to make all th
$GLOBALS local right?

Is this really the idea of global vars?


. [ Christian Dechery      ]
. Webdeveloper @ Tá Na Mesa!
. Listmaster @ Gaita-L
. http://www.tanamesa.com.br



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




This issue is better to search for in archives ... 
I can count hundreds of such threads in my mailbox already...

here: www.EditPlus.com,
it is better, cooler, simpler and faster then textpad which I used for a
whole bunch of time and simply uninstaller once I found EditPlus,.

Cheers,
Maxim Maletsky

 

-----Original Message-----
From: Matt DeLong [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 14, 2001 10:19 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] PHP Editors


Also try:
http://www.textpad.com/



Thanks,

Matt DeLong
Studio 77

eBusiness & Wireless Solutions Provider
615.793.2947
www.studio77.com


----- Original Message -----
From: Brandon Orther <[EMAIL PROTECTED]>
To: PHP User Group <[EMAIL PROTECTED]>
Sent: Thursday, January 18, 2001 11:28 AM
Subject: RE: [PHP] PHP Editors


> I am not sure what OS you are running but for windows I use PHPED. Check
it
> out at www.phped.com
>
> -----Original Message-----
> From: Karl J. Stubsjoen [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 18, 2001 7:03 AM
> To: PHP Mailing List
> Subject: [PHP] PHP Editors
>
>
> So what editor is recommended?  I'm a little familiar with Emacs (kinda
> cool, but I'm use to keywords and such being colored - as in Interdev).
>
> Thanks!
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




EditPlus does that ...  it's on Win...

but again, search archives ...

Cheers,
Maxim Maletsky

-----Original Message-----
From: Michael McGlothlin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 15, 2001 2:53 AM
To: Matt DeLong
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] PHP Editors


I write all my code in a normal plain-text editor, whatever is available 
on whatever OS I'm using - usually Linux. On MacOS I have a handy tool 
called BEdit (I think) that allows me to do a multiple-file search and 
replace. The only problem is it's a hassle to move a couple hundred 
makes of source files back and forth over the network so I'd rather do 
it on the server itself. Does anyone know of a good tool for doing such 
a search and replace? If it only works on individual files that is okay 
as I can always add the multiple-file abilties. I'd like it to be a 
freely available open source program if possible. I know I can do this 
sort of thing w/ Perl, and have, but Perl is a less than perfect tool in 
this case so I'd like something made for the purpose. Thanks.

Matt DeLong wrote:

> Also try:
> http://www.textpad.com/
> 
> 
> 
> Thanks,
> 
> Matt DeLong
> Studio 77
> 
> eBusiness & Wireless Solutions Provider
> 615.793.2947
> www.studio77.com
> 
> 
> ----- Original Message -----
> From: Brandon Orther <[EMAIL PROTECTED]>
> To: PHP User Group <[EMAIL PROTECTED]>
> Sent: Thursday, January 18, 2001 11:28 AM
> Subject: RE: [PHP] PHP Editors
> 
> 
>> I am not sure what OS you are running but for windows I use PHPED. Check
> 
> it
> 
>> out at www.phped.com
>> 
>> -----Original Message-----
>> From: Karl J. Stubsjoen [mailto:[EMAIL PROTECTED]]
>> Sent: Thursday, January 18, 2001 7:03 AM
>> To: PHP Mailing List
>> Subject: [PHP] PHP Editors
>> 
>> 
>> So what editor is recommended?  I'm a little familiar with Emacs (kinda
>> cool, but I'm use to keywords and such being colored - as in Interdev).
>> 
>> Thanks!
>> 
>> 
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>> 
>> 
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>> 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]







__________John Monfort_________________
_+-----------------------------------+_
     P E P I E  D E S I G N S
       www.pepiedesigns.com
"The world is waiting, are you ready?"
-+___________________________________+-

On Fri, 16 Feb 2001, Maxim Maletsky wrote:

> This issue is better to search for in archives ...
> I can count hundreds of such threads in my mailbox already...
>
> here: www.EditPlus.com,
> it is better, cooler, simpler and faster then textpad which I used for a
> whole bunch of time and simply uninstaller once I found EditPlus,.
>
> Cheers,
> Maxim Maletsky
>
>
>
> -----Original Message-----
> From: Matt DeLong [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 14, 2001 10:19 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] PHP Editors
>
>
> Also try:
> http://www.textpad.com/
>
>
>
> Thanks,
>
> Matt DeLong
> Studio 77
>
> eBusiness & Wireless Solutions Provider
> 615.793.2947
> www.studio77.com
>
>
> ----- Original Message -----
> From: Brandon Orther <[EMAIL PROTECTED]>
> To: PHP User Group <[EMAIL PROTECTED]>
> Sent: Thursday, January 18, 2001 11:28 AM
> Subject: RE: [PHP] PHP Editors
>
>
> > I am not sure what OS you are running but for windows I use PHPED. Check
> it
> > out at www.phped.com
> >
> > -----Original Message-----
> > From: Karl J. Stubsjoen [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, January 18, 2001 7:03 AM
> > To: PHP Mailing List
> > Subject: [PHP] PHP Editors
> >
> >
> > So what editor is recommended?  I'm a little familiar with Emacs (kinda
> > cool, but I'm use to keywords and such being colored - as in Interdev).
> >
> > Thanks!
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>






www.textpad.com

Wonderful app, highlighting, keeps your tabs.... lots of keyboard
shortcuts.... and lots of customization.

This is what all my developers prefer.


Dallas K.





I know, I was a TextPad fun too untill I found EditPlus ...
It is better, at least I though so.

Try it, it's a good alternative to TextPad ... especially for html/css work
... 
supports PHP as well and has VERY COOL RegEx replacement and search in files
(whether opened or in folder)

0.2c


Cheers,
Maxim Maletsky




-----Original Message-----
From: Dallas Kropka [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 16, 2001 5:20 PM
To: Maxim Maletsky; 'Michael McGlothlin'; Matt DeLong
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] PHP Editors



www.textpad.com

Wonderful app, highlighting, keeps your tabs.... lots of keyboard
shortcuts.... and lots of customization.

This is what all my developers prefer.


Dallas K.




This is not browser problem ... 

here:

    echo "<BR><A
HREF=\"$PHP_SELF?mode=sub_category&category=$category&sub_category=" .
urlencode($subcategories[$index]) . "\">" . $subcategories[$index] ."</A>';

This will always work.

Cheers,
Maxim Maletsky



-----Original Message-----
From: John Vanderbeck [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 14, 2001 11:54 PM
To: [EMAIL PROTECTED]
Subject: [PHP] $PHP_SELF in Netscape PART 2


Ok, I made all the changes from $PHPSELF to $PHP_SELF, and i'm further along
with Netscape than before.  However, it now seems that there are still some
statements that $PHP_SELF isn't evaluated in.  However, now I can narrow it
down to certain statements:

WORKS:
   echo "<P CLASS=Normal><A
HREF=$PHP_SELF?mode=index&category=root>Main</A> -> $category</P>";

DOES NOT WORK:
    echo '<BR><A HREF="', $PHP_SELF, '?mode=sub_category&category=',
$category, '&sub_category=', urlencode($subcategories[$index]), '">',
$subcategories[$index], '</A>';


- John Vanderbeck
- Admin, GameDesign



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Why don't you instead try to learn the strings handling ... 
I persoanlly never used commas in strings ...  looks suspicious to me ...

Cheers,
Maxim Maletsky


-----Original Message-----
From: John Vanderbeck [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 15, 2001 12:11 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] $PHP_SELF in Netscape PART 2


> You are using commas instead of periods, use ".$PHP_SELF." instead of
> ",$PHP_SELF," (and for the other instances as well).

Huh? I am going off of the example from the PHP documentation:

>From http://www.php.net/manual/en/function.urlencode.php
echo '<A HREF="mycgi?foo=', urlencode ($userinput), '">';

So I am using that as a model:
echo ' A HREF=" ', $PHP_SELF, '?mode=index&category=',
urlencode($cateogory), ' ">Blah</A>';

- John Vanderbeck
- Admin, GameDesign

>
>
>                      Visit the Gates Motel webgame:
>                      http://www.gameslate.com/gatesmotel/
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Read the following :

http://www.php.net/manual/en/ref.filesystem.php

Cheers,
Maxim Maletsky



-----Original Message-----
From: Karl J. Stubsjoen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 15, 2001 12:14 AM
To: PHP Mailing List
Subject: [PHP] Help Work with files


Hello, I need to work with files on my web server.  I need to be able move
them, delete them, rename them etc...
Is there a section in the documentation devoted to this?
- How do I list files in a directory?

Thanks!


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




use 

mysql_query($..... , ....) or die(mysql_error() . ' oopps..   big time....
')

Cheers,
Maxim Maletsky

-----Original Message-----
From: Christian Dechery [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 15, 2001 12:51 AM
To: [EMAIL PROTECTED]
Subject: [PHP] need better solution


I need a better solution for reporting SQL errors.

I'm used to work with ASP, and whenever a query has a syntax error, it stops
the script and reports the error as if it was a compile error. This is very
usefull, but int PHP it doesn't work like that, I know.

I came with a function query_error() that I call after each query, that
prints out the query, the error and the line... so I need to call it like
this.

if(!$rs) query_error($query,__LINE__);

but having to writ this down after EVERY single query, along with the
__LINE__
thing can get very boring, does anyone has a better solution?


. [ Christian Dechery      ]
. Webdeveloper @ Tá Na Mesa!
. Listmaster @ Gaita-L
. http://www.tanamesa.com.br



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




yeah ... then at this point why not to use PHPLIB that has it built in
already...

phplib.netuse.de

a great thing ...

Cheers,
Maxim Maletsky



-----Original Message-----
From: Chris Lee [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 15, 2001 1:02 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] need better solution


works for me, just call it. change it to better match yours if you like.

 function check_db($query = 'Unavailble')
 {
  global $store_db;
  if ( mysql_errno() )
    {
      echo "Error: Problem with DataBase : $store_db<br>\n";
      echo "Error: " . mysql_errno() . ':' . mysql_error() . "<br>\n";
      echo "Query: $query<br>\n";
      exit();
    }
 }

I havent played with a more automatic metod, ie. error_reporting();


--


Chris Lee
Mediawaveonline.com

em. [EMAIL PROTECTED]

ph. 250.377.1095
ph. 250.376.2690
fx. 250.554.1120



""Christian Dechery"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
I need a better solution for reporting SQL errors.

I'm used to work with ASP, and whenever a query has a syntax error, it stops
the script and reports the error as if it was a compile error. This is very
usefull, but int PHP it doesn't work like that, I know.

I came with a function query_error() that I call after each query, that
prints out the query, the error and the line... so I need to call it like
this.

if(!$rs) query_error($query,__LINE__);

but having to writ this down after EVERY single query, along with the
__LINE__
thing can get very boring, does anyone has a better solution?


. [ Christian Dechery      ]
. Webdeveloper @ Tá Na Mesa!
. Listmaster @ Gaita-L
. http://www.tanamesa.com.br



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




you could use explode() function of PHP:

$date = 'MM/DD/YYYY';
$date_a = explode('/', $date);
$mm = $date_a[0];
$dd = $date_a[1];
$yyyy = $date_a[2];

$date = "$mm/".($dd+$n)."/$yyyy";

So here you have your date + something else ...
of course your exaple is smarter since in here I could manage to have 33
days...

You can however use mktime, and I believe the 1 month and 33 days will
result to use as february 2, (2 month + 2 days(1 month is 31 days as
january))

anyway ... explode is I believe what you are asking for.

Cheers,
Maxim Maletsky

-----Original Message-----
From: Don [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 15, 2001 12:48 AM
To: php list
Subject: [PHP] date maniplations


Hello,

Sorry if I am confused by the date functions in the manual but I am.
Here's what I want to do:

I have a string in the form MM/DD/YYYY.  I wish to:
1) convert it to a date
2) add $n days to it
3) convert back to a string in the same format above

I believe I can accomplish [2] and [3] with:

$mytdate = date("m/d/Y",mktime(0,0,0,date("m")
,date("d")+$n,date("Y")));

How do I accomplish step 1?
Can I type cast a string to a date?

Thanks,
Don


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Sure, 

here's the fix -- stripslashes() !

I'll explain : in PHP certain caracters have to be escaped to prevent these
hackers breaking your code up.
By default configuration PHP will automatically insert a backslash '/'
infront of every "dangerous" caracters received via GET, POST ect ...  for
instance on a form submission.

In your code you should use the strings just as they are (in the way they
arrived to you), except that on output using stripslashes() the backslash
will disappear.

BUT REMEMBER - ONLY ON OUTPUT...  

ie:

echo stripslashes($text);

Cheers,
Maxim Maletsky 

-----Original Message-----
From: Nguyen, David M [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 15, 2001 1:03 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Why???


Hi all,

I have a PHP web form setup for user to fill in information then email it to
me after pressing SUBMIT button.  Everytime user uses double-quote(") or
single(') it inserts (/) right in front of " or '.  Does anyone know why and
how to fix it?  Please advise.  Below is example of what I got from my email
when user submits form to me. 


Topic: Added \"Initial login to the EMS\" procedure.


Thanks in advance,
David

 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




This 'setting' is one of the best things PHP got.
Yes, you can configure PHP.ini so it won't put '/' infront " or ' but then
you'll have to do it yourself in the script... 

This is more a security issue, it is needed, believe me....

Cheers,
Maxim Maletsky

-----Original Message-----
From: John Vanderbeck [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 15, 2001 1:07 AM
To: Nguyen, David M; [EMAIL PROTECTED]
Subject: Re: [PHP] Why???


I can help you there, as I had the same problem until someone else helped
me.  This is because PHP will escape the input it gets.  I think this is
dependant on some enviroment setting, but I can't recall which one.

To fix it you call stripslashes($var);

- John Vanderbeck
- Admin, GameDesign

----- Original Message -----
From: "Nguyen, David M" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 14, 2001 11:02 AM
Subject: [PHP] Why???


> Hi all,
>
> I have a PHP web form setup for user to fill in information then email it
to
> me after pressing SUBMIT button.  Everytime user uses double-quote(") or
> single(') it inserts (/) right in front of " or '.  Does anyone know why
and
> how to fix it?  Please advise.  Below is example of what I got from my
email
> when user submits form to me.
>
>
> Topic: Added \"Initial login to the EMS\" procedure.
>
>
> Thanks in advance,
> David
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




It will escape the error ... or better say you force the function to always
return true.

Very useful if you don't really care whether you succeed or not. 

Like during user tracking, you don't want to exit the script only because
something went wrong while you were curious where did he come from, am I
right ?

so you use :

$where = @where($user);

this will always return true no matter what happen

Cheers,
Maxim Maletsky



-----Original Message-----
From: Karl J. Stubsjoen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 15, 2001 1:37 AM
To: PHP Mailing List
Subject: [PHP] @ Scope


When you @ "at" a command (supress error messaging) within a function, is
the scope of the @ within the function?

Example:


CloseODBC(1);

# is error message supressed here too?


function CloseODBC($connection_id)
{
    # error messaging supressed
    @odbc_close($connection_id);

}


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Use require("$DOCUMENT_ROOT/includes/folder/file.inc")

from any place on you website...

in other words you need to use the full path to the file.

Cheers,
Maxim Maletsky



-----Original Message-----
From: Brandon Orther [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 15, 2001 3:05 AM
To: PHP User Group
Subject: [PHP] require('asdf')


Hello,

I am using the require() function to open up the head of my pages.  In the
head.php file it requires something relative to its path.  What I want to do
is be able to require('head.php') without having to copy all the files
head.php requires into the folder of the script using this head.php file.

I hope you can understand that thanXor

Thank you,

--------------------------------------------
Brandon Orther
WebIntellects Design/Development Manager
[EMAIL PROTECTED]
800-994-6364
www.webintellects.com
--------------------------------------------


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




why not str_replace('"','|', $describe);
?
 this gotta work ...

Cheers,
Maxim Maletsky



-----Original Message-----
From: Tanya Brethour [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 15, 2001 3:17 AM
To: Web master
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Qoute problem




Let says I strip the slashes.. so it goes back to just normal qoutes.. and
then do the str_replace("\"","|", $describe);

$describe = stripslashes($describe);
str_replace("\"","|",$describe);

It doesnt replace the qoutes..

-Tanya

On Wed, 14 Feb 2001, Web master wrote:

> My approach towards this problem was to parse the data before inserting 
> and before displaying.
> Before inserting the data entered by user, do something like 
> str_replace($comments, "'","~") and do the same thing for " do a 
> different character like | and then insert it into database.
> Do the reverse before displaying the data, it should fix your problem..
> 
> Tanya Brethour wrote:
> 
> > Hi! I was hoping that someone could help me out. I am not positive if I
> > understand whats going on.. so let me try to explain.
> > 
> > This is a process to modify news articles in a MySQL database.
> > 
> > (From the point after picking the article to modify)
> > PHP Script #1:
> >   I grab everything from the database and stick it into the HTML form
> > (textarea, text, etc). I allow the user to modify whatever they want.
> > 
> > PHP Script #2:
> >  This script takes the new information and displays it to the user.. it
is
> > a preview of what it will look like with the changes.
> > 
> > PHP Script #3:
> >  Updates the news article in the database.
> > 
> > Now the problem I am having.. is that the description and content fields
> > have qoutes in them. For example:
> > Description: I like to run and walk. I love "smelly cheese."
> > 
> > So.. when it tries to update the database. It will only store this as
the
> > description:
> >     I like to run and walk. I love\\
> > 
> > I know that its because the qoutes are not being escaped correctly.. and
> > it seems as though it is escaping the escape. 
> > 
> > So my question is.. how can I keep my qoutes?
> > 
> > Just FYI.. I am making the user enter in the description and content in
> > html. So i cant just change the qoutes to HTMLTags because it would
change
> > my <P> and <a href=> etc.
> > 
> > Below is an example of the code (shortened for an example):
> > 
> > PHP Script #1: Editing description
> > 
> > print'
> > </textarea><br>
> > Description:<br><textarea name=describe cols=40 rows=10>';
> > echo $info["description"];
> > print'
> > </textarea><br>';
> > 
> > PHP Script #2: (preview changes)
> > 
> > <input type=hidden name=describe value="<?php print $describe?>">
> > <b>Description:</b><br>
> > <?php print $describe?> <p>
> > 
> > PHP Script #3: (update database)
> > $sql = "UPDATE news SET release_date='$date', title='$title',
> > description='$describe', contact='$contact', content='$test',
type='$type'
> > WHERE news_id=$id";
> > $result = mysql_query($sql)
> > 
> > 
> > Thanks in advance.
> > 
> > -Tanya
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




just type it in your browser ... 

or make .html to be parsed for PHP and include('the_file.php3')


Cheers,
Maxim Maletsky



-----Original Message-----
From: Barry Fawthrop [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 15, 2001 3:14 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Access my script



----- Original Message ----- 
From: "Barry Fawthrop" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 14, 2001 1:01 PM
Subject: Access my script


> I now have my .php3 script works well
> How do I access / call this script automatically from a .html page
> 
> or must it be set to a .shtml page ?
> 
> without the user / viewer pressing a link or button
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




you can use sessions ..

php.net/sessions

the session are cookies which will remember the user and will copy what you
need on your system, making these 30 lines available only to him for the
time you specify.

Cheers,
Maxim Maletsky

-----Original Message-----
From: Tanya Brethour [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 15, 2001 3:20 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: [PHP] Passing vars



Quick question..

If I have like 6 variables to pass to another PHP script... and some of
the vars are actually multiple lines of text (lets say over 30 lines).
What is the best way of doing this?

I would like to avoid doing something like test.php?cheese=(30 lines of
stuff)

Thanks in advance!
-Tanya


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




You may wish to consider why you need to pass 30 lines of code in a
variable.

If the code is static, store it in include files and then pass it in
depending one a variable

if ($variable=1)
    { include(your30linefile);
    }
 else
     { inclue(someotherfile);
     }

or to use a database query, pass a select value in as the index:

$sql = "select some_field from table where id_field = $variable

either way, you pass the value of $variable in from a page with this kind of
link:

<a href="page_name.php?variable=1">click me to submit $varible=1 to
page_name.php</a>

If the 30 lines of code is html that needs to be generated on the fly, break
it up into common blocks and drop them in using either method above.

You can also do things like passing a hidden form field instead of using a
link.


Best regards,
Andrew
---------------------------------------
Andrew Hill - OpenLink Software
Director Technology Evangelism
eBusiness Infrastructure Technology
http://www.openlinksw.com


On 2/15/01 10:20 PM, "Maxim Maletsky" <[EMAIL PROTECTED]> wrote:

> you can use sessions ..
> 
> php.net/sessions
> 
> the session are cookies which will remember the user and will copy what you
> need on your system, making these 30 lines available only to him for the
> time you specify.
> 
> Cheers,
> Maxim Maletsky
> 
> -----Original Message-----
> From: Tanya Brethour [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, February 15, 2001 3:20 AM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: [PHP] Passing vars
> 
> 
> 
> Quick question..
> 
> If I have like 6 variables to pass to another PHP script... and some of
> the vars are actually multiple lines of text (lets say over 30 lines).
> What is the best way of doing this?
> 
> I would like to avoid doing something like test.php?cheese=(30 lines of
> stuff)
> 
> Thanks in advance!
> -Tanya
> 





 - hyphen is something a bit special in RegEx ..

read the manual,  I think you should escape it.


Cheers,
Maxim Maletsky

-----Original Message-----
From: Janet Valade [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 15, 2001 3:21 AM
To: '[EMAIL PROTECTED]'
Subject: [PHP] ereg problem


I am using the following statement to check phone numbers. 

 if (!ereg("^[0-9\-\+\.\ \)\(]{10,}$",$value)) {

Can anyone tell me why this works for every character except the -. It
doesn't see the hyphen as a valid part of the phone number, even though it
recognizes the other characters, e.g. + or .

Janet


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Well, you should write some peace of code that will track your users ....

Try to search on Goggle, hotscripts.com etc ...

PHP cannot tell it to you automatically ... it can give you some data using
which with some logic you can arrived other point you know who they are and
how they found you ...

Cheers,
Maxim Maletsky

-----Original Message-----
From: Barry Fawthrop [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 15, 2001 5:48 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Environment Variables ???
Importance: High


Why do the Environment Variables
REMOTE_IDENT
REMOTE_USER
HTTP_FROM
HTTP_IDENT
and others exists IF they don't return any information ???

Is there anyway to find out Who visit's your site.
(1) I'm trying to determine between Search Engines and actual Visitors
(2) I'm trying to see who is interested in what I have. I have mailing list
and guestbook, yet no-one clicks these

Are there any "tricks" I can use to see who these people are ??
This is for a Christian Ministry site, if this is a factor


Thanks Barry



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




A large application should be a set of well organized files having one
single include at the top.

And in that include you do all kind of things.
Of course auto_prepend works always better /... but not always possible,
right...

use classes, reuse files ... libraries etc ...

Cheers,
Maxim Maletsky




-----Original Message-----
From: John McCreesh [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 15, 2001 5:25 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Structuring large PHP programs


What is the best practice for structuring a PHP program which is
becoming too large to manage as a single file? Should it be broken into
a number of includes, e.g.:

switch ($whatever) {
    case 0:
        include('case0.php');
        break;
    case 1:
        include('case1.php');
        break;
    case 2:
        include('case2.php');
        break;
}

or a number of functions:

require('mylib');
switch ($whatever) {
    case 0:
        case0();
        break;
    case 1:
        case1();
        break;
    case 2:
        case3();
        break;
}

Any thoughts, references to articles (couldn't find anything in
PHPBuilder), etc gratefully received...

Thanks - John

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




if(getenv('REMOTE_ADDR')==$my_IP)
        $LetMeIn = 1;
else
        unset($LetMeIn);

Cheers,
Maxim Maletsky



-----Original Message-----
From: Alexander Wagner [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 15, 2001 8:31 AM
To: PHP Mailing List
Subject: Re: [PHP] Restrict access per IP Address


Karl J. Stubsjoen wrote:
> Okay, last one for the day!  How do you query the clients IP address?
>  We have a site in development, and I want to restrict access to
> people coming in from certain IP addresses.
> Really, all I need to do is query the IP address, I can code the rest
> of it.

$remote_ip = getenv('REMOTE_ADDR');
should work.
There are other ways, but this one should be the safest.

regards
Wagner

-- 
Three may keep a secret, if two of them are dead.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Hey all,

I am about to update one of our servers (i386) running RedHat-6.0 smp to:

Apache-1.3.17
MySQL-3.23.33
ModSSL-2.8.0-1.3.17
PHP-4.0.4pl1
ZendOptimizer-1.0.0-4.0.4

Does anyone know of any problems/incompatabilities between the above packages on the 
above platform.

I am mainly doing this because of a bug in one of the mysql utils (mysqlimport) it 
dumps a core on exit in mysql-3.23.22, and thought I may as well update the whole lot 
and be done with it.

Regards

Joseph




> This issue is better to search for in archives ...
> I can count hundreds of such threads in my mailbox already...
* SNIP *
> Cheers,
> Maxim Maletsky

What about creating some kind of 'knowledge base' or like integrating this
mailing list into php.faqts.com? There are so many threads that keep getting
repeated...or what about a bot that extracts key words and sends an
automated response to that person with a digest version of the last thread
that matched those words? Call it "Ask G'enie" or something...

-Jonathan Sharp





That will be up on PHPBeginner.com within few days.

I think the knowledgebase will become available at least within a week or
so, (time for us to find all the info needed to start it)

Please help me with it if you know how.

Cheers,
Maxim Maletsky



-----Original Message-----
From: Jonathan Sharp [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 16, 2001 12:34 PM
To: Maxim Maletsky; [EMAIL PROTECTED]
Subject: [PHP] Searching Archives


> This issue is better to search for in archives ...
> I can count hundreds of such threads in my mailbox already...
* SNIP *
> Cheers,
> Maxim Maletsky

What about creating some kind of 'knowledge base' or like integrating this
mailing list into php.faqts.com? There are so many threads that keep getting
repeated...or what about a bot that extracts key words and sends an
automated response to that person with a digest version of the last thread
that matched those words? Call it "Ask G'enie" or something...

-Jonathan Sharp


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Could anyone give me the correct syntax for calling a function.

I have a block of code I want to reuse. How do I name this
code block and how do I call it? Having a hard time finding an
answer looking through docs. It's so basic I can't find
an explanation. :)
Jeff Oien




<?php

function someFunction($var)
{
        echo $var;
}

// Your script

someFunction("Foobar!");
?>

if you're creating an instance of a class object....

<?php
class someClass
{
function someFunction($var)
{
        echo $var;
}

}

$someClass = new someClass;

$someClass->someFunction("Foobar!");

?>

Cheers,
-Jonathan Sharp

> -----Original Message-----
> From: Jeff Oien [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, February 15, 2001 8:01 PM
> To: PHP
> Subject: [PHP] Newbie User Def Function Question
> 
> 
> Could anyone give me the correct syntax for calling a function.
> 
> I have a block of code I want to reuse. How do I name this
> code block and how do I call it? Having a hard time finding an
> answer looking through docs. It's so basic I can't find
> an explanation. :)
> Jeff Oien
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 
> 




hi:
i use php 4.0 and win 2000 chinese edition  and mssql 7.0
i have table with image field name is "isospicture"

here is my script 
when mssql_querry execute there will error message 


"0x7332fcbb"  command  reference "0x00bcb000" memory can't written

why ?

$SQL = "Select isospicture  from isospic where [filename] ='rose'";
$result1   = mssql_query($SQL,$link_ID);

gary yang 
from taiwan




How does php handle true and false? Do they act as true booleans? 

Can I do?

function foo()
{
        return false;
}

Thanks,
-Jonathan




Yes, you can return false. 

As for "true booleans", PHP doesn't really have a boolean type - it does
have a sense of "true" and "not true" though. You can return false (a
case-insensitive constant with the value 0) or true (whose value is
probably 1 but could really be anything other than 0 or the empty
string).

You can of course evaluate a true/false value as a regular condition...
if (someFunc()) {
  // do something if someFunc returns true
} else {
  // do something if someFunc returns false
}

..You get the idea.

--toby

Jonathan Sharp wrote:
> 
> How does php handle true and false? Do they act as true booleans?
> 
> Can I do?
> 
> function foo()
> {
>         return false;
> }
> 
> Thanks,
> -Jonathan
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]




Yeah, sure you can,

if return is found in function it then exits it.

for example avoiding 'else' statements:


function returnMeFoo($foo=0)
{
   if(!$foo)
      return "Hey, you forgot to type a number in";
   if($foo>5)
      return "$foo is bigger then 5";
   if($foo<5)
      return "$foo is less then 5";

   return "Then, logically, $foo *IS* 5";
}


// then call this function as 

echo '<P>'.returnMeFoo(4);
echo '<P>'.returnMeFoo(5);
echo '<P>'.returnMeFoo(6);


And see how fun it is!

Cheers,
Maxim Maletsky

-----Original Message-----
From: Jonathan Sharp [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 16, 2001 1:26 PM
To: [EMAIL PROTECTED]
Subject: [PHP] True || False ?


How does php handle true and false? Do they act as true booleans? 

Can I do?

function foo()
{
        return false;
}

Thanks,
-Jonathan

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




oops ...

I think I got too far from your original question:

yes,

function returnMeFoo($foo=0)
{
   if($foo)
      return true;
   return false;
}

if(returnMeFoo())
   echo 'you will not see this echo';
elseif(returnMeFoo(1))
   echo 'but if you see this means the function returned as true';

Cheers,
Maxim Maletsky

-----Original Message-----
From: Maxim Maletsky 
Sent: Friday, February 16, 2001 2:40 PM
To: 'Jonathan Sharp'; [EMAIL PROTECTED]; 'Jeff Oien'
Subject: RE: [PHP] True || False ?


Yeah, sure you can,

if return is found in function it then exits it.

for example avoiding 'else' statements:


function returnMeFoo($foo=0)
{
   if(!$foo)
      return "Hey, you forgot to type a number in";
   if($foo>5)
      return "$foo is bigger then 5";
   if($foo<5)
      return "$foo is less then 5";

   return "Then, logically, $foo *IS* 5";
}


// then call this function as 

echo '<P>'.returnMeFoo(4);
echo '<P>'.returnMeFoo(5);
echo '<P>'.returnMeFoo(6);


And see how fun it is!

Cheers,
Maxim Maletsky

-----Original Message-----
From: Jonathan Sharp [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 16, 2001 1:26 PM
To: [EMAIL PROTECTED]
Subject: [PHP] True || False ?


How does php handle true and false? Do they act as true booleans? 

Can I do?

function foo()
{
        return false;
}

Thanks,
-Jonathan

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Hi everyone!

I wrote a script which utilises semaphore and shared memory.
It polls the shared memory for an event before breaking from the polling
function.
I wrote another script that the sets this event in shared memory.

How I tested the script was as follows:
I ran 3 ttys, two of them running the polling script. Naturally they will be
waiting for the event to be set.
And on the last terminal, I executed the event set script. Upon execution,
both polling scripts were seen to have terminated their polling.

Everything seems to be acting accordingly, except for the warning message
that appears on both terminals running the polling script.

Here is the warning message:
Warning: Releasing SysV semaphore id 1 key 0x7b2 in request cleanup in
Unknown on line 0

Is this warning message potentially a problem? Or could I just turn off this
warning in the php.ini? How can I prevent this message from appearing if it
is not potentially dangerous?

Any help is greatly appreciated.

TIA

Michael





All -

I'm looking to see if anyone knows of a php class for menu navigation. I'm
looking for a pure php / html solution and would like to have the following
features:

  bread crumb trails like: "Home >> Level 1 >> You are here"
  tree style menu navigation (unlimited levels)
  tree layout not dependent on html file and directory structure
  menu item highlighting based on $PHP_SELF

Okay, so I'm asking for a lot. I'm looking at phplib's tree class and the
new menu class in phplib 0.7. (it's broken). I've also poked around looking
for at a few other solutions but they mostly looked like hacks for the
environment they were developed in.

If no one can turn up anything then I guess I'll start building a class to
meet the above requirements. 

-- 
 Scott




you might find this useful

http://www.devshed.com/Server_Side/PHP/SoothinglySeamless/

best regards

Ankur Verma
HCL Technologies
A1CD, Sec -16
Noida, UP
India


----- Original Message -----
From: "Scott Fletcher" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 15, 2001 8:17 PM
Subject: [PHP] Compiling PHP for Apache.


> Hi!
>
>         Right now, I'm trying to figure out which step in order is
> appropriate.  I'm going to put it down now, if I got it wrong then help me
> out with the correct order.  Whether it is from scratch or from existing
> softwares.
>
>
>         1) OpenSSL
>         2) libmcrypt  (Add-on to PHP)
>         3) PHP 4.0
>         4) mod_ssl
>         5) apache
>
>     Thanks,
>  Scott
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]





IN one of the fields being offered to the user, the
user is expected to enter HTML tags alongwith the
text. How can i display this text as html formatted on
my PHP3 page? What should be the field type in the
mySQL db? should it be TEXT?

Regards,
T. Edison jr.


=====
Rahul S. Johari (Director)
******************************************
Abraxas Technologies Inc.
Homepage : http://www.abraxastech.com
Email : [EMAIL PROTECTED]
Tel : 91-4546512/4522124
*******************************************

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/




"Thomas Edison Jr." <[EMAIL PROTECTED]> wrote:
> IN one of the fields being offered to the user, the
> user is expected to enter HTML tags alongwith the
> text. How can i display this text as html formatted on
> my PHP3 page?

That's how it will show by default.

> What should be the field type in the
> mySQL db? should it be TEXT?

Depends on the size of the data you want the user to be able to input.
CHAR, VARCHAR, TEXT and BLOB will all work.

--
Steve Werby
COO
24-7 Computer Services, LLC
Tel: 804.817.2470
http://www.247computing.com/





any kind of field that accepts text (CHAR, VARCHAR, BLOB (TEXT, LONGTEXT)
etc) is OK.

htmlspecialchars will encode that for you and show HTML as HTML visibly.

see here: www.php.net/htmlspecialchars

Cheers,
Maxim Maletsky



-----Original Message-----
From: Thomas Edison Jr. [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 16, 2001 2:23 PM
To: [EMAIL PROTECTED]
Subject: [PHP] HTML Coding in mySQL field


IN one of the fields being offered to the user, the
user is expected to enter HTML tags alongwith the
text. How can i display this text as html formatted on
my PHP3 page? What should be the field type in the
mySQL db? should it be TEXT?

Regards,
T. Edison jr.


=====
Rahul S. Johari (Director)
******************************************
Abraxas Technologies Inc.
Homepage : http://www.abraxastech.com
Email : [EMAIL PROTECTED]
Tel : 91-4546512/4522124
*******************************************

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




hi:
i use php 4.0 and win 2000 chinese edition  and mssql 7.0
i have table with image field name is "isospicture"

here is my script 
when mssql_querry execute there will error message 


"0x7332fcbb"  command  reference "0x00bcb000" memory can't written

why ?

$SQL = "Select  isospicture   from  isospic  where [filename] ='rose'";
$result1   = mssql_query($SQL,$link_ID);  //here  wrong 

gary yang 
from taiwan




sounds like a windows bug... and not enough info to diagnose.
why is filename in [] by the way?

you may wish to include more of you connection script as well.
first thing I would try with an error like that is to upgrade your PHP.
sounds like you have .dll's arguing for memory address space  - i'm not sure
how to track what the other application is.

regards,
jaxon


On 2/16/01 12:51 AM, "codemake" <[EMAIL PROTECTED]> wrote:

> hi:
> i use php 4.0 and win 2000 chinese edition  and mssql 7.0
> i have table with image field name is "isospicture"
> 
> here is my script
> when mssql_querry execute there will error message
> 
> 
> "0x7332fcbb"  command  reference "0x00bcb000" memory can't written
> 
> why ?
> 
> $SQL = "Select  isospicture   from  isospic  where [filename] ='rose'";
> $result1   = mssql_query($SQL,$link_ID);  //here  wrong
> 
> gary yang 
> from taiwan
> 





Hi,

I have a form that has 4 variables, one, $pass_category, being a select
list. The form posts a php script. Once inside the PHP script if I have not
selected one of the select list variables the value should be blank. If I
echo this out the value shows as blank. However, I later check the value of
the passed select list variable and it passes a  "if > "" test which has me
baffled. I don't have this problem with my three other variables that are
just form fields versus a select list. Am I missing something basic or ??
What I'm doing here is building a SQL statement based on form variables. A
snippet of the script is below.

I'd sincerely appreciate any help or guidance!!
Andre
<?php

mysql_close;

$pass_category = $HTTP_POST_VARS["form_cat"];

$pass_company = $HTTP_POST_VARS["form_company"];

$pass_contact = $HTTP_POST_VARS["form_contact"];

$pass_sort = $HTTP_POST_VARS["form_sort"];

if ($debug =="y")

{

echo "Pass_category=$pass_category<br>";     /* This shows as blank */

echo "Pass_company=$pass_company<br>";

echo "Pass_contact=$pass_contact<br>";

echo "Pass_sort=$pass_sort<br>";

}

$db = mysql_pconnect("mysql1:katychamber.com", "katyc2", "katyc2");

...............

...............

if ($pass_category > "") $sql2 = $sql2 . " and cat = '$pass_category' ";
/* this statement passes this test even though it appears to be blank */

...............







what about the form itself?
I see no problems in here (except of course that you disclosed your mySQL
host, login and password)


Cheers,
Maxim Maletsky


-----Original Message-----
From: Andre Bajew [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 16, 2001 2:57 PM
To: [EMAIL PROTECTED]
Subject: [PHP] form variables showing blank but query shows non-blank ??


Hi,

I have a form that has 4 variables, one, $pass_category, being a select
list. The form posts a php script. Once inside the PHP script if I have not
selected one of the select list variables the value should be blank. If I
echo this out the value shows as blank. However, I later check the value of
the passed select list variable and it passes a  "if > "" test which has me
baffled. I don't have this problem with my three other variables that are
just form fields versus a select list. Am I missing something basic or ??
What I'm doing here is building a SQL statement based on form variables. A
snippet of the script is below.

I'd sincerely appreciate any help or guidance!!
Andre
<?php

mysql_close;

$pass_category = $HTTP_POST_VARS["form_cat"];

$pass_company = $HTTP_POST_VARS["form_company"];

$pass_contact = $HTTP_POST_VARS["form_contact"];

$pass_sort = $HTTP_POST_VARS["form_sort"];

if ($debug =="y")

{

echo "Pass_category=$pass_category<br>";     /* This shows as blank */

echo "Pass_company=$pass_company<br>";

echo "Pass_contact=$pass_contact<br>";

echo "Pass_sort=$pass_sort<br>";

}

$db = mysql_pconnect("mysql1:katychamber.com", "katyc2", "katyc2");

...............

...............

if ($pass_category > "") $sql2 = $sql2 . " and cat = '$pass_category' ";
/* this statement passes this test even though it appears to be blank */

...............




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




>Ted Goranson pressed the little lettered thingies in this order...
>..
>  > I'm faced with writing some rather difficult regex's, and would like
>  > to be pointed to a comprehensive list of POSIX regex operators.
>...
>try:
>http://www.contactor.se/~dast/mail2sms/regex.shtml
>http://www.ciser.cornell.edu/info/regex.html
>
>If at all possible, I would recommend using the perl compatible REs
>since they're more powerful, are documented much more thoroughly and
>support for them is much easier to obtain.
>
>If it's not possible to use PCREs, the above links (particularly the first)
>whould contain details for just about anything you may need to do with
>POSIX REs.

Christopher--

Thanks so much for the URLs but they are hardly complete and not at 
all succinct. I supposed the POSIX REs because that's what I thought 
the PHP docs said. PCREs are good too? Sure seems like the PHP docs 
would include this don't you think?

Best, Ted

_____________
Ted Goranson
Fusecap and Sirius-Beta, Virginia Beach USA
757/426-6704
[EMAIL PROTECTED]
Symmetry Conference: http://www.isis-s.unsw.edu.au




Gerry,

the following is your problem:
you fetch a row from the query result in each iteration:
> while ($row = mysql_fetch_array($sql_result)) {

and the use the value of $ID.
> $fn = "/images/$ID.jpg";

you need to fetch the value of the ID column into the ID variable
before. Assuming your select looks like the following:

select ID, description, blah from images;

you need to do something like

$ID = $row[0];
$description = $row[1];
$blah = $row[2];

Or you just change your while condition to

while( list( $ID, $description, $blah ) = mysql_fetch_row( $result ) ) {

Cheers,
Ben

Gerry wrote:
> 
> Hello again:

> 
> Ben Peter wrote:
> >
> > Gerry,
> >
> > could you give us a bit more code, esp. the while or for loop that
> > surrounds the code you have quoted?
> >
> > Cheers,
> > Ben
> 
> Sorry for the confusion, and yes I did mispelled camera in english. Here
> is more of my sloppy code. I might have an extra }...not sure though
> since I have anther couple of "ifs" above it. the code works fine, but
> not the "(!$file_exists)" part since it seams it is not checking and it
> gives the same result all over the table--"no image". I did change
> things as suggested I think, but stll get the same thing.
> 
>  echo"<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"
> width=\"100%\" bgcolor=\"ffffff\"\n>";
> echo"<tr>/n";
> 
> while ($row = mysql_fetch_array($sql_result)) {
> 
> echo"</td><td width=\"20%\" align=\"center\" valign=\"top\"><font size=\"2\">/n";
> echo $row["name"];
> echo "</font>\n";
> echo"</td><td width=\"20%\" align=\"center\" valign=\"top\"><font size=\"2\">/n";
> echo $row["Color"];
> echo "</font>\n";
> echo"</td><td width=\"20%\" align=\"center\" valign=\"top\"><font size=\"2\">";
> echo $row["Size"];
> echo "</font>\n";
> echo"</td><td width=\"20%\" align=\"center\" valign=\"top\"> </form> ";
> echo"<td width=\"20%\" align=\"center\" valign=\"top\"><font size=\"2\">";
> if (!file_exists($fn)) {
> echo "not working yet";
> } else {
> echo'<img src=\"http://site.com/images/camera.gif\">';
> clearstatcache();
> }
>  echo"<tr><td colspan=\"5\" valign=\"top\"><hr size=\"1\"></td></tr>";
> }
> echo"</table>";
> }
> 
> --
> Gerry Figueroa
> -------------- - -  -   -    -    *
> War does not determine who is right, war determine who is left.
> 
> |XXXXXXX|------^|XXXXXXXXXXXXXXXXXX|
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


Reply via email to