Re: [PHP] Check for text

2002-03-29 Thread Jason Wong

On Friday 29 March 2002 14:40, Martin Kampherbeek wrote:
> Someone submits an url through a form.
> Now I want to check in a script to see if there is some tekst in it.
>
> For Example:
> Someone submits http://www.mydomain.com/test.htm
>
> In this htm file I want to check the text "hello".

fopen(), file() etc
strstr(), preg_match(), preg_grep() etc


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
Artificial intelligence has the same relation to intelligence as
artificial flowers have to flowers.
-- David Parnas
*/

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




[PHP] urlencode and decode are producing \\\' instead of \'

2002-03-29 Thread andy

Hi there,

I am trying to fill a form again when an error occures, therefore I redirect
to the form and pass the values via url like this:

HEADER("Location:/profiles/6".$recipient_id."2.html?subject=".rawurlencode($
subject)."&message=".rawurlencode($message)."");

then I put it in again like this
 '.rawurldecode($message).'

The problem is, that this is causing a message like this:
test  \\\'

So what's wrong? Can anybody help on this?

Thank you,

Andy



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




Re: [PHP] where i get .so [dll] file of linux ?

2002-03-29 Thread Prachait Saxena

Hello
But i would like to ues that modules that are not complied wit PHP

i mean dynamic inclusion of modules... Is that possible ?

Prachait

- Original Message -
From: Rouvas Stathis <[EMAIL PROTECTED]>
Newsgroups: php.general
To: Prachait Saxena <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, March 29, 2002 1:43 AM
Subject: Re: [PHP] where i get .so [dll] file of linux ?


>
> In Linux you don't use dl(). Instead, you compile PHP with the modules
> you need and they are there when you call them.
>
> -Stathis.
>

> Prachait Saxena wrote:
> >
> > Hello
> >
> > I would like to Know, where Site or Link i can get complied .so [dll]
files.
> > of linux
> >
> > as i have php_sockets.dll which works very fine in Windows enviroment.
but
> > on linux
> >
> > Can you suggest any other option for this.
> >
> > I am using  dl("php_sockets.dll"); while writing my code for windows and
> > what to same for Linux
> >
> > --
> > Bye, and  Have a nice day.
> >
> > Prachait Saxena


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




[PHP] PDF Load Problem

2002-03-29 Thread Alexis Antonakis

Hi,

One user to a site I have developed has complained that when they are trying
to view a PDF file on the site, that the server is closing the connection
with the browser window before the page has loaded.  The file is only 13
pages long and has a few very small images in it.

What I was wondering was whether anyone else has come across this sort of
problem, and if so, what advice would they be able to give to speed up the
loading/storage of PDF files.

Many Thanks
Alexis


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




[PHP] uploading files problem

2002-03-29 Thread Claudio Fedel

hi there,

I'm trying to upload a file using php on an apache server running on
linux.

The code of the form I'm using is as follow:


File to upload:



Upload




when I press the submit button after selecting the file, nothing
happens. 
I tried to print the filename passed by the form but it is empty.
If I run the same page on my win2k server, everything works fine.
It seems as that the form doesn't pass post variables. I also tried to
delete the enctype parameter and in this case the variables are printed
on screen.

Is there any particular setting on linux for this page to work?

thanks






Re: [PHP] uploading files problem

2002-03-29 Thread Balaji Ankem

hi  friend,

do we have static variables in php?

If we have can u give the syntax!!1

Thanks in advance
Balaji
Content-Type: multipart/alternative;
boundary="_=_NextPart_001_01C1D70D.F3519000"


--_=_NextPart_001_01C1D70D.F3519000
Content-Type: text/plain

hi there,

I'm trying to upload a file using php on an apache server running on
linux.

The code of the form I'm using is as follow:


File to upload:



Upload




when I press the submit button after selecting the file, nothing
happens. 
I tried to print the filename passed by the form but it is empty.
If I run the same page on my win2k server, everything works fine.
It seems as that the form doesn't pass post variables. I also tried to
delete the enctype parameter and in this case the variables are printed
on screen.

Is there any particular setting on linux for this page to work?

thanks




--_=_NextPart_001_01C1D70D.F3519000--



**Disclaimer
  


Information contained in this E-MAIL being proprietary to Wipro Limited
is 'privileged' and 'confidential' and intended for use only by the
individual or entity to which it is addressed. You are notified that any
use, copying or dissemination of the information contained in the E-MAIL
in any manner whatsoever is strictly prohibited.



 



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


Re: [PHP] uploading files problem

2002-03-29 Thread Balaji Ankem

specify the value attribute in input elements!!!

- Original Message -
From: "Balaji Ankem" <[EMAIL PROTECTED]>
Date: Friday, March 29, 2002 4:27 pm
Subject: Re: [PHP] uploading files problem

> hi  friend,
> 
> do we have static variables in php?
> 
> If we have can u give the syntax!!1
> 
> Thanks in advance
> Balaji
> Content-Type: multiparboundary="
> _=_NextPart_001_01C1D70D.F3519000"
> 
> --_=_NextPart_001_01C1D70D.F3519000
> Content-Type: text/plain
> 
> hi there,
> 
> I'm trying to upload a file using php on an apache server running on
> linux.
> 
> The code of the form I'm using is as follow:
> 
>  action=$PHP_SELF?action=doupload >
> File to upload:
> 
> 
> 
> Upload
> 
> 
> 
> 
> when I press the submit button after selecting the file, nothing
> happens. 
> I tried to print the filename passed by the form but it is empty.
> If I run the same page on my win2k server, everything works fine.
> It seems as that the form doesn't pass post variables. I also 
> tried to
> delete the enctype parameter and in this case the variables are 
> printedon screen.
> 
> Is there any particular setting on linux for this page to work?
> 
> thanks
> 
> 
> 
> 
> --_=_NextPart_001_01C1D70D.F3519000--
> 
> 


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


**Disclaimer
  


Information contained in this E-MAIL being proprietary to Wipro Limited
is 'privileged' and 'confidential' and intended for use only by the
individual or entity to which it is addressed. You are notified that any
use, copying or dissemination of the information contained in the E-MAIL
in any manner whatsoever is strictly prohibited.



 



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


[PHP] Re: uploading files problem

2002-03-29 Thread andy

put dubble quotes inside your html. I think this is in the spec, as soon as
it is no numeric format:



Cheers, Andy


"Claudio Fedel" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> hi there,
>
> I'm trying to upload a file using php on an apache server running on
> linux.
>
> The code of the form I'm using is as follow:
>
>  action=$PHP_SELF?action=doupload >
> File to upload:
> 
> 
> 
> Upload
> 
> 
>
>
> when I press the submit button after selecting the file, nothing
> happens.
> I tried to print the filename passed by the form but it is empty.
> If I run the same page on my win2k server, everything works fine.
> It seems as that the form doesn't pass post variables. I also tried to
> delete the enctype parameter and in this case the variables are printed
> on screen.
>
> Is there any particular setting on linux for this page to work?
>
> thanks
>
>
>
>



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




[PHP] Re: Sending a header redirect mid-page

2002-03-29 Thread Xavier DELAS

You can do that with a javascript command:

if($dbfail) {
ob_end_clean();
print("

parent.location.href=http://".$SERVER_NAME."/closed.php";;

");
exit;  // Halt the rest of the page from loading
 };




"Dan Tappin" <[EMAIL PROTECTED]> a écrit dans le message de news:
[EMAIL PROTECTED]
> I am trying to add error trapping to my site.  In particular I want to
> direct visitors to an error page when for what ever reason a MySQL
> connection can not be made.  Rather than a page full of errors I want a
> generic 'we are temporarily closed performing maintenance etc.. etc'
>
> Basically after a failed mysql_connect attempt I want a redirection to
this
> error page.  I have searched the PHP site and mailing lists and I have
seen
> a few solutions.
>
> In particular I found the use of ob_start() before the header info is send
> on the page then the use of the follow for the redirect:
>
> if($dbfail) {
>
> ob_end_clean();
> header("Location: http://".$SERVER_NAME."/closed.php";);
> exit;  // Halt the rest of the page from loading
>
> };
>
> I have also thought about just using a mysql_connect test in the header of
> each page that I have a mysql query in and have the redirect there.  I
want
> to have such an include any way to add some generic functions to call from
> anywhere as well.
>
> My only concern is that I am adding another mysql_connect and I don't want
> to slow things down any (things are blazing fast now but I want to keep it
> that way).
>
> It would be really nice if there was a one line function that could do
this.
> I also use Lasso and they have a simple [URL_Redirect:'http://domain.com']
> tag which does the job.
>
> I am also unfamiliar with the output buffer functions even after reading
up
> on them in the manual.  If I call ob_start() at the start of my page do I
> need to call a closing ob function after my $dbfail code if the connection
> is successful and my redirect ob_end_clean(); call is not made?
>
> Any help would be greatly appreciated.
>
> Thanks,
>
> Dan
> P.S. Please CC me/the list as I am on Digest Mode :^)
> --
> Dan Tappin
> Wavefront Communications Limited
> P:(403) 241-0062
> F:(403) 241-0302
> E: [EMAIL PROTECTED]
>
>



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




Re: [PHP] urlencode and decode are producing \\\' instead of \'

2002-03-29 Thread Bogdan Stancescu

You don't have to rawurlDEcode again - that's done automatically. You 
have to encode so you're HTTP compliant, but the decoding is done by PHP 
(or even Apache? I'm not sure) when receiving urlencoded strings via URL 
and form data.

Bogdan

andy wrote:

>Hi there,
>
>I am trying to fill a form again when an error occures, therefore I redirect
>to the form and pass the values via url like this:
>
>HEADER("Location:/profiles/6".$recipient_id."2.html?subject=".rawurlencode($
>subject)."&message=".rawurlencode($message)."");
>
>then I put it in again like this
> wrap="virtual">'.rawurldecode($message).'
>
>The problem is, that this is causing a message like this:
>test  \\\'
>
>So what's wrong? Can anybody help on this?
>
>Thank you,
>
>Andy
>
>
>




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




[PHP] a href problem

2002-03-29 Thread Anders Henke

Hi folks!

Im running this forum for Flash users and I have created it in Flash. Now,
I've got this little problem... If a users writes a URL like
http://www.test.com, the url becomes clickable thanks to the code below.

$text = str_replace("<", "<", $text);
$text = str_replace(">", ">", $text);
$text = str_replace("www.", "http://www.";, $text);
$text = str_replace("http://http://";, "http://";, $text);
$text = eregi_replace("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])",
"\\1://\\2\\3",
$text);
$text =
eregi_replace("(([a-z0-9_]|\\-|\\.)+@([^[:space:]]*)([[:alnum:]-]))", "mailto:\\1\";>\\1", $text);
$text = urlencode($text);

Everything works just fine, until someone writes http://www.test.com";>http://www.test.com. The output then becomes
http://www.test.com";
target="_blank">http://www.test.com
target="_blank">http://www.test.com.


Does anyone have a solution for this?

Regards

Anders Henke



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




[PHP] creating MySQL Users

2002-03-29 Thread Liam

29/03/2002 10:26:41 PM

Hi, I've been trying to work this out, but I can't.
Myabe I need more sleep, I'm sure it's something really stupid.

Could someone have a look over this code for me please?
It's meant to add MySQL users.


">
User
Password






Thanks,
Liam



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




Re: [PHP] urlencode and decode are producing \\\' instead of \'

2002-03-29 Thread andy

does not help, any other ideas?


"Bogdan Stancescu" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> You don't have to rawurlDEcode again - that's done automatically. You
> have to encode so you're HTTP compliant, but the decoding is done by PHP
> (or even Apache? I'm not sure) when receiving urlencoded strings via URL
> and form data.
>
> Bogdan
>
> andy wrote:
>
> >Hi there,
> >
> >I am trying to fill a form again when an error occures, therefore I
redirect
> >to the form and pass the values via url like this:
> >
>
>HEADER("Location:/profiles/6".$recipient_id."2.html?subject=".rawurlencode(
$
> >subject)."&message=".rawurlencode($message)."");
> >
> >then I put it in again like this
> >  >wrap="virtual">'.rawurldecode($message).'
> >
> >The problem is, that this is causing a message like this:
> >test  \\\'
> >
> >So what's wrong? Can anybody help on this?
> >
> >Thank you,
> >
> >Andy
> >
> >
> >
>
>
>



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




Re: [PHP] urlencode and decode are producing \\\' instead of \'

2002-03-29 Thread Andrey Hristov

try to do double rawurldecode().

Andrey

- Original Message - 
From: "andy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 29, 2002 2:36 PM
Subject: Re: [PHP] urlencode and decode are producing \\\' instead of \'


> does not help, any other ideas?
> 
> 
> "Bogdan Stancescu" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > You don't have to rawurlDEcode again - that's done automatically. You
> > have to encode so you're HTTP compliant, but the decoding is done by PHP
> > (or even Apache? I'm not sure) when receiving urlencoded strings via URL
> > and form data.
> >
> > Bogdan
> >
> > andy wrote:
> >
> > >Hi there,
> > >
> > >I am trying to fill a form again when an error occures, therefore I
> redirect
> > >to the form and pass the values via url like this:
> > >
> >
> >HEADER("Location:/profiles/6".$recipient_id."2.html?subject=".rawurlencode(
> $
> > >subject)."&message=".rawurlencode($message)."");
> > >
> > >then I put it in again like this
> > >  > >wrap="virtual">'.rawurldecode($message).'
> > >
> > >The problem is, that this is causing a message like this:
> > >test  \\\'
> > >
> > >So what's wrong? Can anybody help on this?
> > >
> > >Thank you,
> > >
> > >Andy
> > >
> > >
> > >
> >
> >
> >
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


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




Re: [PHP] urlencode and decode are producing \\\' instead of \'

2002-03-29 Thread andy

does not work. Just like the decode function is out of order!
It is not even decoding \'

Andy


"Andrey Hristov" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
00e301c1d71e$b00569a0$0b01a8c0@ANDreY">news:00e301c1d71e$b00569a0$0b01a8c0@ANDreY...
> try to do double rawurldecode().
>
> Andrey
>
> - Original Message -
> From: "andy" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, March 29, 2002 2:36 PM
> Subject: Re: [PHP] urlencode and decode are producing \\\' instead of \'
>
>
> > does not help, any other ideas?
> >
> >
> > "Bogdan Stancescu" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > You don't have to rawurlDEcode again - that's done automatically. You
> > > have to encode so you're HTTP compliant, but the decoding is done by
PHP
> > > (or even Apache? I'm not sure) when receiving urlencoded strings via
URL
> > > and form data.
> > >
> > > Bogdan
> > >
> > > andy wrote:
> > >
> > > >Hi there,
> > > >
> > > >I am trying to fill a form again when an error occures, therefore I
> > redirect
> > > >to the form and pass the values via url like this:
> > > >
> > >
> >
>HEADER("Location:/profiles/6".$recipient_id."2.html?subject=".rawurlencode(
> > $
> > > >subject)."&message=".rawurlencode($message)."");
> > > >
> > > >then I put it in again like this
> > > >  > > >wrap="virtual">'.rawurldecode($message).'
> > > >
> > > >The problem is, that this is causing a message like this:
> > > >test  \\\'
> > > >
> > > >So what's wrong? Can anybody help on this?
> > > >
> > > >Thank you,
> > > >
> > > >Andy
> > > >
> > > >
> > > >
> > >
> > >
> > >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>



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




RE: [PHP] creating MySQL Users

2002-03-29 Thread Rick Emery

>   $query .= "ON $username";

The ON clause should identify the database name, not the user.  It should
appear as "*.*.

-Original Message-
From: Liam [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 29, 2002 4:27 PM
To: [EMAIL PROTECTED]
Subject: [PHP] creating MySQL Users


29/03/2002 10:26:41 PM

Hi, I've been trying to work this out, but I can't.
Myabe I need more sleep, I'm sure it's something really stupid.

Could someone have a look over this code for me please?
It's meant to add MySQL users.


">
User
Password






Thanks,
Liam



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

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




[PHP] Re: ASP vs PHP

2002-03-29 Thread Evan

Hope this will help you:

1) Macromedia Ultradev + PHAkt extension (www.macromedia.com) $$
2) www.phpide.de
3) www.phpedit.com
4) http://dd.cron.ru/dbg (debugger)


Evan


"Ciro Martins" <[EMAIL PROTECTED]> ha scritto nel messaggio
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> Hi!
>
>
> I've been programming in PHP for long. But one question that always is
> coming to my mind is to know if there exists some kind of tools (like
> for SP. It exists a tool called ASPWebTools for wich it is possible to
> develop applications written in ASP and connecting with DB like SQL
> Server in an automatic way) that can help in the development of
> applications using PHP and databases. For instance, that could allow to
> develop automatically forms to connect to databases using PHP.
>
> Does anyone know any related application or tools.
> Because in ASP with that tool is more easy to develop code.
>
> Thanks in advance
>
> Ciro Martins
>



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




Re: [PHP] where i get .so [dll] file of linux ?

2002-03-29 Thread Rouvas Stathis

I always recompile PHP when I need a new module, but searching the
mailling list archives I found the following post by Rasmus that says
dl() in *nix is possible. Well, if Rasmus says it can be done, he is
propably true:-)



Subject: Re: [PHP] Re: The future of PHP - accessory libraries
   Date: Tue, 28 Aug 2001 11:01:34 -0700 (PDT)
   From: Rasmus Lerdorf <[EMAIL PROTECTED]>
 To: Michael Kimsal <[EMAIL PROTECTED]>
 CC: PHP General <[EMAIL PROTECTED]>

> That's not allowing me to simply dl() an SO file, because I don't have the
> SO file to start with - that's what I was trying to get at.  If I have
> to reconfigure
> everything, there's not much point, I don't think.  Unless I'm missing
> something
> obvious.  I'd like to be able to simply have an SO file I can dl()
> without recompiling.
> Or are you saying that that configure statement WILL create an SO file
> that can
> be dl()ed later, without recompiling PHP?

Exactly.  When you do ./configure --with-foo=shared; make
then modules/foo.so will appear magically and you can dl() that or load
it
using "extension=foo.so" in your php.ini.  You don't have to recompile
PHP.

-Rasmus



-Stathis

Prachait Saxena wrote:
> 
> Hello
> But i would like to ues that modules that are not complied wit PHP
> 
> i mean dynamic inclusion of modules... Is that possible ?
> 
> Prachait
> 
> - Original Message -
> From: Rouvas Stathis <[EMAIL PROTECTED]>
> Newsgroups: php.general
> To: Prachait Saxena <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Friday, March 29, 2002 1:43 AM
> Subject: Re: [PHP] where i get .so [dll] file of linux ?
> 
> >
> > In Linux you don't use dl(). Instead, you compile PHP with the modules
> > you need and they are there when you call them.
> >
> > -Stathis.
> >
> 
> > Prachait Saxena wrote:
> > >
> > > Hello
> > >
> > > I would like to Know, where Site or Link i can get complied .so [dll]
> files.
> > > of linux
> > >
> > > as i have php_sockets.dll which works very fine in Windows enviroment.
> but
> > > on linux
> > >
> > > Can you suggest any other option for this.
> > >
> > > I am using  dl("php_sockets.dll"); while writing my code for windows and
> > > what to same for Linux
> > >
> > > --
> > > Bye, and  Have a nice day.
> > >
> > > Prachait Saxena
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

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




[PHP] OT - representing data

2002-03-29 Thread Alastair Battrick

Hi All

I have over 26000 urls in a table. They are all urls and query strings of
hits to the same 10 - 20 sites.

I need to have a way to allow the user to select one of these, and then do
some processing on it, and I'm struggling to find a way.

I did have a select dropdown with a list of them, but that has become
unmanageable, even when coupled with a restrictor text box. For example, the
user types 'david' in the restrictor, and then the dropdown only lists those
urls with '%david%'

Has anyone got a genius way of allowing the user to select one easily and
without having to download all 26000.

TIA

Alastair Battrick
Senior Developer
Lightwood Consultancy Ltd
http://www.lightwood.net


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




Re: [PHP] urlencode and decode are producing \\\' instead of \'

2002-03-29 Thread Jason Wong

On Friday 29 March 2002 20:56, andy wrote:
> does not work. Just like the decode function is out of order!
> It is not even decoding \'

> > > > >I am trying to fill a form again when an error occures, therefore I
> > >
> > > redirect
> > >
> > > > >to the form and pass the values via url like this:
> >
> >HEADER("Location:/profiles/6".$recipient_id."2.html?subject=".rawurlencode
> >(
> >
> > > $
> > >
> > > > >subject)."&message=".rawurlencode($message)."");
> > > > >
> > > > >then I put it in again like this
> > > > >  > > > >wrap="virtual">'.rawurldecode($message).'
> > > > >
> > > > >The problem is, that this is causing a message like this:
> > > > >test  \\\'
> > > > >
> > > > >So what's wrong? Can anybody help on this?

Well your problem is not caused by the rawurlencode, rawurldecode. It's 
probably because you have magic_quotes_gpc set to on. 

Try this:

For your URL: rawurlencode(stripslashes($subject)), and same for $message.

For your textarea: htmlspecialchars($subject), & $message.

If you're putting $subject & $message into a DB you would probably want to do 
the reverse of htmlspecialchars() before inserting them into the DB.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
If you don't know what game you're playing, don't ask what the score is.
*/


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




Re: [PHP] urlencode and decode are producing \\\' instead of \'

2002-03-29 Thread Bogdan Stancescu

Jason Wong wrote:

>Well your problem is not caused by the rawurlencode, rawurldecode. It's 
>probably because you have magic_quotes_gpc set to on. 
>
>Try this:
>
>For your URL: rawurlencode(stripslashes($subject)), and same for $message.
>
>For your textarea: htmlspecialchars($subject), & $message.
>
>If you're putting $subject & $message into a DB you would probably want to do 
>the reverse of htmlspecialchars() before inserting them into the DB.
>

Mr. Wong is wright :-) The only problem is that you should 
rawurlencode(stripslashes($subject)) in the header and 
htmlspecialchars(stripslashes($subject)) in the textarea for the 
expected results.

Bogdan



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




Re: [PHP] urlencode and decode are producing \\\' instead of \'

2002-03-29 Thread Anders Henke

Hi!

What about using stripslashes:
$variable = stripslashes($variable);

Also see http://www.php.net/stripslashes

/Anders Henke


"Jason Wong" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]...
> On Friday 29 March 2002 20:56, andy wrote:
> > does not work. Just like the decode function is out of order!
> > It is not even decoding \'
>
> > > > > >I am trying to fill a form again when an error occures, therefore
I
> > > >
> > > > redirect
> > > >
> > > > > >to the form and pass the values via url like this:
> > >
> >
>HEADER("Location:/profiles/6".$recipient_id."2.html?subject=".rawurlencode
> > >(
> > >
> > > > $
> > > >
> > > > > >subject)."&message=".rawurlencode($message)."");
> > > > > >
> > > > > >then I put it in again like this
> > > > > >  > > > > >wrap="virtual">'.rawurldecode($message).'
> > > > > >
> > > > > >The problem is, that this is causing a message like this:
> > > > > >test  \\\'
> > > > > >
> > > > > >So what's wrong? Can anybody help on this?
>
> Well your problem is not caused by the rawurlencode, rawurldecode. It's
> probably because you have magic_quotes_gpc set to on.
>
> Try this:
>
> For your URL: rawurlencode(stripslashes($subject)), and same for $message.
>
> For your textarea: htmlspecialchars($subject), & $message.
>
> If you're putting $subject & $message into a DB you would probably want to
do
> the reverse of htmlspecialchars() before inserting them into the DB.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
>
> /*
> If you don't know what game you're playing, don't ask what the score is.
> */
>



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




RE: [PHP] Program Looping ?

2002-03-29 Thread Hunter, Ray

You need to also make sure that you change the script execution time allowed
in the php.ini file to 5 minutes or more or else you will get a time out
error.



Thank you,

Ray Hunter
Firmware Engineer

ENTERASYS NETWORKS


> -Original Message-
> From: Jason Caldwell [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, March 28, 2002 11:56 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Program Looping ?
> 
> 
> I've written a script that checks my email.  However, when I 
> run the script (from the command line) -- I want it to loop 
> with a 5 minute delay and the ability to stop the program 
> anytime by pressing a key on the keyboard (say) the ~ key.
> 
> Anyone know how to do this?
> 
>  
> function check_mail()
> {
> // my email code is here
> }
> 
> check_mail();
> 
> ?>
> 
> thanks.
> jason
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



Re: [PHP] where i get .so [dll] file of linux ?

2002-03-29 Thread Prachait Saxena

Well i did not have the permission for both

edting of php.in and recompling the apache ???

Now what i can do ?

Prachait
- Original Message -
From: Rouvas Stathis <[EMAIL PROTECTED]>
Newsgroups: php.general
Cc: <[EMAIL PROTECTED]>
Sent: Friday, March 29, 2002 6:34 PM
Subject: Re: [PHP] where i get .so [dll] file of linux ?


> I always recompile PHP when I need a new module, but searching the
> mailling list archives I found the following post by Rasmus that says
> dl() in *nix is possible. Well, if Rasmus says it can be done, he is
> propably true:-)
>
> 
>
> Subject: Re: [PHP] Re: The future of PHP - accessory libraries
>Date: Tue, 28 Aug 2001 11:01:34 -0700 (PDT)
>From: Rasmus Lerdorf <[EMAIL PROTECTED]>
>  To: Michael Kimsal <[EMAIL PROTECTED]>
>  CC: PHP General <[EMAIL PROTECTED]>
>
> > That's not allowing me to simply dl() an SO file, because I don't have
the
> > SO file to start with - that's what I was trying to get at.  If I have
> > to reconfigure
> > everything, there's not much point, I don't think.  Unless I'm missing
> > something
> > obvious.  I'd like to be able to simply have an SO file I can dl()
> > without recompiling.
> > Or are you saying that that configure statement WILL create an SO file
> > that can
> > be dl()ed later, without recompiling PHP?
>
> Exactly.  When you do ./configure --with-foo=shared; make
> then modules/foo.so will appear magically and you can dl() that or load
> it
> using "extension=foo.so" in your php.ini.  You don't have to recompile
> PHP.
>
> -Rasmus
>
> 
>
> -Stathis
>
> Prachait Saxena wrote:
> >
> > Hello
> > But i would like to ues that modules that are not complied wit PHP
> >
> > i mean dynamic inclusion of modules... Is that possible ?
> >
> > Prachait
> >
> > - Original Message -
> > From: Rouvas Stathis <[EMAIL PROTECTED]>
> > Newsgroups: php.general
> > To: Prachait Saxena <[EMAIL PROTECTED]>
> > Cc: <[EMAIL PROTECTED]>
> > Sent: Friday, March 29, 2002 1:43 AM
> > Subject: Re: [PHP] where i get .so [dll] file of linux ?
> >
> > >
> > > In Linux you don't use dl(). Instead, you compile PHP with the modules
> > > you need and they are there when you call them.
> > >
> > > -Stathis.
> > >
> >
> > > Prachait Saxena wrote:
> > > >
> > > > Hello
> > > >
> > > > I would like to Know, where Site or Link i can get complied .so
[dll]
> > files.
> > > > of linux
> > > >
> > > > as i have php_sockets.dll which works very fine in Windows
enviroment.
> > but
> > > > on linux
> > > >
> > > > Can you suggest any other option for this.
> > > >
> > > > I am using  dl("php_sockets.dll"); while writing my code for windows
and
> > > > what to same for Linux
> > > >
> > > > --
> > > > Bye, and  Have a nice day.
> > > >
> > > > Prachait Saxena
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php


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




[PHP] get_browser() problem ?

2002-03-29 Thread R'twick Niceorgaw

Hi all,
I'm trying to get some info from get_browser() function. But, I'm getting a
page can not be displayed error.
The script is a simple one as give below. My hosting comapny says,
get_browser() works on their system and there must be some error in my
script but I couldn't find any error. Can some one tell me if indeed I have
an error there ?

I have PHP 4.1.2 running on freeBSD. detail PHP configuration can be found
here http://66.216.8.221/phpi.php

and the script is http://66.216.8.221/brw.php

Any help would be much appreciated.

Regards
R'twick

Code copied from the browser script :
--


 BROWSER TEST

\n";
$br = get_browser($HTTP_USER_AGENT);
while (list($k,$v)=each($br))
 echo "$k = $v";
?>







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




Re: [PHP] creating MySQL Users

2002-03-29 Thread Rafael Perazzo

Try this query : 

   $query = "GRANT SELECT,INSERT,UPDATE,DELETE,ALTER
";
   $query .= "ON $username ";
   $query .= "TO $username@localhost ";
   $query .= "IDENTIFIED BY '$password';";

Make sure that you put a blank space after each
string, except the last one. 
I hope this work!

Rafael Perazzo 

--- Liam <[EMAIL PROTECTED]> wrote:
> 29/03/2002 10:26:41 PM
> 
> Hi, I've been trying to work this out, but I can't.
> Myabe I need more sleep, I'm sure it's something
> really stupid.
> 
> Could someone have a look over this code for me
> please?
> It's meant to add MySQL users.
> 
> 
> ">
> User
> Password
> 
> 
> 
>  if ($REQUEST_METHOD=="POST") { 
> 
>   $mysql_access = mysql_connect("localhost", "root",
> "password");
>   if (!$mysql_access) { echo("ERROR: " .
> mysql_error() . "\n"); }
>   $query = "GRANT SELECT,INSERT,UPDATE,DELETE,ALTER";
>   $query .= "ON $username";
>   $query .= "TO $username@localhost";
>   $query .= "IDENTIFIED BY '$password';";
>   mysql_query($query, $mysql_access);
> 
>   print("Successfully added $username to the MySQL
> database!");
> 
> } 
> ?>
> 
> 
> Thanks,
> Liam
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__
Do You Yahoo!?
Yahoo! Greetings - send holiday greetings for Easter, Passover
http://greetings.yahoo.com/

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




Re: [PHP] where i get .so [dll] file of linux ?

2002-03-29 Thread Rouvas Stathis

You should ask your administrator to do it for you.
BTW, most propably you don't have to recompile Apache.

-Stathis.

PS: Please, forward only to the list and to individual emails (if it is
possible).

Prachait Saxena wrote:
> 
> Well i did not have the permission for both
> 
> edting of php.in and recompling the apache ???
> 
> Now what i can do ?
> 
> Prachait
> - Original Message -
> From: Rouvas Stathis <[EMAIL PROTECTED]>
> Newsgroups: php.general
> Cc: <[EMAIL PROTECTED]>
> Sent: Friday, March 29, 2002 6:34 PM
> Subject: Re: [PHP] where i get .so [dll] file of linux ?
> 
> > I always recompile PHP when I need a new module, but searching the
> > mailling list archives I found the following post by Rasmus that says
> > dl() in *nix is possible. Well, if Rasmus says it can be done, he is
> > propably true:-)
> >
> > 
> >
> > Subject: Re: [PHP] Re: The future of PHP - accessory libraries
> >Date: Tue, 28 Aug 2001 11:01:34 -0700 (PDT)
> >From: Rasmus Lerdorf <[EMAIL PROTECTED]>
> >  To: Michael Kimsal <[EMAIL PROTECTED]>
> >  CC: PHP General <[EMAIL PROTECTED]>
> >
> > > That's not allowing me to simply dl() an SO file, because I don't have
> the
> > > SO file to start with - that's what I was trying to get at.  If I have
> > > to reconfigure
> > > everything, there's not much point, I don't think.  Unless I'm missing
> > > something
> > > obvious.  I'd like to be able to simply have an SO file I can dl()
> > > without recompiling.
> > > Or are you saying that that configure statement WILL create an SO file
> > > that can
> > > be dl()ed later, without recompiling PHP?
> >
> > Exactly.  When you do ./configure --with-foo=shared; make
> > then modules/foo.so will appear magically and you can dl() that or load
> > it
> > using "extension=foo.so" in your php.ini.  You don't have to recompile
> > PHP.
> >
> > -Rasmus
> >
> > 
> >
> > -Stathis
> >
> > Prachait Saxena wrote:
> > >
> > > Hello
> > > But i would like to ues that modules that are not complied wit PHP
> > >
> > > i mean dynamic inclusion of modules... Is that possible ?
> > >
> > > Prachait
> > >
> > > - Original Message -
> > > From: Rouvas Stathis <[EMAIL PROTECTED]>
> > > Newsgroups: php.general
> > > To: Prachait Saxena <[EMAIL PROTECTED]>
> > > Cc: <[EMAIL PROTECTED]>
> > > Sent: Friday, March 29, 2002 1:43 AM
> > > Subject: Re: [PHP] where i get .so [dll] file of linux ?
> > >
> > > >
> > > > In Linux you don't use dl(). Instead, you compile PHP with the modules
> > > > you need and they are there when you call them.
> > > >
> > > > -Stathis.
> > > >
> > >
> > > > Prachait Saxena wrote:
> > > > >
> > > > > Hello
> > > > >
> > > > > I would like to Know, where Site or Link i can get complied .so
> [dll]
> > > files.
> > > > > of linux
> > > > >
> > > > > as i have php_sockets.dll which works very fine in Windows
> enviroment.
> > > but
> > > > > on linux
> > > > >
> > > > > Can you suggest any other option for this.
> > > > >
> > > > > I am using  dl("php_sockets.dll"); while writing my code for windows
> and
> > > > > what to same for Linux
> > > > >
> > > > > --
> > > > > Bye, and  Have a nice day.
> > > > >
> > > > > Prachait Saxena

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




php-general Digest 29 Mar 2002 15:28:22 -0000 Issue 1255

2002-03-29 Thread php-general-digest-help


php-general Digest 29 Mar 2002 15:28:22 - Issue 1255

Topics (messages 90641 through 90675):

Re: Help with Acrobat FDF support
90641 by: Rasmus Lerdorf

Mysql adding extra fields.
90642 by: David Duong
90643 by: Miguel Cruz
90646 by: hugh danaher

CyberCash Please
90644 by: Gabriel Richards

Check for text
90645 by: Martin Kampherbeek
90649 by: Jason Wong

Program Looping ?
90647 by: Jason Caldwell
90648 by: Demitrious S. Kelly
90671 by: Hunter, Ray

urlencode and decode are producing \\\' instead of \'
90650 by: andy
90658 by: Bogdan Stancescu
90662 by: andy
90663 by: Andrey Hristov
90664 by: andy
90668 by: Jason Wong
90669 by: Bogdan Stancescu
90670 by: Anders Henke

Re: where i get .so [dll] file of linux ?
90651 by: Prachait Saxena
90666 by: Rouvas Stathis
90672 by: Prachait Saxena
90675 by: Rouvas Stathis

PDF Load Problem
90652 by: Alexis Antonakis

uploading files problem
90653 by: Claudio Fedel
90654 by: Balaji Ankem
90655 by: Balaji Ankem
90656 by: andy

Re: Sending a header redirect mid-page
90657 by: Xavier DELAS

a href problem
90659 by: Anders Henke

Re: ASP vs PHP
90660 by: Evan

creating MySQL Users
90661 by: Liam
90665 by: Rick Emery
90674 by: Rafael Perazzo

OT  - representing data
90667 by: Alastair Battrick

get_browser() problem ?
90673 by: R'twick Niceorgaw

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]


--

--- Begin Message ---

You have to build the FDF extension to include FDF support by adding the
--with-fdftk to the PHP build flags.

-Rasmus

On Thu, 28 Mar 2002, Robert Stoeber wrote:

> I just found the very cool looking new FDF functions to support Acrobat
> forms.  According to the documentation at www.php.net I have to download &
> install the FDF SDK.
>
> Found the latest SDK and I put two files from the C directory of the SDK at:
>
> /usr/lib/php4/libfdftk.so
> /usr/include/fdftk.h
>
> Then I figured that I had to put something into php.ini to load the FDF
> code, so I added a line like this to php.ini:
>
> extension=libfdftk.so
>
> Unfortunately, it doesn't work.  I get an error message:
>
> Invalid library (maybe not a PHP library) 'libfdftk.so'
>
> I've looked all over various newsgroups, forums, etc and that's where the
> instructions stop, but there must be more to it.  Can anyone point me in the
> right direction?
>
> My system is Redhat Linux 7.2, Apache 1.3.22, PHP 4.0.6.
>
> [EMAIL PROTECTED]
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


--- End Message ---
--- Begin Message ---

How do I add extra fields after it has already been set?



--- End Message ---
--- Begin Message ---

On Thu, 28 Mar 2002, David Duong wrote:
> How do I add extra fields after it has already been set?

1) Read the manual conveniently available at http://www.mysql.org; this 
is not rocket science.

2) ALTER TABLE mytable ADD boogers_per_hour INT;

miguel


--- End Message ---
--- Begin Message ---

Try,

[type] can be int or char () or blob or real or something else drawn
from the mysql manual

$query="ALTER table_name ADD column_name [type] AFTER other_column_name";
$result=mysql_query($query);
if (!$result) die("couldn't alter table".mysql_error());

Hope this helps,
Hugh


- Original Message -
From: "David Duong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 28, 2002 9:33 PM
Subject: [PHP] Mysql adding extra fields.


> How do I add extra fields after it has already been set?
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


--- End Message ---
--- Begin Message ---

Hello.

Would someone who has had experience and/or success with PHP and CyberCash
please contact me.

Thank you.
Gabe

-
Ender Technology Corp.
Websites, Database Applications, Hosting
(310) 516-7411
[EMAIL PROTECTED]
http://www.endertechnology.com/



--- End Message ---
--- Begin Message ---

Someone submits an url through a form.
Now I want to check in a script to see if there is some tekst in it.

For Example:
Someone submits http://www.mydomain.com/test.htm

In this htm file I want to check the text "hello".



--- End Message ---
--- Begin Message ---

On Friday 29 March 2002 14:40, Martin Kampherbeek wrote:
> Someone submits an url through a form.
> Now I want to check in a script to see if there is some tekst in it.
>
> For Example:
> Someone submits http://www.mydomain.com/test.htm
>
> In this htm file I want to check the text "hello".

f

[PHP] Re: OT - representing data

2002-03-29 Thread Hugh Bothwell

How about a hierarchical tree?  Strip the common precursor stuff
([http[s]://][www.]) and proceed from there, splitting on '.', '/', '?' and
'&'.

I would also put a Yahoo-style split-level back-out link on the page, ie
[nandotimes].[com]/[news]/[current]/
article2001.html(1 ref  4000 views)
article2002.html(1 ref  2500 views)
   [article2003.php]   (4 refs  6600 views)
article2004.html(1 ref  800 views)
(where [text] indicates a hyperlink)

Combine this with your restrictor text box and N-items-per-page and it
should be reasonably navigable.


> I have over 26000 urls in a table. They are all urls and query strings of
> hits to the same 10 - 20 sites.
>
> I need to have a way to allow the user to select one of these, and then do
> some processing on it, and I'm struggling to find a way.
>
> I did have a select dropdown with a list of them, but that has become
> unmanageable, even when coupled with a restrictor text box. For example,
the
> user types 'david' in the restrictor, and then the dropdown only lists
those
> urls with '%david%'
>
> Has anyone got a genius way of allowing the user to select one easily and
> without having to download all 26000.



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




[PHP] XSLT and DOM

2002-03-29 Thread Sean P . Scanlon

Can anyone tell me why this is not working?


-- snip of 
xslt_processor.php

$doc  = new_xmldoc("1.0");
$root = $doc->add_root("debug");
$head = $root->new_child("broswer", "1");
$head->set_attribute("key", "UserAgent");
$head->set_attribute("value", $HTTP_USER_AGENT);
$head = $root->new_child("broswer", "1");
$head->set_attribute("key", "UserAgent");
$head->set_attribute("value", $HTTP_USER_AGENT);

$xslt_args["buf"] =  sprintf("%s", $doc->dumpmem());
// $xslt_args["buf"] =  $doc->dumpmem();


$xh = xslt_create();

$result = xslt_process($xh, $REQ_FILE, $XSL, NULL, $xslt_args, array());

--snip of 
xml-html.xsl---

  

 
   
  == 
   
   
 

there is no output and the count() is 0

if i "manually set $xslt_args["buf"] like so:
$xslt_args["buf"] =
"





";

everything works fine. is there a known issue with using DOM and XSLT with 
php or
am i missing something completely trivial?

Thanks,
--
-
Sean P. Scanlon
perl -e 'print pack("h*", "3707370426c6575646f647e2e65647"), "\n"'
-


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




[PHP] Re: How to Pass the Username which from Windows Login

2002-03-29 Thread J Wynia

$network = new COM("WScript.Network");
$computername = $network->ComputerName;
$username = $network->UserName;

Password can't be grabbed for fairly obvious reasons.

"Jack" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Dear all
> I want to prevent user to make another login before they can browse the
> Intranet, so is there anyway that php can grep the username from the
windows
> Login or Domain Login?
> Which means if a user can login to the Windows NT, then he/she will have
the
> right to browse the Intranet!
>
> Thx a lot
> Jack
> [EMAIL PROTECTED]
>
>



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




[PHP] Database-Driven Web Site.

2002-03-29 Thread GENESiS DESiGNS

Hello,

Would anyone out there be willing to teach me how to make a database-driven web 
site with PHP and MySQL? My MSN Messenger email is: [EMAIL PROTECTED]

THANKS!


-GENESiS DESiGNS
-Sean Kennedy
-http://www.gdesigns.vcn.com


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




Re: [PHP] Database-Driven Web Site.

2002-03-29 Thread Erik Price


On Friday, March 29, 2002, at 11:50  AM, GENESiS DESiGNS wrote:

> Hello,
>
> Would anyone out there be willing to teach me how to make a 
> database-driven web
> site with PHP and MySQL? My MSN Messenger email is: 
> [EMAIL PROTECTED]
>
> THANKS!

Well, there are places that teach classes on this subject.  There are 
also books devoted especially to this subject.  O'Reilly is coming out 
with one, there's one advertised at sitepoint.com, and there are more 
(like Visual QuickPro PHP Advanced by Larry Ullman or PHP and MySQL 
Database Applications by Bulger and Greenspan).

It's a big topic, you're best off reading one of these books and then 
asking here for help on specific questions.


Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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




RE: [PHP] Database-Driven Web Site.

2002-03-29 Thread SHEETS,JASON (Non-HP-Boise,ex1)

Hi Sean,

I'd suggest looking at some of the PHP and database tutorials available, for
the database you most likely would be interested in learning about MySQL, at
least at first. There are a lot of good resources on the PHP website at
http://www.php.net and good MySQL documentation available at
http://www.mysql.com.  

If you look at the PHP mailing list you will find there is a lot of
discussion about PHP books. I'd also suggest looking on amazon.com and
reading the reviews of books for PHP and MySQL, one of my favorites was "PHP
and MySQL Web Development" but there are a lot of other excellent books
available as well.

Some good resources for finding already existing scripts is
www.hotscripts.com, www.zend.com, http://php.resourceindex.com by looking at
existing code you can get a feel for how you might do something.

Before you set out to create a database driven website you need to decide
what you want your website to do, does it really need to be database driven?
It is not that hard to create such a website but why introduce overhead that
you really don't need.

Jason

-Original Message-
From: GENESiS DESiGNS [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 29, 2002 2:50 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Database-Driven Web Site.


Hello,

Would anyone out there be willing to teach me how to make a database-driven
web 
site with PHP and MySQL? My MSN Messenger email is:
[EMAIL PROTECTED]

THANKS!


-GENESiS DESiGNS
-Sean Kennedy
-http://www.gdesigns.vcn.com


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

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




[PHP] Question about database-driven web sites.

2002-03-29 Thread GENESiS DESiGNS

Hello,

What will a database-driven web site do for? How does it releive stress on me? 
What is it good for? Why should I learn it? Thanks,


-GENESiS DESiGNS
-Sean Kennedy
-http://www.gdesigns.vcn.com


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




[PHP] Test - Sorry, but it's necessary

2002-03-29 Thread Eric Starr





RE: [PHP] Question about database-driven web sites.

2002-03-29 Thread Rick Emery

> What will a database-driven web site do for?
If you have to ask, you have no need

> How does it relieve stress on me? 
It doesn't.  Quite the opposite

> What is it good for?
If you have to ask, you have no need

> Why should I learn it?
If you have to ask, you have no need

-Original Message-
From: GENESiS DESiGNS [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 29, 2002 4:22 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Question about database-driven web sites.


Hello,

What will a database-driven web site do for? How does it releive stress on
me? 
What is it good for? Why should I learn it? Thanks,


-GENESiS DESiGNS
-Sean Kennedy
-http://www.gdesigns.vcn.com


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

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




[PHP] function calls...Incorrect output...What am I doing wrong?

2002-03-29 Thread Eric Starr

I am learning PHP and I am having some trouble.  I am working on a hit
counter application.  I am using PHP 4 even though the file extension might
lead you to believe I am using PHP 3.

This code is on a page called "homePage.php3".  Here is the instantiation of my 
Counter:
All Done!"
?>

Here is count.txt... this is where I store the counts of each page...this is some test 
data:

testPage.php3 6
homePage.php3 76
b 99

Here is my counter.php3 code.  This code is not complete.  All it should do right now 
is to output the position in the array that it found the hitcounter...using the test 
data above I am expecting the output to be ">>>1<<<", assuming that PHP arrays are 
zero numbered, but instead I am getting ">>><<<".  What am I doing wrong?

mDataFile = "./counter/count.txt";
 $this->mCount = 1;
 $this->mCounterPosition = -1;
 $this->mName = $name;
 $this->mHandle = fopen($this->mDataFile, "r+");

 // Reading the file into an array...each new line is a seperate element of the 
array
 if (!($this->mFileArray = file($this->mDataFile)))
{
printf("Could not read this file: " . $mHandle . "");
 }
 $this->mCountPosition = $this->hitCounterPosition();  // ??? Why is this not 
returning anything ???
 printf(">>>" . $this->mCountPosition . "<<< ");  // The output I am getting 
is:  >>><<<
}

function hitCounterPosition() //returns the position of the hitcounter in mFileArray
{
   for ($i=0; $i < count( $mFileArray ); $i++) // iterates through the array
   {
  $pos = strpos( $mFileArray[$i], $mName);
  if (!is_integer($pos)) // The hit counter has NOT been found
  {
 return (-1);
  }
  else // The hit counter has been found
  {
 return ($pos);
  }
   }
}
} // end of class
?>




[PHP] PHP and XML/XLST/WDDX etc

2002-03-29 Thread Dennis Moore

I am looking for opinions and other philosophy on a couple of XML issues.  I have my 
own opinion, but I am curious what others think and what they are doing...

I am in the process of updating many of my applications to include XML/XLST/ and/or 
WDDX technologies.   Many of my applications read a static configuration file which 
assigns values to variables and arrays.   If we need to change something we manually 
edit the configuration files.  In some instances, we have written web interfaces to 
manage these configuration files.  

I am in a dilemma right now between "If it ain't broke, don't fix it" and "Looking 
over my shoulder".  I am trying to determine whether it makes more sense to use XML 
for maintaining configuration files.  

As far as content management, we use static include files or MySQL databases to store 
site content.   I am not sure where the advantage of using XML/XLST for this 
functionality.   

Please comment.



Re: [PHP] Question about database-driven web sites.

2002-03-29 Thread Dennis Moore

It all depends on what the needs for your site(s) are.

Typically, you use database driven web sites as a means of storing data
separate from the layout and style of your web site.   The advantage of this
is that you can just update your data in the database without affecting the
layout and style of your web site.  Many developers dynamically serve the
content from a database into the websites using PHP.   This is extremely
powerful if you have content which needs to be represented within a table or
if content changes on a regular basis.

There are many books and web articles on this subject.

I hope this helps... my 2 cents...




- Original Message -
From: "GENESiS DESiGNS" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 29, 2002 5:22 AM
Subject: [PHP] Question about database-driven web sites.


> Hello,
>
> What will a database-driven web site do for? How does it releive stress on
me?
> What is it good for? Why should I learn it? Thanks,
>
>
> -GENESiS DESiGNS
> -Sean Kennedy
> -http://www.gdesigns.vcn.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




Re: [PHP] OT - representing data

2002-03-29 Thread Miguel Cruz

On Fri, 29 Mar 2002, Alastair Battrick wrote:
> I have over 26000 urls in a table. They are all urls and query strings of
> hits to the same 10 - 20 sites.
> 
> I need to have a way to allow the user to select one of these, and then do
> some processing on it, and I'm struggling to find a way.
> 
> I did have a select dropdown with a list of them, but that has become
> unmanageable, even when coupled with a restrictor text box. For example, the
> user types 'david' in the restrictor, and then the dropdown only lists those
> urls with '%david%'
> 
> Has anyone got a genius way of allowing the user to select one easily and
> without having to download all 26000.

It depends on how the people will be approaching the data, I guess.

Maybe you could work out a tree, where first they pick between .com, .org, 
.net, .gr, whatever, and then they pick the prior term in the domain name, 
then they pick the first term after the slash, etc.?

miguel


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




Re: [PHP] PHP and XML/XLST/WDDX etc

2002-03-29 Thread Erik Price


On Friday, March 29, 2002, at 12:52  PM, Dennis Moore wrote:

> I am in the process of updating many of my applications to include
> XML/XLST/ and/or WDDX technologies.   Many of my applications read a
> static configuration file which assigns values to variables and arrays.
> If we need to change something we manually edit the configuration files.
> In some instances, we have written web interfaces to manage these
> configuration files.
>
> I am in a dilemma right now between "If it ain't broke, don't fix it"
> and "Looking over my shoulder".  I am trying to determine whether it
> makes more sense to use XML for maintaining configuration files.
>
> As far as content management, we use static include files or MySQL
> databases to store site content.   I am not sure where the advantage of
> using XML/XLST for this functionality.

In my experience, you're going to get a lot of anti-XML responses about 
this.  My limited experience of dealing with XML is that it is very 
complicated and difficult to actually do, regardless of the promises of 
simplicity that are usually made when discussing XML.  HOWEVER -- once 
your application is all set up, I imagine that it will actually be 
somewhat easier to maintain.  It's learning how to do all of this, plus 
the fact that the XML tech is so young right now.  For instance, check 
out the man page on xslt_set_sax_handler() or xslt_set_sax_handlers() -- 
not very informative.  And while xslt_process() has a man page that 
actually explains how to use it, it really helps to have a more 
fundamental understanding of XSLT, since it is not explained in the man 
page why you use the argument syntax that is used.

I just discovered this last one last night... so you might have seen the 
thread.  I think it's interesting, and I'm trying to incorporate it into 
my app even though it DEFINITELY doesn't need this kind of 
functionality, because I want to learn more about it.  In fact, if 
performance or high volume are issues to you, then you should probably 
hold off for now, as most of these functions require quite a bit of 
processing -- XML was never intended to be lean or mean.

Probably the hardest thing is finding resources on this -- there are 
quite a few tutorials on DevShed or SitePoint or PHPBuilder that do a 
good job of introducing a topic, and there are some books on XML itself, 
and its related technologies, but I haven't found much that goes 
in-depth into using PHP with XML.  There is far more about Java and XML 
than PHP.  I finally found a mailing list devoted to PHP/XML issues, but 
it's on Yahoo! Groups and I'm having a bitch of a time getting 
subscribed (who ever thought that a web-based interface for mailing list 
management was a good idea?)

Anyway, best of luck to you -- let me know if you find a community 
dedicated to this very topic, since I'd like to focus on it a bit more.


Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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




RE: [PHP] FTP RAW

2002-03-29 Thread Andrew Chase

FTP with raw sockets is a little bit tricky because it actually requires a
second 'data' socket to be opened for each upload/download command.

Check out this excellent FTP class, which *doesn't* require PHP to be
compiled --with-ftp:

http://www.spencernetwork.org/ftp/ftp-class.txt

And of course the FTP Protocol RFC is helpful:

http://www.w3.org/Protocols/rfc959/

-Andy


> -Original Message-
> From: Analysis & Solutions [mailto:[EMAIL PROTECTED]]

> > I have written the code to upload using RAW FTP commands.
>
> Cool!
>
> How'd you get it to work?
>
> --Dan


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




Re: [PHP] Question about database-driven web sites.

2002-03-29 Thread heinisch

At 29.03.2002  10:22, you wrote:
>Hello,
>
>What will a database-driven web site do for? How does it releive stress on 
>me?
>What is it good for? Why should I learn it? Thanks,
Think of a template,
You set up a design , and put database data in it.
If you have any changes on your website, you´ll change some parameters in the
db and the whole site works with these new values.
Also If you develop for customers, you can have the final site in your db and
just switch on/off some "extras" on customers demand with just a few clicks.
There are a lot of reasons why to use it, but for me these are the main 
reasons.
Small work, big effort.
HTH Oliver


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




[PHP] User Authentication

2002-03-29 Thread Omland Christopher m

Hi, I had a question on user authentication/member accounts.
I have built a MySQL database with users and passwords, and I wrote this
code:

LOGIN IN PROGRESS

PLEASE LOG IN



Username:
Password:
 

Click Here");

}

So this will work it regonizes a real user vs. a fake on I do. But I don't
understand whats to stop someone from directly linking to a protected
page? For example why couldn't someone just go directly to
./about.php.

Does this make sense? Should I have the login form in one file and the php
script in another? Do I need to check the http header somehow to see if
they have logged in?
Thanks.
-Chris


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




Re: [PHP] User Authentication

2002-03-29 Thread Jason Wong

On Saturday 30 March 2002 02:24, Omland Christopher m wrote:
> So this will work it regonizes a real user vs. a fake on I do. But I don't
> understand whats to stop someone from directly linking to a protected
> page? For example why couldn't someone just go directly to
> ./about.php.

You're right there's absolutely nothing to stop them from doing that.

> Does this make sense? Should I have the login form in one file and the php
> script in another? Do I need to check the http header somehow to see if
> they have logged in?

The usual way to do login is that after authentication you send the user a 
cookie. On the subsequent pages that you want to protect you check for the 
presence of a valid cookie. If one is present you let them view the page, 
otherwise redirect them to a login page or something.



-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
"The only way I can lose this election is if I'm caught in bed with a dead 
girl or a live boy."
-- Louisiana governor Edwin Edwards
*/

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




RE: [PHP] PHP and XML/XLST/WDDX etc

2002-03-29 Thread J. Scott Johnson

Just to follow up on some of these thoughts.

XML is definitely complicated to move into.  Its unclear if you aren't
involved in data interchange, if the benefits are really there.  If you are
just developing in your own way, you may not need it.  OTOH, its new, sexy
and may "sell better" to your customers (if you have such).  Bear in mind
that if you are db backed, you still need to flatten to store in a DB.
There aren't many XML stores, most aren't that good, and they aren't that
fast.  With that said, I am doing XML now but its for data interchange, not
anything else.

NOTE -- I was doing SGML in 89 and XML ain't all that different.

Scott

* * * * * * * * * * * * * * * * * * * * * * * * * *
J. Scott Johnson
PHP Consulting and Design Work
* * * * * * * * * * * * * * * * * * * * * * * * * *
Virtual:
* * * * * * * * * * * * * * * * * * * * * * * * * *
[EMAIL PROTECTED]
http://www.fuzzygroup.com/
Yahoo IM: fuzzygroup


-Original Message-
From: Erik Price [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 29, 2002 12:54 PM
To: Dennis Moore
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] PHP and XML/XLST/WDDX etc



On Friday, March 29, 2002, at 12:52  PM, Dennis Moore wrote:

> I am in the process of updating many of my applications to include
> XML/XLST/ and/or WDDX technologies.   Many of my applications read a
> static configuration file which assigns values to variables and arrays.
> If we need to change something we manually edit the configuration files.
> In some instances, we have written web interfaces to manage these
> configuration files.
>
> I am in a dilemma right now between "If it ain't broke, don't fix it"
> and "Looking over my shoulder".  I am trying to determine whether it
> makes more sense to use XML for maintaining configuration files.
>
> As far as content management, we use static include files or MySQL
> databases to store site content.   I am not sure where the advantage of
> using XML/XLST for this functionality.

In my experience, you're going to get a lot of anti-XML responses about
this.  My limited experience of dealing with XML is that it is very
complicated and difficult to actually do, regardless of the promises of
simplicity that are usually made when discussing XML.  HOWEVER -- once
your application is all set up, I imagine that it will actually be
somewhat easier to maintain.  It's learning how to do all of this, plus
the fact that the XML tech is so young right now.  For instance, check
out the man page on xslt_set_sax_handler() or xslt_set_sax_handlers() --
not very informative.  And while xslt_process() has a man page that
actually explains how to use it, it really helps to have a more
fundamental understanding of XSLT, since it is not explained in the man
page why you use the argument syntax that is used.

I just discovered this last one last night... so you might have seen the
thread.  I think it's interesting, and I'm trying to incorporate it into
my app even though it DEFINITELY doesn't need this kind of
functionality, because I want to learn more about it.  In fact, if
performance or high volume are issues to you, then you should probably
hold off for now, as most of these functions require quite a bit of
processing -- XML was never intended to be lean or mean.

Probably the hardest thing is finding resources on this -- there are
quite a few tutorials on DevShed or SitePoint or PHPBuilder that do a
good job of introducing a topic, and there are some books on XML itself,
and its related technologies, but I haven't found much that goes
in-depth into using PHP with XML.  There is far more about Java and XML
than PHP.  I finally found a mailing list devoted to PHP/XML issues, but
it's on Yahoo! Groups and I'm having a bitch of a time getting
subscribed (who ever thought that a web-based interface for mailing list
management was a good idea?)

Anyway, best of luck to you -- let me know if you find a community
dedicated to this very topic, since I'd like to focus on it a bit more.


Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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



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




RE: [PHP] User Authentication

2002-03-29 Thread Vail, Warren

To solve this problem, I store some variables in a session, and at the
beginning of each page that needs to be secure in my site, I check to see if
the session variable is set (usually $userid), if not I redirect the user
back to the logon page.  At least two things will cause the variable to be
missing, a direct reference to the page using the URL, and the session
having expired.

I also make it a practice of coding a page as two separate php files, the
first of which performs the test above and retrieves information and
presents it on the web page (this is my presentation layer).  The second php
program that is referenced as the as the Action of my form or as a href from
an anchor on the form when data is not to be submitted.  This second php
program may test again for my session variable, but it does only processing
(storing data in the database, etc), then does a redirect header("Location:
page.php"), some of redirections will take it back to the page in file one,
other redirections will take it to other pages.

The reason for this dual program style, is that it avoids the problem with
using the POST method of form processing and pressing the back button on the
browser (IE and Netscape both issue an error).  Because every one of the
pages presented in my application are redirected to, they are entered by a
"GET" by default and the back button works fine.  The second "process only"
program can pass variables to the next form either as GET parameters
appended to the URL, or as a session variable.  A redirect cannot cause a
form to be entered with a POST method that I am aware of.

hope this helps,

Warren Vail
Tools, Metrics & Quality Processes
(415) 667-7814
Pager (877) 774-9891
215 Fremont 02-658


-Original Message-
From: Omland Christopher m [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 29, 2002 10:25 AM
To: Rouvas Stathis
Cc: Kevin Stone; 'Justin French'; 'php'
Subject: [PHP] User Authentication


Hi, I had a question on user authentication/member accounts.
I have built a MySQL database with users and passwords, and I wrote this
code:

LOGIN IN PROGRESS

PLEASE LOG IN



Username:
Password:
 

Click Here");

}

So this will work it regonizes a real user vs. a fake on I do. But I don't
understand whats to stop someone from directly linking to a protected
page? For example why couldn't someone just go directly to
./about.php.

Does this make sense? Should I have the login form in one file and the php
script in another? Do I need to check the http header somehow to see if
they have logged in?
Thanks.
-Chris


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

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




[PHP] Re: function calls...Incorrect output...What am I doing wrong?

2002-03-29 Thread Eric Starr

Testing reply...


**
"Eric Starr" <[EMAIL PROTECTED]> wrote in message
003f01c1d748$8785e200$[EMAIL PROTECTED]">news:003f01c1d748$8785e200$[EMAIL PROTECTED]...
I am learning PHP and I am having some trouble.  I am working on a hit
counter application.  I am using PHP 4 even though the file extension might
lead you to believe I am using PHP 3.

This code is on a page called "homePage.php3".  Here is the instantiation of
my Counter:
All Done!"
?>

Here is count.txt... this is where I store the counts of each page...this is
some test data:

testPage.php3 6
homePage.php3 76
b 99

Here is my counter.php3 code.  This code is not complete.  All it should do
right now is to output the position in the array that it found the
hitcounter...using the test data above I am expecting the output to be
">>>1<<<", assuming that PHP arrays are zero numbered, but instead I am
getting ">>><<<".  What am I doing wrong?

mDataFile = "./counter/count.txt";
 $this->mCount = 1;
 $this->mCounterPosition = -1;
 $this->mName = $name;
 $this->mHandle = fopen($this->mDataFile, "r+");

 // Reading the file into an array...each new line is a seperate element
of the array
 if (!($this->mFileArray = file($this->mDataFile)))
{
printf("Could not read this file: " . $mHandle . "");
 }
 $this->mCountPosition = $this->hitCounterPosition();  // ??? Why is
this not returning anything ???
 printf(">>>" . $this->mCountPosition . "<<< ");  // The output I am
getting is:  >>><<<
}

function hitCounterPosition() //returns the position of the hitcounter in
mFileArray
{
   for ($i=0; $i < count( $mFileArray ); $i++) // iterates through the array
   {
  $pos = strpos( $mFileArray[$i], $mName);
  if (!is_integer($pos)) // The hit counter has NOT been found
  {
 return (-1);
  }
  else // The hit counter has been found
  {
 return ($pos);
  }
   }
}
} // end of class
?>





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




[PHP] IMPORTANT question for anyone using XSLT

2002-03-29 Thread Erik Price

My, there have been a lot of questions about XSLT in the past 24 hrs... 
admittedly most of them coming from me.  In addition to my first 
question (repeated below for clarity), I have a second one -- how do I 
perform an XSLT transformation on multiple XML documents?  Do I need to 
perform a separate XSLT transformation on each one?  The reason I ask is 
b/c I am pulling my XML from a DB, so there may be more than one based 
on the results from the query.  If anyone can answer this, that'd be 
great.

If not, perhaps you can help with this situation, which I believe will 
probably plague just about any PHP programmer who will ever use XSLT 
with PHP (or possibly any other language):

I am still unsure of the best way to mix PHP & [X]HTML together in an 
XSLT stylesheet, because regardless of whether you specify the output 
method as "text" or "xml", if you are using HTML tags they must be 
well-formed, because Sablotron or expat (not sure which) will want the 
XSLT stylesheet to be a well-formed document.  Only, we often interrupt 
our HTML code when using PHP, like this:

$output_to_browser = "Go";
$output_to_browser .= "home";

(of course, the output to the browser will by a hyperlink to index.php 
that says "Go home".)

The above looks fine as PHP code, but if you try to manipulate the data 
from an XSLT process in this fashion, you won't be able to use HTML 
tags -- the greater-than and less-than symbols can't be used, since an 
XSLT sheet is technically an XML document and these are not well-formed 
tags.  In the XSLT sheet, the above might look like:


  ">Go Home


I thought that perhaps if I specified text as the output method, then 
the greater-than and less-than signs wouldn't be parsed, so I could use 
them as such:




  

  
">Go Home
  


See what's happening in the above?  I thought I had "escaped" my  
tags by placing them within the  tags, but this is not so -- 
they are parsed, and the document is then interpreted as not being 
well-formed.


So unless you want to do a straight XML-to-XML or XML-to-XHTML 
transformation, OR you don't want to use ANY XML or XHTML tags in your 
output document, you're kind of up a river.  Unless someone on this list 
can help me find a way to "escape" the HTML tags when creating PHP code.

And the only way I can think of doing it (which I still haven't tested, 
but might have to use) is to use variables to represent the HTML tags so 
that instead of

Go Home

I could use

$astartag = "Go Home";

and then make the style sheet like this:




  
$astartag
  
 
  
$aendtag
  



That should work in theory.  But it's incredibly crude.


What do you all think?





Erik









Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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




[PHP] Re: function calls...Incorrect output...What am I doing wrong?

2002-03-29 Thread Eric Starr

Please notice that I am attepting to call a function "hitCounterPosition()"
in the constructor "Counter" with this line of code:
$this->mCountPosition = $this->hitCounterPosition();

The very next line in the code prints out the value of mCountPosition
printf(">>>" . $this->mCountPosition . "<<< ");

The output is not what I expected.  I am expecting:
>>>1<<<
Instead I am getting:
>>><<<





"Eric Starr" <[EMAIL PROTECTED]> wrote in message
003f01c1d748$8785e200$[EMAIL PROTECTED]">news:003f01c1d748$8785e200$[EMAIL PROTECTED]...
I am learning PHP and I am having some trouble.  I am working on a hit
counter application.  I am using PHP 4 even though the file extension might
lead you to believe I am using PHP 3.

This code is on a page called "homePage.php3".  Here is the instantiation of
my Counter:
All Done!"
?>

Here is count.txt... this is where I store the counts of each page...this is
some test data:

testPage.php3 6
homePage.php3 76
b 99

Here is my counter.php3 code.  This code is not complete.  All it should do
right now is to output the position in the array that it found the
hitcounter...using the test data above I am expecting the output to be
">>>1<<<", assuming that PHP arrays are zero numbered, but instead I am
getting ">>><<<".  What am I doing wrong?

mDataFile = "./counter/count.txt";
 $this->mCount = 1;
 $this->mCounterPosition = -1;
 $this->mName = $name;
 $this->mHandle = fopen($this->mDataFile, "r+");

 // Reading the file into an array...each new line is a seperate element
of the array
 if (!($this->mFileArray = file($this->mDataFile)))
{
printf("Could not read this file: " . $mHandle . "");
 }
 $this->mCountPosition = $this->hitCounterPosition();  // ??? Why is
this not returning anything ???
 printf(">>>" . $this->mCountPosition . "<<< ");  // The output I am
getting is:  >>><<<
}

function hitCounterPosition() //returns the position of the hitcounter in
mFileArray
{
   for ($i=0; $i < count( $mFileArray ); $i++) // iterates through the array
   {
  $pos = strpos( $mFileArray[$i], $mName);
  if (!is_integer($pos)) // The hit counter has NOT been found
  {
 return (-1);
  }
  else // The hit counter has been found
  {
 return ($pos);
  }
   }
}
} // end of class
?>





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




[PHP] Security hole using cookies for sessions. Workaround?

2002-03-29 Thread Andy

Hi there,

I recently discovered a hole in my and a lot other apps on the net.
There must be a workaround, becaus I also found apps which work fine.

The sittuation is as follows:
After signing in, I am setting a cookie with a unique session id.
Cookie parameter is set to 0. The session expires as soon as the client
closes the browser.
Thats what I thought.

Real live looks like this:
Closing all browser windows makes the session expired, as it should. But!!
Closing the window with the application inside does not expire the session
if
there is another child of this browser open. For example e-mail services. I
found
a service where it possible to close your browser window with the app inside
and
the session is still active. What if the person is in a internet caffee?
Someone else
just takes the other open window of the browser and hits on the history the
last
browsed sites and here he goes!

My question is:
Is there a way to close this hole and let the session expire as soon as only
the active window
is closed?

Thanx you for any help,

Andy



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




RE: [PHP] Re: function calls...Incorrect output...What am I doing wrong?

2002-03-29 Thread Rick Emery

Your problem is that you reference $mFileArray.  You should reference
$this_.mFileArray:

   for ($i=0; $i < count( $mFileArray ); $i++) // iterates through the array

Therefore, count($mFileArray) is 0, so the loop ends without an explicit
exit

-Original Message-
From: Eric Starr [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 29, 2002 1:01 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: function calls...Incorrect output...What am I doing
wrong?


Please notice that I am attepting to call a function "hitCounterPosition()"
in the constructor "Counter" with this line of code:
$this->mCountPosition = $this->hitCounterPosition();

The very next line in the code prints out the value of mCountPosition
printf(">>>" . $this->mCountPosition . "<<< ");

The output is not what I expected.  I am expecting:
>>>1<<<
Instead I am getting:
>>><<<





"Eric Starr" <[EMAIL PROTECTED]> wrote in message
003f01c1d748$8785e200$[EMAIL PROTECTED]">news:003f01c1d748$8785e200$[EMAIL PROTECTED]...
I am learning PHP and I am having some trouble.  I am working on a hit
counter application.  I am using PHP 4 even though the file extension might
lead you to believe I am using PHP 3.

This code is on a page called "homePage.php3".  Here is the instantiation of
my Counter:
All Done!"
?>

Here is count.txt... this is where I store the counts of each page...this is
some test data:

testPage.php3 6
homePage.php3 76
b 99

Here is my counter.php3 code.  This code is not complete.  All it should do
right now is to output the position in the array that it found the
hitcounter...using the test data above I am expecting the output to be
">>>1<<<", assuming that PHP arrays are zero numbered, but instead I am
getting ">>><<<".  What am I doing wrong?

mDataFile = "./counter/count.txt";
 $this->mCount = 1;
 $this->mCounterPosition = -1;
 $this->mName = $name;
 $this->mHandle = fopen($this->mDataFile, "r+");

 // Reading the file into an array...each new line is a seperate element
of the array
 if (!($this->mFileArray = file($this->mDataFile)))
{
printf("Could not read this file: " . $mHandle . "");
 }
 $this->mCountPosition = $this->hitCounterPosition();  // ??? Why is
this not returning anything ???
 printf(">>>" . $this->mCountPosition . "<<< ");  // The output I am
getting is:  >>><<<
}

function hitCounterPosition() //returns the position of the hitcounter in
mFileArray
{
   for ($i=0; $i < count( $mFileArray ); $i++) // iterates through the array
   {
  $pos = strpos( $mFileArray[$i], $mName);
  if (!is_integer($pos)) // The hit counter has NOT been found
  {
 return (-1);
  }
  else // The hit counter has been found
  {
 return ($pos);
  }
   }
}
} // end of class
?>





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

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




Re: [PHP] Security hole using cookies for sessions. Workaround?

2002-03-29 Thread Rasmus Lerdorf

> My question is:
> Is there a way to close this hole and let the session expire as soon as only
> the active window
> is closed?

Nope, that's how browsers work.  Your only real way to fix it would be to
expire a session after a certain amount of inactivity.  That's what the
PHP sessions do by default - 24 minutes of inactivity and the session data
is expired.

There is no way to detect a user closing one window of a browser session.

-Rasmus


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




[PHP] PDF bug question?

2002-03-29 Thread Ethan Nelson

Hello,

I checked the developer database, and I'm not saying it isn't in there...
but I couldn't find it, so here it goes:

Here is the problem... given the code below, I would expect a fill color of
73% cyan, 26% magenta, 5% yellow and 0 black.  However, the 73% cyan will
default to zero unless you specify 1.  The bug is that no gradient is
allowed for the first color option in the pdf set color command.  It takes
either 1 or zero and anything in between defaults to zero.  This is true of
RGB as well.  If you do not specify 1, the first colorspace defaults to 0.

pdf_setcolor("$pdf","fill","cmyk",.73,.26,.05,0);

I'm using php 4.05 RC1.  I know there was a bug about the last options being
required but ignored for color options, such as RGB, that doesn't make use
of them, but I don't know of one relating to this... am I doing something
wrong?

-Ethan Nelson

___
Ethan Nelson, Web Applications Engineer
Net Solutions, LLC
840 Lawrence Street
Eugene, OR 97401
[EMAIL PROTECTED]
http://www.netsolutionsllc.com
Voice +1 541 345-7087
Fax   +1 541 485-5519



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




RE: [PHP] Re: function calls...Incorrect output...What am I doing wrong?

2002-03-29 Thread Rick Emery

I mean:
$this->mFileArray:

-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 29, 2002 1:13 PM
To: 'Eric Starr'; [EMAIL PROTECTED]
Subject: RE: [PHP] Re: function calls...Incorrect output...What am I
doing wrong?


Your problem is that you reference $mFileArray.  You should reference
$this_.mFileArray:

   for ($i=0; $i < count( $mFileArray ); $i++) // iterates through the array

Therefore, count($mFileArray) is 0, so the loop ends without an explicit
exit

-Original Message-
From: Eric Starr [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 29, 2002 1:01 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: function calls...Incorrect output...What am I doing
wrong?


Please notice that I am attepting to call a function "hitCounterPosition()"
in the constructor "Counter" with this line of code:
$this->mCountPosition = $this->hitCounterPosition();

The very next line in the code prints out the value of mCountPosition
printf(">>>" . $this->mCountPosition . "<<< ");

The output is not what I expected.  I am expecting:
>>>1<<<
Instead I am getting:
>>><<<





"Eric Starr" <[EMAIL PROTECTED]> wrote in message
003f01c1d748$8785e200$[EMAIL PROTECTED]">news:003f01c1d748$8785e200$[EMAIL PROTECTED]...
I am learning PHP and I am having some trouble.  I am working on a hit
counter application.  I am using PHP 4 even though the file extension might
lead you to believe I am using PHP 3.

This code is on a page called "homePage.php3".  Here is the instantiation of
my Counter:
All Done!"
?>

Here is count.txt... this is where I store the counts of each page...this is
some test data:

testPage.php3 6
homePage.php3 76
b 99

Here is my counter.php3 code.  This code is not complete.  All it should do
right now is to output the position in the array that it found the
hitcounter...using the test data above I am expecting the output to be
">>>1<<<", assuming that PHP arrays are zero numbered, but instead I am
getting ">>><<<".  What am I doing wrong?

mDataFile = "./counter/count.txt";
 $this->mCount = 1;
 $this->mCounterPosition = -1;
 $this->mName = $name;
 $this->mHandle = fopen($this->mDataFile, "r+");

 // Reading the file into an array...each new line is a seperate element
of the array
 if (!($this->mFileArray = file($this->mDataFile)))
{
printf("Could not read this file: " . $mHandle . "");
 }
 $this->mCountPosition = $this->hitCounterPosition();  // ??? Why is
this not returning anything ???
 printf(">>>" . $this->mCountPosition . "<<< ");  // The output I am
getting is:  >>><<<
}

function hitCounterPosition() //returns the position of the hitcounter in
mFileArray
{
   for ($i=0; $i < count( $mFileArray ); $i++) // iterates through the array
   {
  $pos = strpos( $mFileArray[$i], $mName);
  if (!is_integer($pos)) // The hit counter has NOT been found
  {
 return (-1);
  }
  else // The hit counter has been found
  {
 return ($pos);
  }
   }
}
} // end of class
?>





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

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

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




RE: [PHP] creating MySQL Users

2002-03-29 Thread Joel Caturia

I think you'll find this works better if you use "PUT" as your method,
as opposed to POST, which is for File Uploads.
 
(http://www.php.net/manual/en/features.file-upload.php#features.file-upl
oad.post-method)

Is your code ever actually getting into the 'if' construct, if not,
that's probably your answer!

- Joel

-Original Message-
From: Liam [mailto:[EMAIL PROTECTED]] 
Sent: Friday, March 29, 2002 2:27 PM
To: [EMAIL PROTECTED]
Subject: [PHP] creating MySQL Users

29/03/2002 10:26:41 PM

Hi, I've been trying to work this out, but I can't.
Myabe I need more sleep, I'm sure it's something really stupid.

Could someone have a look over this code for me please?
It's meant to add MySQL users.


">
User
Password






Thanks,
Liam



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



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




RE: [PHP] creating MySQL Users

2002-03-29 Thread Joel Caturia

DAMMIT.. It's too early, I knew I was gonna make that mistake..
GET/PUT/POST, what's the difference right? Sorry, post would be the
right method to use.. agh..



- Joel

-Original Message-
From: Liam [mailto:[EMAIL PROTECTED]] 
Sent: Friday, March 29, 2002 2:27 PM
To: [EMAIL PROTECTED]
Subject: [PHP] creating MySQL Users

29/03/2002 10:26:41 PM

Hi, I've been trying to work this out, but I can't.
Myabe I need more sleep, I'm sure it's something really stupid.

Could someone have a look over this code for me please?
It's meant to add MySQL users.


">
User
Password






Thanks,
Liam



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



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




[PHP] Displaying Image with PHP

2002-03-29 Thread Jay Paulson

Hello--

I can't quite seem to get this to work.  What I'm trying to do is pull data
out of a MySQL db of an image that I had put into the db.  When I originally
put the image into the db I had to use the "addslashes" function so that it
would be inserted into the db correctly.  Now when I select the data out of
the db I do "stripslashes" on the file data.  However, I still get a broken
image in my test page.  So I included the code I'm using below.  the only
ting that I can think of (it actually just popped into my head) is for a 50k
file how big would the table have to be? I'm currently using the field type
of mediumtext which should be enough.

Thanks for any help!
jay

===
$query = "SELECT filename, filedata, dateline FROM reviews where id=$id";
$results = dbQuery($query);

$filedata = stripslashes($results["rowData"]["FILEDATA"][0]);
$filename = $results["rowData"]["FILENAME"][0];

if (strstr($HTTP_USER_AGENT,"MSIE")) {
  $attachment = '';
} else {
  $attachment = ' atachment;';
}

header("Cache-control: max-age=31536000");
header("Expires: " . gmdate("D, d M Y H:i:s",time()+31536000) . "GMT");
header("Last-Modified: " . gmdate("D, d M Y
H:i:s",$results["rowData"]["DATELINE"][0]) . "GMT");
header("Content-disposition:$attachment filename=$filename");
header("Content-Length: ".strlen($filedata));
$extension=strtolower(substr(strrchr($filename,"."),1));

if ($extension=="gif") {
  header("Content-type: image/gif");
} elseif ($extension=="jpg" or $extension=="jpeg") {
  header("Content-type: image/pjpeg");
} elseif ($extension=="png") {
  header("Content-type: image/png");
} elseif ($extension=="pdf") {
 header("Content-type: application/pdf");
} else {
  header("Content-type: unknown/unknown");
}
echo $filedata;


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




Re: [PHP] Displaying Image with PHP

2002-03-29 Thread Rasmus Lerdorf

mediumtext is long enough, but you are putting binary data into it, not
text.  You should be using mediumblob.  The limit is 16M for that column
type.

-Rasmus

On Fri, 29 Mar 2002, Jay Paulson wrote:

> Hello--
>
> I can't quite seem to get this to work.  What I'm trying to do is pull data
> out of a MySQL db of an image that I had put into the db.  When I originally
> put the image into the db I had to use the "addslashes" function so that it
> would be inserted into the db correctly.  Now when I select the data out of
> the db I do "stripslashes" on the file data.  However, I still get a broken
> image in my test page.  So I included the code I'm using below.  the only
> ting that I can think of (it actually just popped into my head) is for a 50k
> file how big would the table have to be? I'm currently using the field type
> of mediumtext which should be enough.
>
> Thanks for any help!
> jay
>
> ===
> $query = "SELECT filename, filedata, dateline FROM reviews where id=$id";
> $results = dbQuery($query);
>
> $filedata = stripslashes($results["rowData"]["FILEDATA"][0]);
> $filename = $results["rowData"]["FILENAME"][0];
>
> if (strstr($HTTP_USER_AGENT,"MSIE")) {
>   $attachment = '';
> } else {
>   $attachment = ' atachment;';
> }
>
> header("Cache-control: max-age=31536000");
> header("Expires: " . gmdate("D, d M Y H:i:s",time()+31536000) . "GMT");
> header("Last-Modified: " . gmdate("D, d M Y
> H:i:s",$results["rowData"]["DATELINE"][0]) . "GMT");
> header("Content-disposition:$attachment filename=$filename");
> header("Content-Length: ".strlen($filedata));
> $extension=strtolower(substr(strrchr($filename,"."),1));
>
> if ($extension=="gif") {
>   header("Content-type: image/gif");
> } elseif ($extension=="jpg" or $extension=="jpeg") {
>   header("Content-type: image/pjpeg");
> } elseif ($extension=="png") {
>   header("Content-type: image/png");
> } elseif ($extension=="pdf") {
>  header("Content-type: application/pdf");
> } else {
>   header("Content-type: unknown/unknown");
> }
> echo $filedata;
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




Re: [PHP] Question about database-driven web sites.

2002-03-29 Thread hugh danaher

Though I just made a flat database (one table only) the attached article was
useful in learning how to put together a mysql database using php.
Hope this helps,
Hugh

- Original Message -
From: "GENESiS DESiGNS" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 29, 2002 2:22 AM
Subject: [PHP] Question about database-driven web sites.


> Hello,
>
> What will a database-driven web site do for? How does it releive stress on
me?
> What is it good for? Why should I learn it? Thanks,
>
>
> -GENESiS DESiGNS
> -Sean Kennedy
> -http://www.gdesigns.vcn.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




[PHP] Checking url validation

2002-03-29 Thread Roberts, Mark

I am using the following to verify a url:

if (!$fp = fopen("http://www.anyurl.com";, "r"))
{
echo "not valid";
}
else
{
echo "this is a valid url";
}

I always get a not valid message. What am I doing wrong? Is there a better
way to do this?

Mark Roberts
Sr. Systems Analyst
LanApps/Web Development
The Williams Information Services Corporation
918-573-1706
[EMAIL PROTECTED]





Re: [PHP] Checking url validation

2002-03-29 Thread Billy S Halsey

Try an extra layer of parens:

if (($fp = fopen("http://www.anyurl.com";, "r") == NULL)
{
echo "not valid";
}
else
{
echo "this is a valid url";
}


Roberts, Mark wrote:
> I am using the following to verify a url:
> 
> if (!$fp = fopen("http://www.anyurl.com";, "r"))
> {
>   echo "not valid";
> }
> else
> {
>   echo "this is a valid url";
> }
> 
> I always get a not valid message. What am I doing wrong? Is there a better
> way to do this?
> 
> Mark Roberts
> Sr. Systems Analyst
> LanApps/Web Development
> The Williams Information Services Corporation
> 918-573-1706
> [EMAIL PROTECTED]
> 
> 
> 


-- 


/-=[ BILLY S HALSEY ]=--\
| Member of Technical Staff, Sun Microsystems, Inc. ESP Solaris SW  |
| "All opinions and technical advice offered in this message are my |
| own and not necessarily endorsed by my employer." |
\--=[ [EMAIL PROTECTED] ]=/


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




Re: [PHP] Checking url validation

2002-03-29 Thread Billy S Halsey

Oops ... That's not balanced. Add another ) at the end of the if.

/bsh/

Billy S Halsey wrote:
> Try an extra layer of parens:
> 
> if (($fp = fopen("http://www.anyurl.com";, "r") == NULL)
> {
> echo "not valid";
> }
> else
> {
> echo "this is a valid url";
> }
> 
> 
> Roberts, Mark wrote:
> 
>> I am using the following to verify a url:
>>
>> if (!$fp = fopen("http://www.anyurl.com";, "r"))
>> {
>> echo "not valid";
>> }
>> else
>> {
>> echo "this is a valid url";
>> }
>>
>> I always get a not valid message. What am I doing wrong? Is there a 
>> better
>> way to do this?
>>
>> Mark Roberts
>> Sr. Systems Analyst
>> LanApps/Web Development
>> The Williams Information Services Corporation
>> 918-573-1706
>> [EMAIL PROTECTED]
>>
>>
>>
> 
> 


-- 


/-=[ BILLY S HALSEY ]=--\
| Member of Technical Staff, Sun Microsystems, Inc. ESP Solaris SW  |
| "All opinions and technical advice offered in this message are my |
| own and not necessarily endorsed by my employer." |
\--=[ [EMAIL PROTECTED] ]=/


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




Re: [PHP] Security hole using cookies for sessions. Workaround?

2002-03-29 Thread Andy

hmm.. but there must be some other way to do this. I know one site which is
handling this problem.

check out http://www.web.de

Andy

"Rasmus Lerdorf" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > My question is:
> > Is there a way to close this hole and let the session expire as soon as
only
> > the active window
> > is closed?
>
> Nope, that's how browsers work.  Your only real way to fix it would be to
> expire a session after a certain amount of inactivity.  That's what the
> PHP sessions do by default - 24 minutes of inactivity and the session data
> is expired.
>
> There is no way to detect a user closing one window of a browser session.
>
> -Rasmus
>



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




[PHP] A Calendar type thingy

2002-03-29 Thread David Johansen

Ok, I'm still kind of new to this and I just have a question on how I should
go about implementing something. I need to make a calendar type thing with
different times in each day and store some values for each time in a
database. I was just wondering what would be the best way to do this. Here's
what my data type would look like in C:

struct time
{
char name[50];
int avail;
int max;
}

struct day
{
 char date[15];
 time time_values[6];
}

day myDates[14];

So I would have a structure for each day and that structure would hold the
date and 6 times. Each time would have it's name, available spots and
maximum spots. What would be the best way to set this up in PHP and store it
in a mySQL database. Thanks,
Dave



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




RE: [PHP] Displaying Image with PHP

2002-03-29 Thread James E. Hicks III

## Heres where I add images to DB with field type of BLOB for image

if ( ($submit == 'Add Image') && ($userid != 'demo') ){
   if ($image != 'none'){
  $name = strtr($name, "'", " ");
  $image = addslashes(fread(fopen($image, "r"), filesize($image)));
  mysql_select_db($dbase) or die( "Unable to select database");
  $query = "insert into images values ('$name','$image')";
  mysql_query($query);
  if (mysql_error()){
 echo (" Upload of image failed. It is possible
the");
 echo (" image name is already on file. Try another name.");
 echo ("");
 exit;
  }
   }
   $submit = 'Image Index';
}

Here's my image script. I know I should send more information in the Header, but
it works w/out it. Notice that I ommitted the stripslashes. I ran into the same
problem as you are having when I had the stripslashes in it. I would make more
sense to me if you had to use the stripslashes.





Your code.
===
$query = "SELECT filename, filedata, dateline FROM reviews where id=$id";
$results = dbQuery($query);

$filedata = stripslashes($results["rowData"]["FILEDATA"][0]);
$filename = $results["rowData"]["FILENAME"][0];

if (strstr($HTTP_USER_AGENT,"MSIE")) {
  $attachment = '';
} else {
  $attachment = ' atachment;';
}

header("Cache-control: max-age=31536000");
header("Expires: " . gmdate("D, d M Y H:i:s",time()+31536000) . "GMT");
header("Last-Modified: " . gmdate("D, d M Y
H:i:s",$results["rowData"]["DATELINE"][0]) . "GMT");
header("Content-disposition:$attachment filename=$filename");
header("Content-Length: ".strlen($filedata));
$extension=strtolower(substr(strrchr($filename,"."),1));

if ($extension=="gif") {
  header("Content-type: image/gif");
} elseif ($extension=="jpg" or $extension=="jpeg") {
  header("Content-type: image/pjpeg");
} elseif ($extension=="png") {
  header("Content-type: image/png");
} elseif ($extension=="pdf") {
 header("Content-type: application/pdf");
} else {
  header("Content-type: unknown/unknown");
}
echo $filedata;


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


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




[PHP] creating files with same user id than the script?

2002-03-29 Thread Kai Schaetzl

One of our customers installed a CMS application scripted in PHP and 
it creates a lot of new files. These are all getting created under 
the userid of nobody (the webserver's id) instead of the user's id 
(the scrip's id) which makes it somewhat difficult to run the 
application in safemode because here and then it will run into a 
barrier. Is this a problem with the coding or will PHP always create 
new files under the webserver's user id?


Kai

--

Kai Schätzl, Berlin, Germany
Get your web at Conactive Internet Services: http://www.conactive.com
IE-Center: http://ie5.de & http://msie.winware.org




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




[PHP] Processing Code created on the fly

2002-03-29 Thread Jonathan Duncan

I am trying to create an HTML Table which has TH headers which are different
depending upon the link clicked to access the page.  Also, the content of
the TD's below the headers would be different depending on the headers and
depending on the link clicked.

I have sorted out many of the details, but one eludes me.  Attached is an
example that I have created to try to prove my point.  In it you will first
see two variables that have been created inside of a function.  The function
is called with certain values and these variables are created and populated
with PHP code that needs to be evaluated at a point later in the file that
calls the function.

Next you will see a WHILE statement that should take the contents of the
those variables and evaluate those contents as if they had been hard-coded
in place of the variables.

So far, when I run the script as is it simply prints the contents of the
variables, which is raw PHP code, but does not process it.  The results is
that the raw PHP code that is in the variables doesn't get process, but is
output at text on the resulting HTML page.

Can anyone help me figure this out?  I would really appreciate it.

Thanks in advance,
Jonathan Duncan


begin 666 example.php
M/#\-"E1H97-E('9A2@@)'-E2@\5$0^)&%C8V]U;G0\+U1$/@T*"0D)"2 @(#Q41#XD
M2!W97)E('!A
MF%B;&4];F\L;65N=6)Ahttp://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] A Calendar type thingy

2002-03-29 Thread Kevin Stone

Perhaps simply store a standard English date as the index for a single
table (ie. 032902 or 03/29/02) along with a `time` and `comments` field.
Use PHP's extensive library of built-in date/time functions to translate
the date to timestamp and vice versa.

---
CREATE TABLE `test_calendar` (`dates` INT(6) NOT NULL, `time` INT(14)
NOT NULL, `comments` TINYTEXT NOT NULL , INDEX (`dates`)) 
---

Then reference the times corresponding to that date with the query
string..

---
SELECT * FROM calendar WHERE dates = 032902
---

You can add as many times/comments to any one date that you like and
then view them all or just one at a time.  You end up with some
duplicate data in the table but it's no biggie.  I wouldn't get too
complex because I don't see the need for multiple data sets in your
example.

-Kevin

-Original Message-
From: David Johansen [mailto:[EMAIL PROTECTED]] 
Sent: Friday, March 29, 2002 1:44 PM
To: [EMAIL PROTECTED]
Subject: [PHP] A Calendar type thingy

Ok, I'm still kind of new to this and I just have a question on how I
should
go about implementing something. I need to make a calendar type thing
with
different times in each day and store some values for each time in a
database. I was just wondering what would be the best way to do this.
Here's
what my data type would look like in C:

struct time
{
char name[50];
int avail;
int max;
}

struct day
{
 char date[15];
 time time_values[6];
}

day myDates[14];

So I would have a structure for each day and that structure would hold
the
date and 6 times. Each time would have it's name, available spots and
maximum spots. What would be the best way to set this up in PHP and
store it
in a mySQL database. Thanks,
Dave



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




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




[PHP] [PHP4.1.2-APACHE1.3.24-WIN32]: using $_SESSION

2002-03-29 Thread John Mpaliza








  
  I'm using Apache-win-php4.1.3 and can't create session variables by 
  using session_start() and $_SESSION['...']. I'm new to php, please 
  help.
  Next week I tried php4.1.1 and all was working well. Now, I'm using 
  php4.1.2,  as an Apache module and with 
  session.use_trans_sid=1,register_globals=off  in php.ini, I can't 
  redirect a page to another and access the $_SESSION['variables'] defined 
  in the 1st document. All codes that were working correctly first now do 
  not.
  es. pageone.php
  
     session_start();
     $_SESSION['var']="testsession";
     header( "Location: anotherpage.php?".SID);
     exit;
  ?>
  -
  anotherpage.php
   
  
     session_start();
     print $_SESSION['var'];
     ..
  ?>
  N.B: I got a warning: undefined index : var; and make some controls I 
  noticed that $_SESSION['var'] is not set in the anotherpage.php. And in 
  pageone.php, $_SESSION['var'] is set as a normal variable but not a 
  session variable because all files (sess_21ae6dg34) in the 
  temp directory are EMPTY.EMPTY..
  $_SESSION isset but $_SESSION['...'] exits in a page as a normal 
  variable but not a session variable.
   
  Please help me. Thank u.
   
  John







___  IncrediMail - il mondo della posta elettronica si 
è finalmente evoluto - Clicca 
Qui

[PHP] Can you find the parse error?

2002-03-29 Thread Eric Kilgore

What's wrong with this code that it would give this error?

Parse error: parse error, expecting `','' or `';''

$query = "INSERT INTO tblUserInfo (UserID, Complex, Contact, Address, State,
City, Zip, Phone,
 Fax, email, fee) VALUES ('".$UserID."', '".$Complex."', '".$Contact."',
'".$Address."',
  '".$State."', '".$City."', '".$Zip."', '".$Phone."', '".$Fax."',
'".$email."', '".$fee."')";

I think I've been staring at it too long. I can't find it.

Eric


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




[PHP] Is it possible to pass javascript variables to PHP without user's activity?

2002-03-29 Thread Andrew Korsak

Hello.
I got a question.
Is it possible to pass javascript variables to PHP without user's
activity, using post method?
I want to read  user cookie with javascript and pass it to PHP.
I guess I will need to use meta tag to do this?


-- 
Message Info.
Date: Friday, March 29, 2002 
Time: 4:52:36 PM  


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




[PHP] From Newman: Just installed, get this error message.

2002-03-29 Thread Philip J. Newman

Security Alert! PHP CGI cannot be accessed directly. 
This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a 
page will only be served up if the REDIRECT_STATUS CGI variable is set. This variable 
is set, for example, by Apache's Action directive redirect. 

You may disable this restriction by recompiling the PHP binary with the 
--disable-force-cgi-redirect switch. If you do this and you have your PHP CGI binary 
accessible somewhere in your web tree, people will be able to circumvent .htaccess 
security by loading files through the PHP parser. A good way around this is to define 
doc_root in your php.ini file to something other than your top-level DOCUMENT_ROOT. 
This way you can separate the part of your web space which uses PHP from the normal 
part using .htaccess security. If you do not have any .htaccess restrictions anywhere 
on your site you can leave doc_root undefined. If you are running IIS, you may safely 
set cgi.force_redirect=0 in php.ini. 


Philip J. Newman
PhilipNZ :: Design Solutions
http://www.philipnz.com/
[EMAIL PROTECTED]
ICQ# 20482482
+64 25 6144012



RE: [PHP] Can you find the parse error?

2002-03-29 Thread Eric Kilgore

There are a couple of carriage returns, but this has never affected any of
my other code. I'm using dreamweaver.

-Original Message-
From: Henning, Brian [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 29, 2002 1:55 PM
To: 'Eric Kilgore'
Subject: RE: [PHP] Can you find the parse error?


is there a carrage return in the middle of the statement?  what editor are
you using?
it might be wrapping wrong

-Original Message-
From: Eric Kilgore [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 29, 2002 3:46 PM
To: php-general (E-mail)
Subject: [PHP] Can you find the parse error?


What's wrong with this code that it would give this error?

Parse error: parse error, expecting `','' or `';''

$query = "INSERT INTO tblUserInfo (UserID, Complex, Contact, Address, State,
City, Zip, Phone,
 Fax, email, fee) VALUES ('".$UserID."', '".$Complex."',
'".$Contact."',
'".$Address."',
  '".$State."', '".$City."', '".$Zip."', '".$Phone."', '".$Fax."',
'".$email."', '".$fee."')";

I think I've been staring at it too long. I can't find it.

Eric


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


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




Re: [PHP] Is it possible to pass javascript variables to PHP withoutuser's activity?

2002-03-29 Thread Miguel Cruz

On Fri, 29 Mar 2002, Andrew Korsak wrote:
> I want to read  user cookie with javascript and pass it to PHP.

PHP already gets the cookie information. What do you need JavaScript for?

miguel


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




RE: [PHP] Can you find the parse error?

2002-03-29 Thread Rick Emery

I ran it through my PHP.  Worked fine.

You may wish to close each line with a ".

-Original Message-
From: Eric Kilgore [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 29, 2002 3:46 PM
To: php-general (E-mail)
Subject: [PHP] Can you find the parse error?


What's wrong with this code that it would give this error?

Parse error: parse error, expecting `','' or `';''

$query = "INSERT INTO tblUserInfo (UserID, Complex, Contact, Address, State,
City, Zip, Phone,
 Fax, email, fee) VALUES ('".$UserID."', '".$Complex."',
'".$Contact."', '".$Address."',
  '".$State."', '".$City."', '".$Zip."', '".$Phone."', '".$Fax."',
'".$email."', '".$fee."')";

I think I've been staring at it too long. I can't find it.

Eric


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

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




Re: [PHP] Can you find the parse error?

2002-03-29 Thread Miguel Cruz

On Fri, 29 Mar 2002, Eric Kilgore wrote:
> What's wrong with this code that it would give this error?
> 
> Parse error: parse error, expecting `','' or `';''
> 
> $query = "INSERT INTO tblUserInfo (UserID, Complex, Contact, Address, State,
> City, Zip, Phone,
>Fax, email, fee) VALUES ('".$UserID."', '".$Complex."', '".$Contact."',
> '".$Address."',
> '".$State."', '".$City."', '".$Zip."', '".$Phone."', '".$Fax."',
> '".$email."', '".$fee."')";
> 
> I think I've been staring at it too long. I can't find it.

I don't see an error, but wouldn't it be easier (and faster) to write:

  $query = "INSERT INTO tblUserInfo (UserID, Complex, Contact, Address,
  State, City, Zip, Phone, Fax, email, fee) VALUES ('$UserID', '$Complex',
  '$Contact', '$Address', '$State', '$City', '$Zip', '$Phone', '$Fax',
  '$email', '$fee')";

without all the concatenation?

miguel


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




[PHP] RE: [PHP-WIN] Re: How to Pass the Username which from Windows Login

2002-03-29 Thread Vail, Warren

Does this retrieve the userid of the machine where the web server is
running, or does it retrieve the userid of the machine where the browser is
running?


Warren Vail
Tools, Metrics & Quality Processes
(415) 667-7814
Pager (877) 774-9891
215 Fremont 02-658


-Original Message-
From: J Wynia [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 29, 2002 8:38 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP-WIN] Re: How to Pass the Username which from Windows Login


$network = new COM("WScript.Network");
$computername = $network->ComputerName;
$username = $network->UserName;

Password can't be grabbed for fairly obvious reasons.

"Jack" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Dear all
> I want to prevent user to make another login before they can browse the
> Intranet, so is there anyway that php can grep the username from the
windows
> Login or Domain Login?
> Which means if a user can login to the Windows NT, then he/she will have
the
> right to browse the Intranet!
>
> Thx a lot
> Jack
> [EMAIL PROTECTED]
>
>



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

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




[PHP] Nead Help With A Php Script

2002-03-29 Thread Alain Kumschick François Robert

Hello,

I need a php script that checks if the there is a cookie set with the users
username and if not
it brings you to an other page and telling you that you are not loged in!

thanks for any help


alain kumschick
[EMAIL PROTECTED]
http://www.kumschicknw.com






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




[PHP] [PHP-APACHE-WIN]: using $_SESSION instead of register().......

2002-03-29 Thread John Mpaliza




  
  

   
  
  


  
I'm using Apache-win-php4.1.3 and can't create session 
variables by using session_start() and $_SESSION['...']. I'm new 
to php, please help.
Next week I tried php4.1.1 and all was working well. Now, using 
php4.1.3, compiled as an Apache module and with 
session.use_trans_sid=1 in php.ini, I can't redirect a page to 
another and access the $_SESSION['variables'] defined in the 1st 
document. All codes that were working correctly first now do 
not.
es. pageone.php

   session_start();
   $_SESSION['var']="testsession";
   header( "Location: anotherpage.php?".SID);
   exit;
?>
-
anotherpage.php
 

   session_start();
   print $_SESSION['var'];
   ..
?>
N.B: I got a warning: undefined index : var; and make some 
controls I noticed that $_SESSION['var'] is not set in the 
anotherpage.php. And in pageone.php, $_SESSION['var'] is set as a 
normal variable but not a session variable because all files 
(sess_21ae6dg34) are EMPTY.
 
Please help me. Thank u.
 
John

  

  
  



   
  

  


  
  
  ___  IncrediMail - il mondo della posta elettronica si 
è finalmente evoluto - Clicca 
Qui

RE: [PHP] Can you find the parse error?

2002-03-29 Thread Eric Kilgore

Good to know I'm not going crazy. I found the error in the previous
function. I failed to end an echo statement and the next quote on that page
was this statement. Doh.

-Original Message-
From: Miguel Cruz [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 29, 2002 2:08 PM
To: Eric Kilgore
Cc: php-general (E-mail)
Subject: Re: [PHP] Can you find the parse error?


On Fri, 29 Mar 2002, Eric Kilgore wrote:
> What's wrong with this code that it would give this error?
>
> Parse error: parse error, expecting `','' or `';''
>
> $query = "INSERT INTO tblUserInfo (UserID, Complex, Contact, Address,
State,
> City, Zip, Phone,
>Fax, email, fee) VALUES ('".$UserID."', '".$Complex."', '".$Contact."',
> '".$Address."',
> '".$State."', '".$City."', '".$Zip."', '".$Phone."', '".$Fax."',
> '".$email."', '".$fee."')";
>
> I think I've been staring at it too long. I can't find it.

I don't see an error, but wouldn't it be easier (and faster) to write:

  $query = "INSERT INTO tblUserInfo (UserID, Complex, Contact, Address,
  State, City, Zip, Phone, Fax, email, fee) VALUES ('$UserID', '$Complex',
  '$Contact', '$Address', '$State', '$City', '$Zip', '$Phone', '$Fax',
  '$email', '$fee')";

without all the concatenation?

miguel


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


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




RE: [PHP] Can you find the parse error?

2002-03-29 Thread Kevin Stone

I have found it safer to use backticks on all of my table and field
names.  I doubt that's the problem but it's a good practice and
something to try anyway.

INSERT INTO `tblUserInfo` (`UserID`, `Complex`, `Contact`,.. etc..

By the way what are those complicated looking '".$var."' for?  You
should only have to do '$var'

If all else fails run the query string through phpMyAdmin if you have it
installed.  That usually helps me pin down the problem.

-Kevin

-Original Message-
From: Eric Kilgore [mailto:[EMAIL PROTECTED]] 
Sent: Friday, March 29, 2002 2:46 PM
To: php-general (E-mail)
Subject: [PHP] Can you find the parse error?

What's wrong with this code that it would give this error?

Parse error: parse error, expecting `','' or `';''

$query = "INSERT INTO tblUserInfo (UserID, Complex, Contact, Address,
State,
City, Zip, Phone,
 Fax, email, fee) VALUES ('".$UserID."', '".$Complex."',
'".$Contact."',
'".$Address."',
  '".$State."', '".$City."', '".$Zip."', '".$Phone."',
'".$Fax."',
'".$email."', '".$fee."')";

I think I've been staring at it too long. I can't find it.

Eric


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




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




Re: [PHP] creating files with same user id than the script?

2002-03-29 Thread Rasmus Lerdorf

That's the way it works since Apache runs as a single user id. There is no
way PHP can escape this. You might look into setting this user up with the
open_basedir restriction instead of safe_mode. Under open_basedir the
user's scripts can only manipulate files under the directory you specify.

Your other options are running PHP in CGI mode under suExec (a bit slow
and clunky) or running multiple instances of Apache behind a reverse proxy
like Squid where you configure Squid via something like SquidGuard to send
requests to various ports on localhost based on which domain is being
requested.  Then you would set up multiple instances of Apache each
listening to a different port on localhost and each running as that user's
user id.  The last option is the most powerful, but is also somewhat more
resource intensive.

-Rasmus

On Fri, 29 Mar 2002, Kai Schaetzl wrote:

> One of our customers installed a CMS application scripted in PHP and
> it creates a lot of new files. These are all getting created under
> the userid of nobody (the webserver's id) instead of the user's id
> (the scrip's id) which makes it somewhat difficult to run the
> application in safemode because here and then it will run into a
> barrier. Is this a problem with the coding or will PHP always create
> new files under the webserver's user id?
>
>
> Kai
>
> --
>
> Kai Schätzl, Berlin, Germany
> Get your web at Conactive Internet Services: http://www.conactive.com
> IE-Center: http://ie5.de & http://msie.winware.org
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




Re: [PHP] PHP and XML/XLST/WDDX etc

2002-03-29 Thread Rich Buggy

> I am in a dilemma right now between "If it ain't broke, don't fix it" and
"Looking
> over my shoulder".  I am trying to determine whether it makes more sense
to use
> ML for maintaining configuration files.

  Compiled program ==> ML configuration file
  Interpreted program (i.e PHP) ==> included configuration file with
variables set

  For most interpreted programs I can't see any advantage in adding extra
code and processing time just to store the config file in a ML.

> As far as content management, we use static include files or MySQL
databases to
> store site content.   I am not sure where the advantage of using XML/XLST
for this
> functionality.

  I'm currently working on a class library/application framework for PHP
(similar to Delphi's VCL) in which I'm using XML/XSLT for the templates.
It's working great with development not taking very long at all. The two
main advantages of using XML/XSLT for content management that I can see are:
1. It's easier to enforce a common look and feel on a site.
2. It's easier to re-target content (different transformations for
different browsers).
.

  Rich



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




[PHP] A quesiton about arrays and indexes

2002-03-29 Thread David Johansen

Ok, I have a question about arrays and indexes. Something weird happens when
I try this:

echo "week[$i][$j]: $week[$i][$k][0]";

Of course $i and $j have their appropriate values. It just prints out
Array[0][4] (0 and 4 being the values of $i and $k, but if I do the code
below it works just fine. Is there something I'm just not getting or
something?

$temp = $week[$i][$k][0];
echo "week[$i][$j]: $temp";

THanks,
Dave



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




Re: [PHP] A quesiton about arrays and indexes

2002-03-29 Thread Miguel Cruz

On Fri, 29 Mar 2002, David Johansen wrote:
> Ok, I have a question about arrays and indexes. Something weird happens when
> I try this:
> 
> echo "week[$i][$j]: $week[$i][$k][0]";

If you're array subscripts inside "double quotes", then use {braces}
around the entire variable:

   echo "week[$i][$k]: {$week[$i][$k][0]}":

miguel


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




Re: [PHP] A quesiton about arrays and indexes

2002-03-29 Thread Rasmus Lerdorf

Complex arrays inside quoted strings either need to be escaped with {}'s
or drop out of the quoted string to display them.  ie.

echo "".$week[$i][$j].": ".$week[$i][$k][0]."";

or

echo "${week[$i][$j]}: ${week[$i][$k][0]}";

-Rasmus

On Fri, 29 Mar 2002, David Johansen wrote:

> Ok, I have a question about arrays and indexes. Something weird happens when
> I try this:
>
> echo "week[$i][$j]: $week[$i][$k][0]";
>
> Of course $i and $j have their appropriate values. It just prints out
> Array[0][4] (0 and 4 being the values of $i and $k, but if I do the code
> below it works just fine. Is there something I'm just not getting or
> something?
>
> $temp = $week[$i][$k][0];
> echo "week[$i][$j]: $temp";
>
> THanks,
> Dave
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




[PHP] [PHP-DB] Displaying Floats

2002-03-29 Thread Ian Wayne

Hi all. 

I can't believe I'm stuck on this - seems to me there ought to be an easy
way to do this, but I've been hunting through the literature and I just
can't find it. If anyone can point me in the right direction it'd be much
appreciated...

I have a table of accounts and I want to display all the money amounts to 2
decimal places. How do I do this? Should I use floatval (which I can't use
because it's CVS only)? Or is there some other way?

Many thanks

Ian


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




Re: [PHP] [PHP-DB] Displaying Floats

2002-03-29 Thread Miguel Cruz

On Fri, 29 Mar 2002, Ian Wayne wrote:
> I have a table of accounts and I want to display all the money amounts
> to 2 decimal places. How do I do this? Should I use floatval (which I
> can't use because it's CVS only)? Or is there some other way?

   http://php.net/printf

miguel


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




Re: [PHP] [PHP-DB] Displaying Floats

2002-03-29 Thread Rasmus Lerdorf

A couple of ways.  The most flexible is probably to use number_format()
since that lets you set the separators as well.

printf("%.2f",$value) would also do it.

-Rasmus

On Fri, 29 Mar 2002, Ian Wayne wrote:

> Hi all.
>
> I can't believe I'm stuck on this - seems to me there ought to be an easy
> way to do this, but I've been hunting through the literature and I just
> can't find it. If anyone can point me in the right direction it'd be much
> appreciated...
>
> I have a table of accounts and I want to display all the money amounts to 2
> decimal places. How do I do this? Should I use floatval (which I can't use
> because it's CVS only)? Or is there some other way?
>
> Many thanks
>
> Ian
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




Re: [PHP] [PHP-DB] Displaying Floats

2002-03-29 Thread Bogdan Stancescu

As replied above, or

echo(round($money*100)/100);

Just to point out another way - the previous suggestions are better 
because they most probably involve way less math on the server.

Bogdan

Ian Wayne wrote:

>Hi all. 
>
>I can't believe I'm stuck on this - seems to me there ought to be an easy
>way to do this, but I've been hunting through the literature and I just
>can't find it. If anyone can point me in the right direction it'd be much
>appreciated...
>
>I have a table of accounts and I want to display all the money amounts to 2
>decimal places. How do I do this? Should I use floatval (which I can't use
>because it's CVS only)? Or is there some other way?
>
>Many thanks
>
>Ian
>
>




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




Re: [PHP] Processing Code created on the fly

2002-03-29 Thread Jason Wong

On Saturday 30 March 2002 05:32, Jonathan Duncan wrote:
> I am trying to create an HTML Table which has TH headers which are
> different depending upon the link clicked to access the page.  Also, the
> content of the TD's below the headers would be different depending on the
> headers and depending on the link clicked.
>
> I have sorted out many of the details, but one eludes me.  Attached is an
> example that I have created to try to prove my point.  In it you will first
> see two variables that have been created inside of a function.  The
> function is called with certain values and these variables are created and
> populated with PHP code that needs to be evaluated at a point later in the
> file that calls the function.

I suggest that you post again and include your code inline with your post 
rather than attaching it. 

People are lazy and many (me included) couldn't/wouldn't be bothered to save 
your attachment and open up their text editor/viewer to read it.


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
It is always the best policy to tell the truth, unless, of course,
you are an exceptionally good liar.
-- Jerome K. Jerome
*/

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




[PHP] gettext functionality needs configuration flag

2002-03-29 Thread Thalis A. Kalfigopoulos

Someone with the proper authority should probably put on the manual pages that to get 
the gettext functionality you have to configure with the --with-gettext flag. The 
--with-XYZ comes in almost all pages that require an additional flag, so at first I 
was mislead into believing it is compiled in by default.
Hope I saved someone some time and the ugly "Fatal error: Call to undefined function: 
bindtextdomain() in ..." messg.

cheers,
--thalis


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




Re: [PHP] Processing Code created on the fly

2002-03-29 Thread Jonathan Duncan

Jason,

That is a good point and that being the case, following is my code.

Thanks,
Jonathan Duncan
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
$account
   $service";



This is file that calls the above function:
(The lines with the *s are supposed to take
the data from the variables and then process
them as if they were part of the code.)

while ($sqlresult = mysql_fetch_array($result)) {
 $id = $sqlresult['id'];
 $account = $sqlresult['account'];
*$thefunction->othervars;
 $email = $sqlresult['email'];
 $terms = $sqlresult['terms'];
 $account_list .= "
   image
*  $thefunction->tabledata;
   \$$m_amount
   $paidthru
   \$$amountdue
   mailto:$email\"; $oelinkstyle>$email
   $terms";
?>



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




[PHP] From Newman: Redirect function not working.

2002-03-29 Thread Philip J. Newman

I have just updated my copy of PHP and changed the INI file.  Some of my redirect 
commands no longer work.

Any Suggestions.

Philip J. Newman
PhilipNZ :: Design Solutions
http://www.philipnz.com/
[EMAIL PROTECTED]
ICQ# 20482482
+64 25 6144012



Re: [PHP] Processing Code created on the fly

2002-03-29 Thread Jason Wong

On Saturday 30 March 2002 11:16, Jonathan Duncan wrote:

>  These variables are populated and assigned in a function:
> (This is just an example.  In actuality these variables
> are populated using other means.)
> -
> $othervars = " $service = $sqlresult['service'];
>  $m_amount = $sqlresult['m_amount'];
>  $paidthru = $sqlresult['paidthru'];
>  $amountdue = $sqlresult['amountdue'];";
>
> $tabledata = " $account
>$service";
>
>
>
> This is file that calls the above function:
> (The lines with the *s are supposed to take
> the data from the variables and then process
> them as if they were part of the code.)
> 
> while ($sqlresult = mysql_fetch_array($result)) {
>  $id = $sqlresult['id'];
>  $account = $sqlresult['account'];
> *$thefunction->othervars;
>  $email = $sqlresult['email'];
>  $terms = $sqlresult['terms'];
>  $account_list .= "
> HREF=\"editaccount.php?id=$id&edit=yes\">image
> *  $thefunction->tabledata;
>\$$m_amount
>$paidthru
>\$$amountdue
>mailto:$email\"; $oelinkstyle>$email
>$terms";
> ?>

You need to check out the eval() function.



-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
The real trouble with reality is that there's no background music.
*/

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




Re: [PHP] Processing Code created on the fly

2002-03-29 Thread Jonathan Duncan

Yeah, I have played with the eval function a bit, but it didn't seem to help
much.  Then again, I haven't ever used the eval function before so I may not
know how to properly implement it.  I have read the page for eval on php.net
several times as well as the very helpful examples, but whenever I use eval,
it just prints out the same stuff.  By same stuff I mean wether I use eval
or just the variable by itself it just prints out the contents of the
variable.  In the web page source it looks as if the contents were merely
echoed because it still has the $'s and variable names.  Any other ideas or
examples on how to implement eval on this?

Thanks for the help,
Jonathan Duncan


"Jason Wong" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> On Saturday 30 March 2002 11:16, Jonathan Duncan wrote:
>
> >  > These variables are populated and assigned in a function:
> > (This is just an example.  In actuality these variables
> > are populated using other means.)
> > -
> > $othervars = " $service = $sqlresult['service'];
> >  $m_amount = $sqlresult['m_amount'];
> >  $paidthru = $sqlresult['paidthru'];
> >  $amountdue = $sqlresult['amountdue'];";
> >
> > $tabledata = " $account
> >$service";
> >
> >
> >
> > This is file that calls the above function:
> > (The lines with the *s are supposed to take
> > the data from the variables and then process
> > them as if they were part of the code.)
> > 
> > while ($sqlresult = mysql_fetch_array($result)) {
> >  $id = $sqlresult['id'];
> >  $account = $sqlresult['account'];
> > *$thefunction->othervars;
> >  $email = $sqlresult['email'];
> >  $terms = $sqlresult['terms'];
> >  $account_list .= "
> > > HREF=\"editaccount.php?id=$id&edit=yes\">image
> > *  $thefunction->tabledata;
> >\$$m_amount
> >$paidthru
> >\$$amountdue
> >mailto:$email\"; $oelinkstyle>$email
> >$terms";
> > ?>
>
> You need to check out the eval() function.
>
>
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
>
> /*
> The real trouble with reality is that there's no background music.
> */



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




[PHP] Re: gettext functionality needs configuration flag

2002-03-29 Thread CC Zona

In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Thalis A. Kalfigopoulos) wrote:

> Someone with the proper authority should probably put on the manual pages 
> that to get the gettext functionality you have to configure with the 
> --with-gettext flag.

Did you know that anyone is allowed to add an annotation to the manual?  
For instance, if you go to , you'll see several 
"user-contributed comments" (directly below the official text).  At the top 
and bottom of that block is a image of a plus sign and an image of a 
question mark; click on the plus sign to add your own note to the page.

-- 
CC

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




[PHP] global vars in a function

2002-03-29 Thread Justin French

Hi,

Am I missing something? I'm trying to use vars set in my config.php file in
a function, and can't seem to do it without using $GLOBALS["varname"], which
is a bit of a pain in the

---config.php---
$var1 = 1;
---

---something.php---
function foo
{
if($var1)
{
echo "foo"; // doesn't work
}
}

function foo2
{
if($GLOBALS["var1"])
{
echo "foo"; // does work
}
}
---

Is there a way to make global vars available in each function, or is this
just the way things go?


Justin French
-
http://indent.com.au
http://soundpimps.com
-




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




  1   2   >