Re: [PHP] varibles defination

2005-08-05 Thread edwardspl
> > How can we define and display the varibles by using for loop
> > function ?
>
>  for ($x=0;$x<10;$x++){
>   $func[$x]=$x;
> }
> print_r($func);
> ?>

If I want to define a set of varibles ( two dimension array, eg : $func[0,0] )
and via the varibles of form tag ( format, eg : $_GET["varname"] or
$_POST["varname"] )...
How about the example ?

Edward.

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



Re: [PHP] Re: Sending post data from a script

2005-08-05 Thread Vedanta Barooah
here is an example that posts data to the altavista babelfish form using curl:
http://www.phpclasses.org/browse/file/9812.html
thanks,

-- 
*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*~:~*
Vedanta Barooah

On 8/6/05, Manuel Lemos <[EMAIL PROTECTED]> wrote:
> Hello,
> 
> on 08/05/2005 04:33 PM Paul Nowosielski said the following:
> > I'm trying to setup a PHP script that will send a POST data request to a
> > web form. The script needs to be automatic and not driven by a web form..
> >
> > For example.
> >
> > I have a cron script that runs every 15 minutes. The cron script calls
> > my php script on the server and sends the important data to a web based
> > form without human interaction. The data has to be passed with the
> > method="post". Sending the data via a URL request does not suffice.
> >
> > So my question in general is: How can I send HTTP POST data to a remote
> > interface without using an HTML FORM?.
> 
> You may want to take a look at this HTTP client class. Besides
> submitting POST form values, it also handles redirection and cookies if
> necessary.
> 
> http://www.phpclasses.org/httpclient
> 
> 
> --
> 
> Regards,
> Manuel Lemos
> 
> PHP Classes - Free ready to use OOP components written in PHP
> http://www.phpclasses.org/
> 
> PHP Reviews - Reviews of PHP books and other products
> http://www.phpclasses.org/reviews/
> 
> Metastorage - Data object relational mapping layer generator
> http://www.meta-language.net/metastorage.html
> 
> --
> 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] Javascript Src and HTTP_REFERER

2005-08-05 Thread Joe Wollard
I haven't tested this and it's off the top of my head so don't shoot  
me if I'm off track here ;-)


You could possibly use some embedded javascript to set a cookie with  
the current URL stored in it. This would be easy to spoof as well,  
but not quite as easy as appending ?site=xyz.


(shrug) just a thought


On Aug 5, 2005, at 6:58 PM, Cabbar Duzayak wrote:


Hi,

I have a web page (say page1) which refers to a php within  
javascript tag as:


http://mysite.com/javascript_dump.php";>

As you can see, this calls a php file which dumps javascript. The
problem here is, within this php I couldn't get which page it is
called from.

Basically, if it comes from affiliate site 1, I will show some
content, and if it comes from affiliate site 2, I will show some other
content.

And, the thing is, within this javascript_dump.php, HTTP_REFERER shows
nothing, because it gives you the referer of the html page (page1)
that contains this 

[PHP] Return Path

2005-08-05 Thread sub
I don't seem to be able to set the "return path" using the mail() function. I 
can't figure out why "from" will let me set it, but not the return path. 

$headers = 'From: [EMAIL PROTECTED]' . "\r\n" .
   'Return-path: [EMAIL PROTECTED]' . "\r\n" .
   'X-Mailer: PHP/' . phpversion();

mail($email, $subject, $message, $headers);


Any thoughts?

Andrew Darrow
Kronos1 Productions
www.pudlz.com



Re: [PHP] Re: PHP 5.0.4 on AMD64

2005-08-05 Thread Joseph Oaks
Thanks, I will give that a try, and let you know.

Joe

Holografix ([EMAIL PROTECTED]) wrote:
>
> Hi
>
> Take a look here: http://forums.fedoraforum.org/showthread.php?t=59163
>
> I had that problem too.
>
> Regards
> holografix
>
>
> ""Joseph Oaks"" <[EMAIL PROTECTED]> escreveu na mensagem
> news:[EMAIL PROTECTED]
> > So, heres the deal, I'm running Fedora Core 3 on an dual proc AMD64
> > system.
> >
> > I have compiled Apache 2.0.54, and PHP 5.0.4, when I try to start apache
> > I am given an error. The error is as follows...
> >
> > [EMAIL PROTECTED] conf]# /etc/rc.d/init.d/httpd start
> > Starting httpd: Syntax error on line 24 of
> > /opt/apache-2.0.54/conf/httpd.conf:
> > Cannot load /opt/apache-2.0.54/modules/libphp5.so into server:
> > /opt/apache-2.0.54/modules/libphp5.so: cannot restore segment prot after
> > reloc:
> > Permission denied
> >
> > The only thing I'm finding on google is about /usr/lib64 well I don't have
> > a
> > /usr/lib64, its just /usr/lib so that can't be the issue.
> >
> > Any suggestion would be appreciated.
> > thanks
> >
> > Joe
> >
> > --
> > "Computers are like air conditioners - they stop working properly when you
> > open Windows"
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
"Computers are like air conditioners - they stop working properly when you
open Windows"

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



[PHP] Re: PHP 5.0.4 on AMD64

2005-08-05 Thread Holografix
Hi

Take a look here: http://forums.fedoraforum.org/showthread.php?t=59163

I had that problem too.

Regards
holografix


""Joseph Oaks"" <[EMAIL PROTECTED]> escreveu na mensagem 
news:[EMAIL PROTECTED]
> So, heres the deal, I'm running Fedora Core 3 on an dual proc AMD64 
> system.
>
> I have compiled Apache 2.0.54, and PHP 5.0.4, when I try to start apache
> I am given an error. The error is as follows...
>
> [EMAIL PROTECTED] conf]# /etc/rc.d/init.d/httpd start
> Starting httpd: Syntax error on line 24 of 
> /opt/apache-2.0.54/conf/httpd.conf:
> Cannot load /opt/apache-2.0.54/modules/libphp5.so into server:
> /opt/apache-2.0.54/modules/libphp5.so: cannot restore segment prot after
> reloc:
> Permission denied
>
> The only thing I'm finding on google is about /usr/lib64 well I don't have 
> a
> /usr/lib64, its just /usr/lib so that can't be the issue.
>
> Any suggestion would be appreciated.
> thanks
>
> Joe
>
> -- 
> "Computers are like air conditioners - they stop working properly when you
> open Windows" 

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



RE: FW: [PHP] [NEWBIE GUIDE] For the benefit of new members

2005-08-05 Thread Rick Emery

Quoting "Chris W. Parker" <[EMAIL PROTECTED]>:


Rick Emery 
   on Friday, August 05, 2005 4:54 PM said:


Well, as I found out when I Google'd before I posted, it *lists*
plenty of JavaScript mailing lists. But it can hardly "recommend a
good" one, which is what I asked for, can it? I was soliciting
opinions.


Yes I know, but I was hoping you wouldn't notice (because that's what
makes the joke so great)! :)


Oh, I get it now :-)

There has been a lot mentioned lately about checking Google before 
posting, and I didn't want anyone to think that I hadn't Google'd 
before I posted (I've actually joined a mailing list I found that way, 
but was looking for good recommendations). I apologize if I came off a 
little defensive.


Thanks,
Rick
--
Rick Emery

"When once you have tasted flight, you will forever walk the Earth
with your eyes turned skyward, for there you have been, and there
you will always long to return"
 -- Leonardo Da Vinci

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



[PHP] Can I retrieve a stored php session variable from within a javascript function?

2005-08-05 Thread Mauricio Pellegrini
Hi , 
I wonder if it's possible to retrieve the value from a php session
variable from within a javascript function.

Does anyone have any ideas about this?

Thank you 
Mauricio

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



RE: FW: [PHP] [NEWBIE GUIDE] For the benefit of new members

2005-08-05 Thread Chris W. Parker
Rick Emery 
on Friday, August 05, 2005 4:54 PM said:

> Well, as I found out when I Google'd before I posted, it *lists*
> plenty of JavaScript mailing lists. But it can hardly "recommend a
> good" one, which is what I asked for, can it? I was soliciting
> opinions.

Yes I know, but I was hoping you wouldn't notice (because that's what
makes the joke so great)! :)



Chris.

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



RE: FW: [PHP] [NEWBIE GUIDE] For the benefit of new members

2005-08-05 Thread Rick Emery

Quoting "Chris W. Parker" <[EMAIL PROTECTED]>:


Rick Emery 
   on Friday, August 05, 2005 4:20 PM said:


Can anybody recommend a good JavaScript mailing list?


If by anybody you mean Google, then yes anybody can recommend a good
JavaScript mailing list.


Well, as I found out when I Google'd before I posted, it *lists* plenty 
of JavaScript mailing lists. But it can hardly "recommend a good" one, 
which is what I asked for, can it? I was soliciting opinions.


Thanks for the reply anyway,
Rick
--
Rick Emery

"When once you have tasted flight, you will forever walk the Earth
with your eyes turned skyward, for there you have been, and there
you will always long to return"
 -- Leonardo Da Vinci

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



RE: FW: [PHP] [NEWBIE GUIDE] For the benefit of new members

2005-08-05 Thread Chris W. Parker
Rick Emery 
on Friday, August 05, 2005 4:20 PM said:

> Can anybody recommend a good JavaScript mailing list?

If by anybody you mean Google, then yes anybody can recommend a good
JavaScript mailing list.


Hope this helps!
Chris.

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



Re: FW: [PHP] [NEWBIE GUIDE] For the benefit of new members

2005-08-05 Thread Rick Emery

Quoting Jay Blanchard <[EMAIL PROTECTED]>:


6. PHP is a server side scripting language. Whatever processing PHP does
takes place BEFORE the output reaches the client. Therefore, it is not
possible to access users' computer related information (OS, screen size
etc) using PHP. Nor can you modify any the user side settings. You need
to go for JavaScript and ask the question in a JavaScript list.


Since you brought it up :-)

Can anybody recommend a good JavaScript mailing list?

Thanks,
Rick
--
Rick Emery

"When once you have tasted flight, you will forever walk the Earth
with your eyes turned skyward, for there you have been, and there
you will always long to return"
 -- Leonardo Da Vinci

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



[PHP] Javascript Src and HTTP_REFERER

2005-08-05 Thread Cabbar Duzayak
Hi,

I have a web page (say page1) which refers to a php within javascript tag as:

http://mysite.com/javascript_dump.php";>

As you can see, this calls a php file which dumps javascript. The
problem here is, within this php I couldn't get which page it is
called from.

Basically, if it comes from affiliate site 1, I will show some
content, and if it comes from affiliate site 2, I will show some other
content.

And, the thing is, within this javascript_dump.php, HTTP_REFERER shows
nothing, because it gives you the referer of the html page (page1)
that contains this 

Re: [PHP] Magic Quotes or Curley Quotes or Something

2005-08-05 Thread Lance Earl
Hi Marco,

Thanks for the help, you gave me a place to start. Before doing what would
amount to a lot of coding to correct this problem throughout my site I
wanted to see if it could be corrected on the server side.

I found the following section in the php.ini file:

; As of 4.0b4, PHP always outputs a character encoding by default in
; the Content-type: header.  To disable sending of the charset, simply
; set it to be empty.
;
; PHP's built-in default is text/html
default_mimetype = "text/html"
default_charset = "utf-8"
;default_charset = "iso-8859-1"

In the default file the iso-8859-1 line was commented out so I uncommented
it to see it that would help. It changed the unreadable goop to another
type of unreadable goop but the problem remained.

I then recommented the iso-8859-1 line and added the utf-8 line. This
changed the output back to what I had before. My thinking is that since my
code worked under the older version of php, it should also work under the
newer version if I can configure it correctly.

Thanks,

Lance

> Hello Lance--
>
> On 8/5/05 2:18 PM, "Lance Earl" <[EMAIL PROTECTED]> wrote:
>
>> I recently upgraded my server. It is running Ubuntu Linux with PHP and
>> MySQL. My site allows people to post content to their own web oages
>> through a web interface. Many of my customers compose their content on a
>> word processer and then cust and paste it to the web interface for
>> insertion to the database and later retrevial and display on a web page.
>>
>> The problem I am having is that content which includes quotes is is not
>> being seen correctly. Rather than inserting a slashed quote (/"), it
>> inserts a bunch of strange formatted gunk. A sample of the problem anc
>> be
>> seen at www.dallypost.com/ranch/page5688.php
>>
>
> You have an encoding problem--the content is being uploaded to your site
> using a different encoding mechanism (most likely utf-8) than the one you
> use to display it.
>
> I'm not much of an expert in this area, but a couple of suggestions:
>
> 1. You're already outputting UTF-8 code from the looks of it, so a simple
>
> Header ("Content-type: text/html; charset=utf-8");
>
> Or even adding this to your HTML code in the :
>
> 
>
> Should do it. Remember to also use htmlentities ($data, null, "utf-8"); to
> properly encode the entities in your content.
>
> 2. Convert the text over from UTF-8 to ISO-8859-1. I think you can use
> utf8_decode, or you may have to go with the mbstring extension (not too
> sure
> here, I'd just go ahead and convert everything over to UTF-8).
>
> I'm sure some other people who have more experience with this stuff can
> give
> you even more pointers, but this should get you started.
>
> Cheers,
>
>
> Marco
>
> --
> BeebleX - The PHP Search Engine
> http://beeblex.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Lance Earl, President
DallyPost, Inc. - Equine Marketing/Training/Shows
Rockland, Idaho 208-548-2721 or 208-604-2721
[EMAIL PROTECTED]
http://www.dallypost.com  http://www.dallypost.com/ranch
Horse Marketing - Clinics - Shows

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



Re: [PHP] how to check http:// or https:// ?

2005-08-05 Thread Matt Blasinski
True, but if you check that it's equal to 'on' and it doesn't exist, 
you'll get a warning.  If you want to avoid the warning, check that it 
exists first.


Matt



I mean, if $_SERVER['HTTPS'] exists doesn't mean it's equal to 'on'
but if $_SERVER['HTTPS'] == 'on' IT MEANS $_SERVER['HTTPS'] exists

why then
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on')


-afan


Jochem Maas wrote:


Marco Tabini wrote:


On 8/5/05 2:43 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:



Thanks Marco!
:)

I was looking for something like this on phpinfo() but didn't found?





That's because it shows up only if you are under HTTPS! :-)




AFAICT tell you should check whether the value is actually set to 'on'
(IIRC a post by Rasmus):

e.g.

if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') {
echo 'you are secure(-ish?)';   }

SIDENOTE REGARDING BEEBLEX.COM:

I just added a bookmark in firefox to beeblex.com as follows

http://beeblex.com/search.php?d=ALLDB&s=%s
and I gave it a keyword of 'beeb'

now I can go to firefox and type 'beeb HTTPS' to get an direct hit -
so now there is no excuse not to be using Marco's cool new resource :-)




Marco




-afan

Marco Tabini wrote:



IIRC, if you're using Apache you can check

If (isset ($_SERVER['HTTPS']))

You can also check this thread:

http://beeblex.com/lists/index.php/php.general/190410?h=%24_SERVER%5B%27HTTP 


S%27%5D

--
BeebleX - The PHP Search Engine
http://beeblex.com

On 8/5/05 2:05 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:





Hi,
I need to check does URL use http or https?

Right now I use this code:

if(preg_match('/https:/', $_SERVER['SCRIPT_URI']) == false)
{
 header('location: [URL]https://www.test.com/test.php[/URL]');
 exit;
}

but I am sure there is much better solution.
:)
 























--
Matt Blasinski (mbv)
Information Systems Technology Services Professional
Internet Infrastructure Applications Technology
Division of Information Technology
3228 Computer Science and Statistics
1210 West Dayton Street
Madison WI 53706
Work (608) 263-4865
Personal Cell (608) 347-6940



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



[PHP] PHP 5.0.4 on AMD64

2005-08-05 Thread Joseph Oaks
So, heres the deal, I'm running Fedora Core 3 on an dual proc AMD64 system.

I have compiled Apache 2.0.54, and PHP 5.0.4, when I try to start apache
I am given an error. The error is as follows...

[EMAIL PROTECTED] conf]# /etc/rc.d/init.d/httpd start
Starting httpd: Syntax error on line 24 of /opt/apache-2.0.54/conf/httpd.conf:
Cannot load /opt/apache-2.0.54/modules/libphp5.so into server:
/opt/apache-2.0.54/modules/libphp5.so: cannot restore segment prot after
reloc:
Permission denied

The only thing I'm finding on google is about /usr/lib64 well I don't have a
/usr/lib64, its just /usr/lib so that can't be the issue.

Any suggestion would be appreciated.
thanks

Joe

-- 
"Computers are like air conditioners - they stop working properly when you
open Windows"

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



Re: [PHP] how to check http:// or https:// ?

2005-08-05 Thread [EMAIL PROTECTED]

Right. Tested and found $_SERVER['HTTPS'] has to be 'on'  :)

But, there is something in the code Jochem wrote that bothers me for a 
while:


if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') {
   echo 'you are secure(-ish?)';   
}


Doesn't
$_SERVER['HTTPS']=='on'
automatically means
isset($_SERVER['HTTPS'])
?

I mean, if $_SERVER['HTTPS'] exists doesn't mean it's equal to 'on'
but if $_SERVER['HTTPS'] == 'on' IT MEANS $_SERVER['HTTPS'] exists

why then
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on')


-afan


Jochem Maas wrote:


Marco Tabini wrote:


On 8/5/05 2:43 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:



Thanks Marco!
:)

I was looking for something like this on phpinfo() but didn't found?




That's because it shows up only if you are under HTTPS! :-)



AFAICT tell you should check whether the value is actually set to 'on'
(IIRC a post by Rasmus):

e.g.

if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') {
echo 'you are secure(-ish?)';   
}


SIDENOTE REGARDING BEEBLEX.COM:

I just added a bookmark in firefox to beeblex.com as follows

http://beeblex.com/search.php?d=ALLDB&s=%s
and I gave it a keyword of 'beeb'

now I can go to firefox and type 'beeb HTTPS' to get an direct hit -
so now there is no excuse not to be using Marco's cool new resource :-)




Marco




-afan

Marco Tabini wrote:



IIRC, if you're using Apache you can check

If (isset ($_SERVER['HTTPS']))

You can also check this thread:

http://beeblex.com/lists/index.php/php.general/190410?h=%24_SERVER%5B%27HTTP 


S%27%5D

--
BeebleX - The PHP Search Engine
http://beeblex.com

On 8/5/05 2:05 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:





Hi,
I need to check does URL use http or https?

Right now I use this code:

if(preg_match('/https:/', $_SERVER['SCRIPT_URI']) == false)
{
 header('location: [URL]https://www.test.com/test.php[/URL]');
 exit;
}

but I am sure there is much better solution.
:)
 



















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



Re: [PHP] String to Stream

2005-08-05 Thread Jochem Maas

Eric Gorr wrote:

Jochem Maas wrote:


Eric Gorr wrote:


Jochem Maas wrote:
 > http://php.net/manual/en/function.stream-wrapper-register.php is as


close as it gets
I think. - total overkill for manipulating strings IMHO - (me thinks 
there is atleast
one other in agreement) - there is a reason php has all those built 
in string functions :-)





And there are good reasons why other very intelligent people thought 
that including such functionality directly in the C++ STL and many 
other  libraries was a good idea too.




indeed - but php !== c++ obviously.

personally I don't get your angle on this one, but like Jay I'd be 
interested to know how you think this might be useful - so if you

could give an explicit (as poss.) example it might help us to
understand.



Well, as I mentioned before, you are welcome to look into the 
surrounding useful examples for istringstream, etc. I can't think of a 
single reason why similar reasons why istringstream, etc. is useful 
would not apply to a php stream_wrapper for strings.


I know google - the c++ stuff is a little (my first understatement of the day 
:-)
over my head - couldn't find anything that made things clearer for me.



As for why things like istringstream, etc. are useful, you can also head 
over comp.lang.c++ and ask...I, quite simply, have no interest in a 
debate or discussion I already know the final answer toi.e. it is 


thanks for the heads up.


useful.


some people would say the same about guns - I don't get that either.




btw do you think the functionality surrounding stream_wrapper_register()
will do it for you?



I don't see any reason why not at the moment.


thats good I guess :-)






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



[PHP] Re: Sending post data from a script

2005-08-05 Thread Manuel Lemos

Hello,

on 08/05/2005 04:33 PM Paul Nowosielski said the following:

I'm trying to setup a PHP script that will send a POST data request to a
web form. The script needs to be automatic and not driven by a web form.

For example.

I have a cron script that runs every 15 minutes. The cron script calls
my php script on the server and sends the important data to a web based
form without human interaction. The data has to be passed with the
method="post". Sending the data via a URL request does not suffice.

So my question in general is: How can I send HTTP POST data to a remote
interface without using an HTML FORM?.


You may want to take a look at this HTTP client class. Besides 
submitting POST form values, it also handles redirection and cookies if 
necessary.


http://www.phpclasses.org/httpclient


--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

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



RE: [PHP] String to Stream

2005-08-05 Thread Jay Blanchard
[snip]
Well, as I mentioned before, you are welcome to look into the 
surrounding useful examples for istringstream, etc. I can't think of a 
single reason why similar reasons why istringstream, etc. is useful 
would not apply to a php stream_wrapper for strings.

As for why things like istringstream, etc. are useful, you can also head

over comp.lang.c++ and ask...I, quite simply, have no interest in a 
debate or discussion I already know the final answer toi.e. it is 
useful.
[/snip]

That is all cool Eric, we weren't looking for a debate or dicussion
either, we were trying to help. Usually people post here with a more
specific problem or issue that they are looking for a solution to.

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



Re: [PHP] String to Stream

2005-08-05 Thread Eric Gorr

Jochem Maas wrote:

Eric Gorr wrote:


Jochem Maas wrote:
 > http://php.net/manual/en/function.stream-wrapper-register.php is as


close as it gets
I think. - total overkill for manipulating strings IMHO - (me thinks 
there is atleast
one other in agreement) - there is a reason php has all those built 
in string functions :-)




And there are good reasons why other very intelligent people thought 
that including such functionality directly in the C++ STL and many 
other  libraries was a good idea too.



indeed - but php !== c++ obviously.

personally I don't get your angle on this one, but like Jay I'd be 
interested to know how you think this might be useful - so if you

could give an explicit (as poss.) example it might help us to
understand.


Well, as I mentioned before, you are welcome to look into the 
surrounding useful examples for istringstream, etc. I can't think of a 
single reason why similar reasons why istringstream, etc. is useful 
would not apply to a php stream_wrapper for strings.


As for why things like istringstream, etc. are useful, you can also head 
over comp.lang.c++ and ask...I, quite simply, have no interest in a 
debate or discussion I already know the final answer toi.e. it is 
useful.



btw do you think the functionality surrounding stream_wrapper_register()
will do it for you?


I don't see any reason why not at the moment.


--
== Eric Gorr === http://www.ericgorr.net ===
"I believe each individual is naturally entitled to do as he pleases
with himself and the fruits of his labor, so far as it in no way
interferes with any other man's rights." - Abraham Lincoln
== Insults, like violence, are the last refuge of the incompetent... ===

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



Re: [PHP] Re: need help finding parsing error please

2005-08-05 Thread Matthew Weier O'Phinney
* Jochem Maas <[EMAIL PROTECTED]> :
> Matthew Weier O'Phinney wrote:
> > * Bruce Gilbert <[EMAIL PROTECTED]> :
> > >
> > > I am getting this on the following code, and I am not sure what is
> > > causing the error and need some pros to take a look at it for me.
> > >
> > > the error is:
> > >
> > > Parse error: parse error, unexpected '{' in
> > > /hsphere/local/home/bruceg/inspired-evolution.com/Contact_Form2.php on
> > > line 161
>
> the error is correct. (that sounds funny)
>
> find the line containing:
>
> if (isset($err_msg) || isset($email_err) { echo
>
> and look _very_ _very_ carefully at it. look again.
> see it now?
>
> I don't know if my mail client made a mess of your code layout
> or if it was just a mess - if it was a mess to begin with then
> I would recommend you try and be more consistent in the way you
> present your code - it makes it easier to maintain and debug - granted
> php doesn't care about the layout - you can write everything on a single line
> if you really want. google on Coding Standards - pick a style your eyes like
> and try to stick with it - you wont regret it.

+1 

I personally use PEAR's CS, and made that decision a little over a year
ago. I've never looked back, and code I've had to maintain that predates
that decision gets updated -- simply because it makes maintenance and
debugging a thousandfold easier.

> > 
> > 
> > > if ($_POST['op']!='ds') { 
> > >// they need to see the form
> > >echo "$form_block";
> > >} else if ($_POST["op"]  == "ds")  {
> > 
> > 
> > Where's the end to this elseif? You follow it immediately with the
> > following lines, which simply won't work (can't define functions inside
> > if() blocks).
>
> Matthew but it's perfectly valid to define a function inside an if()
> block... It generally gets doen in apps where they have to support older 
> versions
> of php and conditionally define functions if they don't exist e.g.
>
> if (!defined("array_push")) {
>   function array_push($arr, $val)  { /*stuff*/ }
> }

D'oh! I was thinking this was an anonymous function (ala perl), and of
course it's not. Good catch, Jochem.

-- 
Matthew Weier O'Phinney
Zend Certified Engineer
http://weierophinney.net/matthew/

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



Re: [PHP] String to Stream

2005-08-05 Thread Jochem Maas

Eric Gorr wrote:

Jochem Maas wrote:
 > http://php.net/manual/en/function.stream-wrapper-register.php is as


close as it gets
I think. - total overkill for manipulating strings IMHO - (me thinks 
there is atleast
one other in agreement) - there is a reason php has all those built in 
string functions :-)



And there are good reasons why other very intelligent people thought 
that including such functionality directly in the C++ STL and many other 
 libraries was a good idea too.


indeed - but php !== c++ obviously.

personally I don't get your angle on this one, but like Jay I'd be interested
to know how you think this might be useful - so if you could give an explicit
(as poss.) example it might help us to understand.

btw do you think the functionality surrounding stream_wrapper_register()
will do it for you?







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



Re: [PHP] String to Stream

2005-08-05 Thread Miles Thompson


But WHY WHY WHY would one want to treat a string as a stream, when PHP has 
such good string handling functions?


THATS not been explained.

(Unless, knowing C and its limited string handling capabilities, one is 
looking for a familiar hammer.)


It's Friday - time to go socialize - Miles

PS How do you like Canada's new Governor General? Sharper looking than the 
average, middle-aged-to-ancient white male politico, which is what we have 
historically been saddled with. /mt


At 04:24 PM 8/5/2005, Eric Gorr wrote:

Jay Blanchard wrote:

[snip]
Neither solution was particularly appealing which is why I asked the 
question.

[/snip]
I see. Sorry I couldn't be more helpful. And I thought you wore looking
for a more precise function rather than the whole lot of things that can
be accomplished with isstringstream.


Looks like it wouldn't be terribly difficult to get something like this up 
and running.


I was just taking a look at:

http://us3.php.net/manual/en/function.stream-wrapper-register.php

I'm kinda surprised no one has written a wrapper for strings yet...


--
== Eric Gorr === http://www.ericgorr.net ===


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



Re: [PHP] String to Stream

2005-08-05 Thread Eric Gorr

Jochem Maas wrote:
 > http://php.net/manual/en/function.stream-wrapper-register.php is as

close as it gets
I think. - total overkill for manipulating strings IMHO - (me thinks 
there is atleast
one other in agreement) - there is a reason php has all those built in 
string functions :-)


And there are good reasons why other very intelligent people thought 
that including such functionality directly in the C++ STL and many other 
 libraries was a good idea too.




--
== Eric Gorr === http://www.ericgorr.net ===
"I believe each individual is naturally entitled to do as he pleases
with himself and the fruits of his labor, so far as it in no way
interferes with any other man's rights." - Abraham Lincol
== Insults, like violence, are the last refuge of the incompetent... ===

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



Re: [PHP] how to check http:// or https:// ?

2005-08-05 Thread Jochem Maas

Marco Tabini wrote:

On 8/5/05 3:24 PM, "Jochem Maas" <[EMAIL PROTECTED]> wrote:


SIDENOTE REGARDING BEEBLEX.COM:

I just added a bookmark in firefox to beeblex.com as follows

http://beeblex.com/search.php?d=ALLDB&s=%s
and I gave it a keyword of 'beeb'

now I can go to firefox and type 'beeb HTTPS' to get an direct hit -
so now there is no excuse not to be using Marco's cool new resource :-)




:-)

There's also a Firefox search toolbar with a Google passthru:

http://beeblex.com/faq/ <-- (see item #4)


impressive

really very nice indeed!



Cheers,


Marco




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



Re: [PHP] Sending post data from a script

2005-08-05 Thread Jochem Maas

Paul Nowosielski wrote:

Hi All,

I'm trying to setup a PHP script that will send a POST data request to a
web form. The script needs to be automatic and not driven by a web form.

For example.

I have a cron script that runs every 15 minutes. The cron script calls
my php script on the server and sends the important data to a web based
form without human interaction. The data has to be passed with the
method="post". Sending the data via a URL request does not suffice.

So my question in general is: How can I send HTTP POST data to a remote
interface without using an HTML FORM?.

Any suggestions would be appreciated.


assuming the cron script in written in php ;-) 
try the curl extension - should do nicely:

http://php.net/curl




TIA!



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



RE: [PHP] Sending post data from a script

2005-08-05 Thread Jay Blanchard
[snip]
I'm trying to setup a PHP script that will send a POST data request to a
web form. The script needs to be automatic and not driven by a web form.

For example.

I have a cron script that runs every 15 minutes. The cron script calls
my php script on the server and sends the important data to a web based
form without human interaction. The data has to be passed with the
method="post". Sending the data via a URL request does not suffice.

So my question in general is: How can I send HTTP POST data to a remote
interface without using an HTML FORM?.

Any suggestions would be appreciated.
[/snip]

http://www.php.net/curl

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



Re: [PHP] String to Stream

2005-08-05 Thread Jochem Maas

Eric Gorr wrote:
This should be a fairly easy question for someone who already knows the 
answer...


What I would like to be able to do is take a string and place it into a 
'resource' so I can use functons like fscanf, fseek to process the string.


Is this possible? If so, how?


http://php.net/manual/en/function.stream-wrapper-register.php is as close as it 
gets
I think. - total overkill for manipulating strings IMHO - (me thinks there is 
atleast
one other in agreement) - there is a reason php has all those built in string 
functions :-)



p.s. While I would be interested in possible alternative solutions, I 
would like to know how to accomplish this task even if it does not end 
up being the solution I use.





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



[PHP] Sending post data from a script

2005-08-05 Thread Paul Nowosielski
Hi All,

I'm trying to setup a PHP script that will send a POST data request to a
web form. The script needs to be automatic and not driven by a web form.

For example.

I have a cron script that runs every 15 minutes. The cron script calls
my php script on the server and sends the important data to a web based
form without human interaction. The data has to be passed with the
method="post". Sending the data via a URL request does not suffice.

So my question in general is: How can I send HTTP POST data to a remote
interface without using an HTML FORM?.

Any suggestions would be appreciated.


TIA!

-- 
Paul Nowosielski
Webmaster CelebrityAccess.com
303.440.0666 ext:219 

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



Re: [PHP] Re: Is gethostbyaddr() slow?

2005-08-05 Thread Kristen G. Thorson



kalinga wrote:


On 8/4/05, Kristen G. Thorson <[EMAIL PROTECTED]> wrote:
 


kalinga wrote:

   


if you are quering a external host, the bad network conditions may

cause delay in results.

if your server is connected to a heavily loaded hub/ cheap switch, or
the target hosts DNS servers are poorly configured/ slow in responce
it adds further delay to your result.

try dig/ nslookup on your server for the target hostname/address, you
may experience the same delay as with the php function.



 

Thanks for the reply.  The problem I had - and that I was trying to 
briefly describe - is not quite explained by slow DNS lookup, at least 
not so far.  I have one script, run on the same machine:


takes less than 1 second on CLI:

# php gethostbyname.php
Content-type: text/html
X-Powered-By: PHP/4.3.2

gethostbyname(www.imakenews.com) took 0.0010 s and resolved to 
208.254.39.65
gethostbyname(rssnewsapps.ziffdavis.com) took 0.0005 s and resolved to 
63.87.252.162
gethostbyname(itpapers.zdnet.com) took 0.1922 s and resolved to 
216.239.113.159
gethostbyname(rssnewsapps.ziffdavis.com) took 0.0005 s and resolved to 
63.87.252.162



Running CLI again, host names are apparently cached, because then they 
all return in .0005 seconds.


takes 20 seconds under Apache 2.0.46:

gethostbyname(www.imakenews.com) took 5.0071 s and resolved to 
208.254.39.65
gethostbyname(rssnewsapps.ziffdavis.com) took 5.0099 s and resolved to 
63.87.252.162
gethostbyname(itpapers.zdnet.com) took 5.0097 s and resolved to 
216.239.113.159
gethostbyname(rssnewsapps.ziffdavis.com) took 5.0099 s and resolved to 
63.87.252.162



This will happen consistently, with less than 1/100 s variation in time 
for each lookup.



Any DNS lookup tools are perfectly fast when run from the command line.  
Also, other machines in the same subnet, using the same DNS servers, 
using 99% same apache config files (I diff'ed 'em) run just as fast 
under same apache/php version as they do command line.  It's hard to 
imagine what external DNS problem could exist that would affect only one 
of our servers, and on that one, only apache/php and nothing command 
line.  Something else is going on, but my initial tries of 
downgrading/upgrading both php and apache haven't made a different yet.  
Perhaps you have another suggestion?
   



could you please mention the environment, i mean, the os, and the
versions of php? is it binary install or a compile?

 



All binaries - RH-packaged rpms.

Working version (takes < 1 second for each gethostbyname() call under 
CLI and under apache):


# rpm -qa | grep php
php-odbc-4.3.2-23.ent
php-imap-4.3.2-23.ent
php-pgsql-4.3.2-23.ent
php-4.3.2-23.ent
php-ldap-4.3.2-23.ent
php-mysql-4.3.2-23.ent
# rpm -qa | grep httpd
httpd-2.0.46-46.ent
redhat-config-httpd-1.1.0-4.30.2
httpd-devel-2.0.46-46.ent
# uname -r -o -i -s
Linux 2.4.21-4.ELsmp i386 GNU/Linux


Not working (takes 5 seconds for each gethostbyname() call under apache, 
but < 1 second under CLI):


# rpm -qa | grep php
php-imap-4.3.2-23.ent
php-4.3.2-23.ent
php-odbc-4.3.2-23.ent
php-mysql-4.3.2-23.ent
php-ldap-4.3.2-23.ent
php-pgsql-4.3.2-23.ent
# rpm -qa | grep httpd
httpd-2.0.46-46.ent
redhat-config-httpd-1.1.0-4.30.2
httpd-devel-2.0.46-46.ent
# uname -r -o -i -s
Linux 2.4.21-4.ELsmp i386 GNU/Linux


The function returns correctly, but it takes about 5 seconds every 
time.  After I run the script the first time on the "not working" 
machine, it looks like the names are cached for the CLI, as they tend to 
take only .0005 seconds to resolve.


Thanks for the help.


kgt





Re: [PHP] how to check http:// or https:// ?

2005-08-05 Thread Marco Tabini
On 8/5/05 3:24 PM, "Jochem Maas" <[EMAIL PROTECTED]> wrote:
> SIDENOTE REGARDING BEEBLEX.COM:
> 
> I just added a bookmark in firefox to beeblex.com as follows
> 
> http://beeblex.com/search.php?d=ALLDB&s=%s
> and I gave it a keyword of 'beeb'
> 
> now I can go to firefox and type 'beeb HTTPS' to get an direct hit -
> so now there is no excuse not to be using Marco's cool new resource :-)
> 

:-)

There's also a Firefox search toolbar with a Google passthru:

http://beeblex.com/faq/ <-- (see item #4)

Cheers,


Marco

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



RE: [PHP] String to Stream

2005-08-05 Thread Jay Blanchard
[snip]
Looks like it wouldn't be terribly difficult to get something like this 
up and running.

I was just taking a look at:

http://us3.php.net/manual/en/function.stream-wrapper-register.php

I'm kinda surprised no one has written a wrapper for strings yet...
[/snip]

Perhaps because there is such a wealth of string handling functions now
that not anyone has seen a need to do so. That is why I suggested that
you might be interested in writing an extension if you see it being a
valuable tool to have in your arsenal.

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



Re: [PHP] String to Stream

2005-08-05 Thread Eric Gorr

Jay Blanchard wrote:

[snip]
Neither solution was particularly appealing which is why I asked the 
question.

[/snip]

I see. Sorry I couldn't be more helpful. And I thought you wore looking
for a more precise function rather than the whole lot of things that can
be accomplished with isstringstream. 


Looks like it wouldn't be terribly difficult to get something like this 
up and running.


I was just taking a look at:

http://us3.php.net/manual/en/function.stream-wrapper-register.php

I'm kinda surprised no one has written a wrapper for strings yet...


--
== Eric Gorr === http://www.ericgorr.net ===
"Government is not reason, it is not eloquence, it is force; like fire,
a troublesome servant and a fearful master." - George Washington
== Insults, like violence, are the last refuge of the incompetent... ===

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



Re: [PHP] how to check http:// or https:// ?

2005-08-05 Thread Jochem Maas

Marco Tabini wrote:

On 8/5/05 2:43 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:



Thanks Marco!
:)

I was looking for something like this on phpinfo() but didn't found?



That's because it shows up only if you are under HTTPS! :-)


AFAICT tell you should check whether the value is actually set to 'on'
(IIRC a post by Rasmus):

e.g.

if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') {
echo 'you are secure(-ish?)';   
}

SIDENOTE REGARDING BEEBLEX.COM:

I just added a bookmark in firefox to beeblex.com as follows

http://beeblex.com/search.php?d=ALLDB&s=%s
and I gave it a keyword of 'beeb'

now I can go to firefox and type 'beeb HTTPS' to get an direct hit -
so now there is no excuse not to be using Marco's cool new resource :-)




Marco




-afan

Marco Tabini wrote:



IIRC, if you're using Apache you can check

If (isset ($_SERVER['HTTPS']))

You can also check this thread:

http://beeblex.com/lists/index.php/php.general/190410?h=%24_SERVER%5B%27HTTP
S%27%5D

--
BeebleX - The PHP Search Engine
http://beeblex.com

On 8/5/05 2:05 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:





Hi,
I need to check does URL use http or https?

Right now I use this code:

if(preg_match('/https:/', $_SERVER['SCRIPT_URI']) == false)
{
 header('location: [URL]https://www.test.com/test.php[/URL]');
 exit;
}

but I am sure there is much better solution.
:)
  














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



RE: [PHP] String to Stream

2005-08-05 Thread Michael Sims
Eric Gorr wrote:
> Again, I would like to treat the string as a stream.
>
> One possible way to accomplish this would be to simply write the
> string to a temporary file, open the file with fopen and then use
> fscanf, fseek, etc. to process the text.
>
> However, I am assuming there is an easier way (i.e. a method without
> the file io overhead) to be able to treat the string as a stream.

If you're willing to go the lengths of writing out a temporary file and the 
overhead
is the only thing that is stopping you, AND you are running on Linux, consider 
using
a tmpfs volume (RAM-based) and write your temp files there.  That should almost
eliminate any overhead of writing the file out.  tmpfs is flexible, as it grows 
(up
to a maximum you can set) and shrinks as necessary, and can even have its 
contents
paged out to the swap file if they haven't been accessed in a while.  Assuming
you've got the RAM to spare, setting one up is as simple as creating a 
directory and
adding an entry to /etc/fstab.  I've used tmpfs volumes for similar things in 
the
past with great success.  FWIW...

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



RE: [PHP] String to Stream

2005-08-05 Thread Jay Blanchard
[snip]
Neither solution was particularly appealing which is why I asked the 
question.
[/snip]

I see. Sorry I couldn't be more helpful. And I thought you wore looking
for a more precise function rather than the whole lot of things that can
be accomplished with isstringstream. 

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



Re: [PHP] String to Stream

2005-08-05 Thread Eric Gorr

Jay Blanchard wrote:

However, if I
know what you want to do with the string more specifically (I asked for
examples, which you have not given) I can get you to the right PHP
functions. 


I am familiar with all of the PHP string functions.


PHP does not have a class or function similar to
isstringstream


Ok.

I thought it might since PHP does apparently have some generic stream 
functionality.


see: http://us3.php.net/stream



(I have not checked phpclasses.org to see if someone has
written one, so there might be one there).


I could not find any. Entering 'string stream' into the search field did 
not appear to turn up anything useful.


So, please provide a more precise example. 


Please see useful examples related to istringstream. A google search 
would be useful here.



You could always write an
extension if the answers I have given are not satisfactory, but I think
that PHP has many built in string functions that it can probably
manipulate a string any way that you would desire.


As you have already stated, the PHP built in string functions are not 
directly capable of treating a string as a stream.


But thank you, it would appear that I will either need to write the 
string out to a file and then read it back in or just use the builtin 
string functions to process the string.


Neither solution was particularly appealing which is why I asked the 
question.


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



Re: [PHP] Magic Quotes or Curley Quotes or Something

2005-08-05 Thread Jochem Maas

Lance Earl wrote:

I recently upgraded my server. It is running Ubuntu Linux with PHP and
MySQL. My site allows people to post content to their own web oages
through a web interface. Many of my customers compose their content on a
word processer and then cust and paste it to the web interface for
insertion to the database and later retrevial and display on a web page.

The problem I am having is that content which includes quotes is is not
being seen correctly. Rather than inserting a slashed quote (/"), it


I don't think it's the root of your problem but I think you mean an espaced
quote - i.e. one that been 'backslashed' - \"


inserts a bunch of strange formatted gunk. A sample of the problem anc be
seen at www.dallypost.com/ranch/page5688.php


Marco seems to be right about the encoding - but I can;t admit to even knowing
half as much as him about that topic (make me dizzy everytime!) so I won't 
attempt
to thicken the plot sp to speak.

g'luck



Thanks




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



Re: [PHP] Re: need help finding parsing error please

2005-08-05 Thread Jochem Maas

Matthew Weier O'Phinney wrote:

* Bruce Gilbert <[EMAIL PROTECTED]>:


Hello,

I am getting this on the following code, and I am not sure what is
causing the error and need some pros to take a look at it for me.

the error is:

Parse error: parse error, unexpected '{' in
/hsphere/local/home/bruceg/inspired-evolution.com/Contact_Form2.php on
line 161


the error is correct. (that sounds funny)

find the line containing:

if (isset($err_msg) || isset($email_err) { echo

and look _very_ _very_ carefully at it. look again.
see it now?

I don't know if my mail client made a mess of your code layout
or if it was just a mess - if it was a mess to begin with then
I would recommend you try and be more consistent in the way you
present your code - it makes it easier to maintain and debug - granted
php doesn't care about the layout - you can write everything on a single line
if you really want. google on Coding Standards - pick a style your eyes like
and try to stick with it - you wont regret it.






if ($_POST['op']!='ds') { 
   // they need to see the form

   echo "$form_block";
   } else if ($_POST["op"]  == "ds")  {



Where's the end to this elseif? You follow it immediately with the
following lines, which simply won't work (can't define functions inside
if() blocks).


Matthew but it's perfectly valid to define a function inside an if()
block... It generally gets doen in apps where they have to support older 
versions
of php and conditionally define functions if they don't exist e.g.

if (!defined("array_push")) {
function array_push($arr, $val)  { /*stuff*/ }
}





//Function saves time and space by eliminating unneccesary code
function check($fieldname)
{






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



RE: [PHP] String to Stream

2005-08-05 Thread Jay Blanchard
[snip]
Jay Blanchard wrote:
> What, exactly, do you want to accomplish? 

I want to be able to treat a string as a stream.
[/snip]

I know C++ and I know what you are talking about here. As I said before,
you would have pretty high overhead to do this in PHP. However, if I
know what you want to do with the string more specifically (I asked for
examples, which you have not given) I can get you to the right PHP
functions. PHP does not have a class or function similar to
isstringstream (I have not checked phpclasses.org to see if someone has
written one, so there might be one there).

So, please provide a more precise example. You could always write an
extension if the answers I have given are not satisfactory, but I think
that PHP has many built in string functions that it can probably
manipulate a string any way that you would desire.

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



Re: [PHP] String to Stream

2005-08-05 Thread Eric Gorr

Jay Blanchard wrote:
What, exactly, do you want to accomplish? 


I want to be able to treat a string as a stream.

For example, the C++ STL contains istringstream, which allows one to 
treat strings as streams. 
(http://www.cplusplus.com/ref/iostream/istringstream/)


If you are truly wondering why such functionality is useful and examples 
of usefulness, I might recommend asking at comp.lang.c++ 
(http://groups-beta.google.com/group/comp.lang.c++).


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



Re: [PHP] how to check http:// or https:// ?

2005-08-05 Thread Marco Tabini

On 8/5/05 2:43 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:

> Thanks Marco!
> :)
> 
> I was looking for something like this on phpinfo() but didn't found?

That's because it shows up only if you are under HTTPS! :-)


Marco

> 
> 
> -afan
> 
> Marco Tabini wrote:
> 
>> IIRC, if you're using Apache you can check
>> 
>> If (isset ($_SERVER['HTTPS']))
>> 
>> You can also check this thread:
>> 
>> http://beeblex.com/lists/index.php/php.general/190410?h=%24_SERVER%5B%27HTTP
>> S%27%5D
>> 
>> --
>> BeebleX - The PHP Search Engine
>> http://beeblex.com
>> 
>> On 8/5/05 2:05 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>> 
>>  
>> 
>>> Hi,
>>> I need to check does URL use http or https?
>>> 
>>> Right now I use this code:
>>> 
>>> if(preg_match('/https:/', $_SERVER['SCRIPT_URI']) == false)
>>> {
>>>   header('location: [URL]https://www.test.com/test.php[/URL]');
>>>   exit;
>>> }
>>> 
>>> but I am sure there is much better solution.
>>> :)
>>>
>>> 
>> 
>> 
>> 
>> 
>> 
>>  
>> 

-- 
Marco Tabini
President & CEO

Marco Tabini & Associates, Inc.
28 Bombay Ave.
Toronto, ON M3H 1B7
Canada

Phone: +1 (416) 630-6202
Fax: +1 (416) 630-5057

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



Re: [PHP] how to check http:// or https:// ?

2005-08-05 Thread [EMAIL PROTECTED]

Thanks Marco!
:)

I was looking for something like this on phpinfo() but didn't found?


-afan

Marco Tabini wrote:


IIRC, if you're using Apache you can check

If (isset ($_SERVER['HTTPS']))

You can also check this thread:

http://beeblex.com/lists/index.php/php.general/190410?h=%24_SERVER%5B%27HTTP
S%27%5D

--
BeebleX - The PHP Search Engine
http://beeblex.com

On 8/5/05 2:05 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:

 


Hi,
I need to check does URL use http or https?

Right now I use this code:

if(preg_match('/https:/', $_SERVER['SCRIPT_URI']) == false)
{
  header('location: [URL]https://www.test.com/test.php[/URL]');
  exit;
}

but I am sure there is much better solution.
:)
   







 



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



RE: [PHP] String to Stream

2005-08-05 Thread Jay Blanchard
[snip]
Again, I would like to treat the string as a stream.

One possible way to accomplish this would be to simply write the string 
to a temporary file, open the file with fopen and then use fscanf, 
fseek, etc. to process the text.

However, I am assuming there is an easier way (i.e. a method without the

file io overhead) to be able to treat the string as a stream.
[/snip]

Treating a string as a stream (the most common thing is to convert a
stream to a string and work with the string using the string functions I
showed you or writing custom functions) is going to incur additioanl
overhead. What, exactly, do you want to accomplish? Can you give an
example?

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



Re: [PHP] String to Stream

2005-08-05 Thread Eric Gorr

Jay Blanchard wrote:

[snip]
Jay Blanchard wrote:


If you place the string into a variable then you would be able to work
with it that way.



Using what functions?

Part of the point was not to need to keep track of the current location 
in the string, etc...basically things that streams tend to handle well.




There are probably better functions for dealing with a
string than the ones you have mentioned (fseek is a file pointer).



'like fscanf, fseek'
[/snip]

You have been a little vague about your desired usage but here is one
idea; Explode the string into an array and then use array functions to
navigate the string. 


Here is a whole list of methods for handling strings

http://us2.php.net/manual/en/ref.strings.php


Again, I would like to treat the string as a stream.

One possible way to accomplish this would be to simply write the string 
to a temporary file, open the file with fopen and then use fscanf, 
fseek, etc. to process the text.


However, I am assuming there is an easier way (i.e. a method without the 
file io overhead) to be able to treat the string as a stream.



--
== Eric Gorr === http://www.ericgorr.net ===
"Therefore the considerations of the intelligent always include both
benefit and harm." - Sun Tzu
== Insults, like violence, are the last refuge of the incompetent... ===

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



RE: [PHP] String to Stream

2005-08-05 Thread Jay Blanchard
[snip]
Jay Blanchard wrote:
> If you place the string into a variable then you would be able to work
> with it that way.

Using what functions?

Part of the point was not to need to keep track of the current location 
in the string, etc...basically things that streams tend to handle well.

> There are probably better functions for dealing with a
> string than the ones you have mentioned (fseek is a file pointer).

'like fscanf, fseek'
[/snip]

You have been a little vague about your desired usage but here is one
idea; Explode the string into an array and then use array functions to
navigate the string. 

Here is a whole list of methods for handling strings

http://us2.php.net/manual/en/ref.strings.php




-- 
== Eric Gorr === http://www.ericgorr.net ===
"Those who would sacrifice a little freedom for temporal safety
deserve neither to be safe or free." - Benjamin Franklin
== Insults, like violence, are the last refuge of the incompetent... ===

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



Re: [PHP] Re: Everything works...Unless they hit the "back" button...

2005-08-05 Thread Kristen G. Thorson

Jack Jackson wrote:


Kristen G. Thorson wrote:

You said "If the user makes changes, those changes get error checked 
but do not become part of the sql query."  Where in your code is it 
failing to become part of the query?  Put a check at each level and 
see where *exactly* it fails to get deep enough to become one with 
the query.  Also, I'm confused.  I asked if the query was what you're 
expecting, and you answered yes, which implies the data becomes part 
of the query.



Thanks for this; yes I was confused before and thank you for the 
clarification.


Now I am confused by how to check the logic: I echo out the sql as it 
is built, and if I'm going forward in the questionnaire it shows 
clearly but



$qidlist_sql="DELETE FROM teresa WHERE q_id IN (" . 
(implode(",",$qidlist)) . ");";

echo "";
echo "\$ cqidlist_sql:" . $qidlist_sql . "";

   $q_a_sql="INSERT INTO teresa (u_id, q_id, a_id )
VALUES " . (implode(",",$qanda)) . ";";

 mysql_query($qidlist_sql);

echo "";
echo "\$ q_a_sql:" . $q_a_sql . "";

  if($q_a_result = mysql_query($q_a_sql))
{
  unset($_SESSION['required_fields']);
  $cat = $_POST['cat']+1;
  include_once(QUESTIONS . 'q.inc');
}


 shows NOTHING if I hit the BACK button. I'm still not seeing where 
the logic error is which makes it so that when I hit the BACK button 
it loses the plot.


Sorry for my misunderstanding
JJ



Keep going backwards.  It looks like maybe you've got an IF statement 
that you're not getting past.  Find where that is, and why it's 
evaluating to false.  If it's outputting *nothing*, then you're not 
evening reaching those echo statements.  Make a note after every IF 
statement, something like


echo "Inside if( this == that )";

So you know which blocks of code are being processed.


kgt

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



Re: [PHP] String to Stream

2005-08-05 Thread Eric Gorr

Jay Blanchard wrote:

[snip]
What I would like to be able to do is take a string and place it into a 
'resource' so I can use functons like fscanf, fseek to process the

string.

Is this possible? If so, how?

p.s. While I would be interested in possible alternative solutions, I 
would like to know how to accomplish this task even if it does not end 
up being the solution I use.

[/snip]

If you place the string into a variable then you would be able to work
with it that way.


Using what functions?

Part of the point was not to need to keep track of the current location 
in the string, etc...basically things that streams tend to handle well.



There are probably better functions for dealing with a
string than the ones you have mentioned (fseek is a file pointer).


'like fscanf, fseek'





--
== Eric Gorr === http://www.ericgorr.net ===
"Those who would sacrifice a little freedom for temporal safety
deserve neither to be safe or free." - Benjamin Franklin
== Insults, like violence, are the last refuge of the incompetent... ===

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



RE: [PHP] String to Stream

2005-08-05 Thread Jay Blanchard
[snip]
What I would like to be able to do is take a string and place it into a 
'resource' so I can use functons like fscanf, fseek to process the
string.

Is this possible? If so, how?

p.s. While I would be interested in possible alternative solutions, I 
would like to know how to accomplish this task even if it does not end 
up being the solution I use.
[/snip]

If you place the string into a variable then you would be able to work
with it that way. There are probably better functions for dealing with a
string than the ones you have mentioned (fseek is a file pointer).

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



Re: [PHP] Magic Quotes or Curley Quotes or Something

2005-08-05 Thread Marco Tabini
Hello Lance--

On 8/5/05 2:18 PM, "Lance Earl" <[EMAIL PROTECTED]> wrote:

> I recently upgraded my server. It is running Ubuntu Linux with PHP and
> MySQL. My site allows people to post content to their own web oages
> through a web interface. Many of my customers compose their content on a
> word processer and then cust and paste it to the web interface for
> insertion to the database and later retrevial and display on a web page.
> 
> The problem I am having is that content which includes quotes is is not
> being seen correctly. Rather than inserting a slashed quote (/"), it
> inserts a bunch of strange formatted gunk. A sample of the problem anc be
> seen at www.dallypost.com/ranch/page5688.php
> 

You have an encoding problem--the content is being uploaded to your site
using a different encoding mechanism (most likely utf-8) than the one you
use to display it. 

I'm not much of an expert in this area, but a couple of suggestions:

1. You're already outputting UTF-8 code from the looks of it, so a simple

Header ("Content-type: text/html; charset=utf-8");

Or even adding this to your HTML code in the :



Should do it. Remember to also use htmlentities ($data, null, "utf-8"); to
properly encode the entities in your content.

2. Convert the text over from UTF-8 to ISO-8859-1. I think you can use
utf8_decode, or you may have to go with the mbstring extension (not too sure
here, I'd just go ahead and convert everything over to UTF-8).

I'm sure some other people who have more experience with this stuff can give
you even more pointers, but this should get you started.

Cheers,


Marco

--
BeebleX - The PHP Search Engine
http://beeblex.com

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



[PHP] String to Stream

2005-08-05 Thread Eric Gorr
This should be a fairly easy question for someone who already knows the 
answer...


What I would like to be able to do is take a string and place it into a 
'resource' so I can use functons like fscanf, fseek to process the string.


Is this possible? If so, how?

p.s. While I would be interested in possible alternative solutions, I 
would like to know how to accomplish this task even if it does not end 
up being the solution I use.



--
== Eric Gorr === http://www.ericgorr.net ===
"Those who would sacrifice a little freedom for temporal safety
deserve neither to be safe or free." - Benjamin Franklin
== Insults, like violence, are the last refuge of the incompetent... ===

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



[PHP] Magic Quotes or Curley Quotes or Something

2005-08-05 Thread Lance Earl
I recently upgraded my server. It is running Ubuntu Linux with PHP and
MySQL. My site allows people to post content to their own web oages
through a web interface. Many of my customers compose their content on a
word processer and then cust and paste it to the web interface for
insertion to the database and later retrevial and display on a web page.

The problem I am having is that content which includes quotes is is not
being seen correctly. Rather than inserting a slashed quote (/"), it
inserts a bunch of strange formatted gunk. A sample of the problem anc be
seen at www.dallypost.com/ranch/page5688.php

Thanks


-- 
Lance Earl, President
DallyPost, Inc. - Equine Marketing/Training/Shows
Rockland, Idaho 208-548-2721 or 208-604-2721
[EMAIL PROTECTED]
http://www.dallypost.com  http://www.dallypost.com/ranch
Horse Marketing - Clinics - Shows

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



Re: [PHP] how to check http:// or https:// ?

2005-08-05 Thread Marco Tabini
IIRC, if you're using Apache you can check

If (isset ($_SERVER['HTTPS']))

You can also check this thread:

http://beeblex.com/lists/index.php/php.general/190410?h=%24_SERVER%5B%27HTTP
S%27%5D

--
BeebleX - The PHP Search Engine
http://beeblex.com

On 8/5/05 2:05 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:

> Hi,
> I need to check does URL use http or https?
> 
> Right now I use this code:
> 
> if(preg_match('/https:/', $_SERVER['SCRIPT_URI']) == false)
> {
>header('location: [URL]https://www.test.com/test.php[/URL]');
>exit;
> }
> 
> but I am sure there is much better solution.
> :)

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



[PHP] how to check http:// or https:// ?

2005-08-05 Thread [EMAIL PROTECTED]

Hi,
I need to check does URL use http or https?

Right now I use this code:

if(preg_match('/https:/', $_SERVER['SCRIPT_URI']) == false) 
{

  header('location: [URL]https://www.test.com/test.php[/URL]');
  exit;
}

but I am sure there is much better solution.
:)

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



Re: [PHP] Re: Everything works...Unless they hit the "back" button...

2005-08-05 Thread Jack Jackson

Kristen G. Thorson wrote:
You said "If the user makes changes, those changes get error checked but 
do not become part of the sql query."  Where in your code is it failing 
to become part of the query?  Put a check at each level and see where 
*exactly* it fails to get deep enough to become one with the query.  
Also, I'm confused.  I asked if the query was what you're expecting, and 
you answered yes, which implies the data becomes part of the query.


Thanks for this; yes I was confused before and thank you for the 
clarification.


Now I am confused by how to check the logic: I echo out the sql as it is 
built, and if I'm going forward in the questionnaire it shows clearly but



$qidlist_sql="DELETE FROM teresa WHERE q_id IN (" . 
(implode(",",$qidlist)) . ");";

echo "";
echo "\$ cqidlist_sql:" . $qidlist_sql . "";

   $q_a_sql="INSERT INTO teresa (u_id, q_id, a_id )
VALUES " . (implode(",",$qanda)) . ";";

 mysql_query($qidlist_sql);

echo "";
echo "\$ q_a_sql:" . $q_a_sql . "";

  if($q_a_result = mysql_query($q_a_sql))
{
  unset($_SESSION['required_fields']);
  $cat = $_POST['cat']+1;
  include_once(QUESTIONS . 'q.inc');
}


 shows NOTHING if I hit the BACK button. I'm still not seeing where the 
logic error is which makes it so that when I hit the BACK button it 
loses the plot.


Sorry for my misunderstanding
JJ







kgt






Jack Jackson wrote:

I've tried playing with the $_SERVER['HTTP_REFERER'] and that's no 
good because it's all coming from the same page - index.php!!


What am I missing. . . ?


Jack Jackson wrote:


Hi Kristen, there's a misunderstanding:

Kristen G. Thorson wrote:

The code below isn't much help to debug.  Do some checking to figure 
out how far into your IF statement you're getting.  Is the query 
running?  





Yes it runs successfully

Is it the query you expect?  





Yes it is perfect, and provided this is a new session and we're going 
forward page by page, it properly deletes from and inserts to the db 
as expected


(Step #1 when inserting or creating dynamic

queries that aren't working: print them out to make sure they are 
what you think they are.)  Is the category being incremented?





Yes, absolutely

You say you can go back, but you can't go forward.  





Actually no. In a new session, I can start and go forward page by 
page to the end of the questionnaire, advancing each stage perfectly, 
storing all values exactly as I'd expect.


The trouble starts if, during the process, the user hits the BACK 
button. At that point, user can reload the last page of questions, 
displaying the answers they gave. If the user makes changes, those 
changes get error checked but do not become part of the sql query. 
Also, user can not move forwards any more. So it's as the subject 
says - everything works...until they hit the back button, from which 
point the whole thing goes gablooey.


Look at the page source, is the


form action what it should be?





Yes

  Look at the form hidden variables (if


any) are they what you expect?




No. $cat remains what it was BEFORE the user hit the BACK button. 
However the questions dispayed are from the $cat which is in fact $cat-1


??!!









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



[PHP] Re: need help finding parsing error please

2005-08-05 Thread Matthew Weier O'Phinney
* Bruce Gilbert <[EMAIL PROTECTED]>:
> Hello,
>
> I am getting this on the following code, and I am not sure what is
> causing the error and need some pros to take a look at it for me.
>
> the error is:
>
> Parse error: parse error, unexpected '{' in
> /hsphere/local/home/bruceg/inspired-evolution.com/Contact_Form2.php on
> line 161



> if ($_POST['op']!='ds') { 
> // they need to see the form
> echo "$form_block";
> } else if ($_POST["op"]  == "ds")  {

Where's the end to this elseif? You follow it immediately with the
following lines, which simply won't work (can't define functions inside
if() blocks).

> //Function saves time and space by eliminating unneccesary code
> function check($fieldname)
>   {


-- 
Matthew Weier O'Phinney
Zend Certified Engineer
http://weierophinney.net/matthew/

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



Re: FW: [PHP] [NEWBIE GUIDE] For the benefit of new members

2005-08-05 Thread Alan Milnes

Jay Blanchard wrote:


6. PHP is a server side scripting language. Whatever processing PHP does
takes place BEFORE the output reaches the client. Therefore, it is not
possible to access users' computer related information (OS, screen size
etc) using PHP. Nor can you modify any the user side settings. You need 
to go for JavaScript and ask the question in a JavaScript list.


On the other hand, you can access the information that is SENT by the
user's browser when a client requests a page from your server. You can
find details about browser, OS etc as reported by 
this request. 
(contributed by Wouter van Vliet and reworded by Chris W Parker.)


 


You might want to add to this:-

"To see what information PHP can provide look in the manual for $_SERVER."

That way you give people a pointer along the way 

Alan



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



[PHP] need help finding parsing error please

2005-08-05 Thread Bruce Gilbert
Hello,

I am getting this on the following code, and I am not sure what is
causing the error and need some pros to take a look at it for me.

the error is:

Parse error: parse error, unexpected '{' in
/hsphere/local/home/bruceg/inspired-evolution.com/Contact_Form2.php on
line 161

here is the ENTIRE page code:

http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
http://www.w3.org/1999/xhtml"; xml:lang="en-US"
lang="en-US" dir="ltr">


Inspired Evolution :: Contact












 Skip
over navigation
  
  

  
  
   

  About
Me
  Skill set
  Hire
Me
  Portfolio
  Contact
  Résumé
  Blog
  RSS

  
  
   

Home
  > > Contact

  
  Contact
  

Additional Information
Request



* First Name: 






* Last Name:






* Company: 





* Phone: 





* e-mail: 





* re-enter e-mail: 






 URL:

 



 Best way to reach:





 Best time to contact:











Send me a detailed
message specifying what you wish to accomplish with your web
site.






* indicates a required field.
END_FORM;
if ($_POST['op']!='ds') { 
// they need to see the form
echo "$form_block";
} else if ($_POST["op"]  == "ds")  {

//Function saves time and space by eliminating unneccesary code
function check($fieldname)
{
global $err_msg;
if($_POST[$fieldname] == "")
{ 
if ( !isset($err_msg)) { $err_msg = "Please
re-enter your ".$fieldname.""; }
elseif ( isset($err_msg)) { $err_msg .="\nPlease
re-enter your ".$fieldname.""; }
}
return $err_msg;
}

//
///Function execution/
//

check('firstname');
check('lastname');
check('company');
check('phone');
check('email');
check('email2');
check('URL');
check('Contact_Preference');
check('Contact_Time');
check('message');  

//Validating Email Address
if ($_POST['email'] != $_POST['email2']) { $email_err = "\nEmail address fields do not match"; }

if (isset($err_msg) || isset($email_err) { echo
$err_msg.$email_err."\n\n".$form_block; }
else {
  //it's ok to send, so build the mail
$msg = "E-mail sent from www site\n";
$msg .="Sender's first name:{$_POST['firstname']}\n";
$msg .="Sender's last name:{$_POST['lastname']}\n";
$msg .="Company name:{$_POST['company']}\n";
$msg .="Senders Phone number:{$_POST['phone']}\n";
$msg .="Senders email address:{$_POST['email']}\n";
$msg .="Senders email address (re-typed):{$_POST['email2']}\n";
$msg .="URL :{$_POST['URL']}\n";
$msg .="Contact_Preference: {$_POST['Contact_Preference']}\n";
$msg .="Contact_Time {$_POST['Contact_Time']}\n";
$msg .="Message:{$_POST['message']}\n\n";
$to ="[EMAIL PROTECTED]";
$subject ="There has been a disturbance in the force";
$mailheaders ="From: Inspired-Evolution.com
\n";
$mailheaders .="Reply-To: {$_POST['email']}\n";
//send the mail
mail ($to, $subject, $msg, $mailheaders);
//display information to user
  echo "Hola, $firstname!.
We have received your request for additional information, and will
respond shortly.
Thanks for visiting inspired-evolution.com and have a wonderful day!
Regards,
Inspired Evolution";
}
?>


  
  
  
  


 
  Inspired-Evolution - Web Site: Design, Development, 
Marketing for Raleigh/Durham, Chapel Hill, Cary North Carolina.
  
  
  

   
  





and if this helps, here is the PHP info.
:
http://www.inspired-evolution.com/info.php

TIA!


-- 
::Bruce::

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



Re: [PHP] Average time spent on page

2005-08-05 Thread John Nichel

Jay Blanchard wrote:

[snip]
How can i found out the average time users spent on a page. Anyone
know a tutorial?
[/snip]

How much time spent creating a page?
How much time spent viewing a page?
How much time the page was left open on the desktop?

http://www.google.com/search?hl=en&q=average+time+spent+on+web+page has
a list of thousands, which is nearly how many times you sent the same
e-mail to the list in 3 minutes.



*slaps forehead*

Well lookie there...that Google thing *IS* your friend. ;)

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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



RE: [PHP] Average time spent on page

2005-08-05 Thread Jay Blanchard
[snip]
How can i found out the average time users spent on a page. Anyone
know a tutorial?
[/snip]

How much time spent creating a page?
How much time spent viewing a page?
How much time the page was left open on the desktop?

http://www.google.com/search?hl=en&q=average+time+spent+on+web+page has
a list of thousands, which is nearly how many times you sent the same
e-mail to the list in 3 minutes.

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



[PHP] Average time spent on page

2005-08-05 Thread Popescu Dan
Hi,
 
How can i found out the average time users spent on a page. Anyone
know a tutorial?
 
Thanks in advance for your help !!!

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



[PHP] Average time spent on page

2005-08-05 Thread virtualsoftware
Hi,

How can i found out the average time users spent on a page. Anyone know a 
tutorial?

Thanks in advance for your help !!!

[PHP] Average time spent on a page

2005-08-05 Thread virtualsoftware
Hi,

How can i found out the average time users spent on a page. Anyone know a 
tutorial?

Thanks in advance for your help !!!

FW: [PHP] [NEWBIE GUIDE] For the benefit of new members

2005-08-05 Thread Jay Blanchard
=
Please feel free to add more points and send to the list. 
20050322jb - Note the new location of PHP Editors list.
=

1. If you have any queries/problems about PHP try
http://www.php.net/manual/en first. You can download a copy and use it
offline also. 

Please also try http://www.php.net/manual/faq.php for answers to
frequently answered questions 
about PHP (added by Christophe Chisogne).

2. Try http://www.google.com next. Searching for "php YOUR QUERY" may
fetch you relevant 
information within the first 10 results.

3. There is a searchable archive of the mailing list discussion at
http://phparch.com/mailinglists. Many of the common topics are discussed
repeatedly, and you may get answer to your query from the 
earlier discussions. 

For example: One of the repeatedly discussed question in the list is
"Best PHP editor". Everyone has his/her favourite editor. You can get
all the opinions by going through the list archives. If you want a
chosen list try this link :
http://www.thelinuxconsultancy.co.uk/phpeditors.php
(contributed by Christophe Chisogne).

4. Not sure if PHP is working or you want find out what extensions are
available to 
you?

Just put the following code into a file with a .php extension and access
it through your 
webserver:

 

If PHP is installed you will see a page with a lot of information on it.
If PHP is not installed (or not working correctly) your browser will try
to download the file.
(contributed by Teren and reworded by Chris W Parker)

5. If you are stuck with a script and do not understand what is wrong,
instead of posting 
the whole script, try doing some research yourself. One useful trick is
to print the variable/sql query using print or echo command and check
whether you get what you expected. 

After diagnosing the problem, send the details of your efforts
(following steps 1, 2 & 3) and ask for help.

6. PHP is a server side scripting language. Whatever processing PHP does
takes place BEFORE the output reaches the client. Therefore, it is not
possible to access users' computer related information (OS, screen size
etc) using PHP. Nor can you modify any the user side settings. You need 
to go for JavaScript and ask the question in a JavaScript list.

On the other hand, you can access the information that is SENT by the
user's browser when a client requests a page from your server. You can
find details about browser, OS etc as reported by 
this request. 
(contributed by Wouter van Vliet and reworded by Chris W Parker.)

7. Provide a clear descriptive subject line. Avoid general subjects like
"Help!!", "A Question" etc. Especially avoid blank subjects. 

8. When you want to start a new topic, open a new mail composer and
enter the mailing list address php-general@lists.php.net instead of
replying to an existing thread and replacing the subject and body with
your message.

9. It's always a good idea to post back to the list once you've solved
your problem. People usually add [SOLVED] to the subject line of their
email when posting solutions. By posting your solution you're helping
the next person with the same question. 
[contribued by Chris W Parker]

10. Ask smart questions http://catb.org/~esr/faqs/smart-questions.html
[contributed by Jay Blanchard)

11. Do not send your email to the list with attachments. If you don't
have a place to upload your code, try the many pastebin websites (such
as www.pastebin.com). 
(contributed by Burhan Khalid)

Following these guidelines will ensure that you get effective responses
from the list members. Otherwise, your questions might not be answered.

===
Hope you have a good time programming with PHP.
===

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



Re: [PHP] diplaying code in pages and forums ??

2005-08-05 Thread John Nichel

Gregory Machin wrote:

Let the flaw wares begin ..


Flame war for what?


sorry guys who have limited bandwith and limited email boxes ..

Bla Bla BLA..


Now you're just breaking netiquette 'rules'.

You made a mistake, got called out for it.  The only person who will 
lose here is you.  The more you continue to whine about it, more and 
more members of this list will *PLONK* you.  Then, the next time you 
need help with something, nobody will be listening.


--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] PHP 4.0.6 documentation

2005-08-05 Thread Paul Waring
On Fri, Aug 05, 2005 at 03:53:41PM +0200, Sabine wrote:
> may anybody give me a tip where to find a documentation for 4.0.6?
> Perhaps I'm a little bit blind, but I don't find it.
> Unfortunatedly I have to develop an application on this release.

Does the documentation at php.net not suffice? It usually says when
particular functions were introduced/changed, e.g.:

http://www.php.net/pg_escape_string
pg_escape_string
(PHP 4 >= 4.2.0, PHP 5)

Paul

-- 
Rogue Tory
http://www.roguetory.org.uk

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



RE: [PHP] diplaying code in pages and forums ??

2005-08-05 Thread Jay Blanchard
[snip]
Let the flaw wares begin ..

sorry guys who have limited bandwith and limited email boxes ..

Bla Bla BLA..
[/snip]

There will be no flame war over this. You got called out. You got owned.
I am supposing that you are familiar with /dev/null ? You found the
answer on your own didn't you? Good job.

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



[PHP] PHP 4.0.6 documentation

2005-08-05 Thread Sabine

Hello to all,

may anybody give me a tip where to find a documentation for 4.0.6?
Perhaps I'm a little bit blind, but I don't find it.
Unfortunatedly I have to develop an application on this release.

Thanks for your help
Sabine

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



Re: [PHP] diplaying code in pages and forums ??

2005-08-05 Thread Gregory Machin
Let the flaw wares begin ..

sorry guys who have limited bandwith and limited email boxes ..

Bla Bla BLA..

On 8/5/05, John Nichel <[EMAIL PROTECTED]> wrote:
> Gregory Machin wrote:
> > For anyone who would like a clear answer to the question i politely
> > asked, here is a good artical ..
> 
> A husband will more than likely be pissed at me if I ask him to have his
> wife sleep with me...no matter how polite I ask.
> 
> Politely asked or not, your question demonstrated that you broke one of
> the major 'rules' of a mailing list such as this...RTMF/STFW/STFA.
> 
> --
> John C. Nichel
> ÜberGeek
> KegWorks.com
> 716.856.9675
> [EMAIL PROTECTED]
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
Gregory Machin
[EMAIL PROTECTED]
[EMAIL PROTECTED]
www.linuxpro.co.za
Web Hosting Solutions
Scalable Linux Solutions 
www.iberry.info (support and admin)
www.goeducation (support and admin)
+27 72 524 8096

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



Re: [PHP] diplaying code in pages and forums ??

2005-08-05 Thread John Nichel

Gregory Machin wrote:

For anyone who would like a clear answer to the question i politely
asked, here is a good artical ..


A husband will more than likely be pissed at me if I ask him to have his 
wife sleep with me...no matter how polite I ask.


Politely asked or not, your question demonstrated that you broke one of 
the major 'rules' of a mailing list such as this...RTMF/STFW/STFA.


--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] To count number of vists of one particular Website

2005-08-05 Thread Dotan Cohen
On 8/5/05, Tom Chubb <[EMAIL PROTECTED]> wrote:
> I have AWstats on one of my servers which comes with cPanel, but my
> main site uses another system for which I can only see upto the end of
> the previous day.
> I send out a lot of emails to my subscriber database and sometimes I
> charge people to use my list. I like to be able to see how many times
> a certain image within the newsletter has been hit so I can tell how
> many emails have been opened.
> I'm writing a link tracker script at the moment for it, but I'd like
> to be able to let the public view the stats on my site.
> Hope that's enough info for you.
> 
> I am using MySQL, but can't remember what version?!?!
> 

With this you shouldn't have any limit on how far back you can check,
unless I run into the limits of mysql. We'll see. Certainly more than
a day though, unless you are Google's webmaster!

As fot the image, that won't be a problem, but you will need to pass
the image through a script. That is no problem at all, I intend to
include instructions on how to do so as part of the documentation. Or,
you will need to parse your apache logs (or whatever server you are
on).

Dotan Cohen
http://lyricslist.com/lyrics/artist_albums/100/c_melanie.php
C, Melanie Song Lyrics

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



Re: [PHP] Exceptions: function x throws Exception

2005-08-05 Thread Jochem Maas

Dear Internals,

class FooBar { public function foo() throws Exception {} }
function fooFoo() throws Exception {}

this came up on php-generals and I wondered if anyone had time/cared
to comment if it (as it does to me) seems like a good idea and/or whether it is
technically feasable. My thinking was that one could then use the reflection API
to determine whether functions/methods are capable of throwing exceptions and or
what kind - might be quite handy when using third party apps/classes
(PEAR springs to mind.)

thanks and regards,
Jochem




Torgny Bjers wrote:

Norbert Wenzel wrote:


If there is a class with a function, that might throw exceptions and
does NOT catch them, may I write that like in Java?

class FooClass {

   public function foo() throws Exception {


think about this, especially in terms of the Reflection API, it sounds
like a really good idea (at least to me)



   }

}

Or is there another possibility to tell a function throws an exception
and to force the caller to handle that exception?

thanks in advance,

Norbert




Hello Norbert,

The Java way doesn't work here. The best approach would be to simply run
a try/catch/finally around the call to your function/method, and inside
the function itself you do the following:

if (...) { throw new Exception("My message."); } }



indeed - bottom line is you have to know that a function/method/extension may
throw. mostly you do know because:

1. you wrote the code,
2. or it's documented in the extension manual pages
3. and/ro you hit an unacaught exception whilst developing.

my approach to cover any oversights is to wrap every thing in a main try/catch 
block
just in case - keeping in mind that the idea is that this 'main' catch block is 
never run
is al goes well.


Regards,
Torgny



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



Re: [PHP] To count number of visits to a particular wesite using login-id and password

2005-08-05 Thread Miles Thompson

At 08:41 AM 8/5/2005, suma parakala wrote:

Hi
I am new web application development. Can anyone tell me how can I trace 
how many times mywebsite has been viewed by one particular login and 
password using postgresql database and php

Thanks
Suma


Since you are presumably authenticating against a user table in the 
database, add a login_count field and increment it when the user logs in. 
That will track all your users. Then execute a query to fetch the data for 
a particular user. Hint SELECT COUNT() ...


If you want a profile of activity, add a separate table with timestamp, and 
user_id fields, the user_id having user.user_id as its foreign key. For 
each login, insert a record in this table, and as it's PostgreSQL you can 
set a trigger to automatically write the timestamp. Now you can track your 
usage profile by users, time of day, user and time of day  fun isn't it?


Regards - Miles Thompson

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



Re: [PHP] diplaying code in pages and forums ??

2005-08-05 Thread Miles Thompson


Well, it took about 5 min - checking the PHP site for "display" and then 
for "source".
That lead to the display_source() function, an alias for highlight_file(), 
which itself had a link for highlight_string(). These functions display PHP 
source with syntax highlighting.


It is a fine manual; please Read The Fine Manual.

Side note: Use of other's code, such as Exponent CMS, does not absolve one 
of the responsibility to understand the language, nor of the need to 
wrestle with these things on one's own. Did you know there was a whole 
thread within the last week on this v. issue?


Regards - Miles Thompson

At 06:49 AM 8/5/2005, Gregory Machin wrote:

HI

Please advise.
I'm using exponent cms and I creating a technical site,
I want to display code examples , how do I do this and with syntax 
highlighting,

--
Gregory Machin
[EMAIL PROTECTED]
[EMAIL PROTECTED]
www.linuxpro.co.za
Web Hosting Solutions
Scalable Linux Solutions
www.iberry.info (support and admin)
www.goeducation (support and admin)
+27 72 524 8096

--
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] To count number of visits to a particular wesite using login-id and password

2005-08-05 Thread suma parakala

Hi
I am new web application development. Can anyone tell me how can I trace how 
many times mywebsite has been viewed by one particular login and password 
using postgresql database and php

Thanks
Suma

_
Post FREE Classifieds. 
http://www.sulekha.com/classifieds/cllist.aspx?nma=IN&ref=msn Reach out to 
over a million NRIs.


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



Re: [PHP] Exceptions: function x throws Exception

2005-08-05 Thread Norbert Wenzel

Torgny Bjers wrote:

The Java way doesn't work here. The best approach would be to simply run
a try/catch/finally around the call to your function/method, and inside
the function itself you do the following:

if (...) { throw new Exception("My message."); } }


Hello Torgny,

Thanky you for your fast help.

Greetings,
Norbert

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



Re: [PHP] Exceptions: function x throws Exception

2005-08-05 Thread Torgny Bjers
Norbert Wenzel wrote:
> If there is a class with a function, that might throw exceptions and
> does NOT catch them, may I write that like in Java?
> 
> class FooClass {
> 
> public function foo() throws Exception {
> 
> }
> 
> }
> 
> Or is there another possibility to tell a function throws an exception
> and to force the caller to handle that exception?
> 
> thanks in advance,
> 
> Norbert
> 

Hello Norbert,

The Java way doesn't work here. The best approach would be to simply run
a try/catch/finally around the call to your function/method, and inside
the function itself you do the following:

if (...) { throw new Exception("My message."); } }

Regards,
Torgny

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



[PHP] Exceptions: function x throws Exception

2005-08-05 Thread Norbert Wenzel
If there is a class with a function, that might throw exceptions and 
does NOT catch them, may I write that like in Java?


class FooClass {

public function foo() throws Exception {

}

}

Or is there another possibility to tell a function throws an exception 
and to force the caller to handle that exception?


thanks in advance,

Norbert

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



Re: [PHP] diplaying code in pages and forums ??

2005-08-05 Thread Gregory Machin
For anyone who would like a clear answer to the question i politely
asked, here is a good artical ..

http://www.sitepoint.com/article/highlight-source-code-php


Gregory Machin
[EMAIL PROTECTED]
[EMAIL PROTECTED]
www.linuxpro.co.za
Web Hosting Solutions
Scalable Linux Solutions 
www.iberry.info (support and admin)
www.goeducation (support and admin)
+27 72 524 8096

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



Re: [PHP] carriage return

2005-08-05 Thread Frank de Bot

Diana Castillo wrote:

How can I with php detect when there is a carriage return at the end of the 
text field in a mysql table?


 


Something like this perhaps:

$res = mysql_query($query);
$row = mysql_fetch_object($row)
if (preg_match("/\r$/",$row->textfield) {
   echo "Got CR";
} else {
   echo "No CR at end";
}


Just an example to help you on the way.

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



Re: [PHP] carriage return

2005-08-05 Thread Jochem Maas

Diana Castillo wrote:
How can I with php detect when there is a carriage return at the end of the 
text field in a mysql table?


get the data out of the DB first. stick it in $myString




$myString = "wtf I fond a carriage return - horsedrawn even.\n";
if (preg_match("#[\n|\r|\r\n]$#", $myString)) {
echo "wtf I fond a carriage return - horsedrawn even.";
}

tip: using trim() on $myString will strip a trailing CR.
tip: want to allow blank spaces after the CR, use this regexp instead.
"#[\n|\r|\r\n][ ]*$#" e.g:

$myString = "wtf I fond a carriage return - horsedrawn even.\r\n   ";
if (preg_match("#[\n|\r|\r\n][ ]*$#", $myString)) {
echo "wtf I fond a carriage return - horsedrawn even.";
}


now can I have your roomkey? :-P


also if you want to know what \n and \r and \r\n are about then you might
start by searching for posts by Marco Tabini 3 days back on this list






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



Re: [PHP] diplaying code in pages and forums ??

2005-08-05 Thread Jochem Maas

Gregory Machin wrote:

HI

Please advise.
I'm using exponent cms and I creating a technical site, 


this is not the 'exponent cms' (whatever that is) user group.


I want to display code examples , how do I do this and with syntax highlighting,


shouldn't we be writing the necessary code for you? for nothing?

did you f***ing google for 'syntax highlighting php' or something similar?
and/or do you bother to read any of the posts made by other people of this list?
let me answer those last 2 questions for you - no you bloody well didn't - this 
topic
was covered not more than 3 days ago on the list - PHP has at least 2 functions 
made for the
very purpose (try using the like textbox at the top right hand corner of EVERY 
page on
www.php.net to find them) AND, now get this, php.net has a show source function 
(also on
every page) which allows you to see how they do stuff - the really 'crazy' 
thing is
you can even viwe the source of the script that is used to view the source .. 
right
there in your goddam browser.

with regard to displaying code - you'ree not the first to do - plenty of code 
out there,
in fact it took me 2 seconds to find a WordPress plugin that does exactly that 
-- you might
need to hack that code to make it work in your cms but heh, that's what its all 
about.

my 2 year old son say 'I want' less than a lot of people on this list, make an 
effort.

PS - any one guess I just started having a bad day?

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



[PHP] carriage return

2005-08-05 Thread Diana Castillo
How can I with php detect when there is a carriage return at the end of the 
text field in a mysql table?


-- 
Diana Castillo
Destinia.com
C/Granvia 22 dcdo 4-dcha
28013 Madrid-Spain
Tel : 00-34-913604039 Ext 216
Fax : 00-34-915228673
email: [EMAIL PROTECTED]
Web : http://www.hotelkey.com
  http://www.destinia.com

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



[PHP] diplaying code in pages and forums ??

2005-08-05 Thread Gregory Machin
HI

Please advise.
I'm using exponent cms and I creating a technical site, 
I want to display code examples , how do I do this and with syntax highlighting,
-- 
Gregory Machin
[EMAIL PROTECTED]
[EMAIL PROTECTED]
www.linuxpro.co.za
Web Hosting Solutions
Scalable Linux Solutions 
www.iberry.info (support and admin)
www.goeducation (support and admin)
+27 72 524 8096

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



Re: [PHP] To count number of vists of one particular Website

2005-08-05 Thread Dotan Cohen
On 8/5/05, Tom Chubb <[EMAIL PROTECTED]> wrote:
> On 04/08/05, Dotan Cohen <[EMAIL PROTECTED]> wrote:
> > On 8/4/05, suma parakala <[EMAIL PROTECTED]> wrote:
> > > Hi
> > > Can anyone tell me how can I count how many times my website has been 
> > > viewed
> > > using php
> > > Thanks
> > > Suma
> >
> > Suma,
> > I am working on that now. I will soon have a script ready under GPL.
> > There are two versions, one with mysql and one with flat files. Do you
> > have mysql?
> >
> > Dotan Cohen
> Dotan,
> I'd be interested in seeing that.
> Please can you post a message here when it's ready?
> Thanks,
> Tom
> 
> Tom Chubb
> [EMAIL PROTECTED]
> 07915 053312
> 

Sure. If you have any features that you'd like to request, now's the
time! What stats, in particular, are you interested in? Do you have
mysql? What stats programs are you currently using, and how often do
you check them?

Dotan Cohen
http://lyricslist.com/lyrics/artist_albums/327/martin_ricky.php
Martin, Ricky Song Lyrics

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



[PHP] Cannot pass data between forms when 'enctype' attribute is present

2005-08-05 Thread MisterJingosSmile
Hi and thanx for taking the time to read . . .

The issue I'm experiencing appears to be that I cannot pass data (values)
between forms when
the enctype="multipart/form-data" attribute is present in the form.
Commenting it out allows data
to pass but prevents uploading of files through the form.

As I am no expert at what I am doing (Apache/PHP/MySQL) I would really
appreciate any
pointers you would care to give.

I've been googling around and found an old post from someone who appears to
have the same
issue. It is here:

http://archives.neohapsis.com/archi...03-q4/0771.html

I have also made another post describing my issue in more detail here:

http://www.justlinux.com/forum/showthread.php?t=141885

Cheers.


begin 666 edit.gif
M1TE&[EMAIL PROTECTED]/?_`'B8T'J5Q/___RHS>(*.H9.=L^GI[;2VN9&KV:*KNW2+
MLV=\H+W RG:#H:FSR%QLB>[EMAIL PROTECTED]:DKR^PEQQE4QAA861JIFFO6EUA%EDRX*=
MRXVLX6R"IJRMLXNIW6E]H>3EZV1YG?CX^CU2=765S)JAK<[1VTE9F+S VM_A
MY3I.<.GJ]8R:LPH4:&[EMAIL PROTECTED]:?C1);2LXLIVZZYZJPEYYJ'F6
MR>'BYW&&JBRY(FDT\S/U(*)EM7:Y(B0FGJ2NX:1I=C9WGN%
MFB8US]'3V4E>@A[EMAIL PROTECTED]
M]ZNQNM'2UO;V]V6"LVN&MH">TN?I],'!QE%EBE5ICIVDL'R:S3A#B+>ZO\O-
MVALD;PD3>?'R](B1HI:DO7. G\C*U65_JM+6WNWN^(J8L/?X^5IJG&-TE)"N
MXM35W&1XF4==A*&HM6Z%OOS\_/3U]\G,S^WM[YBSY7N2N*"EM8BFVG>4QLK-
[EMAIL PROTECTED]>>/#Q\H:@S?KZ^X26M'B&HVV,PW&(L7&/[EMAIL PROTECTED]/S_1 ?
MKQ(;:6:$N&6 K5]VG5IBCU9HA6R$KF]]EFZ#IVZ!HP8/6EEQFF9XE_'Q^^?H
MZ8^6GW^7P'V4NG61OWZ)FT-6=P4/9FN I/3T_F-XG.OL]\[2X)2BNW2(JYRH
MP,[EMAIL PROTECTED]'UX",I]?8WI.?MB8X\Z"][V%^L'^8PTUD5,>TU:;@X=P(V,
[EMAIL PROTECTED])0BEUPD$5?B^_P^DA0B%9FF5UCEEUEFVATD'J4P)2PWWN3
[EMAIL PROTECTED]"N6I_H]'2W-74VI*ANY&AO4QAE(R7K_/T]?3S]E-EN%Y[KW*'JT-/
MA8^5J9"9K6B"KEAQG?7U_R'Y! $``/\`+ !&`!8`0 C_`/\)A'# C!E%
M0X:PD2!!SH$#[EMAIL PROTECTED], SG99J?ORL6"$OG25+23(X8&)M*3$>4!&H8X1$'8*D
M`8"D&64CV#QK:\+E`K' %)5$<]Z5F#/H%XI$`N(*T([EMAIL PROTECTED];[HU9O*706Y
MQ#Q1$BYY\,&# $0L6
MMLBA$ "K0(W7-7S)]F6AMFT+>'#CVJ!4?$,(9 NVS11BW7`/:*!+!<,$T**8A02PQ88&$"!1AFJ&&%
M'')82 [EMAIL PROTECTED]@AB%"26:"*)(J28`BJ?8 0!% (NPS0!T1!!LL*(?@, 
DHS/[EMAIL PROTECTED]
[EMAIL PROTECTED]"K5*D' 8?0(0H$H.X&Z:RBT>@.#%$12(\, _%K202RZF< #8
MO("5D<[EMAIL PROTECTED]'/[EMAIL PROTECTED],K >?%%[K_N>+ `""U$9EF&6(P8A8H01M.B
M0!_(:\ 89O)!$$AT([EMAIL PROTECTED]BD
M/! KT+M)+%(`\<4W`EQA`1_6>!!7/+'P<)0E&2R3#A";]&.#/^*XX( 7V?P'
MS1]Z&(/"!XO4$T((!D3]Q"K741('[EMAIL PROTECTED]:T85&-((;E1+ I:[EMAIL PROTECTED]
[EMAIL PROTECTED],,! [EMAIL PROTECTED]( P4D ,/3* 0#_C&!!9 K@<(`!O2L,5I5KC"",R 
"^V 
[EMAIL PROTECTED],->/$N!4W#!#ZCEA%:H(@$"R)[EMAIL PROTECTED];[EMAIL 
PROTECTED]"F,H
MP1%RL8!<+<(>:=$#"<[EMAIL PROTECTED],[EMAIL PROTECTED](HQI5P1X!.,,[EMAIL 
PROTECTED]
M*BQ%"R4((!+/V%9<2&"*3%1182#(Q;G<@)D5_6,+8P&!*8;PAT'@8!$A^)@`
MT$&&6VPA`EZXA28WZ0Y"A.,!H'Q . @1"%2XYY/A0.6YT%&%*CS #9:Y# 4J
ME!D1R$ /_U!!.!HV!EA([EMAIL PROTECTED]&,I#!"HE<@#*7"http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Do I need to use --with-pic with configure?

2005-08-05 Thread Denis Solovyov

>> I have a question I can't answer by myself. :)
>> Do I need to use "--with-pic" option when configuring php 4?
>> I'm going to build it as an Apache 1.3 DSO module and going to
>> run multiple instances of Apache (under different users). I
>> use Linux (kernel 2.4.30).
>> Generally, when one may need to use "--with-pic"?
RL> --with-pic is the default, so you don't need to add it.

When  I  at  first  confugured without "--with-pic" and then immediately
with "--with-pic" I got two different libphp4.so by filesize. If you say
there is no difference, what is nevertheless the difference?

The  question  apperead  since  I  heard  somewhere that "--with-pic" is
important  when  one  is  going  to  use PHP module with multiple Apache
instances...

RL> -Rasmus

Denis Solovyov

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



[PHP] Re: overwrite private class members in php5?

2005-08-05 Thread Norbert Wenzel

Matthew Weier O'Phinney wrote:

* Norbert Wenzel <[EMAIL PROTECTED]>:


Hi, I've done something like this:

class MyClass {

  private $var;

  function __construct($value) {
$this->var = $value;
  }

  public function printVar() {
echo($this->var);
  }

}

$object = new MyClass('1');
$object->printVar(); // prints 1
$object->var = 3; // Fatal Error as expected
$object->$var = 2; // no error msg



$var is empty, so this is setting a non-existent class property to 2.



$object->printVar(); // prints 2



I got 1 when running this -- just as I would expect. Are you sure it
printed 2?

Basically, if a property is undeclared, it is assumed public, so you can
set undefined properties without issue. If defined private or protected,
the calling script will not be able to alter the value.



i did write the script out of my mind, and didn't paste it. not the best 
idea, i know.
thanks for your help, i see my mistakes very clearly. forgive a noob for 
such question.


thanks,
norbert

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



Re: [PHP] login check

2005-08-05 Thread Jochem Maas

[EMAIL PROTECTED] wrote:
 
I think this is the way I need to write my if statement. 


if ( $min && $user[ "min" ] == $min && $user[ "pin" ] == $pin || $pin == 
'allow')


try a couple paretheses to make your intension explicit. your if statement might
work the way you want it but I have no idea - and I'm way to lazy to go and look
up the operator precedence to work it out

if ($min && $user[ "min" ] == $min && ($user[ "pin" ] == $pin || $pin == 
'allow')) {
// you are okay to login
}



$min login name entered by the customer at the form. 
$user[min] is the login name from my sql db that matches $min

$user[pin] is the password from mysql db that matches $min
$pin is the password that is entered by the user

There's 4 checks
1) $min must have a value
2)  $user[ "min" ] must equal $min 
3) $user[ "pin" ] must equal $pin 
4) $pin == 'allow'


check 4 seems a little absurd - anyone who knows it will be able to login
as anyone on your app. also checking whether $user['min'] is equal to $min
_seems_ pointless because I assume that you had to extract the data from the
database somehow - usually this means using the login (i.e. $min) entered by
the user to do the look up.

lots of good reading here on security: http://www.phpsec.org/



I want it so that both 1 and 2 must be true and either 3 or 4 must be true. 
Will this if statement work?


Andrew Darrow
Kronos1 Productions
www.pudlz.com




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