Re: [PHP] IFRAMES & PHP

2003-01-27 Thread Sean Burlington
Greg wrote:

Unfortunatly, that gets rid of the reason I have the iframe in there to
begin with.  I need a scrollable iframe with a set of buttons that perform
certain actions at the top, that have to always be at the top.
-Greg




in that case you either need to try getting some javascript to pass the 
info between frames - or see if there is some style sheet wizadry (fixed 
size divs, visible area, clipping ...???) that will produce the same 
effect on an acceptable proportion of browsers



"Sean Burlington" <[EMAIL PROTECTED]

.uk> wrote in message

[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...


Greg wrote:


Here's the basic layout of my html page, this isn't the real html, just


the


basic idea.











Now inside iframetest.php I have a few check boxes that I want test.php


to


be able to access.  Is there any way to do this?
Thanks!!




not directly ..

 the form does not 'contain' the iframe - in fact the iframe is a
different page ...

so form elements within the iframe page will not be a part of the form
submission process

you /might/ be able to do something with javascript inter-frame
communication - but I doubt you would want to (and the iframe doesn't
sound like a valid page which could cause problems)

what would probably make more sense would be to make the 'html' page
include iframetest.php'

html.php
--







 
 
 

-

then you form elements will be properly contained within the form

--

Sean










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




Re: [PHP] IFRAMES & PHP

2003-01-27 Thread Sean Burlington
Greg wrote:

Here's the basic layout of my html page, this isn't the real html, just the
basic idea.











Now inside iframetest.php I have a few check boxes that I want test.php to
be able to access.  Is there any way to do this?
Thanks!!




not directly ..

 the form does not 'contain' the iframe - in fact the iframe is a 
different page ...

so form elements within the iframe page will not be a part of the form 
submission process

you /might/ be able to do something with javascript inter-frame 
communication - but I doubt you would want to (and the iframe doesn't 
sound like a valid page which could cause problems)

what would probably make more sense would be to make the 'html' page 
include iframetest.php'

html.php
--







 
 
 

-

then you form elements will be properly contained within the form

--

Sean


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



Re: [PHP] help with perl equivalent ?

2003-01-24 Thread Sean Burlington
R'twick Niceorgaw wrote:

Hi all,
I'm pretty much a stranger to perl and now got to convert a perl script to
php. however, at once place I can not understand what the lines are doing
and what could be the equivalent of them in php. Could some one help me with
this ?

Here's my perl code :

   $choice=~s/\.rm//;

$choice = str_replace('.rm', '', $choice);

   $choicedir=substr($choice, 0, 3);

$choicedir=substr($choice, 0, 3);

   $choicedir=~s/^AKM/ogx/

$choice = preg_replace('/^AKM/', 'ogx', $choice);



--

Sean


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




Re: [PHP] A Licensing Question

2003-01-22 Thread Sean Burlington
Chris Hayes wrote:

At 17:17 22-1-03, you wrote:


I was wondering what the licensing issues for app frameworks (or any
included PHP classes/libs) are.  I'm creating a rather large PHP
application for a company, and they'd like to potentially resell it to
some of their customers.

Can I safely use GPL'd libraries, classes, etc. (i.e. PearDB) and
resources that fall under other open source licenses when developing the
app and let them redistribute accordingly, or would that be a violation?
Also, thinking ahead here a bit, if they wanted to use something like 
Zend
Encoder on the project, what sort of added gotchas could that bring up?

Thanks guys!

John


The GPL can be a headache to figure out when it gets to complicated 
situations.
My uneducated working conclusion is that the GPL prevents you from 
selling GPL-ed code as is, or improved GPL-ed code. Selling GPL-ed code, 
even if you improved it, is dead wrong. Even if you eventually totally 
rewrote the code.

you absolutely *may* sell gpl'd code - that's why you see boxed sets of 
Linux distributions on the shelves.

It's just that if you take gpl'd code and modify it - then when you 
release it to a third party (whether you charge money or not) you must 
release this new version also under the gpl.

The GPL is incompatible with per-seat licenses and the third party is 
free to copy and if they wish, resell your code.

So traditional models of selling computer software don't all work with 
gpl'd code.

However - if you want to sell software under a closed licence you will 
need to be carefull to avoid 'linking' with gpl'd code.

The problem is that 'linking' as used in the gpl seems to refer to C 
programming - and is an unclear term when refering to php.

I'm sorry if that fails to give a clear cut answer - this sort of thing 
does not seem to have been testing in the courts yet ...

--

Sean






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



Re: [PHP] Simple E-mail Question

2003-01-22 Thread Sean Burlington
Scott Saraniero wrote:

Hi,

I'm using this line to send an e-mail with info:

mail("[EMAIL PROTECTED]", "$Event Ticket Form", $msg, $mailheaders);

If I want to add mail recipients, or cc, or bcc, how would I do this?

Thanks,
Scott




http://www.php.net/manual/en/function.mail.php

Example 4. Sending complex email.

/* recipients */
$to  = "Mary <[EMAIL PROTECTED]>" . ", " ; // note the comma
$to .= "Kelly <[EMAIL PROTECTED]>";

/* subject */
$subject = "Birthday Reminders for August";

/* message */
$message = '


 Birthday Reminders for August


Here are the birthdays upcoming in August!

 
  PersonDayMonthYear
 
 
  Joe3rdAugust1970
 
 
  Sally17thAugust1973
 



';

/* To send HTML mail, you can set the Content-type header. */
$headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

/* additional headers */
$headers .= "From: Birthday Reminder <[EMAIL PROTECTED]>\r\n";

$headers .= "Cc: [EMAIL PROTECTED]\r\n";
$headers .= "Bcc: [EMAIL PROTECTED]\r\n";

/* and now mail it */
mail($to, $subject, $message, $headers);


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




Re: [PHP] security question regarding including files..

2003-01-21 Thread Sean Burlington
Chris Shiflett wrote:

--- Sean Burlington <[EMAIL PROTECTED]> wrote:


I'm not sure what harm could be done by this though.

if a broswer attempts to load an image reference by
an 


I sent a response about this earlier, but you should
research CSRF and XSS.

It does not matter that the browser shows a broken image if
it has already sent the HTTP request. There is no special
HTTP request for checking whether the Content-Type is
really an image without the receiving Web server taking any
action. A GET is a GET.



hmmm

but what does this have to do with the site allowing users to include 
links to images

this is a security problem for the site that allows you to place 
purchase orders with a single click.

what difference does it make that img links are placed by users ?

I could just as easily trick users into making GET requests by puting 
dodgy img links in a pgae that I control ...

I only initiate a small proportion of the requests my browser makes - in 
fact I go to some trouble to stop some of the requests happening as I 
don't like to see so many ads - I filter outgoing requests via squid.

There are problems in the way the internet is designed and in 
misconcepotions as to how it works - but if we all code for absolute 
security we end up disconnecting from the web entirely.

--

Sean


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



Re: [PHP] security question regarding including files..

2003-01-21 Thread Sean Burlington
Gibbs, Liam - SXIA wrote:

I agree that there are risks - but I do think this can be done safely



Couldn't you just check the submitted URL and find out if it's a gif or
jpeg? I don't think even PHP-enabled servers will run a gif or jpeg.




please send replies to the list ...


and you cant tell what type of file will be returned by the url

it is easy to set up a server to treat a file named foo.gif as a php 
file (or whatever)

even if you tested the url by attemting to download the file it would be 
easy to write a script that would return an innocent gif to requests 
originating for the webservers ip address - and anything else to the 
rest of the world.

I'm not sure what harm could be done by this though.

if a broswer attempts to load an image reference by an 

but this would be worth testing.

--

Sean


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



Re: [PHP] Detecting posts from outside site

2003-01-21 Thread Sean Burlington
[EMAIL PROTECTED] wrote:

Also, speaking of detection, I made a small script that can protect against
people downloading your site's forms, modifying their new local copy (and
putting an absolute URL in the form's ACTION attribute), and then posting
data using the botched form. If it's bulletproof, then I figured this could
help some of you out. If not, I welcome comments (I'm a little bit hesitant
of calling things 'bulletproof'). $http_referer (lowercase) is the
parse_url() of $_SERVER["HTTP_REFERER"]. Some local mucking up can give you
the format you want for it.

if((count($_POST) > 0) && (!stristr($_SERVER["HTTP_REFERER"],
$http_referer))) {
	unset($_POST);
	$evil = "postedfromoutsidepage";
}

Then, you can test for $evil when you need to print an error message or
decide whether or not the data is proper.




HTTP_REFFERER is sent by the client and is not a secure value

it is easy to write a script in eg PHP that will fetch a web page with a 
completely bogus referrer url...

some people argue that cheching the referrer url 'raises the bar' 
security wise - personnaly I think this sort of illusory security leads 
to complacency in data checking.

I think it is better to always remeber that data can be posted to your 
server by many means - treat all data as suspect until proven otherwise.

In addition this method can make code less portable between servers.

--

Sean


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



Re: [PHP] security question regarding including files..

2003-01-21 Thread Sean Burlington
Chris Shiflett wrote:

--- Chad Day <[EMAIL PROTECTED]> wrote:


I want to give my users the ability to submit a URL
to a database, then when they pull up their page,
their photo is included .. what I'm worried about
is them pointing the link to some malicious code or
something..



Your instincts serve you well.

There are two types of attacks to worry about in this
situation, depending on who can see this "image". If only
the user who submitted the URL can see it, then your users
only risk CSRF attacks, which are not very common (yet) but
are very dangerous.

If everyone can see the "image", then your application is
also at risk of XSS.

If you realize that an embedded image is requested
separately by a Web client, you can see that this basically
allows an attacker the opportunity of forcing another user
to visit a URL of the attacker's choice. For example,
consider an image that looks like this:

http://bookstore.xxx/buy.php?book=httphandbook";>



I agree that there are risks - but I do think this can be done safely

if you make sure the user cannot insert javascript into the page, there 
isn't much cross site scripting that can be done.

and make sure they can't insert quotes which would end the quoted string 
in the html page.

is there really any site which will accept a book order based an a sigle 
GET ?

I guess stripping the query string would be safest... but its a balance 
betwwen security and functionality ...


--

Sean





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



Re: [PHP] Page Rendering

2003-01-21 Thread Sean Burlington
Bill Arbuckle, Jr. wrote:

Hi all.  I am having some problems with a script which reads information
from a database and creates a table.  It works in IE but not Netscape. 

it can be usefull to test the resulting html

http://validator.w3.org/

valid html is much more likely to appear consistent across browsers

--

Sean



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




Re: [PHP] pop-up problem

2003-01-20 Thread Sean Burlington
Chris Shiflett wrote:

--- Mark McCulligh <[EMAIL PROTECTED]> wrote:


I wish people won't miss use features for people start
blocking them.  I am using the window.open the way it
was meant for.  I have a online help feature.  I am not
using it a force people to look at banner after banner.



I know exactly what you mean.

However, I believe window.open still works when used like
this:

Click Here

At least, that works with Mozilla's pop-up blocker. As I
understood it, only those annoying automatic popups are
disabled.




I would do

Click Here

as this will still work on non-js browsers - albeit without being able 
to size/position the window.

--

Sean


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



Re: [PHP] Select multiple boxes

2003-01-20 Thread Sean Burlington
John W. Holmes wrote:

use [] in your select box name. When it comes back in the
$_POST array you
will have an array of options.  It breaks HTML standard



No, it does not break HTML standards -- that is a PHP urban myth


(which,


to


my chagrin, I helped to propagate before a wiser head sent me to


read


said


standards in minute detail).  It does not even break XHTML


standards.


Believe me -- I've interrogated the damn standards to within an inch


of


their lives, and they nonetheless insist that [] are legal


characters in


form element name= attributes, and form element name= attributes are


*not*


deprecated.



while I agree that it doesn't break standards - I do find it odd.

and annoying in that it limits the ability of php to  process certain
forms ...

I don't see any benefit of this system - it would be better if php


just


created an array for suitable form data - without requiring that the
element name changes.



How does php know what "suitable form data" is?

I guess it could look for multiple names in the GET or POST data. But
then that would mean for every variable it goes to create, it would have
to go and look if it's already created one by that name. If it did,
erase the old one and make these two an array now. 

Rather than doing that, it can just look for [] in the name and it knows
to make that an array.


well I think you answered your own query - it could look for multiple 
names ...

this seems to work well in other systems - eg Perl:CGI and Java Servlets 
 - though as these have seperate types for an array - so it works quite 
naturally there.

in fact I have only seen this construct in php - it seems odd to me.

I have worked on several projects where forms have been used to 
communicate between systems under the control of different development 
teams - in this case the requirement to rename the form element for it 
to work as a select multiple has been a pain.

--

Sean




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



Re: [PHP] Select multiple boxes

2003-01-20 Thread Sean Burlington
Ford, Mike [LSS] wrote:

-Original Message-
From: Cal Evans [mailto:[EMAIL PROTECTED]]
Sent: 18 January 2003 14:41

use [] in your select box name. When it comes back in the 
$_POST array you
will have an array of options.  It breaks HTML standard 


No, it does not break HTML standards -- that is a PHP urban myth (which, to
my chagrin, I helped to propagate before a wiser head sent me to read said
standards in minute detail).  It does not even break XHTML standards.

Believe me -- I've interrogated the damn standards to within an inch of
their lives, and they nonetheless insist that [] are legal characters in
form element name= attributes, and form element name= attributes are *not*
deprecated.



while I agree that it doesn't break standards - I do find it odd.

and annoying in that it limits the ability of php to  process certain 
forms ...

I don't see any benefit of this system - it would be better if php just 
created an array for suitable form data - without requiring that the 
element name changes.

still - I guess it works :)

--

Sean



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



Re: [PHP] PHP and Sessions?

2003-01-20 Thread Sean Burlington
Tim Thorburn wrote:

Hi,

I've created a password protected area on the site I'm working on using 
PHP Sessions - I've done this several times before without any 
difficulty.  This time, I've copied my old code - made the necessary 
changes for login/passwd/database names, yet the sessions don't appear 
to be working.

I've been comparing the PHP settings on each server - the server that 
works is using 4.2.2, the one that does not is using 4.1.2.  Other than 
that, the only difference is that on the server that works I've changed 
the path to the PHP include dir (from the server set default into my 
account).

Can anyone offer any suggestions?




This is by far the most FAQ on this list...

what changed
http://www.php.net/manual/en/language.variables.predefined.php

why it changed
http://www.php.net/manual/en/security.registerglobals.php


 In PHP 4.2.0 and later, the default value for the PHP directive 
register_globals is off. This is a major change in PHP. Having 
register_globals off affects the set of predefined variables available 
in the global scope. For example, to get DOCUMENT_ROOT you'll use 
$_SERVER['DOCUMENT_ROOT'] instead of $DOCUMENT_ROOT, or $_GET['id'] from 
the URL http://www.example.com/test.php?id=3 instead of $id, or 
$_ENV['HOME'] instead of $HOME.

For related information on this change, read the configuration entry for 
register_globals, the security chapter on Using Register Globals , as 
well as the PHP 4.1.0 and 4.2.0 Release Announcements.

Using the available PHP Reserved Predefined Variables, like the 
superglobal arrays, is preferred.

--

Sean


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



Re: [PHP] SQL+php

2003-01-19 Thread Sean Burlington
Sean Malloy wrote:

I see a lot of these type of answers on the list at the moment.

I'm sick of receiving smart ass answers from people. It wastes my time, and
my bandwidth.

Either answer the fucking question, even if it hasn't been asked correctly,
or don't reply at all.

Given you are a 'PHP Professional' John, I would expect a little more from
you.



I thought Johns response was humorous and to the point ...

John has shown a tremendous willingness to help people on this list - 
and I can undertsand him getting frustrated by the number of unclear 
questions...

I sometimes read this list and see if there is anything I can give back 
to the community ...

..but often give up trying to find questions I can answer in amongst the 
cryptic posts some people seem to think are a way of asking for help.

I think the bandwidth wasters are those who ask questions poorly (it 
takes several follow up mails to find out what the question was) and 
those who don't have a qucik look at the archives first (is someone 
puuting together an FAQ ?)

--

Sean


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



Re: [PHP] Logfile statistics - get words from position between otherwords

2003-01-18 Thread Sean Burlington
Svein O. Bennæs wrote:

I'm trying to write a script that extracts some search-queries from a
logfile, but I'm having problems finding the right function to solve this
problem.

Below you'll find 4 lines from the log - the words I'm trying to extract are
(for now) written in capital letters, and they are always found between the
expression "query=" and "&hits=".

Straightforward; I am trying to get everything between "query=" and "&hits="
on each line, and output statistics on different search queries on a web
page. Probably an easy thing to do, but I'm kinda stuck on this one...

*

192.168.0.1 - - [20/Dec/2002:12:19:24 +0100] "GET
/cgi-bin/search?query=WORD&hits=10&offset=0&clustering=yes&type=all&version=
3.1.0 HTTP/1.1" 200 917 ""0.0310 0. 0. 0

192.168.0.1 - - [20/Dec/2002:12:19:25 +0100] "GET
/cgi-bin/search?query=ANOTHERWORD&hits=10&offset=0&clustering=yes&type=all&v
ersion=3.1.0 HTTP/1.1" 200 917 ""0.0150 0. 0. 0

192.168.0.1 - - [20/Dec/2002:12:19:27 +0100] "GET
/cgi-bin/search?query=YETANOTHERWORD&hits=10&offset=0&clustering=yes&type=al
l&version=3.1.0 HTTP/1.1" 200 917 ""0.0310 0. 0. 0

192.168.0.1 - - [20/Dec/2002:12:19:53 +0100] "GET
/cgi-bin/search?query=AGAINWITHTHEWORD&hits=10&offset=0&qtf_lemmatize=true&r
pf_clustering:enabled=1&rpf_clustering:root=%2A&clustering=yes&type=all&vers
ion=3.1.0 HTTP/1.1" 200 980 ""0.0310 0. 0. 0

*


try this



$line = '192.168.0.1 - - [20/Dec/2002:12:19:27 +0100] 
"GET/cgi-bin/search?query=YETANOTHERWORD&hits=10&offset=0&clustering=yes&type=all&version=3.1.0 
HTTP/1.1" 200 917 ""0.0310 0. 0. 0';
preg_match("/query=([^&]*)/", $line, $matches);

echo $matches[1];

?>





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



Re: [PHP] Adding HTTP URL Code

2003-01-09 Thread Sean Burlington
ELLIOTT,KATHERINE A (HP-FtCollins,ex1) wrote:

OK, so I've gotten NO responses to my query below so I
thought I'd ask for something slightly different and see what
I get.


if you want to get a reply

1) look in the manual/ archives first

2) use a helpful subject line
   eg making links clickable

3) show us the code
   you have tried to get it working - and this code will help greatly 
in explaining what you are trying to do

4) show us the error message OR show us the output
 and explain what is wrong with it


remember - you aren't paying for this - there are hundreds of messages a 
day - personally I only skim read most of them - and if a question makes 
little sense I'm not going to spend time on it.


that said



$text = "This is a test.  It is only a test.
What happens when I include a URL in my results text?

http://not.a.real.url/programs

This is only a test";

$clickable_text = preg_replace("#(http://[^\s]+)#i",
 "$1", $text);

echo $clickable_text;

?>

I haven't been particularly strict with the allowed url charecters - 
I've just allowed everything and assumed that the url ends with 
whitespace (or end of file)

Sean



If I have a bunch of plain text data, how can I pull out the
strings containing "http".  I've tried several different things
but what I end up with is more or less than what I want.
Once I have this, I can add the URL code and replace the
string but I haven't figured out how to do this.

For example, what would I do if my text looks like this (not
including the astrices):

**
This is a test.  It is only a test.
What happens when I include a URL in my results text?

http://not.a.real.url/programs

This is only a test
**

Anyone?  Anyone?

Thanks,

Katherine

-Original Message-
From: ELLIOTT,KATHERINE A (HP-FtCollins,ex1)
[mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 07, 2003 2:36 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Adding HTTP URL Code


Hello,

I have a string of data that can be anywhere from one line (a single URL)
to many, many lines.  The data is in plain text but, as I alluded, may
contain
one or more URLs (or none).  I then take this data and put it on a web page
so I would like to make any URLs in the data live.  Has anyone on the list
done
this?  If so, can you tell me how?  I'm stumped.

Thanks,

Katherine





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




Re: [PHP] Img src

2003-01-08 Thread Sean Burlington
Ezequiel Sapoznik wrote:

I am having a parse error in the following sentence:

  print "";



it would help if you posted the actual error message !

but try this ...

print '';

or

print "";

--

Sean


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




Re: [PHP] email a web page

2003-01-06 Thread Sean Burlington
DC wrote:

Hi all,

I have a newsletter ready to email to my database of customers.

The entire newsletter incl graphics , layout etc is enclosed within a form
which posts to a second page which s supposed to email the desired
page..but it does not work! The code is listed below





  (line 79) $headers .= "From: My site.com<[EMAIL PROTECTED]>\n";




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




and then I get this message each time.

Warning: Undefined variable: headers in
c:\www\cavalier\admin\newsletteremailcommand.php on line 79


you are trying to concatenate a string to a variable that doesn't exist 
yet (this is allowed but you have your system set to emit a warning when 
you use an uninitialised variable)

Warning: Failed to Connect in
c:\www\cavalier\admin\newsletteremailcommand.php on line 91


your system is unable to connect to the mailserver (set in php.ini)


Any quick and easy tips to get my newsletter happening? Even a new script or
easy tutorial in Englsih.




--

Sean



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




Re: [PHP] .doc parsing class or function?

2003-01-05 Thread Sean Burlington
James Brennan wrote:

I'm looking to extract the text from user-uploaded .doc files. Has 
anyone come across a class or function for this? If not, any advice on 
where I would go to figure out how to write one of my own?

thanks,
loop





 search freshmeat.net for antiword

its a beuatiful little command line utility


--

Sean


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




Re: [PHP] Javascript broken!

2003-01-04 Thread Sean Burlington
Adam Wilson wrote:

I am beginning a tidy-up of a very messy site i am now managing. I have
started splitting repeated sections into single header and footer files, for
inclusion via php. Unfortunately the javascript no longer works, i.e.
rollovers etc.

Can someone please help me on this? Is this a known problem?



it's a fairly standard thing to do

most likely editing the files has introduced errors.


--

Sean


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




Re: [PHP] Rookie mail() q's .. can't find answer after RTFM...

2002-12-29 Thread Sean Burlington
-<[ Rene Brehmer ]>- wrote:



Q 1:

Well, building the form and making the page preview the message is the
easy part. But how do I make the page retain the message so that I can 1.
actually send the thing after the second submit, and 2. make it fill out
the form when user wish to alter message (or there's an error) ???



either put the fields you want as hidden fields in the preview page

or

store them as session variables



Q 2:

The manual doesn't really say it that clearly, but do I need to have the
content-type field when the message is plain text already?


plain text is the default


And should I be adding a Date: field, or does the mail() function figure
that out itself?


I'm not sure - have you tried it ?



My incoming mail server does not accept messages without a date field, so
if I need to add it, I'd really like to know. It also doesn't like
messages with more than 1 of each field...(except received-by).



just look at an email in your inbox and copy the format of the date field.

--

Sean :)



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




Re: [PHP] how could a php script return a dns error ?

2002-12-28 Thread Sean Burlington
Hatem Ben wrote:

From: "Sean Burlington" <[EMAIL PROTECTED]>


it's exactly what it says it is...

the website is experiencing technical difficulties...




Yep, this make a confusion for me, and a stupid error that could be solved
in one minute, was done in one day.



[SNIP]



In conclusion our ISP is blocking such websites (an internet censorship
system) and returned that message.
I have said dns error, coz for dns error we got same message (maybe the
server is assumed in all cases down), the original dns error is always
blocked and we got that message inspite.



It's not censorship

they are economising by using a proxy server

and using one that gives unhelpful error messages

BTW - they in this case are the people providing you with your 
connection (not the web hosting company)

they are not blocking the site

but when the page returns no data - they return an error message - this 
is resonable - it just isn't very helpful for web developers.


I'd suggest that you see if you can get a direct connection for testing 
purposes - either by changing browser settings or getting another isp.

Proxys are great for saving bandwidth - but terrible for developing 
websites through :)

--

Sean


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



Re: [PHP] how could a php script return a dns error ?

2002-12-28 Thread Sean Burlington
Hatem Ben wrote:



This is what i get exactly :

The page cannot be displayed
The page you are looking for is currently unavailable; The Web site might be
experiencing technical difficulties, or you may need to adjust your browser
settings.


The same message i got when a website experience dns problem ! anyway, i got
this problem accidently.



well thats not a dns error

it's exactly what it says it is...

the website is experiencing technical difficulties...





if the hosting setup is configured not to report error messages - you
may just be getting an error and no output.

you may be able to override the error reporting on a per-script basis

http://www.php.net/manual/en/function.error-reporting.php

also you could check that the file exists before opening it.




maybe this is what happened, and our national gateway return me this as a
dns error message.



it can be awkward to debug when you get a one-size-fits-all error message


set_error_handler() is anonther function you may find usefull

http://www.php.net/manual/en/function.set-error-handler.php

in fact there are all sorts of things you can do to help debugging - 
even if you don't want error messages apearing on the live site !

--

Sean :-)


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



Re: [PHP] how could a php script return a dns error ?

2002-12-28 Thread Sean Burlington
Hatem Ben wrote:

Hello all,

I got a strange problem, a wrong php script was upladed in my hosting server and make my website

>

return a dns error ! i've discoverd after one day that my
index.php was a wrong one ! normally it should return another error
related to script not to dns ! 

I don't get a dns error on this

I get - 'zero sized reply'


can someone explain me this ?
Is this caused by server configuration or something else ?


I would say that a php error cannot directly cause dns problems - so the 
error message may be wrong ! (what is generating the message ?)

this is the correct script url : http://www.dynamix-tn.com/
and this is the wrong script url : http://www.dynamix-tn.com/index-old.php

in localhost the index-old.php return this error, wich i think should be the correct error message 
at least i can understand that my script is wrong):

Warning: fopen("tmp/sample.htm", "r") - No such file or directory in tmp.class.php on line 43

Warning: Supplied argument is not a valid File-Handle resource in tmp.class.php on line 44

Warning: Supplied argument is not a valid File-Handle resource in tmp.class.php on line 45



on your test system - are these error messages the first thing outputed

if the hosting setup is configured not to report error messages - you 
may just be getting an error and no output.

you may be able to override the error reporting on a per-script basis

http://www.php.net/manual/en/function.error-reporting.php

also you could check that the file exists before opening it.

--

Sean


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



Re: [PHP] Open HTTPS connection

2002-12-26 Thread Sean Burlington
John W. Holmes wrote:

What are the different ways to open an HTTPS connection from within a
script and receive back the response into a variable? I know CURL can do
it, and PHP 4.3 with OpenSSL can use fopen() to do it. Can sockets be
used at all with PHP 4.2 to get the page or maybe a system call to a
simple program to do it? This is going to be on a Win2K machine. Thanks
for any info. 


you could try lynx

http://lynx.isc.org/

its a text browser commanly available on Linux stystems but also 
available for dos/win32

it can retieve and dump to stdout either the raw file or the formatted 
text - and supports https.

--

Sean


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



Re: [PHP] How to display field after MySQL join.

2002-12-26 Thread Sean Burlington
Stephen of Blank Canvas wrote:

Hi Everyone,
 
I'm trying to display the content of two mysql tables on a single page,
I have successfully joined them with the following statement.
 
$query = "SELECT serv.*, cat.* FROM site_services AS serv,
site_servicescat AS cat WHERE serv.servicescat_id = cat.servicescat_id
AND serv.theme_id = $DomainTheme AND serv.status = 1 ORDER BY RAND()
LIMIT 3";

you can do

select name.cat as cname, name.serv as sname

which would give $row['cname'] and $row['sname']

or you could use the numeric indexes ($row[0], $row[1] etc)

or use print_r($row) to see the array contents in detail


This works great but my problem is I have a field in each table called
"title", if I use the normal function of $row[title] I get field from
the "site_services" table but I cannot work out how to get the
"site_servicescat" title field.  I have tried $row[cat.title] but all I
get is errors. 
 
Any help would be really appreciated as I think it's just me missing
something basic.
 
Thanks
 
Stephen




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




Re: [PHP] Unable to match dollar sign in preg_match

2002-12-24 Thread Sean Burlington
John W. Holmes wrote:

I don't know. I just got that from reading the manual. The very first
user comment on the preg_match page.


to put a literal dollar sign in a regex it has to be escaped \$

to put a backslash in a double quoted string you have to escape it \\$

in order to put a literal dollar sign in a double quoted string you have 
to escape it \\\$

or you can use sinlgle quotes - where you only have to escape the dollar 
sign once to mark it a a literal dollar sign and not an end string/line 
placeholder

preg_match('/\$example/' , $matchme))

Sean



chrisbolt at home dot com
12-Mar-2000 03:23 
 
If you want to use some of PHP's special characters in your expression,
such as $, you must escape it twice. For example: 

$matchme = "\$example"; 
if (preg_match("/\$example/", $matchme)) { 

will not be matched because PHP interprets the \$ and passes it as $.
Instead, you must do this: 

if (preg_match("/\\\$example/", $matchme)) {
---

Don't forget to check the manual.

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/


-Original Message-
From: Randall Perry [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 23, 2002 4:07 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Unable to match dollar sign in preg_match

Hokay, that works, but what's with the triple backslashes?




preg_match ("/^.*_\%split\%_$(\d*\.\d*)/", $data, $match);


Should be

preg_match ("/^.*_\%split\%_\\\$(\d*\.\d*)/", $data, $match);

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your


copy


today. http://www.phparch.com/




--
Randall Perry
sysTame

Xserve Web Hosting/Co-location
Website Development/Promotion
Mac Consulting/Sales

http://www.systame.com/



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










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




Re: [PHP] MySQL vs PostgreSQL

2002-12-24 Thread Sean Burlington
Youy are unlikely to egt balanced asvice on this in the MySQL or 
Postgress lists -after all those people have already made thier decision.

I haven't used Postgress much - but basically...


Mysql - available on loads of hosting packages, very large user base.

PostgreSQL - better adherance to ANSII standards, resulting in more 
portable code.
Implements VIEWS, subselects and foriegn keys.

Mysql is faster (as long as you don't need the missing features)
It is better established, and things like subselects are being worked 
on, foriegn keys are already partially implemented.

The docs for both projects have sections on camparing to the other (I 
think they both cheat a bit and compare thier newest version to a 
slighlty older version of the other project)

Sean


Rick Emery wrote:
You accidentally published this to the wrong email list.  I assume you meant to send this
to the MySQL email list.

- Original Message -
From: "Miro Kralovic" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, December 23, 2002 9:10 AM
Subject: [PHP] MySQL vs PostgreSQL




Hi,

I'm just deciding which DB to use for my projects and I'm not clear with one
thing... When considering a database for web, is MySQL good enough? I read
it only supports table locking, which is not very satisfying in such a
multiuser environment as the internet..

Based on your experience, what are pros and cons of MySQL and why most of
you prefer to use MySQL to PostgreSQL, which is aparently more powerful..

Thanks for your opinions..
Miro..



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

2002-12-21 Thread Sean Burlington
Uros Gruber wrote:

Hi!

I wan't to know if there is any goor text parser around here
written in php. I'm asking before i create my own.

I would like extract some text msgs to words and i would also
like take care of stop words, special characters etc... So to
know if some word is regular word, or if is number, html tag,
html entry.




it's not php but check out

http://betsie.sourceforge.net/

written in Perl - the regular expressions may be portable to php

--

Sean


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




Re: [PHP] speet testing (was URL parsing)

2002-12-19 Thread Sean Burlington
1LT John W. Holmes wrote:


I wonder if you could pass on some pointers for speed testing.

thanks



Nothing fancy. Just using the getmicrotime() function defined on the
microtime() manual page to get the time before the bit I'm testing and after
and subtract to get the difference.

www.php.net/microtime

There are fancier classes out there that'll do this and create pretty graphs
and all that, too. I think PEAR has something to help with it.



simple is good :)

thanks for that - I'll start experimenting.

I never used too be too worried about speed  - but have recenetly worked 
on a project that has become very slow and need to start developing 
methods for analysing code changes and thier impact on performance.

--

Sean





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



[PHP] speet testing (was URL parsing)

2002-12-19 Thread Sean Burlington
1LT John W. Holmes wrote:


Assuming $url is what you have above:

$tilde = strpos($url,"~");
$slash = strpos($url,"/",$tilde);
$length = $slash - $tilde;

$username = substr($url,$tilde,$length);

Or you can use a regular expression, but the above is probably faster.

preg_match("!(~[^/]*)/!",$url,$match);
or
preg_match("!(~.*)/!U",$url,$match);

In my tests, the first solution (using strpos) was the fastest by 35%.

---John Holmes...




Hi John,
	Ive been very interested to note that you seem to have a very keen idea 
of the relative speed of different functions.

I wonder if you could pass on some pointers for speed testing.

thanks

--

Sean


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



Re: [PHP] PHP question

2002-12-17 Thread Sean Burlington
1LT John W. Holmes wrote:

Are PHP script supposed to run as the user or as the web server?
Currently I'm running Red Hat 7.3 with apache 1.3.x and all my PHP
scripts run as apache, not as the user. I'm wonder if I can run the
scripts as the user and how do I fix this?



As a module, that's the way it is. I think you can install it as a CGI and
it'll run as the user.




coments valid for apache/linux

if you run the module all the php scripts run as the user/group set in 
apache conf

if you run in cgi mode you can set a different user/group for each 
virtual host (running php in cgi mode is slower)

for security scripts should be run as a user with few system priveleges 
(ie the apache user)

--

Sean




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



Re: [PHP] Divide into words

2002-12-17 Thread Sean Burlington


how about ...




Nope. The question was the position of the words, not how many times
they appear. 


oops :(


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




Re: [PHP] Reject some?

2002-12-16 Thread Sean Burlington
Gerard Samuel wrote:

What Im trying to do is, reject all email address strings ending in 
yahoo.com, except [EMAIL PROTECTED]
Im trying ->


if (preg_match('/[^[EMAIL PROTECTED]|yahoo.com]$/', '[EMAIL PROTECTED]'))
{
   echo 'match found';
}
else
{
   echo 'match not found';
}

?>

The search pattern must also be capable of expanding to something like ->
^[EMAIL PROTECTED]|yahoo.com|^foo@hotmail|hotmail.com
Basically what Im trying to perform is to reject all email address 
strings ending in either yahoo.com or hotmail.com,
except strings ending in [EMAIL PROTECTED] or [EMAIL PROTECTED]

Thanks for any insight you may provide...


this is pretty close


echo (preg_match('/(?
echo "\n";
?>

look at the manual about assertions
http://www.php.net/manual/en/pcre.pattern.syntax.php

--

Sean


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



Re: [PHP] Divide into words

2002-12-16 Thread Sean Burlington
Uros Gruber wrote:

Hi!

For example i have some words:

Today is very beautiful day and sun is shining

What i want to get from this is array

words
 [Today] => 0
 [Is] => 6,30
 [Very] => 8
 [beautiful] => 12
 ..

Can somebody please help me with this. Those nubers are
position of special word in above sentence. If word repeates
i want to have both positions saved in same row like word is.

I tried something but i think it's to lame.




how about ...



--

Sean


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




Re: [PHP] Sesssion help

2002-12-13 Thread Sean Burlington
Hasan / Impex Holidays Maldives wrote:

Hi all,

I finally found a solution.
When i session_register("cookie_agtuser"); instead of $cookie_agtuser =
$_SESSION['cookie_agtuser']; the variable is seen.
I don't know why but if anyone know why this could happen it would help a
lot.

thanks,
Hasan



which version of php do you have installed ??

--

Sean


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




Re: [PHP] cookie expiring with session

2002-12-13 Thread Sean Burlington
Andrea wrote:

I urgently need to store a cookie that expires with session. This cookie has
to be read by a section written in jsp, therefore I don't think I can use
$_SESSION variables.

Can anyone help me?

Andrea





to set a cookie that expires with the session do

setcookie (name, value)

this cookie can then also be read by jsp (as long as it is on the same 
domain)

and you are right that the jsp will not be able to read related 
$_SESSION variables (unless it can access the file/database where php is 
storing that information).


--

Sean


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



Re: [PHP] Regex question

2002-12-13 Thread Sean Burlington
Troy May wrote:

How would take a regular non-formatted text link (http://www.link.com) and
turn it into ready to post HTML? (http://www.link.com>http://www.link.com)

Darn, Outlook formats it, but you get the idea.  It would just be typed out
normally.

Any ideas?




function MakeUrl ($text) {
$text =  preg_replace("/(www\.[a-zA-Z0-9\.\/#~:?+=&%@!_\\-]+)/", 
"http://\\1";  ,$text);#make www. -> http://www.
$text = 
preg_replace("/(http:\/\/)(?!www)([a-zA-Z0-9\.\/#~:?+=&%@!_\\-]+)/", 
"\\1\\2"  ,$text); #eg-- http://kernel.org
$text = 
preg_replace("/(http:\/\/)(www\.)([a-zA-Z0-9\.\/#~:?+=&%@!\\-_]+)/", 
"\\1\\2\\3" ,$text); #eg -- http://www.google.com -> http://www.google.com";>www.google.com
return $text;
}


--

Sean


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



Re: [PHP] Add lines to a text file

2002-12-11 Thread Sean Burlington
Antti wrote:

How can I add lines to a text file? I didn't find any function for this.

Thanks, antti.




just open it in the right mode

if you just need to add to the end of the file without doing anything 
else with it first

$fp = fopen ("/home/rasmus/file.txt", "a");

 'a' - Open for writing only; place the file pointer at the end of the 
file. If the file does not exist, attempt to create it.

http://www.php.net/manual/en/function.fopen.php

then use fwite to actually write to it

--

Sean


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



Re: [PHP] multiline regex

2002-12-11 Thread Sean Burlington
mark wrote:



preg_match_all("|(.*)|U",$content, $body, PREG_PATTERN_ORDER);

the example text im trying to grab is below - Anyone got any ideas, Ive
tried pattern modifying with /m but I cant implement it.
Please help
Thanks
Mark


you need pattern modifier s (PCRE_DOTALL)

this makes . match all chars including newline

m (PCRE_MULTILINE) just affexts where ^ and $ match

the following worked for me ...


$content = '


text text text text text text text text text text text text text text text

 text text text text text text text text text text text text text text text
text text
 text text text text text text text text text text text text text text text
text text

 text text text text text text text text text text text
 text text text text text.

';

preg_match_all("|(.*)|sU",$content, $body, PREG_PATTERN_ORDER);

foreach($body[1] as $key => $font){
  print htmlspecialchars($font)." \n";

?>

--

Sean


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



Re: [PHP] GD installation - Simple Question

2002-12-11 Thread Sean Burlington
[EMAIL PROTECTED] wrote:

Hello list,

simple question:

I´ve heard that it is possible to compile php with dg-support on two ways
1) first way: Distribution dependant with the gd-files and libraries, eg. gd.c, gd.lo, gd.o 
coming with the distribution of the compiled php-4.x-tarball
compiled the follwing way:

./configure .. --with-gd 


2) second way: You can compile the newest Distribution from GD, eg. gd-2.0.8

compiling gd-2.0.8 this way
./configure --prefix=/usr/local/gd ...
eg. under  /usr/local/gd

and the compile php-4.x this way
./configure  --with-gd=/usr/local 


> Did I got that right ?

almost

I think that the value you use for 'prefix=' on gd should be the same as 
the value for 'with-gd='

and its probably best to install gd in /usr/local so that the libraries 
are in an already known location.

like this

./configure --prefix=/usr/local
 eg. under  /usr/local

and the compile php-4.x this way
./configure  --with-gd=/usr/local

if you do this - be aware that you will have two versions of gd 
installed - this shouldn't cause any problems but don't forget you have 
two versions - and if you install more software make sure it finds the 
right version.

- you can always remove the ditro version - but eg rpm may complain 
about dependency problems as it won't know about your /usr/local version.

--

Sean


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



Re: [PHP] upload image

2002-12-11 Thread Sean Burlington
Shaun wrote:

Hi,

i am using a form to upload an image to the server, is it possible to get
the image size during this process so i can store it for later use (i.e.
determining the size of the popup window to view the image)?

thanks for your help






you want

getimagesize()

http://www.php.net/manual/en/function.getimagesize.php
--

Sean


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




Re: [PHP] Filter vulger / controversial words - need word source

2002-12-11 Thread Sean Burlington
DL Neil wrote:

Hi Jon,

[SNIP]

May I suggest, rather than picking your way through this minefield, you
provide a "report abusive comment" link instead?



Most sensible! The employment of a technological solution to a social
problem is somewhat shooting the messenger. However some countries are now
legislating responsibility that ISPs/employers must discharge (shooting the
person who shoes the horses that the Pony Express messenger is riding!?)



I've worked on several projects where the client initially wanted 
filtering - in some cases we have implemented some kind of filtering - 
but it has always ended up being a human that doe the real work.

there simply is no definitive list of words

you can't stop people talking about pussy cats, turkey breasts or even 
shag pile carpets (and words have different meanings from one place to 
the next)


automated filters can be a usefull aid to human moderation - flagging up 
messages for review.

if you want a partial list of offensive terms - try looking at the
meta keywords on a few porn sites ...


--

Sean


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



Re: [PHP] How to test php.info from command line

2002-12-11 Thread Sean Burlington
Jason Wong wrote:

On Tuesday 10 December 2002 02:39, [EMAIL PROTECTED] wrote:


Hello All,



How to test php.info from command line:


#echo "" | php

to the standard output (screen) - or if you want to a file like this way:
#echo "" | php > /tmp/test_php.txt

Oliver Etzel

.eu - domain are coming soon
www.t-host.com



Or simply

  #php -i

It would be nice if there was a text-only version without all the HTML gunge.



this works nicely for me

php -i | lynx -stdin -dump



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