php-general Digest 4 May 2001 17:36:44 -0000 Issue 666

Topics (messages 51369 through 51450):

Re: Working with numbers
        51369 by: Jennifer
        51374 by: Oliver Heinisch
        51397 by: Gyozo Papp

Re: Searching for array keys
        51370 by: mailing_list.gmx.at
        51375 by: Mark Charette
        51386 by: Tim Ward
        51412 by: Martin Skjöldebrand

array 2 links
        51371 by: Joseph Blythe
        51396 by: Gyozo Papp

emalloc message
        51372 by: claudia

Keyboard Hotkeys
        51373 by: Chris Aitken
        51384 by: elias

MD5 password
        51376 by: Yamin Prabudy
        51378 by: elias
        51420 by: Thimo von Rauchhaupt

Gettting an XML file through a proxy
        51377 by: Steve Haemelinck

Re: BET News
        51379 by: Hrishi
        51431 by: John Monfort

Re: OT-Please bare with me :)
        51380 by: Hrishi

Re: HI
        51381 by: Hrishi

Re: Getting  the first part out of a string
        51382 by: Hrishi
        51395 by: Gyozo Papp

Re: % always return int?
        51383 by: Wico de Leeuw

File upload problems.
        51385 by: Hilbert Mostert

Re: how?
        51387 by: Geir Eivind Mork
        51403 by: elias

Choosing a random value out of two
        51388 by: Sebastian Sprenger
        51389 by: Taylor, Stewart
        51390 by: Sebastian Sprenger

Re: Shorten String or encode/decode a string
        51391 by: Christian Reiniger

slashes \" appearing
        51392 by: magnus lawrie
        51407 by: Jason Stechschulte

" appended with \
        51393 by: magnus lawrie
        51394 by: Jason Brooke
        51404 by: James Holloway

Serious upload problems
        51398 by: Hilbert Mostert
        51399 by: Plamen Slavov

Re: Need to know this
        51400 by: Grimes, Dean
        51411 by: Michael Kimsal
        51429 by: Johnson, Kirk
        51439 by: S.J. Black

--register-globals - dev question
        51401 by: Jon Rosenberg

Array help please
        51402 by: peter.beal
        51408 by: Jason Stechschulte
        51409 by: peter.beal

Life easy with MySQL
        51405 by: Hassan Arteaga

Re: changing a file on the server using a web form
        51406 by: Jason Stechschulte

fargin sessions...
        51410 by: motorpsychkill

how to get RAW POST DATA!
        51413 by: ondi

ISAPI
        51414 by: Hassan Arteaga
        51424 by: Phil Driscoll

user tool to > admin  groups, subgroups, and users.
        51415 by: Delbono

PHP using Forms
        51416 by: Mike Mike
        51417 by: Zak Greant
        51419 by: Jon Haworth
        51426 by: Altunergil, Oktay
        51433 by: Mike Mike

Re: [PHP-CVS] cvs: php4 /ext/dotnet dotnet.cpp
        51418 by: Harald Radi

IMAP, krb4 and PHP4.
        51421 by: Liam Hoekenga

date calculation
        51422 by: Gary
        51428 by: James Holloway

Array Assignment
        51423 by: Mark Cain
        51435 by: Gyozo Papp

Help please
        51425 by: Alain ROMERO

Need help cookie
        51427 by: Alain ROMERO

HTTP_HOST or SERVER_ADDR
        51430 by: Wei Weng

Re: session_register()
        51432 by: Johnson, Kirk
        51434 by: Matthew Luchak

Generating thumbnails of JPEG/GIF images
        51436 by: Richard
        51438 by: Web master

HELP!! PHP not working Suddenly!!!
        51437 by: Thomas Edison Jr.
        51441 by: Phil Driscoll
        51443 by: Thomas Edison Jr.

preg vs ereg (performance)
        51440 by: Matthew Aznoe

PHP & Java ?
        51442 by: Jack Sasportas
        51444 by: Tom Carter
        51445 by: Michael Stearne
        51446 by: Peter Dudley
        51448 by: Jack Sasportas
        51449 by: Brian Paulson

Re: restrict access of Copy command
        51447 by: Pandrac

hdml simulator?
        51450 by: Data Driven Design

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]


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




Christian Reiniger wrote:
> 
> On Thursday 03 May 2001 08:53, Jennifer wrote:
> 
> > I have a shopping cart that allows decimal points for quantities.
> > I like it like that, but would like to remove any trailing zeros
> > and if the quantity is not a fraction I would like to remove the
> > decimal point too.
> >
> > What would be the easiest way to do this?  I don't see any
> > function that would make it easy.
> 
> It's so easy that you don't need a function for it :)
> 
> $Qty = "12.470";
> $Qty_real = (double) $Qty;
> 
> echo "$Qty - $Qty_real";
> 
> In other words - convert it from a strin to a floating-point number and
> PHP will do the rest.


I've done some searching on the php site for more info about
double and float etc, but I don't really understand anything I
found.  Can someone give me an explanation about the difference
between decimal, float, double?

Should I be using decimal as my column type in the MySQL database
or should I be using a different column type?

Jennifer




At 01:39 04.05.01 -0400, you wrote:
Ok Jennifer lets do some "basics" ;-)
>I've done some searching on the php site for more info about
>double and float etc, but I don't really understand anything I
>found.  Can someone give me an explanation about the difference
>between decimal, float, double?

decimal is a straight number f.e 123456 the size/length of this number 
belongs to the used hardware/compiler (normally 64bit???)
it could be "signed" so it could be -123456 or +123456
float is a number like 123,456 or 0,123456 size/signed  see above
double is also a number like float but with the double size (normally 128 
bit ??)


>Should I be using decimal as my column type in the MySQL database
>or should I be using a different column type?

If you want to store float numbers like prices or so you could use 
float(M,D) where M ist the langth of all numbers
and D is the number of the fraction(is that word right) I mean what´s 
behind the "," .
Look in the manual of mysql "datatypes" to get more information about 
numbers and other interesting
datatypes.
HTH Oliver







Hello, Jennifer

are you still struggling with the trailing zeros?
Then try, 
    echo round($number, 2); // with ie.: $number = 123.45 and 123.00

As I know there is no particular float, but double type in PHP.

(double means "double precision number" -- ie.: 15 decimal places instead of 6 decimal 
places or something like that -
, and therefore a 'double' consumes twice the space that 'float' does - in compiled 
languages such as C (8 bytes vs 4 bytes). 
So doubles and floats is closely related to the hardware representation. 
This is why "real" programming languages usually deal with floats and doubles.

Decimal (or numeric) comes from an another domain of computer science, namely database 
systems.
Decimal is a completely different approach of representing numbers, dealing with 
precision as commonly used in daily life, ie .: cents or gramms (as you wish in your 
shopping cart class). In a DBMS the storage space never does matter,
it focuses the ease of use and "readability".
You can specify how many digits are for storing the integer part and how many the 
fraction part of a number. In other words, this means that you *can specify* the 
maximum storable number (respect the whole number of digits) and minimal resolution / 
granulation (respect to number of fraction digits).

I hope this helps,

Papp Gyozo 
- [EMAIL PROTECTED]

ps.: my english is not so good, but i hope, you can understand what i was talking 
about.

----- Original Message ----- 
From: "Jennifer" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: 2001. május 4. 07:39
Subject: Re: [PHP] Working with numbers


> 
> 
> Christian Reiniger wrote:
> > 
> > On Thursday 03 May 2001 08:53, Jennifer wrote:
> > 
> > > I have a shopping cart that allows decimal points for quantities.
> > > I like it like that, but would like to remove any trailing zeros
> > > and if the quantity is not a fraction I would like to remove the
> > > decimal point too.
> > >
> > > What would be the easiest way to do this?  I don't see any
> > > function that would make it easy.
> > 
> > It's so easy that you don't need a function for it :)
> > 
> > $Qty = "12.470";
> > $Qty_real = (double) $Qty;
> > 
> > echo "$Qty - $Qty_real";
> > 
> > In other words - convert it from a strin to a floating-point number and
> > PHP will do the rest.
> 
> 
> I've done some searching on the php site for more info about
> double and float etc, but I don't really understand anything I
> found.  Can someone give me an explanation about the difference
> between decimal, float, double?
> 
> Should I be using decimal as my column type in the MySQL database
> or should I be using a different column type?
> 
> Jennifer
> 
> -- 
> 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]
> 





> What's the best way of finding out if a specific array key is in an array?
> I have an associative array which *may* look like 
> (car =>saab, house => mansion, countyW=> A) but can equally well look like
> 
> (boat => daycruiser, house => flat, county => B).
> 
> I want to find out if the key "car" is in the array and do something if it
 try something like

if (in_array("keyb",array_keys(array("key"=>"a","keyb"=>"b"))))) { 
... 
}

michael

-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net






> > What's the best way of finding out if a specific array key is in an
array?
> > I have an associative array which *may* look like
> > (car =>saab, house => mansion, countyW=> A) but can equally well look
like
> >
> > (boat => daycruiser, house => flat, county => B).
> >
> > I want to find out if the key "car" is in the array and do something if
it
>  try something like
>
> if (in_array("keyb",array_keys(array("key"=>"a","keyb"=>"b"))))) {
> ...
> }

Maybe I'm being dense here, but won't a simple "isset()" work (using the
KISS principle)?

$ary=array("aa"=>"yy","bb"=>"zz");

$key="aa";
if (isset($ary[$key]))
    print "$key set\n";
else
    print "$key not set\n";

$key="bb";
if (isset($ary[$key]))
    print "$key set\n";
else
    print "$key not set\n";

$key="cc";
if (isset($ary[$key]))
    print "$key set\n";
else
    print "$key not set\n"

returns

aa set
bb set
cc not set

Mark C.





if (isset($array["key"]))

        Tim Ward
        Senior Systems Engineer

Please refer to the following disclaimer in respect of this message:
http://www.stivesdirect.com/e-mail-disclaimer.html


> -----Original Message-----
> From: Martin Skjöldebrand [mailto:[EMAIL PROTECTED]]
> Sent: 04 May 2001 06:13
> To: [EMAIL PROTECTED]
> Subject: Searching for array keys
> 
> 
> What's the best way of finding out if a specific array key is 
> in an array?
> I have an associative array which *may* look like 
> (car =>saab, house => mansion, countyW=> A) but can equally 
> well look like 
> (boat => daycruiser, house => flat, county => B).
> 
> I want to find out if the key "car" is in the array and do 
> something if it 
> is.
> 
> I found:
> 
> $os = array ("Mac", "NT", "Irix", "Linux");
> if (in_array ("Irix", $os)){
>     <do stuff>;
>     }
> 
> But that only works on the values. But it is exactly what I 
> want to do on 
> keys instead.
> 
> Suggestions?
> 




Mark Charette wrote:

> 
>> > What's the best way of finding out if a specific array key is in an
> array?
>> > I have an associative array which *may* look like
>> > (car =>saab, house => mansion, countyW=> A) but can equally well look
> like
>> >
>> > (boat => daycruiser, house => flat, county => B).
>> >
>> > I want to find out if the key "car" is in the array and do something if
> it
>>  try something like
>>
>> if (in_array("keyb",array_keys(array("key"=>"a","keyb"=>"b"))))) {
>> ...
>> }
> 
> Maybe I'm being dense here, but won't a simple "isset()" work (using the
> KISS principle)?
> 
> $ary=array("aa"=>"yy","bb"=>"zz");
> 
> $key="aa";
> if (isset($ary[$key]))
>     print "$key set\n";
> else
>     print "$key not set\n";
> 
> $key="bb";
> if (isset($ary[$key]))
>     print "$key set\n";
> else
>     print "$key not set\n";
> 
> $key="cc";
> if (isset($ary[$key]))
>     print "$key set\n";
> else
>     print "$key not set\n"
> 
> returns
> 
> aa set
> bb set
> cc not set
> 
Thanks, 

So simple - giving it more thought than before rushing off to work I would 
possibly have found it myself.

M.




Hello,

I seem to be having some difficulty understanding why the following function skips 
every 5th array item, 
basically the following function takes two parameters category and an array, when 
placed inside a table it will generate
links based on the array items splitting the table into columns when more than 4 links 
have been generated. 
However as mentioned every 5th array item is skipped hmm..

The solution is probably really obvious but I can't seem to see it!

function array2links($cat, $arr) {
        $i = 0;
        $cat = rawurlencode($cat);
        while ( list( $key, $val ) = each($arr)) {

                $link = "<a class=\"cats\" href=\"products.php?Cat=$cat&Code=$key\" 
title=\"$val\">$val</a><br>";
                if ( $i < 4 ) {
                $out .= "$link";
                } else {
                $out .= "</td><td valign=\"top\">";
                $i = 0;
                continue;
                }
                $i++;
        }
        return $out;
}

Any help/ideas would be appreciated,

Regards,

Joseph.






Hi,

You are really messed up with this 'if' statement.
What you want is nicely described, so I won't repeat it, just make some correction...

function array2links($cat, $arr) 
{
    $i = 0;
    $cat = rawurlencode($cat);
    while ( list( $key, $val ) = each($arr)) 
    {
         $out .= "<a class=\"cats\" href=\"products.php?Cat=$cat&Code=$key\" 
title=\"$val\">$val</a><br>";
         if ( $i == 5 ) {
             $out .= "</td><td valign=\"top\">";
             $i = 1;
         }
         else $i++;
     }
     return $out;
 }

----- Original Message ----- 
From: "Joseph Blythe" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: 2001. május 4. 08:02
Subject: [PHP] array 2 links


> Hello,
> 
> I seem to be having some difficulty understanding why the following function skips 
>every 5th array item, 
> basically the following function takes two parameters category and an array, when 
>placed inside a table it will generate
> links based on the array items splitting the table into columns when more than 4 
>links have been generated. 
> However as mentioned every 5th array item is skipped hmm..
> 
> The solution is probably really obvious but I can't seem to see it!
> 
> function array2links($cat, $arr) {
> $i = 0;
> $cat = rawurlencode($cat);
> while ( list( $key, $val ) = each($arr)) {
> 
> $link = "<a class=\"cats\" href=\"products.php?Cat=$cat&Code=$key\" 
>title=\"$val\">$val</a><br>";
> if ( $i < 4 ) {
> $out .= "$link";
> } else {
> $out .= "</td><td valign=\"top\">";
> $i = 0;
> continue;
> }
> $i++;
> }
> return $out;
> }
> 
> Any help/ideas would be appreciated,
> 
> 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]
> 





Hi,

i additional found out, that every time i get the "network error" message i
also get a error message in the apache error log.

FATAL:  emalloc():  Unable to allocate 8426419 bytes

What does this mean, and what can i do?
It´s every time the same amount of bytes.

Please help,

claudia



> Hi,
>
> has anyone ever seen the message "Network error occured while Netscape
> was receiving data ..."
>
> This happens when i save data in my informix database. The values are
> saved, but i get the error message when the browser trys to load the new
> page. The strange thing is, it happens only sometimes on various sites.
> I think it has something to do with the traffic on the site (ca. 400
> users).
>
> After inserting a flush() into the page, which i want to load, i get
> parts of the new page. I saved this page on disk and had a look at the
> HTML, it´s complete, but my browser can´t show it and i get the network
> error message.
>
> If i make a "View Source" of the uncomplete page i get:
> <TITLE>Missing Post reply data</TITLE>
> <H1>Data Missing</H1>
> This document resulted from a POST operation and has expired from the
> cache. If you wish you can repost the form data to recreate the document
> by pressing the <b>reload</b> button.
>
> I´m working on NT4, php4.0.4pl1, ODBC-> Informix Database
>
> Thanks for any help!
>
> Claudia
>
> --
> 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,

Just a quick quesiton I was asked by someone here at work for a database im 
working on. Is there any system which people have been able to utilise 
Javascript or another method to map out a keyboard shortcut to do 
something. Either making it process a submit button to a PHP script, or 
simulate a click to a link which is on the page.

Im not confident of a "yes" response, but I figured I would ask just incase.


Cheers


Chris



--
       Chris Aitken - Webmaster/Database Designer - IDEAL Internet
email: [EMAIL PROTECTED]  phone: +61 2 4628 8888  fax: +61 2 4628 8890
             --------------------------------------------

       Unix -- because a computer's a terrible thing to waste!





yes sure you can!

you can with javascript do it!

check www.javascript.com and search for keyboard-slider script!

-elias
www.eassoft.cjb.net

"Chris Aitken" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hey guys,
>
> Just a quick quesiton I was asked by someone here at work for a database
im
> working on. Is there any system which people have been able to utilise
> Javascript or another method to map out a keyboard shortcut to do
> something. Either making it process a submit button to a PHP script, or
> simulate a click to a link which is on the page.
>
> Im not confident of a "yes" response, but I figured I would ask just
incase.
>
>
> Cheers
>
>
> Chris
>
>
>
> --
>        Chris Aitken - Webmaster/Database Designer - IDEAL Internet
> email: [EMAIL PROTECTED]  phone: +61 2 4628 8888  fax: +61 2 4628 8890
>              --------------------------------------------
>
>        Unix -- because a computer's a terrible thing to waste!
>
>
> --
> 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 there assume that I had a password field in md5 format like this
$1$uJ8d$jJKOHnfh^79824/.
how do i compare an input password to the password that I sore in database

so it can return right or wrong password

thanks

Yamin Prabudy





Get Input password into $pwd
Get hashed password from db into $hashed_pwd

do compare like:
if (md5($pwd) == $hashed_pwd) { // good! }

""Yamin Prabudy"" <[EMAIL PROTECTED]> wrote in message
004901c0d462$ff394240$[EMAIL PROTECTED]">news:004901c0d462$ff394240$[EMAIL PROTECTED]...
> Hi there assume that I had a password field in md5 format like this
> $1$uJ8d$jJKOHnfh^79824/.
> how do i compare an input password to the password that I sore in database
>
> so it can return right or wrong password
>
> thanks
>
> Yamin Prabudy
>
>
> --
> 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 there assume that I had a password field in md5 format like this
> $1$uJ8d$jJKOHnfh^79824/.
> how do i compare an input password to the password that I sore in database
>
> so it can return right or wrong password

Just compare the md5 hashed password with the md5 hashed string from the
database. If the password is like the string, the hashes must equal, too.

The difficult lies IMHO in hashing the password on client side. There are
Javascripts-Modules out there in the Net, but this is rather unsecure.






Hi All

Anybody got an idea how I can get an XML file through a proxy.
I tried fsockopen with a a GET request but this does not give me what I want
:)

Thx

Haemelinck Steve

Personal:
Haemelinck.be - Developers Unite :)
Junior WebDeveloper
http://www.haemelinck.be:8080/
[EMAIL PROTECTED]

Work:
MCT IT Consulting - Take consulting 2 the next level
Junior IT Consultant
http://www.mct.be/
[EMAIL PROTECTED]






<posted & mailed>

MTV Jams wrote:

> http://www.mp3.com/mcpedro     from [EMAIL PROTECTED]
> 
> The question is this, If you placed a Jamaican born MC on a Hip
> Hop/Trance/Techno track and told him to flow without losing his yard
> essence (Jamaican Vibes), what would you get? Most likely confusion of
> course, unless the MC was Pedro!

does pedro have a problem with PHP ? i thought this group was moderated ?

DIE SPAMMER.

or i'll soak your nuts in liquid copper. and Pedros too.








Ok...all together now, in how many languages can you say,
OUT OF PLACE !!!

--Spammers, sheesh !



--


On Thu, 3 May 2001, MTV Jams wrote:

> http://www.mp3.com/mcpedro     from [EMAIL PROTECTED]
>
> The question is this, If you placed a Jamaican born MC on a Hip
> Hop/Trance/Techno track and told him to flow without losing his yard essence
> (Jamaican Vibes), what would you get? Most likely confusion of course,
> unless the MC was Pedro!
> Peter Gracey a.k.a. MCPedro (Mp3Eternity) was born and raised in Kingston
> Jamaica, and later moved to Florida where he honed his skills. Pedro would be
> the first to admit, being raised on the streets of Waterhouse in a rough political
> climate, and then later in Miami, plays a large part in his "no-nonsense"
> militant aura. Influenced by artists such as Shabba Ranks, Garnett Silk, Bob
> Marley,Papa San, Maxi Priest, Luciano and Sanchez, and fused with his
> passion for writing, it was inevitable that Pedro would be heard.
> Leaving Jamaica College at 17, Pedro resided in Miami, San Diego, Seattle and
> back to Miami where he mingled with the underground culture, toasting on local
> sound systems and appearing at parties in all three cities. After taking time off
> from the military, Pedro returned with a vengeance to show his skills. Working
> the underground Dance Hall circuit with the likes of Tinga Stewart, RPI,
> Sanchez, Luciano, Barrington Levy, Buju Banton and Gloria Estefan. He
> continued to record his first single entitled "Life" in 1996. By this time Pedro
> has been touring with 303Infinity who then introduced him to Nadine Renee
> (The voice behind Planet Soul.. " Set U Free")where melodic Dance Hall hooks
> combined with a smooth yet rugged Hip Hop/ Trance-Techno flow. He managed
> to touch Electronic fans like no other Dance Hall artist ever did, representing
> the "real Hip Hop/Techno" without losing his Jamaican borne flavor, "yardcore."
> Please visit Pedro Music Station and feel free to download his tracks at no
> charge at
>
> http://www.mp3.com/mcpedro
>
> [EMAIL PROTECTED]  : Email us with any comments or if you wish to
> stop recieving updates on Pedro.
>
>
> --
> 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]
>
>





Brandon Orther wrote:

> menu on the new Cobalt XTR server admin section.  If anyone has a
> JavaScript or a tutorial how to make a drop down menu please send me a
> link.
try http://www.webreference.com/dhtml/

cheers,
Hrishi




Jorge Amaya wrote:

> I am new user of php, I have installed apache 1.3.x, php3 and mysql, but
> I have a problem, My navigator doesn't recognize the files of php3, that
> is to say it doesn't work me php in the navigator, I have configured
> such and like says the manual in php.ini and also in the directives of
> Apache

are you browsing the filesystem ("file://C|/..") or through apache 
("http://localhost/";) ?

remember that you can add hosts/aliases using the file c:\windows\hosts

cheers,
Hrishi




Richard Kurth wrote:

>  I know how to get last part of a string out of a string
>  But how do I get the first part before the needle On the example
>  below I just what domain
> 
>  $hostdomain= domain.com
> 
> $host = substr (strrchr ($hostdomain, "."), 1);
strrchr  (two r) finds the first occurence from the end of the string
strchr (one r) finds the first occurence from the beginning of the string
>  echo $host;  com
> 
> 
> 





$pos = strpos($hostdomain, '.');
if ($pos === false) { /*no point found */}
else 
    $str = substr($hostdomain,0, $pos);

or much better:

$parts = explode('.', $hostdomain); 

and you get all parts of $domain name.
from $hostdomain = "www.behsci.sote.hu"
$parts = array('www', 'behsci', 'sote', 'hu');


----- Original Message ----- 
From: "Richard Kurth" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: 2001. május 4. 02:44
Subject: [PHP] Getting the first part out of a string


> I know how to get last part of a string out of a string
>  But how do I get the first part before the needle On the example
>  below I just what domain
> 
>  $hostdomain= domain.com
> 
> $host = substr (strrchr ($hostdomain, "."), 1);
>  echo $host;  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]
> 





At 21:33 3-5-2001 -0300, Christian Dechery wrote:
>How can I get the modulus of an float by an integer?
>
>$time=3.345345;
>$time2=2.34234;
>$time3=$time%$time2;

try $time3=(long)$time%$time2;

something like that should work

>echo $time3;
>
>this outputs 1.
>
>$time=3.345345;
>$time2=2
>$time3=$time%$time2;
>echo $time3;
>
>this also outputs 1.
>
>Of course... when dividing two floats, there is no remainder... but, there 
>is an integer invovled... is automatically converted to float before 
>dividing, so that's why no remainder?
>____________________________
>. 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]
>





Hello all,

I have some serious problems with file uploads,
when i upload a file to the server it creates the $userfile, $userfile_type, 
$userfile_name and $userfile_size 
variables, but it doesn't create the actual file in the /tmp dir (the upload 
directory).
I have used redhat 7.0 with apache 1.3.14 and php-4.0.4pl1, I have also 
tried redhat 7.1 with apache 1.3.19 and php 4.0.5 but the problem still exists.

Can anyone help?

Thanks ,
Hilbert Mostert.





On Thursday 03 May 2001 17:30, Jason Stechschulte wrote:
>  On Thu, May 03, 2001 at 03:56:55PM -0700, elias wrote:

>  > i even tried the eval() which should work, but it didn't, scroll down to
>  > message with Subject: $hello
>  I don't think you understand eval().  Either that or I don't.  If I
>  understand correctly, eval(); requires a complete PHP statement.
>  Welcome $username is not a complete PHP statement.

that is correct, eval("echo $string"); can be used as a extremly silly way to 
echo though. 

>  Why don't you just make myfile.txt a valid php file and then include it?
>  myfile.txt.php:
>  Welcome <?php echo $username;?>
>  Enjoy your staying at: <?php echo $site_name;?>
>  Mail admin. at <?php echo $admin_mail?> for any questions...

Now this is as effective as to go to another room for each sip of a glass you 
make, why not just:
<?
echo <<<OUT
        Welcome $username<br>
        Enjoy your staying at: $site_name<br>
        Mail admin at $admin_mail for any questions
OUT;
?>
or at least use <?=$var?> if you want to be mean to the server instead of 
wearing out the keyboard.

-- 
 php developer / CoreTrek AS        | Higgledy Piggledy  Coeducational Yale
 Sandnes / Rogaland / Norway        | University   Extracurricular Gave up
 web: http://www.moijk.net/         | misogyny  Heterosexual Opened its door. 




Guys!

Your solutions are great, and i though of that too! but what prevents what
i'm thinking of to be done?

Again, ...i have a .TXT file and not a PHP file
and inside that .TXT file i have PHP variable names, like $myname, $hisemail
....
I want like:
$myname = "elias";
$hisemail = "[EMAIL PROTECTED]"
// Read myfile.TXT into $lines,
$parsed_lines = $lines; // Sure hoping it get parsed and $myname and other
vars get substituted
.
.
.
// store $parsed_lines into database

Actually, i don't want to Include("myfile.txt") i want to read it via file()
and find a solution to parse the nested variable names in it!

I even tried:

eval("\$parsed_lines = \"$lines\";"); // -> will be evaluated as:
$parsed_lines = "hello $myname, $hisemail"; , in turn should get correct
values of $myname and $hisemail and replace them into $parsed_lines ...

anyway...thanks all.

elias.

"Geir Eivind Mork" <[EMAIL PROTECTED]> wrote in message
01050411160600.03561@maria">news:01050411160600.03561@maria...
> On Thursday 03 May 2001 17:30, Jason Stechschulte wrote:
> >  On Thu, May 03, 2001 at 03:56:55PM -0700, elias wrote:
>
> >  > i even tried the eval() which should work, but it didn't, scroll down
to
> >  > message with Subject: $hello
> >  I don't think you understand eval().  Either that or I don't.  If I
> >  understand correctly, eval(); requires a complete PHP statement.
> >  Welcome $username is not a complete PHP statement.
>
> that is correct, eval("echo $string"); can be used as a extremly silly way
to
> echo though.
>
> >  Why don't you just make myfile.txt a valid php file and then include
it?
> >  myfile.txt.php:
> >  Welcome <?php echo $username;?>
> >  Enjoy your staying at: <?php echo $site_name;?>
> >  Mail admin. at <?php echo $admin_mail?> for any questions...
>
> Now this is as effective as to go to another room for each sip of a glass
you
> make, why not just:
> <?
> echo <<<OUT
> Welcome $username<br>
> Enjoy your staying at: $site_name<br>
> Mail admin at $admin_mail for any questions
> OUT;
> ?>
> or at least use <?=$var?> if you want to be mean to the server instead of
> wearing out the keyboard.
>
> --
>  php developer / CoreTrek AS        | Higgledy Piggledy  Coeducational
Yale
>  Sandnes / Rogaland / Norway        | University   Extracurricular Gave up
>  web: http://www.moijk.net/         | misogyny  Heterosexual Opened its
door.
>
> --
> 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 want to randomly assign either "value1" or "value2" to a $variable.
how can that be done?
thanks,
Sebastian






srand((double) microtime() * 1000000);
$which = rand(0,1);
$variable = ($which)? $value1 : $ value2;

-Stewart

-----Original Message-----
From: Sebastian Sprenger [mailto:[EMAIL PROTECTED]]
Sent: 04 May 2001 10:21
To: [EMAIL PROTECTED]
Subject: [PHP] Choosing a random value out of two


hi. i want to randomly assign either "value1" or "value2" to a $variable.
how can that be done?
thanks,
Sebastian



-- 
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]




THANKSALOT!
sebastian

""Taylor, Stewart"" <[EMAIL PROTECTED]> schrieb im
Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> srand((double) microtime() * 1000000);
> $which = rand(0,1);
> $variable = ($which)? $value1 : $ value2;
>
> -Stewart
>
> -----Original Message-----
> From: Sebastian Sprenger [mailto:[EMAIL PROTECTED]]
> Sent: 04 May 2001 10:21
> To: [EMAIL PROTECTED]
> Subject: [PHP] Choosing a random value out of two
>
>
> hi. i want to randomly assign either "value1" or "value2" to a $variable.
> how can that be done?
> thanks,
> Sebastian
>
>
>
> --
> 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 Thursday 03 May 2001 21:25, Jared Howard wrote:
> I want to shorten a string that I'll be throwing through the url.  It's
> not so much that it's too long, but it's ugly.  What it is, is my query
> string that I need to pass through to different pages, i.e. viewing
> multiple pages. Anyway, I was looking at encode and decode features but
> not really sure that they could shorten it down significantly.  Now I
> understand that I won't be able to use it, but I tried the crypt()
> function and liked how small it made it.  The string information

*g* Yess, crypt() even manages to crunch down megabytes of data to about 
10 bytes.
The problem is that it is a one-way function, i.e. you can't decrypt the 
data afterwards (it's a kind of checksum generator)...

You should use sessions or something similar - instead of passing all the 
data around on each request, store it in a database and just pass around 
the record ID

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

...to paraphrase Churchill, while representative  democracy may be
terrible, it's still the best system that large corporations can buy.

- David Weinberger JOHO January 25, 2000




I am using a form to test posting a variable. If my variable looks like this
in script post_var.php3 :

"stringinaaform"

then  it comes out like this in recieve.php3 :

\"stringinaaform\"

why? thanks in advance.






On Fri, May 04, 2001 at 12:41:57PM +0200, magnus lawrie wrote:
> I am using a form to test posting a variable. If my variable looks like this
> in script post_var.php3 :
> "stringinaaform"
> then  it comes out like this in recieve.php3 :
> \"stringinaaform\"
> why? thanks in advance.

Because PHP is configured with:
--enable-magic-quotes

-- 
Jason Stechschulte
[EMAIL PROTECTED]
--
But maybe we don't really need that...
             -- Larry Wall in <[EMAIL PROTECTED]>




I am using a form to test posting a variable. If my variable looks like this
in script post_var.php3 :

"stringinaaform"

then  it comes out like this in recieve.php3 :

\"stringinaaform\"

why? thanks in advance.








> I am using a form to test posting a variable. If my variable looks like this
> in script post_var.php3 :
> 
> "stringinaaform"
> 
> then  it comes out like this in recieve.php3 :
> 
> \"stringinaaform\"
> 
> why? thanks in advance.

Did you check the manual? http://www.php.net/manual/en/configuration.php 

jason 







Magnus,

$string = stripslashes($string);
http://www.php.net/manual/en/function.stripslashes.php

James.

""magnus lawrie"" <[EMAIL PROTECTED]> wrote in message
9cu11s$6k1$[EMAIL PROTECTED]">news:9cu11s$6k1$[EMAIL PROTECTED]...
> I am using a form to test posting a variable. If my variable looks like
this
> in script post_var.php3 :
>
> "stringinaaform"
>
> then  it comes out like this in recieve.php3 :
>
> \"stringinaaform\"
>
> why? thanks in advance.
>
>
>
>
>
> --
> 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]
>






Hello all,

I have some serious problems with file uploads,
when i upload a file to the server it creates the $userfile, =
$userfile_type, $userfile_name and $userfile_size=20
variables, but it doesn't create the actual file in the /tmp dir (the =
upload directory).
I have used redhat 7.0 with apache 1.3.14 and php-4.0.4pl1, I have also=20
tried redhat 7.1 with apache 1.3.19 and php 4.0.5 but the problem still =
exists.

Can anyone help?

Thanks ,
Hilbert Mostert.




Did you check if user nobody has write permission for the /tmp directory?
----- Original Message ----- 
From: "Hilbert Mostert" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday 04 May 2001 ?. 1:55 PM
Subject: [PHP] Serious upload problems


Hello all,

I have some serious problems with file uploads,
when i upload a file to the server it creates the $userfile, =
$userfile_type, $userfile_name and $userfile_size=20
variables, but it doesn't create the actual file in the /tmp dir (the =
upload directory).
I have used redhat 7.0 with apache 1.3.14 and php-4.0.4pl1, I have also=20
tried redhat 7.1 with apache 1.3.19 and php 4.0.5 but the problem still =
exists.

Can anyone help?

Thanks ,
Hilbert Mostert.






I believe PHP stands for: PHP Hypertext Preprocessor where the first P
actually stands for PHP. Just Like GNU: GNU Not Unix.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 03, 2001 10:37 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Need to know this


Parsed Hypertext Processing, AFAIK.

YoBro wrote:

> Hello,
>
> I need to find out what PHP stands for.
>
> Also what is better,
> ASP or PHP and who has the biggest market share.
>
> Any help would be really great.
>
> Thanks,
>
> Chris
>
> --
> 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]




Go check the archives - marc.theaimsgroup.com has a link to them, and I
think there's a
link at php.net.  We've also got a link to them at
http://phphelpdesk.com/search/ (frames
required).

You'll find numerous arguments on both sides in the archives.  More than
you'll
probably get in a response to your post.  You're asking a PHP list, so
expect bias
in the replies and posts you read (much as you'd expect bias asking a
microsoft
newsgroup which was better).

Our personal answer -

PHP is better.

Comparison
---------------
PHP is
* fast - 'nuff said
* inherently powerful as a language - good array handling, memory
management,
many functions, etc.
* easy to learn - annotated manual with real-world user feedback/input
* cross platform - write once, run many places
* free - 'nuff said
* open - relatively easy for people to write extensions for it (C people,
anyway)

ASP/VBScript is
* not that fast
* inherently less powerful than PHP
* not terribly intuitive unless you've grown up with VB
* tied to one platform (NT on x86 architecture)
* 'free' only with purchase of a Windows license
* closed - writing COM objects can only be so useful, because the authors
still
don't have acecss to the underlying code to see what's going on exactly.

Market share is tough to define.  I think PHP probably has a broader
installed base,
because it's 'on' with so many linux distros now.  ASP, as a whole, probably
still
may have a slight edge in terms of being used in real life day to day
deployments.

Don't base a decision to use it on market share.  Microsoft certainly didn't
do that -
PHP was around before MS even had a webserver.  If they'd said 'well, Perl
and PHP
already exist, I guess we should use those because they have bigger market
share
than we have in that market', they wouldn't have started.  Same with CF and
others.
What exists and who has larger marketshare won't be good reasons to fall
back on if a project fails ("well, everyone else is using it!") or you can'
debug something at
three in the morning.  Web application development still tends to end up
being
a rather solitary (or isolated) job at the end of the day, and you need to
choose
something you feel comfortable with short term and long term.



YoBro wrote:

> Hello,
>
> I need to find out what PHP stands for.
>
> Also what is better,
> ASP or PHP and who has the biggest market share.
>
> Any help would be really great.
>
> Thanks,
>
> Chris
>
>





People Hate Perl ;)

Kirk

> I need to find out what PHP stands for.




> People Hate Perl ;)

That's gorgeous! <g>

Alpha




Can someone on the dev team remind me at what version --register-globals
became the default way PHP works?  I looked in the config manual, but it
looks like that config optoin has been completely removed from the list.  I
think now it is in the php.ini file.  Is this correct?  Thanks

Jon





I'm trying to debug some software that I downloaded from the web.

It seems to work fine most of the time however it occasionally crashed with
database errors.

When I look at the code it has a lot of array references that i don't
understand

e.g. $Session[clientID]


most references at are of the form $arrayname["item"]  or $arrayname[$item]
as I would expect.

is the example correct code? if so what does it mean?


Thanks


Peter






On Fri, May 04, 2001 at 01:19:57PM +0100, peter.beal wrote:
> I'm trying to debug some software that I downloaded from the web.
> It seems to work fine most of the time however it occasionally crashed with
> database errors.
> When I look at the code it has a lot of array references that i don't
> understand
> e.g. $Session[clientID]
> most references at are of the form $arrayname["item"]  or $arrayname[$item]
> as I would expect.
> is the example correct code? if so what does it mean?

It either does the same thing as $Sessin["clientID"] The quotes are
optional but recommended, because clientID could be defined as a
constant and that could give unexpected results.

-- 
Jason Stechschulte
[EMAIL PROTECTED]
--
: How would you disambiguate these situations?

By shooting the person who did the latter.
             -- Larry Wall in <[EMAIL PROTECTED]>




Thanks

Peter

"Jason Stechschulte" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Fri, May 04, 2001 at 01:19:57PM +0100, peter.beal wrote:
> > I'm trying to debug some software that I downloaded from the web.
> > It seems to work fine most of the time however it occasionally crashed
with
> > database errors.
> > When I look at the code it has a lot of array references that i don't
> > understand
> > e.g. $Session[clientID]
> > most references at are of the form $arrayname["item"]  or
$arrayname[$item]
> > as I would expect.
> > is the example correct code? if so what does it mean?
>
> It either does the same thing as $Sessin["clientID"] The quotes are
> optional but recommended, because clientID could be defined as a
> constant and that could give unexpected results.
>
> --
> Jason Stechschulte
> [EMAIL PROTECTED]
> --
> : How would you disambiguate these situations?
>
> By shooting the person who did the latter.
>              -- Larry Wall in <[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]
>






Who knows about some "Visual Query Generator or/ and Visual Diagram
Generator" as MS SQL but  for MySQL ?

--
M. Sc. Hassan Arteaga Rodríguez
Microsoft Certified System Engineer
Network Admin, WEB Programmer
FUNDYCS, Ltd
[EMAIL PROTECTED]




On Thu, May 03, 2001 at 04:02:32PM -0400, Sherman wrote:
>       I have installed mod_php on my Apache web server and there is
> something I was curious about.  I would like there to be a web page with a
> form that a user can enter some info into.. and it change a file in say
> /etc/file.txt when they submit the form .. any tips or advice on how I would
> get started doing this?  Thanks in advance.

First of all, I would learn HTML.  Then create an HTML form.  

Next I would learn how to program.  Since you have installed mod_php, I
would probably learn how to program in php.  Once this is accomplished,
you will realize just how easy your task really is.

If you are looking for a tutorial, check out some links from here:
http://www.php.net/links.php

-- 
Jason Stechschulte
[EMAIL PROTECTED]
--
If this were Ada, I suppose we'd just constant fold 1/0 into

    die "Illegal division by zero"
             -- Larry Wall in <[EMAIL PROTECTED]>




If anybody is remotely interested, this is how I got php 4.0.4 to do
sessions without cookies and with register_globals=OFF.  Tested on IE
4.something (I'm not really coherent right now ;) and Netscape 4.5. This
took me a while to figure out and thought it might help save someone else
the trouble.  Let me know if you can improve upon this...


//---------------------------------sess01.php

<?php
session_start();
session_register('varA');
session_register('varB');
?>

<form action="sess02.php">
first name:<input type="text" name="varA">
<br>
last name:<input type="text" name="varB">
<input type="submit" value="send">
</form>


//---------------------------------sess02.php

<?php

session_start();

$varA=$HTTP_GET_VARS['varA'];
$varB=$HTTP_GET_VARS['varB'];

$GLOBALS['HTTP_SESSION_VARS']['varA'] = $varA;
$GLOBALS['HTTP_SESSION_VARS']['varB'] = $varB;

echo $HTTP_SESSION_VARS['varA'];
echo $HTTP_SESSION_VARS['varB'];

?>





Hi there php people!

Is there any way to get RAW POST DATA from cgi-bin php script with
track_vars turned on?
the array $HTTP_POST_VARS contains parsed data with "_" instead of spaces
and split all RAW data by "=" !!! thats too bad!

is there any other variable?

Have a nice day!






I want to setup PHP on W2000 + IIS 5 PC as ISAPI..When I change from CGI to
ISAPI ..I receive this error messages:

500 Internal Server Error  

Steps followed to install ISAPI..

IIS 4.0+ (isapi):
1. Copy the php.ini-dist to your systemroot (the directory where you
installed windows), rename it to php.ini, and
edit it to fit your needs
2. Start the Microsoft Management Console or the Internet Services Manager,
located in your Control Panel
3. Click on your webserver, and select properties
4. If you don't want to perform HTTP Authentication using PHP, you can (and
should) skip this step. Under ISAPI Filters,
add a new ISAPI filter. Use PHP as the filter name, and supply a path to the
php4isapi.dll
5. Under Home Directory, click on the Configuration button. Add a new entry
to the Application Mappings. Use the path the
php4isapi.dll as the Executable, supply .php as the extension, leave Method
exclusions, blank, and check the Script engine
checkbox
6. Stop IIS completely
7. Start IIS again 


Thanks !!!

--
M. Sc. Hassan Arteaga Rodríguez
Microsoft Certified System Engineer
Network Admin, WEB Programmer
FUNDYCS, Ltd
[EMAIL PROTECTED]




As it says in the installation notes, the ISAPI module is not ready for
production use - and what you are witnessing is its favourite trick!

If you are an IIS wizard and are able to investigate why it goes wrong, your
input would be most welcome!

Cheers
--
Phil Driscoll
Dial Solutions
+44 (0)113 294 5112
http://www.dialsolutions.com
http://www.dtonline.org





Is there any?

I need to create a tool for creating administering users like this.

user1, user2, user3, etc..

Under user1 there are 
subuserA, subuserB, subuserC, etc..

Under subuserA there are 
many other users...


it's like a piramyd.

Does anyone know any link about such a tool?


Thanks
Nicola





Hello,
I have a form field  <TEXTAREA name="Home" ROWS=10
COLS=40><? echo $Home ?></TEXTAREA> 
with this data in it:

My Home
11 North 5th St
St. Paul MN
Phone: (555) 555-5555
Fax: (555) 555-5555
E-Mail: [EMAIL PROTECTED]

When submited it goes into a mysql database.  The
problem i'm running into is that the output looks like
this after the call from the mysql database to html:

My Home 11 North 5th St St. Paul MN Phone: (555)
555-5555 Fax: (555) 555-5555 E-Mail:
[EMAIL PROTECTED]

How do I get it to print out with line breaks like how
I have typed it into the form?
Thank you
  --Mike



__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/




Use the nl2br() function

--zak

----- Original Message ----- 
From: "Mike Mike" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 04, 2001 8:11 AM
Subject: [PHP] PHP using Forms


> Hello,
> I have a form field  <TEXTAREA name="Home" ROWS=10
> COLS=40><? echo $Home ?></TEXTAREA> 
> with this data in it:
> 
> My Home
> 11 North 5th St
> St. Paul MN
> Phone: (555) 555-5555
> Fax: (555) 555-5555
> E-Mail: [EMAIL PROTECTED]
> 
> When submited it goes into a mysql database.  The
> problem i'm running into is that the output looks like
> this after the call from the mysql database to html:
> 
> My Home 11 North 5th St St. Paul MN Phone: (555)
> 555-5555 Fax: (555) 555-5555 E-Mail:
> [EMAIL PROTECTED]
> 
> How do I get it to print out with line breaks like how
> I have typed it into the form?
> Thank you
>   --Mike
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great prices
> http://auctions.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]
> 





Try this:

$Home = nl2br($Home);     // nl2br converts newlines to <br>s

See http://www.php.net/nl2br for more info.

(Incidentally, I answered exactly the same question yesterday, in exactly
the same way. *Please* check the list archives/last few days postings/manual
before posting this sort of thing :-)

HTH
Jon


-----Original Message-----
From: Mike Mike [mailto:[EMAIL PROTECTED]]
Sent: 04 May 2001 15:12
To: [EMAIL PROTECTED]
Subject: [PHP] PHP using Forms


Hello,
I have a form field  <TEXTAREA name="Home" ROWS=10
COLS=40><? echo $Home ?></TEXTAREA> 
with this data in it:

My Home
11 North 5th St
St. Paul MN
Phone: (555) 555-5555
Fax: (555) 555-5555
E-Mail: [EMAIL PROTECTED]

When submited it goes into a mysql database.  The
problem i'm running into is that the output looks like
this after the call from the mysql database to html:

My Home 11 North 5th St St. Paul MN Phone: (555)
555-5555 Fax: (555) 555-5555 E-Mail:
[EMAIL PROTECTED]

How do I get it to print out with line breaks like how
I have typed it into the form?
Thank you
  --Mike



__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.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]



**********************************************************************
'The information included in this Email is of a confidential nature and is 
intended only for the addressee. If you are not the intended addressee, 
any disclosure, copying or distribution by you is prohibited and may be 
unlawful. Disclosure to any party other than the addressee, whether 
inadvertent or otherwise is not intended to waive privilege or
confidentiality'

**********************************************************************




The below does the newline and takes care of html tags which might otherwise
get parsed by the web browser.

# This function is to fix the characters. It replaces all htmlentities with
their &amp kind representation
# and converts newlines to html breaks (<BR>)
function fix($string)
                {
                        return(nl2br(htmlentities($string)));
                }


-----Original Message-----
From: Jon Haworth [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 04, 2001 10:16 AM
To: 'Mike Mike'; [EMAIL PROTECTED]
Subject: RE: [PHP] PHP using Forms


Try this:

$Home = nl2br($Home);     // nl2br converts newlines to <br>s

See http://www.php.net/nl2br for more info.

(Incidentally, I answered exactly the same question yesterday, in exactly
the same way. *Please* check the list archives/last few days postings/manual
before posting this sort of thing :-)

HTH
Jon


-----Original Message-----
From: Mike Mike [mailto:[EMAIL PROTECTED]]
Sent: 04 May 2001 15:12
To: [EMAIL PROTECTED]
Subject: [PHP] PHP using Forms


Hello,
I have a form field  <TEXTAREA name="Home" ROWS=10
COLS=40><? echo $Home ?></TEXTAREA> 
with this data in it:

My Home
11 North 5th St
St. Paul MN
Phone: (555) 555-5555
Fax: (555) 555-5555
E-Mail: [EMAIL PROTECTED]

When submited it goes into a mysql database.  The
problem i'm running into is that the output looks like
this after the call from the mysql database to html:

My Home 11 North 5th St St. Paul MN Phone: (555)
555-5555 Fax: (555) 555-5555 E-Mail:
[EMAIL PROTECTED]

How do I get it to print out with line breaks like how
I have typed it into the form?
Thank you
  --Mike



__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.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]



**********************************************************************
'The information included in this Email is of a confidential nature and is 
intended only for the addressee. If you are not the intended addressee, 
any disclosure, copying or distribution by you is prohibited and may be 
unlawful. Disclosure to any party other than the addressee, whether 
inadvertent or otherwise is not intended to waive privilege or
confidentiality'

**********************************************************************

-- 
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]




Thank you all!! :-)

--- "Altunergil, Oktay" <[EMAIL PROTECTED]> wrote:
> The below does the newline and takes care of html
> tags which might otherwise
> get parsed by the web browser.
> 
> # This function is to fix the characters. It
> replaces all htmlentities with
> their &amp kind representation
> # and converts newlines to html breaks (<BR>)
> function fix($string)
>               {
>                       return(nl2br(htmlentities($string)));
>               }
> 
> 
> -----Original Message-----
> From: Jon Haworth
> [mailto:[EMAIL PROTECTED]]
> Sent: Friday, May 04, 2001 10:16 AM
> To: 'Mike Mike'; [EMAIL PROTECTED]
> Subject: RE: [PHP] PHP using Forms
> 
> 
> Try this:
> 
> $Home = nl2br($Home);     // nl2br converts newlines
> to <br>s
> 
> See http://www.php.net/nl2br for more info.
> 
> (Incidentally, I answered exactly the same question
> yesterday, in exactly
> the same way. *Please* check the list archives/last
> few days postings/manual
> before posting this sort of thing :-)
> 
> HTH
> Jon
> 
> 
> -----Original Message-----
> From: Mike Mike [mailto:[EMAIL PROTECTED]]
> Sent: 04 May 2001 15:12
> To: [EMAIL PROTECTED]
> Subject: [PHP] PHP using Forms
> 
> 
> Hello,
> I have a form field  <TEXTAREA name="Home" ROWS=10
> COLS=40><? echo $Home ?></TEXTAREA> 
> with this data in it:
> 
> My Home
> 11 North 5th St
> St. Paul MN
> Phone: (555) 555-5555
> Fax: (555) 555-5555
> E-Mail: [EMAIL PROTECTED]
> 
> When submited it goes into a mysql database.  The
> problem i'm running into is that the output looks
> like
> this after the call from the mysql database to html:
> 
> My Home 11 North 5th St St. Paul MN Phone: (555)
> 555-5555 Fax: (555) 555-5555 E-Mail:
> [EMAIL PROTECTED]
> 
> How do I get it to print out with line breaks like
> how
> I have typed it into the form?
> Thank you
>   --Mike
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great
> prices
> http://auctions.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]
> 
> 
> 
>
**********************************************************************
> 'The information included in this Email is of a
> confidential nature and is 
> intended only for the addressee. If you are not the
> intended addressee, 
> any disclosure, copying or distribution by you is
> prohibited and may be 
> unlawful. Disclosure to any party other than the
> addressee, whether 
> inadvertent or otherwise is not intended to waive
> privilege or
> confidentiality'
> 
>
**********************************************************************
> 
> -- 
> 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]


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/




hi,

here is a patched version of php4.0.5 with the fixed com extension.

http://celery.nme.at/php-4.0.5.zip

regards
harald





I'm trying to use UW IMAP c-client w/ the kerberos v4 patches with PHP
4.0.x and IMP 2.2.x

I've tried both IMAP 4.7c and IMAP2000 - both the c-clients build fine.  I
had some problems getting IMAP 4.7c working with PHP4, but I've confirmed
that it does work (I can open IMAP streams using a clear text password).
IMAP2000 works as well.  The IMAP 4.7c c-client works as intended with PHP
3.0.x.

here's the problem..
if the environment KRBTKFILE is set, and points to a valid krb4 ticket
file, the krb4 patched c-client should automatically recognize this use
that ticket file when trying to open IMAP connections.

This works in PHP 3.0.x.  PHP 4.0.x seems to be ignoring the ticket file
(or more likely the environment variable).  I'm setting it by adding this
to an auto prepend file..

        <?php

        $krbtkfile = "/ticket/kerb." . getenv("REMOTE_USER");
        putenv("KRBTKFILE=$krbtkfile");

        ?>

Works fine in PHP 3.0.x, but not in 4.0.4x or 4.0.5 (tho, in PHP 3.0.x
c-client seems to cache KRBTKFILE erroneously when used as an apache
server module, so we have to use it in CGI mode).

Is there another way to get KRBTKFILE into a part of the environment where
PHP will pay attention to it?  Anyone have any suggestions?  I'm at a
loss.

thanks

Liam Hoekenga
UM Webmaster Team





Is there a way to do calculations with dates? Preferably ignoring weekends.

Thanks, Gary






Gary,

Yes. Check the manual for mktime(); and getdate();
http://www.php.net/quickref.php

James

> Is there a way to do calculations with dates? Preferably ignoring
weekends.
>
> Thanks, Gary
>
>
>
> --
> 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 new to PHP (which will be obvious in just a minute).

In Perl I can assign dynamic keys ad infinitum to an array such as:

$sku{$id}{$line}{$price} = 99;

But the syntax is escaping me for the same function in PHP.

As I was trying to debug my thinking, I ran the following little test and am
confused about the result.

Two things:
1) Why does the code below produce this result?
2) How do I assign to an multidimensional array with dynamic keys?

Here is the test code:

$first = "Elementary";
$second = "Middle";

echo "before assignment:<BR>";
echo "first = $first<BR>";    // prints: first = Elementary
echo "second = $second<P>";   // prints: second = Middle   --- looks as
expected here


$first[$second] = "pass";


echo "After Assignment:<BR>";
echo "first = $first<BR>";    // prints: first = plementary   ---  what is
this ????!!
echo "second = $second<BR>";  // prints: second = Middle
echo "$first[$second]";    // prints: P

Thanks








"Mark Cain" <[EMAIL PROTECTED]> wrote in message 
9cufuv$s20$[EMAIL PROTECTED]">news:9cufuv$s20$[EMAIL PROTECTED]...
> 
> Two things:
> 1) Why does the code below produce this result?
> 2) How do I assign to an multidimensional array with dynamic keys?
> 
> Here is the test code:
> 
> $first = "Elementary";
> $second = "Middle";
> 
> echo "before assignment:<BR>";
> echo "first = $first<BR>";    // prints: first = Elementary
> echo "second = $second<P>";   // prints: second = Middle   --- looks as
> expected here
> 
> 

look, before the assignment:

0. both $first and $second are string-type variables.

> $first[$second] = "pass";

1. In this case the brackets mean to index a character of the string (like in C), but 
2. $second is converted into int because of using as a string-index,
    the integer value of $second ("Middle") equals to 0. (how can you convert it in 
any other way?)
3. Things getting clearer... the your assignment says:
    - the 1st character of string $first let be "pass", 
there is no room any other character, but "p". (because of PHP think you'd like to 
change the 1st char only.)
4. so: "Elementary" ---> "plementary"
> 
> 
> echo "After Assignment:<BR>";
> echo "first = $first<BR>";    // prints: first = plementary   ---  what is
> this ????!!
> echo "second = $second<BR>";  // prints: second = Middle
> echo "$first[$second]";    // prints: P

what you want is the following - i think (i'm not familiar with perl at all):

$first = array($first, $second); what this produces is can be tested with 
var_dump($first) not with echo, by the way
var_dump($first);

This is a one-dimensional array with two entries.





This code works fine on Win NT/IIS with Netscape but not with IE4 :
cookie is not set ?????

<?php
  include "include.php";

  if (authUser($username,$userpass)) {
    // do not work with  IIS
    //$exp  = gmdate ("M d Y H:i:s", time()-3600);

//setcookie("AUTHORIZER",$username.":".md5($username.$userpass),$exp."
GMT");

    $exp = gmdate("M d Y H:i:s", time()+86400)." GMT";
    print "<script language='javascript'>";
    print "var expdate=new Date ();";
    print "expdate.setTime(expdate.getTime()+(24*60*60*1000*31));";
    print
"document.cookie='MYCOOKIE='+escape('".$username.":".md5($username.$userpass)."')
+';expires=expires '+expdate.toGMTString();";
    print "</script>";
  }
  //not header behind print
  //header("Location: $HTTP_REFERER");

  print "<script language='javascript'>";
  print "document.location='$HTTP_REFERER';";
  print "</script>";
?

$HTTP_COOKIE_VARS['MYCOOKIE'] is always empty in $HTTP_REFERER and this
only with IE 4/5

Help !!!!!!!






This code works fine on Win NT/IIS with Netscape but not with IE4 :
cookie is not set ?????

<?php
  include "include.php";

  if (authUser($username,$userpass)) {
    // do not work with  IIS
    //$exp  = gmdate ("M d Y H:i:s", time()-3600);

//setcookie("AUTHORIZER",$username.":".md5($username.$userpass),$exp."
GMT");

    $exp = gmdate("M d Y H:i:s", time()+86400)." GMT";
    print "<script language='javascript'>";
    print "var expdate=new Date ();";
    print "expdate.setTime(expdate.getTime()+(24*60*60*1000*31));";
    print
"document.cookie='MYCOOKIE='+escape('".$username.":".md5($username.$userpass)."')

+';expires=expires '+expdate.toGMTString();";
    print "</script>";
  }
  //not header behind print
  //header("Location: $HTTP_REFERER");

  print "<script language='javascript'>";
  print "document.location='$HTTP_REFERER';";
  print "</script>";
?

$HTTP_COOKIE_VARS['MYCOOKIE'] is always empty in $HTTP_REFERER and this
only with IE 4/5

Help !!!!!!!







Which one is more adequate for representing server ip?

Thanks

-- 
Wei Weng
Network Software Engineer
KenCast Inc.







> -----Original Message-----
> From: Jennifer [mailto:[EMAIL PROTECTED]]
> Subject: Re: [PHP] session_register()

> > 1. What browser are you using? I, and others, have seen 
> erratic results with
> > sessions using Netscape 4.x. If this is your browser, try 
> your code with
> > another browser, if possible.
> 
> This appears to be the problem.  Now what?  So I have to forget
> about sessions or forget about the multitude of NS 4.x users that
> still exist?

At least 3 of us have reported this problem here on this list. No one seems
to have an answer. On the up side, it seems to be erratic, Netscape 4.x
sometimes works. Realistically, this affects less than 10% of your visitors.
So.... I don't know what else to say, except good luck!

Kirk




I would be very interested in hearing of any developments with session
anomilies..

Netscape® Communicator 4.76 M$2000

PHP Version 4.0.4pl1 
System Windows NT 5.0 build 2195 
Server API CGI 
ZEND_DEBUG disabled 
Thread Safety enabled 


"works" using:

<?php
session_register ("sidcount");
$sidcount++;
?>

Hello visitor, you have seen this page <?php echo $sidcount; ?>
times.<p>

<php?
# the <?=SID?> is necessary to preserve the session id
# in the case that the user has disabled cookies
?>


____________________________ 
Matthew Luchak 
Webmaster
Kaydara Inc. 
[EMAIL PROTECTED]



I would be very interested in hearing of any developments with session
anomilies..

Netscape® Communicator 4.76 M$2000

"works" using:

<?php
session_register ("sidcount");
$sidcount++;
?>

Hello visitor, you have seen this page <?php echo $sidcount; ?>
times.<p>

<php?
# the <?=SID?> is necessary to preserve the session id
# in the case that the user has disabled cookies
?>


____________________________ 
Matthew Luchak 
Webmaster
Kaydara Inc. 
[EMAIL PROTECTED]







Greetings.

    Is there any quick way to generate thumbnails of existing pictures in a
directory? It would seem quite worthless to create 120x120 images of ones
that already exist, and upload duplicates.. Therefore, dynamic thumbnails
would be perfect. Any solutions?

    PHP 4.0+ thanks.

- Richard






I wrote a small function like the following to create my won thumbnails.

function make_tumb_nail($url){

  $size=GetImageSize("image/$url");
  $ht=$size[1];
  $wd=$size[0];

  if($ht>$wd){
  $h=$ht;
  for($i=1.01;;){
   if($h<121){
    break;
   }
   $h=$ht/$i;
   $w=$wd/$i;
   $i=$i+0.01;
  }
  } else {
  $w=$wd;
  for($i=1.01;;){
   if($w<91){
    break;
   }
   $h=$ht/$i;
   $w=$wd/$i;
   $i=$i+0.01;
  }
  }
  $wd=floor(round($w));
  $ht=floor(round($h));
  $returnstring="width=$wd height=$ht border=0";
  return $returnstring;
}

This function returns the thumbnail width and height as string and use 
it along with the original string.

<img src="image/<?php $url ?>"  <? php make_thumb_nail($url) ?>>

Hope this helps.


Richard wrote:

> Greetings.
> 
>     Is there any quick way to generate thumbnails of existing pictures in a
> directory? It would seem quite worthless to create 120x120 images of ones
> that already exist, and upload duplicates.. Therefore, dynamic thumbnails
> would be perfect. Any solutions?
> 
>     PHP 4.0+ thanks.
> 
> - Richard
> 
> 
> 





gosh, i just downloaded the new PHP file from
www.php.net, the file i downloaded is :

***
PHP 4.0.5 [4,590Kb] - 30 April 2001
(CGI binary plus server API versions for Apache,
AOLserver, ISAPI and NSAPI. MySQL support built-in,
many extensions included, packaged as zip) 
***

i'm using win98 & PWS 4. I did everything by the book.
I had succesfully installed & was running earlier
versions of PHP on my system. i just did this upgrade
& ka-BOom!! I copied all the DLL's in the DLL folder
to my windows/system folder. Copied the php.ini to the
windows folder. Did everything with the registry.
Making extensions, declaring paths to php.exe,
checking the "execute" box in my PWS! done everything
by the book! Then what's wrong. 

2 things i didn't do is : 
1. did not mention anything in doc_root in php.ini (as
i never did before, but used 2 work)
2. did not use the pws-php4*.reg for updating my
registry (as i do it manually. I did try this but it
doesn't make a different) 
3. first i copied the new browscap.ini to my system,
it didn't still work...so i brought back my original
and it still doesn't work!!! 

I don't know what to do.... please somebody help!!!

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!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/




If you were replacing an earlier version of php, your registry should
already have contained the correct stuff - did you change anything?

What does ka-BOom actually mean in terms of error messages etc?

>From the command line, change to the folder containing php.exe, type
php.exe -i and see if you get a page full of html - the output of
phpinfo() - or some error messages. If you get the html, then php is working
fine but your PWS configuration is not.

Cheers
--
Phil Driscoll
Dial Solutions
+44 (0)113 294 5112
http://www.dialsolutions.com
http://www.dtonline.org






i was gonna die until u came along, at least you have
given me some hope. i'm not able 2 eat since this
happened. 
anyway,

> already have contained the correct stuff - did you
> change anything?
yes, because the earlier php were in very different
folders..i had a pretty pretty early version of PHP4.
so basically all i changed in the registry were paths.


> What does ka-BOom actually mean in terms of error
> messages etc?
when i try an open a php page in my browser, it gives
a "HTTP 500 - Internal server error " and nothing
comes up.

> From the command line, change to the folder
> containing php.exe, type php.exe -i and see if you 
> get a page full of html - the output of
wow - i did this thing, and YES! i did get a whole lot
of HTML tags!!!! so that means my PHP is working fine.
than what the hell is the problem with my PWS???? it
was working great with the earlier version. i didn't
change anything with it here!!

T. Edison jr.


> phpinfo() - or some error messages. If you get the
> html, then php is working
> fine but your PWS configuration is not.
> 
> Cheers
> --
> Phil Driscoll
> Dial Solutions
> +44 (0)113 294 5112
> http://www.dialsolutions.com
> http://www.dtonline.org
> 
> 


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

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/




I am in the process of writing an application that does a lot of parsing in
which performance is the key.  In the process, I performed some rudimentary
speed testing that yielded some interesting results.  Rather than keep them
to myself, I thought I would share them.

I am currently parsing out the contents of general webpages, so for the test
case, I used a string that contained the html to generate a fairly standard
select list (with 31 options).  For the first test, I merely wanted to pull
out the name of the select element.  I used the following two parsing
commands in a side-by-side timing comparison and ran each in a loop 5000
times to get a larger time value:

    preg_match(
"/name=[ ]?(['\"])?((?(1)[^\\1]|[^\s\>])+?)(?(1)\\1|[\s>])/i", $string,
$arr );

    eregi( "name=[\"']{0,1}([_0-9a-zA-Z]+)[\"']{0,1}", $string, $arr );

Note: The preg_match expression is actually far more accurate that the eregi
as well as complex.  It handles the case of "name=34 multiple>" as well as
"name='my select'".  Both expressions were also case insensitive.

The results:
        preg_match
        Timer: This page was generated in 0.26572799682617 seconds.

        eregi
        Timer: This page was generated in 1.2171900272369 seconds.


The preg_match is considerably faster than ereg and much more powerful (the
PHP homepage for the documentation), and while the syntax takes a little
adjustment (if you have never used Perl before), it is not that difficult to
convert to.  When I replaced all of my eregi statements with their
preg_match equivalents, I found that the parsing portion of my page went
from .46 seconds to .23.  When it comes to regular expression pattern
matching, I have come to the conclusion that the only option is preg_match.


Inspired by this revelation, I decided to test preg_split vs split vs
explode.  It was not nearly as interesting, but I thought I would post my
results nonetheless.

Using the same string as above, I decided to split the string by the
</option tag.  I used the following commands in a side-by-side comparison
(again in a loop of 5000):

    preg_split( '/<\/option/i', $string, $arr );
    spliti( "</option>", $string, $arr );
    explode( "</option>", $string, $arr );

The results:

        preg_split
        Timer: This page was generated in 0.23138296604156 seconds.

        split
        Timer: This page was generated in 0.22009003162384 seconds.

        explode
        Timer: This page was generated in 0.14973497390747 seconds.


This really is not too surprising when it comes to explode.  If there is no
complex pattern matching, always use explode.  preg_split vs split was a
little surprising given my findings above, but in general, it looks like
while there is not much of a difference, split has the slight edge.


Summary:
* If you are doing regular expression matching in a string, use preg_match.
Not only is it much faster, but it is much more powerful than ereg.
* If you are splitting a string by a simple string pattern, use explode.
* If you are splitting a string using regular expressions, use split unless
you need the functionality of preg_split.


Disclaimer:
I have not done exhaustive performance study of all of the possible
scenarios to find discrepancies, but from my observations so far, the above
conclusions have held true.  If anyone has any other information, please
post it for us all to share.  I hope some of you have found this useful.


Matthew Aznoe
Fuzz Technologies
[EMAIL PROTECTED]
(406) 587-1100 x217




While working on some web sites which contain mouse over java, and then
adding in some db stuff via php/mysql, the java seems to break.
Is there something special I need to do to prevent that break?
Is this a common problem?
Does using templates get around that problem ?

Thanks !
___________________________________________________________
Jack Sasportas
Innovative Internet Solutions
Phone 305.665.2500
Fax 305.665.2551
www.innovativeinternet.com
www.web56.net






I assume by java you mean some permutation of javascript.

PHP runs server-side which means all the PHP processing is done before it
is sent to the client. What the client recieves has nothing to do with
PHP, that is all effectively "removed" ie parsed by the PHP engine. The
client just recieves HTML and javascript etc. The javascript the runs
"client-side" ie on the client, separate from the server and its PHP.

Long and short of it is that no, what the PHP does won't effect the
javascript. The only possibility is that in adding your database stuff you
somehow altered the javascript part of the code, or the html it refers to.
I'ld back track and check carefully if I was you.

Templates won't help directly, except that if you find one which does what
yuo want then obviously you know that will work. Personally, I prefer
writing my own stuff for my own needs.

HTH,
Tom

Tom Carter
Web Architect
roundcorners ltd.

On Fri, 4 May 2001, Jack Sasportas wrote:

> While working on some web sites which contain mouse over java, and then
> adding in some db stuff via php/mysql, the java seems to break.
> Is there something special I need to do to prevent that break?
> Is this a common problem?
> Does using templates get around that problem ?
>
> Thanks !
> ___________________________________________________________
> Jack Sasportas
> Innovative Internet Solutions
> Phone 305.665.2500
> Fax 305.665.2551
> www.innovativeinternet.com
> www.web56.net
>
>
>
> --
> 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]
>





They are totally un-related.  Make sure that the final HTML on the page 
(some of it generated by PHP) is corrent and doesn't break the 
Java/Javascript. 

Michael


Jack Sasportas wrote:

>While working on some web sites which contain mouse over java, and then
>adding in some db stuff via php/mysql, the java seems to break.
>Is there something special I need to do to prevent that break?
>Is this a common problem?
>Does using templates get around that problem ?
>
>Thanks !
>___________________________________________________________
>Jack Sasportas
>Innovative Internet Solutions
>Phone 305.665.2500
>Fax 305.665.2551
>www.innovativeinternet.com
>www.web56.net
>
>
>







If it's javascript, then be careful about echoing PHP variables into
Javascript strings.  If you have something like (in Javascript)

var myString = '<?php echo $phpString; ?>';

and $phpString contains any apostrophes, then the javascript will break
because Javascript thinks the string has ended prematurely.  E.g, if
$phpString is "My cat's pajamas" then the javascript would be sent to the
browser thus:

var myString = 'My cat's pajamas';

and you can see that there are too many single quotes, which will, of
course, cause Javascript's high-powered debugging utilities to kick in and
give you a highly useful error report.

Pete.

> While working on some web sites which contain mouse over java, and then
> adding in some db stuff via php/mysql, the java seems to break.
> Is there something special I need to do to prevent that break?
> Is this a common problem?
> Does using templates get around that problem ?







I am echoing the javascript and other html, and at this point *not* putting
values into the javascript.
I take a string like so:

$string="
JavaCode....
HTML<Stuff>
";

I make sure that *everything* in the quotes has only sinlge quotes no double
quotes so that PHP doesn't think its the end of the string, then I echo
$string;

Somehow the java mouseover breaks, then I tried taking the java mouseover
single quotes and putting them back to double quotes preceeded by a \ to tell
php to ignore that quote, but that didn't work either.
Is it the way I am echoing or something ?

Thanks !


Peter Dudley wrote:

> If it's javascript, then be careful about echoing PHP variables into
> Javascript strings.  If you have something like (in Javascript)
>
> var myString = '<?php echo $phpString; ?>';
>
> and $phpString contains any apostrophes, then the javascript will break
> because Javascript thinks the string has ended prematurely.  E.g, if
> $phpString is "My cat's pajamas" then the javascript would be sent to the
> browser thus:
>
> var myString = 'My cat's pajamas';
>
> and you can see that there are too many single quotes, which will, of
> course, cause Javascript's high-powered debugging utilities to kick in and
> give you a highly useful error report.
>
> Pete.
>
> > While working on some web sites which contain mouse over java, and then
> > adding in some db stuff via php/mysql, the java seems to break.
> > Is there something special I need to do to prevent that break?
> > Is this a common problem?
> > Does using templates get around that problem ?
>
> --
> 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]

--
___________________________________________________________
Jack Sasportas
Innovative Internet Solutions
Phone 305.665.2500
Fax 305.665.2551
www.innovativeinternet.com
www.web56.net






Is there any way that we can see the page?

That might help in sorting out the problem

Thank you
Brian Paulson
Sr. Web Developer
[EMAIL PROTECTED]
http://www.chieftain.com
1-800-269-6397


-----Original Message-----
From: Jack Sasportas [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 04, 2001 11:22 AM
To: php
Subject: Re: [PHP] PHP & Java ?


I am echoing the javascript and other html, and at this point *not* putting
values into the javascript.
I take a string like so:

$string="
JavaCode....
HTML<Stuff>
";

I make sure that *everything* in the quotes has only sinlge quotes no double
quotes so that PHP doesn't think its the end of the string, then I echo
$string;

Somehow the java mouseover breaks, then I tried taking the java mouseover
single quotes and putting them back to double quotes preceeded by a \ to
tell
php to ignore that quote, but that didn't work either.
Is it the way I am echoing or something ?

Thanks !


Peter Dudley wrote:

> If it's javascript, then be careful about echoing PHP variables into
> Javascript strings.  If you have something like (in Javascript)
>
> var myString = '<?php echo $phpString; ?>';
>
> and $phpString contains any apostrophes, then the javascript will break
> because Javascript thinks the string has ended prematurely.  E.g, if
> $phpString is "My cat's pajamas" then the javascript would be sent to the
> browser thus:
>
> var myString = 'My cat's pajamas';
>
> and you can see that there are too many single quotes, which will, of
> course, cause Javascript's high-powered debugging utilities to kick in and
> give you a highly useful error report.
>
> Pete.
>
> > While working on some web sites which contain mouse over java, and then
> > adding in some db stuff via php/mysql, the java seems to break.
> > Is there something special I need to do to prevent that break?
> > Is this a common problem?
> > Does using templates get around that problem ?
>
> --
> 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]

--
___________________________________________________________
Jack Sasportas
Innovative Internet Solutions
Phone 305.665.2500
Fax 305.665.2551
www.innovativeinternet.com
www.web56.net



--
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]







Yep, that was most of the problem. I was coding and testing from one machine
on my network so all the files had the same owner. When I changed the owner
for the files for each virtual host to the user for that virtual hosts, and
set permissions to 705, everything seems to work as it should.

Now I need to learn how to "jail" the user in the FTP routine, and then I
will have every one in a nice, secure, cozy pocket, I hope.

Thanks very much for the help.

Pan
Sebastien Roy <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi
>
> I got the same setup as you with safe_mode = On  and I try to use the copy
> function between 2 virtual host. When I copy from one virtual host to
another,
> I got an error message telling me that the copy function is not allowed :
>
> Warning: SAFE MODE Restriction in effect. The script whose uid is 88 is
not
> allowed to access /home/host/yourdomain owned by uid 98 in
> home/www/host/127.0.0.1:8080/html/index.php on line 37
>
> His your virtual host have all the same users?
>
>
> Regards,
>
> Sebastien Roy
>
>
> PanDragon wrote:
>
> > Thanks for the suggestion, but I need to be able to use the copy
command, I
> > just do not want it to be able to read from one virtual host to another.
I
> > would imagine that lots of web hosters running php with virtual hosts
would
> > have the same problem.
> >
> > Sebastien Roy <[EMAIL PROTECTED]> wrote in message
> > news:<[EMAIL PROTECTED]>...
> > > Hi,
> > >
> > > There is a section in the php.ini where you can specified the function
you
> > > don't whant to use  :
> > >
> > > disable_functions : copy; ...
> > >
> > > I never used it, but I think it's what you are looking for.
> > >
> > >
> > > Regards,
> > >
> > > Sebastien Roy
> > > [EMAIL PROTECTED]
> > >
> > >
> > > PanDragon wrote:
> > >
> > > > I am running an apache server with virtual hosts and need to prevent
the
> > php
> > > > Copy command from being able to copy from one virtual host dir to
> > another.
> > > >
> > > > The server is in php safe mode and the doc_root, and basedir are set
> > > > correctly, at least they prevent "includes" and "opendir" and such
from
> > > > working, but "copy" still works.
> > > >
> > > > I sure would appreciate any suggestions.
> > > >
> > > > Pan
> > > >
> > > > --
> > > > 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]
> > >
> > Sebastien Roy <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > Hi,
> > >
> > > There is a section in the php.ini where you can specified the function
you
> > > don't whant to use  :
> > >
> > > disable_functions : copy; ...
> > >
> > > I never used it, but I think it's what you are looking for.
> > >
> > >
> > > Regards,
> > >
> > > Sebastien Roy
> > > [EMAIL PROTECTED]
> > >
> > >
> > > PanDragon wrote:
> > >
> > > > I am running an apache server with virtual hosts and need to prevent
the
> > php
> > > > Copy command from being able to copy from one virtual host dir to
> > another.
> > > >
> > > > The server is in php safe mode and the doc_root, and basedir are set
> > > > correctly, at least they prevent "includes" and "opendir" and such
from
> > > > working, but "copy" still works.
> > > >
> > > > I sure would appreciate any suggestions.
> > > >
> > > > Pan
> > > >
> > > > --
> > > > 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]
>






I'm writing some wireless content in PHP and I've found several wml
simulators but none for hdml. The up.sdk says it works for hdml but displays
my wml content. Anybody know where to find a hdml simulator?

Data Driven Design
P.O. Box 1084
Holly Hill, Florida 32125-1084

http://www.datadrivendesign.com
http://www.rossidesigns.net



Reply via email to