[PHP] OO Programming - get practical

2002-07-22 Thread Paul Dionne

Hey all,

I want to point something out to aspiring authors.  The truth is, that few 
books and web pages out there show examples using OO methods.  For example, 
the book I use as my primary reference has one chapter on OO PHP and that 
is it.  The rest of the examples in the book are in regular functions.  And 
the one example they give is used to create a web page, with the Title , 
KeyWords, Styles, Header, Menu... as the objects.

So, I guess my point is that if people want to encourage use of OO 
programming, they need to use more examples in their books instead of what 
is "easy."  Otherwise, if the reader doesn't "get" the one example, they 
don't have other examples to try.  Furthermore, one cannot encourage people 
to think about how they can program using OO methods if they don't use such 
methods in their teaching of the subject matter.

My 2 cents.

Paul

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




RE: [PHP] redirecting after login

2002-07-22 Thread Peter

why don't u do something like

if (!username)
{ you can not access this page
}
else
{
 //page content
}

?

that's a quick fix but might be all you need to do..


> -Original Message-
> From: Tim Thorburn [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, 23 July 2002 5:01 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] redirecting after login
>
>
>
> >
> >Once they've been redirected, can they just bookmark the resulting page
> >and never have to log in again?
>
>
> Actually, yes - after a couple hours of playing around with the login and
> finally getting the Meta tags to work for me, I found that if the person
> were to simply type in the URL of the protected page, they would
> have full
> access.  Right now I'm playing with sessions and global sessions
> to try and
> correct this problem.  Although its not working as well as I had hoped.
>
> Basically the plan is for all users to goto Page 1 - the login page, and
> then be re-directed to their proper destination - Page 2.  But,
> if a clever
> bad person were to simply type in the URL to Page 2 they could
> have access
> to the database and run amuck.  So I added a line checking to see if the
> session from Page 1 is registered, if not, goto Page 1.  That
> part works -
> what doesn't work is after they login to Page 1, the redirect
> sends them to
> Page 2 and right back to Page 1 because the global session isn't staying
> registered.
>
> Since its 2am I'm quitting for the nite ... but maybe some friendly
> European people awake at this hour might have an idea on this
> one?  Or even
> friendly caffeine addicts on the side of the pond :P
>
> Thanks
> -Tim
>
>
>
> --
> 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] redirecting after login

2002-07-22 Thread Tim Thorburn


>
>Once they've been redirected, can they just bookmark the resulting page
>and never have to log in again?


Actually, yes - after a couple hours of playing around with the login and 
finally getting the Meta tags to work for me, I found that if the person 
were to simply type in the URL of the protected page, they would have full 
access.  Right now I'm playing with sessions and global sessions to try and 
correct this problem.  Although its not working as well as I had hoped.

Basically the plan is for all users to goto Page 1 - the login page, and 
then be re-directed to their proper destination - Page 2.  But, if a clever 
bad person were to simply type in the URL to Page 2 they could have access 
to the database and run amuck.  So I added a line checking to see if the 
session from Page 1 is registered, if not, goto Page 1.  That part works - 
what doesn't work is after they login to Page 1, the redirect sends them to 
Page 2 and right back to Page 1 because the global session isn't staying 
registered.

Since its 2am I'm quitting for the nite ... but maybe some friendly 
European people awake at this hour might have an idea on this one?  Or even 
friendly caffeine addicts on the side of the pond :P

Thanks
-Tim



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




Re: [PHP] Re: Using fopen()/fread()/fscanf()

2002-07-22 Thread Jason Wong

On Tuesday 23 July 2002 14:16, Jason Soza wrote:
> I'm fairly certain that fopen() is working fine - I can echo "$contents";
> and it works great, but it displays the entire page that I fetched. I just
> want certain parts of the page and unfortunately, fscanf() doesn't seem to
> think $contents or $filename are valid. Just more info on this, I tried
> replacing fscanf($filename,...) with fscanf($contents,...) and got the same
> result.


Not sure why you're using fscanf() and why it doesn't work. I would use 
preg_match() on $contents.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Communications satellite used by the military for star wars.
*/


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




RE: [PHP] Re: Using fopen()/fread()/fscanf()

2002-07-22 Thread Jason Soza

Okay, I removed that line and I no longer get the invalid File-Handle
resource error, but I also don't get anything useful. Maybe my fscanf() line
needs some work? With this new code, if I print_r($headlines); I get 229 of
these: Array ( [0] => )

Code:
$filename =
fopen("http://www.kinyradio.com/juneaunews/latest_juneau_news.html";, "r");

while($headlines = fscanf($filename, "%[a-zA-Z0-9,. ]")) {
print_r($headlines);
}
fclose($filename);

What the fscanf() code -should- be doing, or at least what I intend for it
to do, is grab everything between mailto:[EMAIL PROTECTED]]
Sent: Monday, July 22, 2002 10:16 PM
To: 'Jason Soza'; David Robley; [EMAIL PROTECTED]
Subject: RE: [PHP] Re: Using fopen()/fread()/fscanf()


I'm thinking that you need to remove the:
   $contents = fread($filename, 100);
line. This is probably making the file pointer point to the end of the file.

-Original Message-
From: Jason Soza [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 23, 2002 4:17 PM
To: David Robley; [EMAIL PROTECTED]
Subject: RE: [PHP] Re: Using fopen()/fread()/fscanf()


I'm fairly certain that fopen() is working fine - I can echo "$contents";
and it works great, but it displays the entire page that I fetched. I just
want certain parts of the page and unfortunately, fscanf() doesn't seem to
think $contents or $filename are valid. Just more info on this, I tried
replacing fscanf($filename,...) with fscanf($contents,...) and got the same
result.

Thanks,
Jason Soza


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




RE: [PHP] PHP security bug and patch

2002-07-22 Thread Peter

restart apache

> -Original Message-
> From: Michal Dvoracek [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, 23 July 2002 4:34 PM
> To: Jason Soza
> Cc: [EMAIL PROTECTED]
> Subject: [PHP] PHP security bug and patch
>
>
> Hello,
>
> when applying patch on version 4.2.1 then in phpinfo(); is still PHP
> Version 4.2.1 but SERVER_SOFTWARE: Apache/1.3.26 (Unix) PHP/4.2.2
> mod_ssl/2.8.9 OpenSSL/0.9.6d-beta1
>
> Regards,
> Michal Dvoracek  [EMAIL PROTECTED]
> Capitol Internet Publisher, Korunovacni 6, 170 00 Prague 7, Czech Republic
> tel.: ++420 2 3337 1117, fax:  ++420 2 3337 1112
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>


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




[PHP] PHP security bug and patch

2002-07-22 Thread Michal Dvoracek

Hello,

when applying patch on version 4.2.1 then in phpinfo(); is still PHP
Version 4.2.1 but SERVER_SOFTWARE: Apache/1.3.26 (Unix) PHP/4.2.2
mod_ssl/2.8.9 OpenSSL/0.9.6d-beta1

Regards,
Michal Dvoracek  [EMAIL PROTECTED]
Capitol Internet Publisher, Korunovacni 6, 170 00 Prague 7, Czech Republic
tel.: ++420 2 3337 1117, fax:  ++420 2 3337 1112


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




Re: [PHP] Re: HTML E-mails

2002-07-22 Thread Manuel Lemos

Hello,

On 07/23/2002 03:14 AM, Miguel Cruz wrote:
>>Anyway, would you object to develop a system for a customer where it is 
>>needed to send messages to clients that do not oppose to receive 
>>messages in HTML? If so, why?
> 
> 
> I have never had a customer say "We have three people, and I personally
> installed their email client, and I want to develop a web-based system for
> sending mail to them."

Odd! Haven't you ever had a customer that had a site and wanted to send 
a newsletters to site users that voluntarily subscribe to it? If you 
had, wouldn't you find reasonable that many users may prefer HTML 
messages where the actual documents can be presented in richer forms 
than in plain text?



> What I have heard quite a lot is "We have a growing list of clients and I
> would like to send mail to all of them." This customer is not served by
> having a system that sends confusing scrambled-looking messages to their
> clients.  Better everyone has a slightly blander experience than 10% of
> the users be permanently alienated.

Ok, but wouldn't is be more reasonable if you proposed a system that 
would let the customers decide wether they would get messages in HTML or 
text?



> If they have a way to definitively determine that users are consistently 
> using HTML-capable MUAs, that's excellent, and I would not discourage them 
> from sending HTML-formatted messages to those users.

One obvious way is asking the users which format they prefer.


-- 

Regards,
Manuel Lemos


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




Re: [PHP] Re: MySQL - PHP combined log

2002-07-22 Thread PHPCoder

Thanks, but all these "methods" require modification of the scripts 
already on the server, and it won't ensure any new script being written 
by a user on my system to comply.
Are you all saying that there are no logs kept by default of errors 
generated on php/mysql pages at all unless specifically coded? Wouldn't 
it be possible then in future PHP releases to have a "set_error_logging" 
directive in the php.ini file that will automatically run a wrapper 
function on all mysql_query() functions to do this kind of thing?

How are people out there managing the scripts/script errors caused  by 
users on their systems? Or is it a case of "handling the crisis when it 
happens"?
You see, as administrator, I need to be able to quickly see who are 
coding in such a way as to leave security holes, or even worse, cause 
the server to crash due to poor coding. There are almost 1000 individual 
php files on my server, and it wouldn't be possible for me to scrutinize 
all of them to make sure they are OK.
Are there any admins out there that have policies about scripting 
practices on their systems; ie, checking a script from a user before it 
is allowed to be uploaded etc?

Thanks
 

Richard Lynch wrote:

>>Hi, tried this on mysql list, no luck:
>>
>>I want to be able to view a single log that contains the following:
>>
>>IP of user : page_name (PHP only): time/date: MySQL query ( 'select * 
>>
>>from xxx' etc.) : error msg from mysql/php if any
>
>>So it's almost a hybrid between apache and mysql with some extra's
>>
>>I'm sure you all should see the benifit of this in troubleshooting and 
>>specially keeping track of who does what when it comes to PHP coding on 
>>ones server, specially with crappy code that kills the server.
>>
>>Is something like this possible, already there?
>>
>>PS, Running RedHat 7.0 with PHP4 and mysql 3.23.x
>>
>
>http://php.net/error_log
>
>if you can get everybody to use your own function to query the database.
>
>Or, you could use http://php.net/set_error_handler and
>http://php.net/trigger_error and catch all errors thrown by all PHP code.
>
>Actually, to get the PHP page name and line number, set_error_handler is
>probably your best bet.
>



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




RE: [PHP] Re: Using fopen()/fread()/fscanf()

2002-07-22 Thread Martin Towell

I'm thinking that you need to remove the:
   $contents = fread($filename, 100);
line. This is probably making the file pointer point to the end of the file.

-Original Message-
From: Jason Soza [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 23, 2002 4:17 PM
To: David Robley; [EMAIL PROTECTED]
Subject: RE: [PHP] Re: Using fopen()/fread()/fscanf()


I'm fairly certain that fopen() is working fine - I can echo "$contents";
and it works great, but it displays the entire page that I fetched. I just
want certain parts of the page and unfortunately, fscanf() doesn't seem to
think $contents or $filename are valid. Just more info on this, I tried
replacing fscanf($filename,...) with fscanf($contents,...) and got the same
result.

Thanks,
Jason Soza

-Original Message-
From: David Robley [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 22, 2002 8:37 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Using fopen()/fread()/fscanf()


In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
says...
> I think I'm pretty close to getting this right (maybe!), I've been reading
> through the manual, but can't seem to work it out. I keep getting this
> error:
>
> [Mon Jul 22 19:03:24 2002] [error] PHP Warning:  Supplied argument is not
a
> valid File-Handle resource in index.php on line 66
>
> I'm trying to open a URL, read the contents, then pull out specific info
> found between specific HTML tags. This is what I have so far:
>
> 63|  64|   $filename =
> fopen("http://www.kinyradio.com/juneaunews/latest_juneau_news.html";, "r");
> 65|   $contents = fread($filename, 100);
> 66|   while($headlines = fscanf($filename, " 45\">%[a-zA-Z0-9,. ]",
> $headline)) {
> 67|   extract($headlines);
> 68|   print "
href=\"http://www.kinyradio.com/juneaunews/latest_juneau_news.html\";>$headli
> ne";
> 69|   }
> 70|   fclose($filename);
> 71| ?>
>
> Any ideas? Any other functions I could try instead of fscanf()?

That error indicates that fopen failed to open the requested file. Given
that the URL works fine in a browser, is it possible that your php is not
configured to do remote fopen? Check the setting of allow_url_fopen in
phpinfo()

It is a good idea to test the result of such calls before trying to use
the result:

fopen('Whatever') or exit('Couldn't get it, Boss!');

or

if(fopen('whatever') {
  do good things;
}else{
  bleat vigorously;
}

Cheers
--
David Robley
Temporary Kiwi!

Quod subigo farinam

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


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

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




RE: [PHP] Re: Using fopen()/fread()/fscanf()

2002-07-22 Thread Jason Soza

I'm fairly certain that fopen() is working fine - I can echo "$contents";
and it works great, but it displays the entire page that I fetched. I just
want certain parts of the page and unfortunately, fscanf() doesn't seem to
think $contents or $filename are valid. Just more info on this, I tried
replacing fscanf($filename,...) with fscanf($contents,...) and got the same
result.

Thanks,
Jason Soza

-Original Message-
From: David Robley [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 22, 2002 8:37 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Using fopen()/fread()/fscanf()


In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
says...
> I think I'm pretty close to getting this right (maybe!), I've been reading
> through the manual, but can't seem to work it out. I keep getting this
> error:
>
> [Mon Jul 22 19:03:24 2002] [error] PHP Warning:  Supplied argument is not
a
> valid File-Handle resource in index.php on line 66
>
> I'm trying to open a URL, read the contents, then pull out specific info
> found between specific HTML tags. This is what I have so far:
>
> 63|  64|   $filename =
> fopen("http://www.kinyradio.com/juneaunews/latest_juneau_news.html";, "r");
> 65|   $contents = fread($filename, 100);
> 66|   while($headlines = fscanf($filename, " 45\">%[a-zA-Z0-9,. ]",
> $headline)) {
> 67|   extract($headlines);
> 68|   print "
href=\"http://www.kinyradio.com/juneaunews/latest_juneau_news.html\";>$headli
> ne";
> 69|   }
> 70|   fclose($filename);
> 71| ?>
>
> Any ideas? Any other functions I could try instead of fscanf()?

That error indicates that fopen failed to open the requested file. Given
that the URL works fine in a browser, is it possible that your php is not
configured to do remote fopen? Check the setting of allow_url_fopen in
phpinfo()

It is a good idea to test the result of such calls before trying to use
the result:

fopen('Whatever') or exit('Couldn't get it, Boss!');

or

if(fopen('whatever') {
  do good things;
}else{
  bleat vigorously;
}

Cheers
--
David Robley
Temporary Kiwi!

Quod subigo farinam

--
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] Re: HTML E-mails

2002-07-22 Thread Miguel Cruz

On Tue, 23 Jul 2002, Manuel Lemos wrote:
> On 07/23/2002 02:40 AM, Miguel Cruz wrote:
>> On Sun, 21 Jul 2002, Richard Lynch wrote:
>>> Actually, though, when my clients insist on HTML email, I just
>>> tell them: "No.  If you want that feature, you'll have to hire
>>> somebody else to do it.  I've already explained why." I don't think
>>> I've lost a single client that way -- Every one of
>>> them has re-considered my advice, and outright
>>> refusal, and decided maybe I *do* know what the hell I'm talking about.
>>> YMMV.
>> 
>> I agree with everything you say. Furthermore, I think that
>> when I'm being paid for my expertise, I have a specific responsibility
>> to stop people from doing stupid things, even if they do happen to
>> really want them.  There is no honor - and in the long term, no
>> future - in casting aside my better judgment because I once read that
>> "the customer is always right."
> 
> It is good when you can discourage your customers to use a certain wide 
> spread technology for good reasons and still get paid for that.
> 
> Anyway, would you object to develop a system for a customer where it is 
> needed to send messages to clients that do not oppose to receive 
> messages in HTML? If so, why?

I have never had a customer say "We have three people, and I personally
installed their email client, and I want to develop a web-based system for
sending mail to them."

What I have heard quite a lot is "We have a growing list of clients and I
would like to send mail to all of them." This customer is not served by
having a system that sends confusing scrambled-looking messages to their
clients.  Better everyone has a slightly blander experience than 10% of
the users be permanently alienated.

If they have a way to definitively determine that users are consistently 
using HTML-capable MUAs, that's excellent, and I would not discourage them 
from sending HTML-formatted messages to those users.

miguel


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




[PHP] Re: [ANNOUNCE] PHP Security Advisory: Vulnerability in PHP

2002-07-22 Thread Manuel Lemos

Hello,

On 07/22/2002 08:50 PM, Richard Lynch wrote:
>>Not being an expert in php..i couldnt understand the vulnerability.
>>Can someone shed some light here.
> 
> 
> Very short explanation:
> 
> Upgrade.
> Now!

Downgrading can also be a good option. New versions have new bugs, 
despite that also fix old bugs. This security advisory that the flaw did 
not exist in old versions.

Anyway, always test everything before you update, wether it is upgrading 
or downgrading.

-- 

Regards,
Manuel Lemos


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




[PHP] Re: php security mailing list ...

2002-07-22 Thread Manuel Lemos

Hello,

On 07/22/2002 08:07 PM, Dario Bahena Tapia wrote:
> Hi ...
> 
> I want to be warned about php security issues, I couldn't find
> an exact match in the mailing list names ... which one do you
> recommend me?

http://www.phpadvisory.com/ is what you are looking for.


-- 

Regards,
Manuel Lemos


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




Re: [PHP] Re: HTML E-mails

2002-07-22 Thread Manuel Lemos

Hello,

On 07/23/2002 02:40 AM, Miguel Cruz wrote:
> On Sun, 21 Jul 2002, Richard Lynch wrote:
> 
>>Actually, though, when my clients insist on HTML email, I just tell
>>them:  "No.  If you want that feature, you'll have to hire somebody else
>>to do it.  I've already explained why."  I don't think I've lost a
>>single client that way -- Every one of them has re-considered my advice,
>>and outright refusal, and decided maybe I *do* know what the hell I'm
>>talking about.  YMMV.
> 
> 
> I agree with everything you say. Furthermore, I think that when I'm being 
> paid for my expertise, I have a specific responsibility to stop people 
> from doing stupid things, even if they do happen to really want them. 
> There is no honor - and in the long term, no future - in casting aside my 
> better judgment because I once read that "the customer is always right."

It is good when you can discourage your customers to use a certain wide 
spread technology for good reasons and still get paid for that.

Anyway, would you object to develop a system for a customer where it is 
needed to send messages to clients that do not oppose to receive 
messages in HTML? If so, why?


-- 

Regards,
Manuel Lemos


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




Re: [PHP] Script executing Telnet Shell Command...

2002-07-22 Thread Miguel Cruz

On Mon, 22 Jul 2002, Kondwani Spike Mkandawire wrote:
> I am trying to execute a Script running a telnet command
> testing through a range of IP connections...
> Here goes:
> 
>  $str = "123.456.789.";
> $count = 0;
> 
> while ($count < 999){
> $runTheScriptCommand...
> }
> ?>
> 
> What I want to stick into the while loop is if connection
> was successful, break...  Is there a way I can check whether
> telnet connection was successful on each step through the
> loop or do I have to restructure my program and try
> connecting to a port via fsockopen...  By the way
> does anyone know what port number telnet connects to...

Telnet is port 23, and the protocol is more complicated than you might 
think. Perhaps you could look into using 'expect' (a unix utility) to 
control your telnet session. That might bring you less heartache in the 
long run.

miguel


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




Re: [PHP] redirecting after login

2002-07-22 Thread Miguel Cruz

On Mon, 22 Jul 2002, Tim Thorburn wrote:
> A site I'm working on requires a login screen where various individuals 
> will log into the site and add information for their various 
> departments.  Rather than setup a different script for each department, I 
> was hoping to create one script that would either accept or deny a login 
> based on the username/password stored in a database, then based on the 
> username/password - redirect the individuals browser to a URL.
> 
> I've got the login part working perfectly, and I can turn the URL into a 
> link on the page, but I'd rather have the script just automatically forward 
> the person to the page they're login gives them access to.
> 
> I've tried using header(), but since the redirection takes place about 
> mid-script, it doesn't work.  I've also tried using  tag redirects, 
> but those don't seem to accept the PHP/MySQL combo.

Once they've been redirected, can they just bookmark the resulting page 
and never have to log in again?

miguel


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




Re: [PHP] number of files in a dir vs. performace

2002-07-22 Thread Miguel Cruz

On Mon, 22 Jul 2002, eat pasta type fasta wrote:
> currently I am holding all of the files in 1 directory since the DB can 
> keep track of them, however their number has grown to over 400 at this 
> point
> 
> my issue is whether it would be worth it (performance wise) to split them 
> into thumbs and works thus having 200+ files per directory as opposed to 
> so many, I am expecting the number of images to double in the future.

400 is not very many. Tens of thousands can start to become a problem.

Look at the distribution of your file names and come up with a hashing 
mechanism. For instance, if your filenames are numbers, create 
subdirectories 0/ 1/ 2/ 3/ 4/ etc., and place the files based on their 
final digit.

miguel


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




Re: [PHP] Inline Images ?

2002-07-22 Thread Miguel Cruz

On Sun, 21 Jul 2002, Roberto Ramírez wrote:
> Is there a way to display an image withouth sending the headers first?

You have to send the header - that's how the browser knows what sort of 
image it is.

> I'm trying to display an inline image... but when I try it just only
> send the raw image data...
>
> I've thinking that I need to save an image first to disk and then
> display the image later... 

That's not necessary. 

Hi there. Here is an image:
";

?>

miguel


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




Re: [PHP] Re: HTML E-mails

2002-07-22 Thread Miguel Cruz

On Sun, 21 Jul 2002, Richard Lynch wrote:
> Actually, though, when my clients insist on HTML email, I just tell
> them:  "No.  If you want that feature, you'll have to hire somebody else
> to do it.  I've already explained why."  I don't think I've lost a
> single client that way -- Every one of them has re-considered my advice,
> and outright refusal, and decided maybe I *do* know what the hell I'm
> talking about.  YMMV.

I agree with everything you say. Furthermore, I think that when I'm being 
paid for my expertise, I have a specific responsibility to stop people 
from doing stupid things, even if they do happen to really want them. 
There is no honor - and in the long term, no future - in casting aside my 
better judgment because I once read that "the customer is always right."

miguel


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




Re: [PHP] Doing an HTML POST using header()

2002-07-22 Thread Miguel Cruz

On Mon, 22 Jul 2002, Francis wrote:
> I'm trying to redirect to another website but doing a post to that website
> at the same time. (ie POST rather than a GET (eg: header("Location:
> www.anothersite.com/index.php?page=22");   )
> 
> How do you do an HTML post using the header() whats the syntax? I just cant
> find it anywhere.

You can't.

If you want to do a post, either construct the request yourself, use one 
of the many free classes created to do so, or use the cURL library.

miguel


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




Re: [PHP] number of files in a dir vs. performace

2002-07-22 Thread Michael Sims

On Mon, 22 Jul 2002 23:09:12 -0400, you wrote:

>currently I am holding all of the files in 1 directory since the DB can 
>keep track of them, however their number has grown to over 400 at this 
>point
>
>my issue is whether it would be worth it (performance wise) to split them 
>into thumbs and works thus having 200+ files per directory as opposed to 
>so many, I am expecting the number of images to double in the future.

As one other poster has mentioned, this is not really a PHP issue, but
more of an OS one.  IMHO, anytime you are dealing with a group of
files that numbers more than say, 200 or so, it's worth it to split
them out in seperate directories.  I would suggest some sort of one or
two level hash, based on the filenames.  (Forget just splitting out
the thumbnails, because if you really expect the number to double in
the future you'll be glad you spent the extra time to put the hash
into place.)  If your names are sufficiently different, I would
suggest hashing the directories based on the first two characters of
the filename.  

For example, lets say you have two jpgs called:

joejohnson.jpg
tomsmith.jpg

Place them in directories like so:

/images/j/o/joejohnson.jpg
/images/t/o/tomsmith.jpg

This is similar to how a lot of mail delivery agents can be configured
to deliver mail to a host with a lot of different users.

If for some reason the filenames tend to begin with the same
characters, then work backward for the hash.  For example, I work at a
real estate company and the photos for our listings are named off the
listing number.  Most of the time these numbers are in the same range,
so we use the LAST two digits of the number.  For example:

2450067.jpg
2450256.jpg

go in

/images/6/7/2450067.jpg
/images/5/6/2450256.jpg

Anyway, with a hash you have a definite algorithm to figure out where
a file should be placed, and later where it should be retrieved.

HTH...

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




Re: [PHP] Comma question

2002-07-22 Thread Miguel Cruz

On Mon, 22 Jul 2002, B i g D o g wrote:
> I figured that the comma was to concatenate but is was wondering if the
> parser handled it different.

The comma isn't actually for concatenation. The net effect is the same in 
this case, but a very different thing is happening.

  echo "hello " , "there";

Here 'echo' is printing two separate arguments. First it is printing 
"hello " and then it is printing "there".

  echo "hello " . "there";

Here the strings are concatenated to form a single string ("hello there") 
and then this is processed by echo which prints it out.

The effects are the same, as I said, but it's important to realize why 
they're very different ways of getting that effect.

miguel


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




Re: [PHP] Passing Special Characters In url

2002-07-22 Thread Miguel Cruz

On Tue, 23 Jul 2002, Ricky wrote:
> I am having problems passing variables in a url specifically when there is
> an & sign. Any suggestions?

There is a special function just for you.

   http://php.net/urlencode

miguel


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




RE: [PHP] redirecting after login

2002-07-22 Thread César Aracena

I forgot to tell you: This snippet is supposed to go at the very top of
the login page (right after the  -Original Message-
> From: César Aracena [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 23, 2002 1:45 AM
> To: 'Tim Thorburn'; [EMAIL PROTECTED]
> Subject: RE: [PHP] redirecting after login
> 
> Hi. Since I haven't used meta tags for years now (don't like them:) I
> can't help you there, but instead, here's a typical login/redirect PHP
> page of mine. As you can see, it doesn't matter if the login form is
at
> the bottom of the page, or even if it's after an included header file
as
> long the form points to $PHP_SELF:
> 
> session_start();
> 
> if ($username && $pass)
> {
>   $db_conn = mysql_connect("localhost", "admin", "password");
> 
>   mysql_select_db("db_name", $db_conn);
> 
>   $query = "SELECT * FROM table_name WHERE username = '$username'
> AND   password = password('$pass')";
> 
>   $result = mysql_query($query, $db_conn);
> 
>   if (mysql_num_rows($result) > 0)
>   {
>   $row = mysql_fetch_array($result);
>   if ($row['devlevel'] == '2')
>   {
>   $valid_admin = $row['devfirst'];
>   session_register("valid_admin");
>   header("Location: ../admin/index.php");
>   exit;
>   }
>   else if ($row['devlevel'] == '1')
>   {
>   $valid_user = $row['devid'];
>   session_register("valid_user");
>   header("Location: index.php");
>   exit;
>   }
>   else
>   {
>   header("Location: ../jumpto.php?fetch=devent");
>   exit;
>   }
>   }
>   else
>   {
>   header("Location: ../jumpto.php?fetch=devent");
>   exit;
>   }
> }
> else
> {
>   header("Location: ../jumpto.php?fetch=devent");
>   exit;
> }
> 
> Like this, I can diferenciate the users by fetching the "devlevel"
> number from the same DB that the user was authenticated from.
> 
> HTH, C.
> 
> 
> > -Original Message-
> > From: Tim Thorburn [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, July 23, 2002 1:00 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] redirecting after login
> >
> > Hi,
> >
> > A site I'm working on requires a login screen where various
> individuals
> > will log into the site and add information for their various
> > departments.  Rather than setup a different script for each
> department, I
> > was hoping to create one script that would either accept or deny a
> login
> > based on the username/password stored in a database, then based on
the
> > username/password - redirect the individuals browser to a URL.
> >
> > I've got the login part working perfectly, and I can turn the URL
into
> a
> > link on the page, but I'd rather have the script just automatically
> > forward
> > the person to the page they're login gives them access to.
> >
> > I've tried using header(), but since the redirection takes place
about
> > mid-script, it doesn't work.  I've also tried using  tag
> redirects,
> > but those don't seem to accept the PHP/MySQL combo.
> >
> > Any ideas?
> >
> > Thanks
> > -Tim
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



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




RE: [PHP] redirecting after login

2002-07-22 Thread César Aracena

Hi. Since I haven't used meta tags for years now (don't like them:) I
can't help you there, but instead, here's a typical login/redirect PHP
page of mine. As you can see, it doesn't matter if the login form is at
the bottom of the page, or even if it's after an included header file as
long the form points to $PHP_SELF:

session_start();

if ($username && $pass)
{
$db_conn = mysql_connect("localhost", "admin", "password");

mysql_select_db("db_name", $db_conn);

$query = "SELECT * FROM table_name WHERE username = '$username'
AND password = password('$pass')";

$result = mysql_query($query, $db_conn);

if (mysql_num_rows($result) > 0)
{
$row = mysql_fetch_array($result);
if ($row['devlevel'] == '2')
{
$valid_admin = $row['devfirst'];
session_register("valid_admin");
header("Location: ../admin/index.php");
exit;
}
else if ($row['devlevel'] == '1')
{
$valid_user = $row['devid'];
session_register("valid_user");
header("Location: index.php");
exit;
}
else
{
header("Location: ../jumpto.php?fetch=devent");
exit;
}
}
else
{
header("Location: ../jumpto.php?fetch=devent");
exit;
}
}
else
{
header("Location: ../jumpto.php?fetch=devent");
exit;
}

Like this, I can diferenciate the users by fetching the "devlevel"
number from the same DB that the user was authenticated from.

HTH, C.


> -Original Message-
> From: Tim Thorburn [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 23, 2002 1:00 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] redirecting after login
> 
> Hi,
> 
> A site I'm working on requires a login screen where various
individuals
> will log into the site and add information for their various
> departments.  Rather than setup a different script for each
department, I
> was hoping to create one script that would either accept or deny a
login
> based on the username/password stored in a database, then based on the
> username/password - redirect the individuals browser to a URL.
> 
> I've got the login part working perfectly, and I can turn the URL into
a
> link on the page, but I'd rather have the script just automatically
> forward
> the person to the page they're login gives them access to.
> 
> I've tried using header(), but since the redirection takes place about
> mid-script, it doesn't work.  I've also tried using  tag
redirects,
> but those don't seem to accept the PHP/MySQL combo.
> 
> Any ideas?
> 
> Thanks
> -Tim
> 
> 
> 
> --
> 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] Passing Special Characters In url

2002-07-22 Thread Justin French

If I want to pass something with &'s in it (commonly a query string i want
to use later), I base64_encode() it, then base64_decode() it later when
needed.

Cheers,

Justin


on 23/07/02 2:29 PM, Ricky ([EMAIL PROTECTED]) wrote:

> Hi,
> 
> I am having problems passing variables in a url specifically when there is
> an & sign. Any suggestions?
> 
> Rick
> 
> 


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




Re: [PHP] another problem

2002-07-22 Thread Justin French

I would have started with a search on php.net for "hex" which would have
showed you two functions, and numerous other links that i'm not going to
read.

dechex() and hexdec() seem to do it for numbers, and i'm sure you'll find
what you need with some more looking.


Justin French


on 23/07/02 6:02 PM, Georgie Casey ([EMAIL PROTECTED]) wrote:

> well, i solved the last problem on my own but now i need help on my new one
> :-)
> 
> how do you convert text to hexadecimal with PHP?
> 
> --
> Regards,
> Georgie Casey
> [EMAIL PROTECTED]
> 
> ***
> http://www.filmfind.tv
> Online Film Production Directory
> ***
> 
> 


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




[PHP] Re: Using fopen()/fread()/fscanf()

2002-07-22 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> I think I'm pretty close to getting this right (maybe!), I've been reading
> through the manual, but can't seem to work it out. I keep getting this
> error:
> 
> [Mon Jul 22 19:03:24 2002] [error] PHP Warning:  Supplied argument is not a
> valid File-Handle resource in index.php on line 66
> 
> I'm trying to open a URL, read the contents, then pull out specific info
> found between specific HTML tags. This is what I have so far:
> 
> 63|  64|   $filename =
> fopen("http://www.kinyradio.com/juneaunews/latest_juneau_news.html";, "r");
> 65|   $contents = fread($filename, 100);
> 66|   while($headlines = fscanf($filename, " 45\">%[a-zA-Z0-9,. ]",
> $headline)) {
> 67|   extract($headlines);
> 68|   print " href=\"http://www.kinyradio.com/juneaunews/latest_juneau_news.html\";>$headli
> ne";
> 69|   }
> 70|   fclose($filename);
> 71| ?>
> 
> Any ideas? Any other functions I could try instead of fscanf()?

That error indicates that fopen failed to open the requested file. Given 
that the URL works fine in a browser, is it possible that your php is not 
configured to do remote fopen? Check the setting of allow_url_fopen in 
phpinfo()

It is a good idea to test the result of such calls before trying to use 
the result:

fopen('Whatever') or exit('Couldn't get it, Boss!');

or

if(fopen('whatever') {
  do good things;
}else{
  bleat vigorously;
}

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




RE: [PHP] Passing Special Characters In url

2002-07-22 Thread Martin Towell

I think the proper way of sending an ampersand is to use &

-Original Message-
From: Ricky [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 23, 2002 2:30 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Passing Special Characters In url


Hi,

I am having problems passing variables in a url specifically when there is
an & sign. Any suggestions?

Rick



-- 
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] Problem with Not displaying HTML if data not found

2002-07-22 Thread Martin Towell

it's the mysql_result()... try this...

echo "'";

mysql_result($result, 0,'FLRPLAN_2')
  ^--- you're always looking at the first row

rf: http://www.php.net/manual/en/function.mysql-result.php


-Original Message-
From: markbm [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 23, 2002 2:29 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Problem with Not displaying HTML if data not found


When I changed this line, it still gives me the same problem.  My db field
is a varchar(125)...could that have anything to do with it?  Basically, the
first time, without data in the field...it works fine and the  is not
displayed, but when I add data back into the field, nothing changes...its
like it does not recognize that something is back in the field.  I did a
commit on the db each time, and cleared the browser cache, etc.

Mark

"Martin Towell" <[EMAIL PROTECTED]> wrote in message
6416776FCC55D511BC4E0090274EFEF5034CFB9D@EXCHANGE">news:6416776FCC55D511BC4E0090274EFEF5034CFB9D@EXCHANGE...
> what about
>   if (strlen($result["FLRPLAN_3"]) > 0)
>
>
>
> -Original Message-
> From: markbm [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 23, 2002 2:02 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Problem with Not displaying HTML if data not found
>
>
> I am trying to develop a page that, in certain places, I only want it to
> display the  and s if data is found for a given field.  For
example,
> if I only have an image for the  first floorplan of a house, I do NOT have
> an image for the  second floorplan of a house, then show the first
floorplan
> image only.skip over that next row because the field in the db is
empty.
>
> The problem that I'm having is that the syntax that I've been using to
> define "empty" in the db field does not always work.  The code reads:
>
> if ($result[FLRPLAN_2]<>" ")  {
>printf ("");
>  printf ("");
>  printf (" Second Floor Plan:
> ")  ;
>
>   printf ("") ;
>  printf ("");
>  printf ("") ;
>  echo " src='http://www.website.com/index_files/main_files/$planid/"; .
> mysql_result($result, 0,'FLRPLAN_2')."'>'";
>  printf (" ") ;
>   printf (" ");
> };
>
>
>
> if ($result[FLRPLAN_3]<>" ")  {;
>   printf ("");
> printf ("
> Third Floor Plan: ");
> printf ("   ");
>  printf ("  ");
>  printf ("   ");
> printf ("");
>   echo " src='http://www.website.com/index_files/main_files/$planid/"; .
> mysql_result($result, 0,'FLRPLAN_3')."'>'";
> printf ("  ");
>  printf ("  ");
>  };
>
>
> I have tried:
>
> 1.  if ($result[FLRPLAN_3]<>" ")  {;
> 2.  if ($result[FLRPLAN_3]<>"")  {;
> 3.  if ($result[FLRPLAN_3]<>'')  {;
> 4.  if ($result[FLRPLAN_3]<>' ')  {;
> 5.  if ($result[FLRPLAN_3]<>NULL)  {;
>
> and none seem to work correctly (i.e. blank field in db, but HTML row
shows
> up with missing image..or image is in db, but no HTML row shows up.
If
> it helps, each of the "image" fields are varchar(125)basically I just
> have the name of the image file, and then a pointer to the web server
> directory structure
>
> Any ideas would be greatly appreciated.  Thanks.
>
> Mark
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



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

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




Re: [PHP] Comma question

2002-07-22 Thread Justin French

on 23/07/02 8:34 AM, B i g D o g ([EMAIL PROTECTED]) wrote:

> What does the "," and "{}" do in this type of statement?
> 
> Example:  echo "{$strName}", htmlspecialchars( $teststr );


Not sure about the comma, but the {braces} are easy.  They help separate the
$vars from other stuff in the string.

Example:



It's a good habbit to get into, and has saved my arse on a few occasions,
although the above example isn't a good one.


Justin


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




[PHP] Passing Special Characters In url

2002-07-22 Thread Ricky

Hi,

I am having problems passing variables in a url specifically when there is
an & sign. Any suggestions?

Rick



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




Re: [PHP] Problem with Not displaying HTML if data not found

2002-07-22 Thread markbm

When I changed this line, it still gives me the same problem.  My db field
is a varchar(125)...could that have anything to do with it?  Basically, the
first time, without data in the field...it works fine and the  is not
displayed, but when I add data back into the field, nothing changes...its
like it does not recognize that something is back in the field.  I did a
commit on the db each time, and cleared the browser cache, etc.

Mark

"Martin Towell" <[EMAIL PROTECTED]> wrote in message
6416776FCC55D511BC4E0090274EFEF5034CFB9D@EXCHANGE">news:6416776FCC55D511BC4E0090274EFEF5034CFB9D@EXCHANGE...
> what about
>   if (strlen($result["FLRPLAN_3"]) > 0)
>
>
>
> -Original Message-
> From: markbm [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 23, 2002 2:02 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Problem with Not displaying HTML if data not found
>
>
> I am trying to develop a page that, in certain places, I only want it to
> display the  and s if data is found for a given field.  For
example,
> if I only have an image for the  first floorplan of a house, I do NOT have
> an image for the  second floorplan of a house, then show the first
floorplan
> image only.skip over that next row because the field in the db is
empty.
>
> The problem that I'm having is that the syntax that I've been using to
> define "empty" in the db field does not always work.  The code reads:
>
> if ($result[FLRPLAN_2]<>" ")  {
>printf ("");
>  printf ("");
>  printf (" Second Floor Plan:
> ")  ;
>
>   printf ("") ;
>  printf ("");
>  printf ("") ;
>  echo " src='http://www.website.com/index_files/main_files/$planid/"; .
> mysql_result($result, 0,'FLRPLAN_2')."'>'";
>  printf (" ") ;
>   printf (" ");
> };
>
>
>
> if ($result[FLRPLAN_3]<>" ")  {;
>   printf ("");
> printf ("
> Third Floor Plan: ");
> printf ("   ");
>  printf ("  ");
>  printf ("   ");
> printf ("");
>   echo " src='http://www.website.com/index_files/main_files/$planid/"; .
> mysql_result($result, 0,'FLRPLAN_3')."'>'";
> printf ("  ");
>  printf ("  ");
>  };
>
>
> I have tried:
>
> 1.  if ($result[FLRPLAN_3]<>" ")  {;
> 2.  if ($result[FLRPLAN_3]<>"")  {;
> 3.  if ($result[FLRPLAN_3]<>'')  {;
> 4.  if ($result[FLRPLAN_3]<>' ')  {;
> 5.  if ($result[FLRPLAN_3]<>NULL)  {;
>
> and none seem to work correctly (i.e. blank field in db, but HTML row
shows
> up with missing image..or image is in db, but no HTML row shows up.
If
> it helps, each of the "image" fields are varchar(125)basically I just
> have the name of the image file, and then a pointer to the web server
> directory structure
>
> Any ideas would be greatly appreciated.  Thanks.
>
> Mark
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



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




Re: [PHP] PHP Security Advisory: Vulnerability in PHP versions4.2.0 and 4.2.1

2002-07-22 Thread Justin French

Greg,

Your attitude stinks.

PHP is a FREE scripting language.  Think about the amount of money you are
probably charging hosting clients, or charging in web or programming
services, or making in site revenue, or whatever way you 'commercially
function' through PHP.

The register globals 'imposition' IS more secure and encourages better
coding practices... would you prefer they made the change now, or in 5 years
when you have 100's more sites to fix.  Better late than later.


If you want something that will never have a bug, never have a security
hole, performs perfectly from day 1, never has an upgrade/change, and will
never change for the better, you are utterly dreaming!

The difference in this case is that the PHP Group aren't emptying your
wallet.


Sorry to hear that you'll have to do some more upgrading, but I'd keep the
complaining to yourself -- "you get what you pay for" springs to mind, but
in the case of PHP, we get a whole lot more.


Justin French









on 23/07/02 2:55 AM, Greg Donald ([EMAIL PROTECTED]) wrote:

> Not only did I get to re-write all my apps the past few months because of
> the new register_globals default that was imposed by `the php group`...
> 
> Now I get to upgrade my PHP install once a month or so cause of new
> security holes..  Yay!
> 
> Wasn't this new register_globals setting supposed to enhance security?
> 
> How would you like to be a sys admin with dozens of machines to upgrade
> before you can proceed with anythign else?
> 
> Can anyone say Ruby?
> 


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




RE: [PHP] redirecting after login

2002-07-22 Thread Martin Towell

using header() should work if you don't output anything before it. If you
can restructure your code so that you can remove any output until after the
header(), then that'd be the way to go.

You said the meta refresh didn't work - did you get the syntax right? Since
I don't use it much, it's one of those tags that takes me ages to get the
syntax right (I could chuck it into a code repository somewhere, but I'm too
lazy to do that...)

Failing the above two methods, you could put a hidden form that gets
auto-submitted when the page loads

HTH
Martin

-Original Message-
From: Tim Thorburn [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 23, 2002 2:00 PM
To: [EMAIL PROTECTED]
Subject: [PHP] redirecting after login


Hi,

A site I'm working on requires a login screen where various individuals 
will log into the site and add information for their various 
departments.  Rather than setup a different script for each department, I 
was hoping to create one script that would either accept or deny a login 
based on the username/password stored in a database, then based on the 
username/password - redirect the individuals browser to a URL.

I've got the login part working perfectly, and I can turn the URL into a 
link on the page, but I'd rather have the script just automatically forward 
the person to the page they're login gives them access to.

I've tried using header(), but since the redirection takes place about 
mid-script, it doesn't work.  I've also tried using  tag redirects, 
but those don't seem to accept the PHP/MySQL combo.

Any ideas?

Thanks
-Tim



-- 
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] Newbie getting close, form submission

2002-07-22 Thread Justin French

I pointed this out to you in my original post:

you mail() call should be:

mail($MailToAddress, $MailSubject, $Message, "From: $MailFromAddress");

not:

mail("$MailToAddress", "$MailSubject", "$Message", "From:
$MailFromAddress");

In other words, I don't think you should wrap plain $vars in double
quotes... it may be the cause of the problem, or it may just slow down PHP a
little when not needed.


For debugging, instead of sending the mail(), just do this:

echo "To: {$MailToAddress}\n";
echo "Subject: {$MailSubject}\n";
echo "Message: {$Message}\n";
echo "From: {$MailFromAddress}\n";

In otherwords, you should be looking to see if each $var you're sending to
the mail() function IS WHAT YOU EXPECT, once you're sure they're correct,
THEN you can pipe them back into a mail() call, and test.

Possibly mail() is not working on the server at all.  A great way to test
that would be to create a SEPARATE SCRIPT which just has this:



The reason for creating a separate script is to ensure that you're only
testing the mail() function, not anything else.


You could also try turning your error reporting on to a higher level, which
may indicate the bug.


Justin





on 22/07/02 11:42 PM, Dean Ouellette ([EMAIL PROTECTED]) wrote:

> I am a complete newbie, search the web for examples right now and use
> them.
> 
> The host has php 3.0
> 
> Having problems with for submission
> Right now, no error messages, but does not actually send the email.
> Ideas?
> 
>  $MailToAddress = "[EMAIL PROTECTED]";
> 
> $MailSubject = "Get Involved List";
> 
> if (!$MailFromAddress)
> 
> {
> $MailFromAddress = "$email";
> }
> 
> $Header = "";
> $Footer = "";
> ?>
> 
>  
> if (!is_array($HTTP_POST_VARS))
> 
> return;
> 
> reset($HTTP_POST_VARS);
> 
> while(list($key, $val) = each($HTTP_POST_VARS))
> 
> {
> $GLOBALS[$key] = $val;
> 
> $val=stripslashes($val);
> 
> $Message .= "$key = $val\n";
> }
> 
> if ($Header) 
> {
> $Message = $Header."\n\n".$Message;
> }
> 
> if ($Footer) 
> 
> {
> $Message .= "\n\n".$Footer;
> }
> 
> mail( "$MailToAddress", "$MailSubject", "$Message", "From:
> $MailFromAddress");
> 
> ?>
> 


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




RE: [PHP] Problem with Not displaying HTML if data not found

2002-07-22 Thread Martin Towell

what about
  if (strlen($result["FLRPLAN_3"]) > 0)



-Original Message-
From: markbm [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 23, 2002 2:02 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Problem with Not displaying HTML if data not found


I am trying to develop a page that, in certain places, I only want it to
display the  and s if data is found for a given field.  For example,
if I only have an image for the  first floorplan of a house, I do NOT have
an image for the  second floorplan of a house, then show the first floorplan
image only.skip over that next row because the field in the db is empty.

The problem that I'm having is that the syntax that I've been using to
define "empty" in the db field does not always work.  The code reads:

if ($result[FLRPLAN_2]<>" ")  {
   printf ("");
 printf ("");
 printf (" Second Floor Plan:
")  ;

  printf ("") ;
 printf ("");
 printf ("") ;
 echo "'";
 printf (" ") ;
  printf (" ");
};



if ($result[FLRPLAN_3]<>" ")  {;
  printf ("");
printf ("
Third Floor Plan: ");
printf ("   ");
 printf ("  ");
 printf ("   ");
printf ("");
  echo "'";
printf ("  ");
 printf ("  ");
 };


I have tried:

1.  if ($result[FLRPLAN_3]<>" ")  {;
2.  if ($result[FLRPLAN_3]<>"")  {;
3.  if ($result[FLRPLAN_3]<>'')  {;
4.  if ($result[FLRPLAN_3]<>' ')  {;
5.  if ($result[FLRPLAN_3]<>NULL)  {;

and none seem to work correctly (i.e. blank field in db, but HTML row shows
up with missing image..or image is in db, but no HTML row shows up.  If
it helps, each of the "image" fields are varchar(125)basically I just
have the name of the image file, and then a pointer to the web server
directory structure

Any ideas would be greatly appreciated.  Thanks.

Mark



-- 
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] redirecting after login

2002-07-22 Thread Tim Thorburn

Hi,

A site I'm working on requires a login screen where various individuals 
will log into the site and add information for their various 
departments.  Rather than setup a different script for each department, I 
was hoping to create one script that would either accept or deny a login 
based on the username/password stored in a database, then based on the 
username/password - redirect the individuals browser to a URL.

I've got the login part working perfectly, and I can turn the URL into a 
link on the page, but I'd rather have the script just automatically forward 
the person to the page they're login gives them access to.

I've tried using header(), but since the redirection takes place about 
mid-script, it doesn't work.  I've also tried using  tag redirects, 
but those don't seem to accept the PHP/MySQL combo.

Any ideas?

Thanks
-Tim



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




[PHP] Problem with Not displaying HTML if data not found

2002-07-22 Thread markbm

I am trying to develop a page that, in certain places, I only want it to
display the  and s if data is found for a given field.  For example,
if I only have an image for the  first floorplan of a house, I do NOT have
an image for the  second floorplan of a house, then show the first floorplan
image only.skip over that next row because the field in the db is empty.

The problem that I'm having is that the syntax that I've been using to
define "empty" in the db field does not always work.  The code reads:

if ($result[FLRPLAN_2]<>" ")  {
   printf ("");
 printf ("");
 printf (" Second Floor Plan:
")  ;

  printf ("") ;
 printf ("");
 printf ("") ;
 echo "'";
 printf (" ") ;
  printf (" ");
};



if ($result[FLRPLAN_3]<>" ")  {;
  printf ("");
printf ("
Third Floor Plan: ");
printf ("   ");
 printf ("  ");
 printf ("   ");
printf ("");
  echo "'";
printf ("  ");
 printf ("  ");
 };


I have tried:

1.  if ($result[FLRPLAN_3]<>" ")  {;
2.  if ($result[FLRPLAN_3]<>"")  {;
3.  if ($result[FLRPLAN_3]<>'')  {;
4.  if ($result[FLRPLAN_3]<>' ')  {;
5.  if ($result[FLRPLAN_3]<>NULL)  {;

and none seem to work correctly (i.e. blank field in db, but HTML row shows
up with missing image..or image is in db, but no HTML row shows up.  If
it helps, each of the "image" fields are varchar(125)basically I just
have the name of the image file, and then a pointer to the web server
directory structure

Any ideas would be greatly appreciated.  Thanks.

Mark



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




Re[2]: [PHP] imagecolortransparent()

2002-07-22 Thread Tom Rogers

Hi,

Tuesday, July 23, 2002, 5:16:43 AM, you wrote:

N> "Tom Rogers" <[EMAIL PROTECTED]> wrote in message
N> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>> Hello Nick,
>>
>> Monday, July 22, 2002, 8:47:39 PM, you wrote:
>>
>> N> i get php to allocate a colour then make it transparent using
>> N> imagecolortransparent()
>>
>> N> instead of turning it transparent it becomes black.
>>
>> N> Is it something i'm doing wrong? can anyone help me?
>>
>> N> thanx in advance
>>
>> Post a bit of the code so we can see what you are doing
>>
>> --
>> Tom
>>

N> $im = imagecreate($size, 21);

N> $bgcolour =
N> imagecolorallocate($im,hexdec(substr($table[bg],0,2)),hexdec(substr($table[b
N> g],2,2)),hexdec(substr($table[bg],4,2)));
N> $fontcolour =
N> imagecolorallocate($im,hexdec(substr($table[fg],0,2)),hexdec(substr($table[f
N> g],2,2)),hexdec(substr($table[fg],4,2)));

N> if ($table[bg] == "no") {
N>  $trans = imagecolortransparent ($im,$bgcolour);
N> }

probably what you need is:

$im = imagecreate($size, 21);
if ($table[bg] == "no") {
   $bgcolour = imagecolorallocate($im,1,1,1);
   $trans = imagecolortransparent ($im,$bgcolour);
}
else{
 $bgcolour = 
imagecolorallocate($im,hexdec(substr($table[bg],0,2)),hexdec(substr($table[bg],2,2)),hexdec(substr($table[bg],4,2)));
}
$fontcolour = 
imagecolorallocate($im,hexdec(substr($table[fg],0,2)),hexdec(substr($table[fg],2,2)),hexdec(substr($table[fg],4,2)));





-- 
Best regards,
Tom


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




Re: [PHP] number of files in a dir vs. performace

2002-07-22 Thread Jason Wong

On Tuesday 23 July 2002 11:09, eat pasta type fasta wrote:
> I'm using mysql to hold references to image files then served on my pages
> via PHP.
>
> I have typically a set of two files:
>
> thumb and a large original, on occasion there is also a variant inreasing
> the set to 3 per image
>
> currently I am holding all of the files in 1 directory since the DB can
> keep track of them, however their number has grown to over 400 at this
> point
>
> my issue is whether it would be worth it (performance wise) to split them
> into thumbs and works thus having 200+ files per directory as opposed to
> so many, I am expecting the number of images to double in the future.

Nothing to do with PHP and everything to do with the OS. FWIW 20K files in one 
directory on Linux is slow.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Yow!  Are we wet yet?
*/


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




[PHP] Using fopen()/fread()/fscanf()

2002-07-22 Thread Jason Soza

I think I'm pretty close to getting this right (maybe!), I've been reading
through the manual, but can't seem to work it out. I keep getting this
error:

[Mon Jul 22 19:03:24 2002] [error] PHP Warning:  Supplied argument is not a
valid File-Handle resource in index.php on line 66

I'm trying to open a URL, read the contents, then pull out specific info
found between specific HTML tags. This is what I have so far:

63| http://www.kinyradio.com/juneaunews/latest_juneau_news.html";, "r");
65| $contents = fread($filename, 100);
66| while($headlines = fscanf($filename, "%[a-zA-Z0-9,. ]",
$headline)) {
67| extract($headlines);
68| print "http://www.kinyradio.com/juneaunews/latest_juneau_news.html\";>$headli
ne";
69| }
70| fclose($filename);
71| ?>

Any ideas? Any other functions I could try instead of fscanf()?

TIA,
Jason Soza


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




Re: [PHP] Pine config

2002-07-22 Thread Miguel Cruz

On Fri, 19 Jul 2002, Michael Hall wrote:
> This is sort of off topic, but can anyone tell me why my Pine email client 
> displays "To: Somebody Or Other" rather than my name "Michael Hall" 
> whenever I send an email to this list?
> 
> I have attempted to fix this many times but cannot for the life of me 
> figure out why it is happening.

It's doing this as a favor to you. If it displayed the "From" you'd know 
less about the message than you know this way.

miguel


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




Re: [PHP] Getting current URL

2002-07-22 Thread Sailom

Thanks :)



"Peter" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
>
> > -Original Message-
> > From: Sailom [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, 23 July 2002 12:53 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] Getting current URL
> >
> >
> > This might be a silly question.
> > Just like the subject, how to get the current URL?  I want to
> > make a reload
> > button by making a form and direct user to the current page.
> >
> > Sailom
>
> a couple of ways i can think of ..
>
> 1 leave the action blank in your form tags eg...  or  action="" method="POST">
>
> 2 have $PHP_SELF as ur action eg  method="POST">
>
> cheers
>



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




[PHP] number of files in a dir vs. performace

2002-07-22 Thread eat pasta type fasta

I'm using mysql to hold references to image files then served on my pages 
via PHP.

I have typically a set of two files:

thumb and a large original, on occasion there is also a variant inreasing 
the set to 3 per image

currently I am holding all of the files in 1 directory since the DB can 
keep track of them, however their number has grown to over 400 at this 
point

my issue is whether it would be worth it (performance wise) to split them 
into thumbs and works thus having 200+ files per directory as opposed to 
so many, I am expecting the number of images to double in the future.

R>

--__-__-__
eat pasta
type fasta


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




[PHP] returning form variables to previous page

2002-07-22 Thread dan rossi

hi i am trying to implement error handling in a join page, i would like to
try and use one page if possible and then go through in steps like ?step=1
etc , i would like to be able to return form variables to the previous step
if there is an error, how could i do this ?



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




RE: [PHP] Getting current URL

2002-07-22 Thread Peter



> -Original Message-
> From: Sailom [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, 23 July 2002 12:53 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Getting current URL
>
>
> This might be a silly question.
> Just like the subject, how to get the current URL?  I want to
> make a reload
> button by making a form and direct user to the current page.
>
> Sailom

a couple of ways i can think of ..

1 leave the action blank in your form tags eg...  or 

2 have $PHP_SELF as ur action eg 

cheers


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




[PHP] How to store an image into a mysql database using php language?

2002-07-22 Thread Rija

I want to store image data into mysql table using BLOB but I don't know how to read it 
after. To record the image, I doesn't have any problem, but to read the file after and 
to view the image, I can't do anything the variable show only comment like this: 
memobin24.bin

So how can I do?

This was the script.






Re: [PHP] PHP Security Advisory: Vulnerability in PHP versions 4.2.0and 4.2.1

2002-07-22 Thread Miguel Cruz

On Mon, 22 Jul 2002, Greg Donald wrote:
> Not only did I get to re-write all my apps the past few months because of 
> the new register_globals default that was imposed by `the php group`...

You didn't have to. The choice was given to you, for your own good. If you 
have very disciplined programmers and a solid auditing process, you can 
still do just fine with register_globals on.

> Now I get to upgrade my PHP install once a month or so cause of new 
> security holes..  Yay!

Vastly preferable to the alternative: Brand X, where security holes go 
unpatched. The PHP group fixed the problem immediately.

> Wasn't this new register_globals setting supposed to enhance security?

Now there's a non-sequitur if ever I saw one. "What do you mean I have to
stop running across the freeway? I thought giving up smoking was supposed
to enhance my health."

> How would you like to be a sys admin with dozens of machines to upgrade 
> before you can proceed with anythign else?

I upgraded dozens of machines. It took about 10 minutes total.

miguel


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




[PHP] Getting current URL

2002-07-22 Thread Sailom

This might be a silly question.
Just like the subject, how to get the current URL?  I want to make a reload
button by making a form and direct user to the current page.

Sailom



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




Re[2]: [PHP] imagecolortransparent()

2002-07-22 Thread Tom Rogers

Hi,

Tuesday, July 23, 2002, 5:16:43 AM, you wrote:

N> "Tom Rogers" <[EMAIL PROTECTED]> wrote in message
N> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>> Hello Nick,
>>
>> Monday, July 22, 2002, 8:47:39 PM, you wrote:
>>
>> N> i get php to allocate a colour then make it transparent using
>> N> imagecolortransparent()
>>
>> N> instead of turning it transparent it becomes black.
>>
>> N> Is it something i'm doing wrong? can anyone help me?
>>
>> N> thanx in advance
>>
>> Post a bit of the code so we can see what you are doing
>>
>> --
>> Tom
>>

N> $im = imagecreate($size, 21);

N> $bgcolour =
N> imagecolorallocate($im,hexdec(substr($table[bg],0,2)),hexdec(substr($table[b
N> g],2,2)),hexdec(substr($table[bg],4,2)));
N> $fontcolour =
N> imagecolorallocate($im,hexdec(substr($table[fg],0,2)),hexdec(substr($table[f
N> g],2,2)),hexdec(substr($table[fg],4,2)));

N> if ($table[bg] == "no") {
N>  $trans = imagecolortransparent ($im,$bgcolour);
N> }

It looks like you are using $table[bg] for 2 purposes
if it is 'no' it will not be a true hex value for the background
colour.
Tom






-- 
Best regards,
Tom


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




Re: [PHP] Re: does this mean ....

2002-07-22 Thread Chris Earle

"r+" allows you to read and write... if that's what you wanted (I think it
is).  Note that it will write over any data that is behind the location of
the file pointer (so write to the end of the file).

"Peter" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
>
> > -Original Message-
> > From: David Robley [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, 23 July 2002 10:41 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] Re: does this mean 
> >
> >
> > In article <[EMAIL PROTECTED]>,
> > [EMAIL PROTECTED]
> > says...
> > > hi all,
> > >
> > > I'm tring to make a script to prompt for a username & then a password
=
> > > for that user onto the actual machine rather than just a web site...
> > >
> > > now i've come across this this line in some documentation
> > >
> > > if ( $File =3D popen( "$useradd_prog $useradd_name", "r" ) )
> > > {
> > > .
> > > .
> > > .
> > >  now to my actual question ..
> > >
> > > does that "r" just mean read? and if so should that "r" be a "w" for =
> > > write in order for it to work?
> > >
> > >
> > >
> > > Cheers=20
> > >
> > > Peter=20
> > > "the only dumb question is the one that wasn't asked"=20
> > > =20
> >
> > If you are just checking the name/password against an existing list,
then
> > you only need read. If you want to add something, then you need a
> > different mode.
> >
> > However, I think you may be better off uing fopen, instead of popen, if
> > you are trying to do what I think you are. The documentation for
> > fopen has
> > a comprehensive description of the modes available; note that w is
kindof
> > destructive in the wrong context :-)
> >
> > Cheers
> > --
> > David Robley
> > Temporary Kiwi!
> >
> > Quod subigo farinam
> >
> i'm tring to run the useradd command (under Solaris) to add a user to the
> system so i don't have to continueously remote log in and also make it
> easier for myself to add users to the system(s).. maybe popen isn't the
best
> option for this .. though i don't think fopen will be able to do what i
need
> it to do.. maybe playing around with sockets would be better?
>
>
> Cheers
>
> Peter
> "the only dumb question is the one that wasn't asked"
>
>



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




[PHP] Re: Looked at documentation, should be fine

2002-07-22 Thread Chris Earle

>>$MailToAddress = [EMAIL PROTECTED];

No quotes around the e-mail address.


>> $Message .= "\n\n$HTTP_POST_VARS[Footer]";
You left out quotes from "Footer"

"Dean Ouellette" <[EMAIL PROTECTED]> wrote in message
00b901c231e6$30300e10$9c89adac@yoda">news:00b901c231e6$30300e10$9c89adac@yoda...
> I am running this on php 3.0
> I have read every document I could find on the web, and cant figure out
> why this form submission is not working.
>
> No errors, just does not sent the e-mail to my account
>
>  If ('GET' == $HTTP_SERVER_VARS['REQUEST_METHOD']) {
>>   $MailToAddress = [EMAIL PROTECTED];
>   $MailSubject = 'Get Involved List';
>   }
> ?>
>
>  If ('POST' == $HTTP_SERVER_VARS['REQUEST_METHOD'])
>   if (isset($HTTP_POST_VARS['email'])) {
> $MailFromAddress = $HTTP_POST_VARS['email'];
>   } else {
> $MailFromAddress = '[EMAIL PROTECTED]';
>   }
>
>   $Message = $HTTP_POST_VARS['Message'];
>   if (isset($HTTP_POST_VARS['Header'])) {
>  $Message = $HTTP_POST_VARS['Header'] . "\n\n$Message";
>   }
>
>   if (isset($HTTP_POST_VARS['Footer'])) {
> $Message .= "\n\n$HTTP_POST_VARS[Footer]";
>   }
>
>   mail($MailToAddress, $MailSubject, $Message, $MailFromAddress);
>   ?>
>



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




[PHP] Re: Traversing an appendable file

2002-07-22 Thread Chris Earle

I was thinking it was obvious because otherwise I'd have just been using
that and not even posted about the "a/a+".  Using "a" works in the way that
it is supposed to (it starts at the end), but what I wanted was to use
append and then just append to anywhere in the file.

Currently to get that done I use "file(filelocation);" and then just search
that array for what I want.  Once I find it I save the key and then
concatenate what I want to that line.  Then after I've done that I implode
the array and "w" (write) that.   This of course works perfectly, but once
the file starts to get larger, I'm worried that it is going to become slow,
so I was looking for a way to append (which now that I think about it, would
do the same thing, only with less work on my part).

"Richard Lynch" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> >Is there any way to fseek (or something to the exact same effect) a file
> >opened with "a" or "a+"?
> >
> >I've tried rewinding and fseeking appendable files, but neither work.
> >
> >Opening up in "r+" gives me part of the desired result, but if where I
want
> >to write is not at the end, it writes over things, which I obviously do
not
> >want.
>
> It may be obvious to you that you don't want that, but it's not to anybody
> else :-)
>
> Use r+ and fseek to the end of the file.  You can use PHP's filesize
> (filelength?) function to find out where that is.
>
> I think a+ is only if you are "promising" not to go backwards into the old
> data...  Maybe it's for some kind of OS optimization or something...



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




RE: [PHP] Re: MySQL - PHP combined log

2002-07-22 Thread Dave [Hawk-Systems]


>>I want to be able to view a single log that contains the following:

>
>http://php.net/error_log
>

how about this curve...  getting PHP to append a line to the apache log.

Currently we are exporting via fopen clf formatted logs for file uploads (whose
file sizes are not recorded by Apache's logging) then doing a merge of the log
files afterwards...

would much rather pump the clf formatted log sting directly into the appropriate
apache log, but if I am not mistaken, using the above function would require
permissions for user nobody(www, whatever) on the log files, no?

cheers,

Dave


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




RE: [PHP] Digit Grouping

2002-07-22 Thread John Holmes

> I've got a small question. Does php provide any function to group a
number
> like 3193576 into 3.193.576  ? Just reads easier when the hits for my
> website are being displayed ... Or if php doesn't have a function for
it
> ..
> anybody any good suggestions on how to do it?

number_format()

---John Holmes...


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




RE: [PHP] Formating datevariables...

2002-07-22 Thread John Holmes

> I have a column in a mysql table with a timestamp. The value of this
> column
> is for instance:
> 
> 20020722185242
> 
> How do i change the format on this to "DDMM" (22072002) in php?

SELECT DATE_FORMAT(date_column,'%d%m%Y') AS Formatted_Date FROM
your_table

There's no need to involve PHP at all...

---John Holmes...


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




[PHP] Looked at documentation, should be fine

2002-07-22 Thread Dean Ouellette

I am running this on php 3.0
I have read every document I could find on the web, and cant figure out
why this form submission is not working.
 
No errors, just does not sent the e-mail to my account
 

 




RE: [PHP] Re: does this mean ....

2002-07-22 Thread Peter



> -Original Message-
> From: David Robley [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, 23 July 2002 10:41 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: does this mean 
>
>
> In article <[EMAIL PROTECTED]>,
> [EMAIL PROTECTED]
> says...
> > hi all,
> >
> > I'm tring to make a script to prompt for a username & then a password =
> > for that user onto the actual machine rather than just a web site...
> >
> > now i've come across this this line in some documentation
> >
> > if ( $File =3D popen( "$useradd_prog $useradd_name", "r" ) )
> > {
> > .
> > .
> > .
> >  now to my actual question ..
> >
> > does that "r" just mean read? and if so should that "r" be a "w" for =
> > write in order for it to work?
> >
> >
> >
> > Cheers=20
> >
> > Peter=20
> > "the only dumb question is the one that wasn't asked"=20
> > =20
>
> If you are just checking the name/password against an existing list, then
> you only need read. If you want to add something, then you need a
> different mode.
>
> However, I think you may be better off uing fopen, instead of popen, if
> you are trying to do what I think you are. The documentation for
> fopen has
> a comprehensive description of the modes available; note that w is kindof
> destructive in the wrong context :-)
>
> Cheers
> --
> David Robley
> Temporary Kiwi!
>
> Quod subigo farinam
>
i'm tring to run the useradd command (under Solaris) to add a user to the
system so i don't have to continueously remote log in and also make it
easier for myself to add users to the system(s).. maybe popen isn't the best
option for this .. though i don't think fopen will be able to do what i need
it to do.. maybe playing around with sockets would be better?


Cheers

Peter
"the only dumb question is the one that wasn't asked"



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




[PHP] Re: does this mean ....

2002-07-22 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> hi all,
> 
> I'm tring to make a script to prompt for a username & then a password =
> for that user onto the actual machine rather than just a web site...
> 
> now i've come across this this line in some documentation
> 
> if ( $File =3D popen( "$useradd_prog $useradd_name", "r" ) )
> {
> .
> .
> .
>  now to my actual question ..
> 
> does that "r" just mean read? and if so should that "r" be a "w" for =
> write in order for it to work?
> 
> 
> 
> Cheers=20
> 
> Peter=20
> "the only dumb question is the one that wasn't asked"=20
> =20

If you are just checking the name/password against an existing list, then 
you only need read. If you want to add something, then you need a 
different mode.

However, I think you may be better off uing fopen, instead of popen, if 
you are trying to do what I think you are. The documentation for fopen has 
a comprehensive description of the modes available; note that w is kindof 
destructive in the wrong context :-)

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: another problem

2002-07-22 Thread David Robley

In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> well, i solved the last problem on my own but now i need help on my new one
> :-)
> 
> how do you convert text to hexadecimal with PHP?
> 
> --
> Regards,
> Georgie Casey
> [EMAIL PROTECTED]

If you are asking what I think you are asking - use ord to get the ascii 
(decimal) value of each character, then use dechex to convert to hex.

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: Formating datevariables...

2002-07-22 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> I have a column in a mysql table with a timestamp. The value of this column
> is for instance:
> 
> 20020722185242
> 
> How do i change the format on this to "DDMM" (22072002) in php?
> 
> Thanx
> 
> -R

You can do it as you get it out of the db - see DATEFORMAT

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] Re: getservbyname

2002-07-22 Thread David Robley

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
says...
> getservbyname takes in the following arguments:
> 
> getservbyname(string service, string protocol);
> 
> is the parameter service similar to those diefined under
> unix's /etc/services file or is there something else
> to it?
> 
> Thanks in advance...
> 
> 
> 
>From the docs:

getservbyname() returns the Internet port which corresponds to service for 
the specified protocol as per /etc/services. protocol is either "tcp" or 
"udp" (in lowercase). 

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP] another problem

2002-07-22 Thread Georgie Casey

well, i solved the last problem on my own but now i need help on my new one
:-)

how do you convert text to hexadecimal with PHP?

--
Regards,
Georgie Casey
[EMAIL PROTECTED]

***
http://www.filmfind.tv
Online Film Production Directory
***



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




RE: [PHP] Formating datevariables...

2002-07-22 Thread Martin Towell

As Demitrious said, use mysql to do it.

But if you want to use php, just use substr(), since all the numbers are
there, there's no point converting to unix time, just to convert it back
again... unless you're going to do some maths of it

-Original Message-
From: Demitrious S. Kelly [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 23, 2002 9:51 AM
To: 'Ragnar'; [EMAIL PROTECTED]
Subject: RE: [PHP] Formating datevariables...


Why not let mysql do it? It has a function do to exactly that, I
think...

But php's date() is the function you're looking for...

-Original Message-
From: Ragnar [mailto:[EMAIL PROTECTED]] 
Sent: Monday, July 22, 2002 4:42 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Formating datevariables...

I have a column in a mysql table with a timestamp. The value of this
column
is for instance:

20020722185242

How do i change the format on this to "DDMM" (22072002) in php?

Thanx

-R



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




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

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




Re: [PHP] Formating datevariables...

2002-07-22 Thread Jeremy

Is the timestamp in UNIX format?
if yes, try date() http://www.php.net/manual/en/function.date.php
if no, try substr()

hope that helps :)
- Jeremy

- Original Message -
From: "Ragnar" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 23, 2002 7:42 AM
Subject: [PHP] Formating datevariables...


> I have a column in a mysql table with a timestamp. The value of this
column
> is for instance:
>
> 20020722185242
>
> How do i change the format on this to "DDMM" (22072002) in php?
>
> Thanx
>
> -R
>
>
>
> --
> 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] does this mean ....

2002-07-22 Thread Peter

hi all,

I'm tring to make a script to prompt for a username & then a password for that user 
onto the actual machine rather than just a web site...

now i've come across this this line in some documentation

if ( $File = popen( "$useradd_prog $useradd_name", "r" ) )
{
.
.
.
 now to my actual question ..

does that "r" just mean read? and if so should that "r" be a "w" for write in order 
for it to work?



Cheers 

Peter 
"the only dumb question is the one that wasn't asked" 
 


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




[PHP] Re: [ANNOUNCE] PHP Security Advisory: Vulnerability in PHP versions 4.2.0 and4.2.1

2002-07-22 Thread Richard Lynch

>Not being an expert in php..i couldnt understand the vulnerability.
>Can someone shed some light here.

Very short explanation:

Upgrade.
Now!

Longer one:

If your web-site has *ANY* FORM tags on it, and you have PHP
ready-and-waiting to process those FORMs, then somebody could manage to
create a really icky FORM page and POST to your site and break in.

Actually, even if you do *NOT* have the FORM tags, but you're "allowing"
them in httpd.conf, and PHP is there, they could break in.

Presumably the precise details of what you'd have to slam into the FORM to
break in are simply too complex to fit into an Announcement of this nature. 
I imagine the Details could be dug out of Bugtrak and/or wherever the bug
was first announced/discussed.  Presumably PHP-Dev and e-matters would be
good places to start digging for gory details.

If Upgrading is impossible, *AND* you don't use FORMs with PHP in the first
place (highly unlikely) than you could just "turn off" POST (forms) in your
httpd.conf and nobody will be allowed to POST (send a form) anything to your
web-site, and then PHP won't ever see the data, since Apache stopped them,
and the bug wouldn't kick in.

Upgrade.
Now!

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: php security mailing list ...

2002-07-22 Thread Richard Lynch

>Hi ...
>
>I want to be warned about php security issues, I couldn't find
>an exact match in the mailing list names ... which one do you
>recommend me?

I believe that the Announce list would have any critical security warnings
sent to it.

It's also very low-volume.

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: Comma question

2002-07-22 Thread Richard Lynch

>Tried to check the archive, but it is offline...
>
>What does the "," and "{}" do in this type of statement?
>
>Example:  echo "{$strName}", htmlspecialchars( $teststr );

The {} makes it *VERY* clear to PHP that $strName is a variable to be
"interpolated" into the string.

This Programmer has actually read the Documentation and believed the
warnings that some day just plain old $strName might not be enough.

The , simply gives more arguments to the echo construct.

You can echo as many things as you want, and they just get sent out one
after the other.

-- 
Like Music?  http://l-i-e.com/artists.htm


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




Re: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processe s

2002-07-22 Thread Richard Lynch

>Yes, that's exactly what I want to do.  But HOW do I do it?
>
>i.e.  I'm sitting in my accept connectinos loop in the chat daemon
>
>While(true)
>{
> //waitforenwconnection
> $new_connection_id=socket_accept();
>
> //got a new connection, go process it
> go_do_this_in_a_new_thread($new_connection_id);
>}
>
>What do I put in place of go_do_this_in_a_new_thread()

Use fsockopen() to "talk" to your *OTHER* PHP script waiting in a loop to do
the *real* work.

IE, have a *second* PHP file that runs on yet another socket to do the work.

>
>-Original Message-
>From: Demitrious S. Kelly [mailto:[EMAIL PROTECTED]] 
>Sent: Monday, July 22, 2002 3:01 PM
>To: 'David Buerer'; [EMAIL PROTECTED]
>Subject: RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processes
>
>
>Yes. Write a daemon which listens on a socket and manages the communications
>it gets from the satellite scripts and works the database for them...
>
>The scripts send off data, and process replies. They don't do the heavy
>work...
>
>-Original Message-
>From: David Buerer [mailto:[EMAIL PROTECTED]] 
>Sent: Monday, July 22, 2002 2:30 PM
>To: '[EMAIL PROTECTED]'
>Subject: RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processes
>
>How to I inovoke a new Thread from the middle of a PHP script?
>
>-Original Message-
>From: Paul Maine [mailto:[EMAIL PROTECTED]] 
>Sent: Monday, July 22, 2002 10:08 AM
>To: David Buerer; [EMAIL PROTECTED]
>Subject: RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processes
>
>
>You can use threads with NT to accomplish what you are asking.
>
>-Original Message-
>From: David Buerer [mailto:[EMAIL PROTECTED]]
>Sent: Monday, July 22, 2002 11:29 AM
>To: '[EMAIL PROTECTED]'
>Subject: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processes
>
>
>I've got effectivly a glorified chat server which upon the arrival of a
>message thorugh a socket connection goes off and runs a bunch of database
>processed.  My questions is this:  How can I seperate the database
>processing into a seperate processor process?  I really don't want the chat
>server to have to wait until after the database processing is done to go
>intercept and process another request--this just doesn't seem right.  I want
>the chat server process to be able to deal with getting and receiving
>messages, and another process to deal with the database processing. That way
>if one of the processes get's slow, the other isn't affected. Something like
>the fork command would work really well, but fork doesn't exist in NT.
>
>Anyone have any ideas?
>
>I'm running Windows NT4.0 sp6a
>Apache Server 1.3.xx
>MySQL
>and of course, PHP 4.2.1
>
>


-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: upgrade 4.1.2 to 4.2.2 (passing vars problem with 4.2.2)

2002-07-22 Thread Richard Lynch

>Hi,
>
>I have been running 4.1.2 for a while with no problems.  This morning, I 
>downloaded 4.2.2, did a configure/make/make install.  All seemed to have 
>gone well.  However, it broke all my sites that use PHP.  Here is a 
>description of how it appeared to be broken.  This is just an example, 
>as I dont really own fakename.com.
>
>User goes to http://www.fakename.com/index.php
>
>User clicks on "help" and gets the main index page instead of the help 
>page.
>
>The URL for help is.. http://www.fakename.com/index.php?target=help
>
>It is like PHP gets passed variables and "forgets" them immediately.
>
>What do I need to do?  I reinstalled 4.1.2 and things are working again. 
>Naturally, I would like to safely upgrade to 4.2.2.
>
>Thanks in advance for any help out there. I am at a loss for ideas on 
>solving this myself.

Read the php.ini file and register_globals section.

Or the two million posts to this and every other PHP forum about
register_globals

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: getservbyname

2002-07-22 Thread Richard Lynch

>getservbyname takes in the following arguments:
>
>getservbyname(string service, string protocol);
>
>is the parameter service similar to those diefined under
>unix's /etc/services file or is there something else
>to it?

Just based on the docs, I'd have to say you simply have to have a "match"
for what's in /etc/services

Of course, if you're on Windows, only God knows what's going to happen with
this one...

Try it and see.

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: Problems Retrieving Session Variables on 2nd submit.

2002-07-22 Thread Richard Lynch

>Below is how the decide.php script registers the variables.
>
>session_start();
>
>
>if (!$phpsessid)
> {
>  session_register("$employee");

session_register('employee');

Right now, you're registering the variable named something like 'Bill Jones'
which isn't even a legal variable name.

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: MySQL - PHP combined log

2002-07-22 Thread Richard Lynch

>Hi, tried this on mysql list, no luck:
>
>I want to be able to view a single log that contains the following:
>
>IP of user : page_name (PHP only): time/date: MySQL query ( 'select * 
>from xxx' etc.) : error msg from mysql/php if any
>
>So it's almost a hybrid between apache and mysql with some extra's
>
>I'm sure you all should see the benifit of this in troubleshooting and 
>specially keeping track of who does what when it comes to PHP coding on 
>ones server, specially with crappy code that kills the server.
>
>Is something like this possible, already there?
>
>PS, Running RedHat 7.0 with PHP4 and mysql 3.23.x

http://php.net/error_log

if you can get everybody to use your own function to query the database.

Or, you could use http://php.net/set_error_handler and
http://php.net/trigger_error and catch all errors thrown by all PHP code.

Actually, to get the PHP page name and line number, set_error_handler is
probably your best bet.

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: Script executing Telnet Shell Command...

2002-07-22 Thread Richard Lynch

>I am trying to execute a Script running a telnet command
>testing through a range of IP connections...
>Here goes:
>
>$str = "123.456.789.";
>$count = 0;
>
>while ($count < 999){
>$runTheScriptCommand...
>}
>?>
>
>What I want to stick into the while loop is if connection
>was successful, break...  Is there a way I can check whether
>telnet connection was successful on each step through the
>loop or do I have to restructure my program and try
>connecting to a port via fsockopen...  By the way
>does anyone know what port number telnet connects to...

You should be able to capture the output of http://php.net/exec or
http://php.net/popen and do whatever you want with it.

fsockopen will, however, almost certainly be faster/better if you have to do
a lot of these.

I think telnet is port 22, usually...  Or maybe 23.  SSH is the other one of
those, and I always forget.

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: stores / ecommerce

2002-07-22 Thread Richard Lynch

>What are some good e-commerce stores written out there for PHP and mySQL??

I got tired of this question cropping up all the time, years and years ago.

Your answer lies here:

http://l-i-e.com/compare/

:-)

-- 
Like Music?  http://l-i-e.com/artists.htm


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




Re: [PHP] PHP Security Advisory: Vulnerability in PHP versions 4.2.0 and 4.2.1

2002-07-22 Thread Richard Lynch

>On Mon, 22 Jul 2002, Marko Karppinen wrote:
>
>>   PHP Security Advisory: Vulnerability in PHP versions 4.2.0 and 4.2.1
>
>Not only did I get to re-write all my apps the past few months because of 
>the new register_globals default that was imposed by `the php group`...

You could have just *CHANGED* the setting in php.ini if it was that big a
friggin' deal.  I did.

>Now I get to upgrade my PHP install once a month or so cause of new 
>security holes..  Yay!

If you want to examine PHP's Security history *OBJECTIVELY* it will go
toe-to-toe against anything else in the same market.

>Wasn't this new register_globals setting supposed to enhance security?

Yes, and it does.

>How would you like to be a sys admin with dozens of machines to upgrade 
>before you can proceed with anythign else?

Ooooh, *dozens* of machines.  Why, that should take you at least an hour to
take care of, unless you want to sit there and twiddle your thumbs while the
text scrolls by.  Get a life!

>Can anyone say Ruby?

Can anyone say "No better"?

But, hey, we don't care.  Go use Ruby if that will make you happy.

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: Can a form submit to two PHP form processers in succession?

2002-07-22 Thread Richard Lynch

>Hi,
>
>I'm not sure how to do this but I have a form which I wish to do the following.
>
>When the uses clicks the "submit button", I wish to perform a check where I 
>look for a value in a MySQL database.  If found, I need
>to return an error page telling the user that the value already exists.  I 
>assume that I can just POST to a PHP page that performs
>the check.
>
>If the value was not found, I would like to POST the results to a PHP form 
>handling script I use.
>
>The above tow are separate PHP documents that are not connected.  In 
>essence, it is akin to one form processing page handing off the
>information to another page.  Can this be done in PHP?

In addition to the other worthy solutions, there is a "posttohost" function
out there that Rasmus wrote ages ago in PHP.

It will let you POST any data you like to any web-form you can visit.

Quite handy. :-)

Google for "Rasmus Lerdorf and PostToHost"

-- 
Like Music?  http://l-i-e.com/artists.htm


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




Re: [PHP] PHP Security Advisory: Vulnerability in PHP versions4.2.0 and 4.2.1

2002-07-22 Thread Richard Lynch

>Well, trying to updrade on Slackware Linux 8.0 and compiling with the GD
>(1.8.4) libraries are giving us some headaches. Some of what seems to be
>wrong;
>
>phpinfo() does not show new build times for each compile, not seemingly a
>caching problem (we have shut down browsers and then re-opened them to no
>avail as far as updated information).
>
>The configure command portion of phpinfo() does not show items we configured
>with PHP.
>
>GD throws errors; imageCreate() as an undefined function.


You're simply looking at the old PHP.

You did stop/start Apache, right?...  Cuz the new PHP won't kick in until
you do.

If so, almost for sure your installation of the "new" PHP binary is not
happening correctly.

Watch carefully when you do "make install" to see where your new copies go.
Use "locate modphp.so" or whatever it is to find out where your old copies
are.

I'm betting they don't match up.

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: multiple search

2002-07-22 Thread Richard Lynch

>My question is what can I do if someone searches for php script for search?
>
>I would want to use OR in my SQL statment. The problem is how do I write the
>query so that it will detect the number of words sent then put enough ORs
>and LIKE '%$search[1]% in?

The LIKE operator will cheerfully return 1 or 0, which you can "add up", or
in your case, "weight and add up" in your SELECT:

$query = "select 0 ";
# The 0 is a kind of 'yeast' to start off our summation of matches.

$words = explode(' ', $search);

while (list(,$word) = $words){
  $word = trim($word);
  if ($word){
$query .= " + article_keyword.weight * article_keyword.keyword like
'%$word%' ";
  }
}

$query .= " as score ";
$query .= " from article_keyword, article_data ";
$query .= " where score > 0 ";
$query .= "   and article_data.aid = article_keyword.aid ";
$query .= " order by score desc ";

echo $query, "\n";

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: imagecolortransparent()

2002-07-22 Thread Richard Lynch

>i get php to allocate a colour then make it transparent using
>imagecolortransparent()
>
>instead of turning it transparent it becomes black.
>
>Is it something i'm doing wrong? can anyone help me?

Show us your code.

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: Inline Images ?

2002-07-22 Thread Richard Lynch

>Is there a way to display an image withouth sending the headers first?

Not reliably.
*SOME* broken browsers will use the apparent "filename" in the URL to decide
what kind of document you are sending, even if you *DO* send the headers!
Grrr.

So you really want your URL to "end" (before any ?) in .jpg or .gif or .png
or whatever.

>I'm trying to display an inline image... but when I try it just only
>send the raw image data...

Don't.  You cannot (as far as I know) cram an image "inline" into an HTML
document.

>I've thinking that I need to save an image first to disk and then
>display the image later... 

You do not need to do that either, though.

>I don't want to do this... but I wanna hear another possiblities before
>doing that...

You need two (2) files.

One with an IMG tag in it, that points to the second file.
The second file needs to spew out a valid JPEG (or GIF or PNG)

Sample:

- index.html
--


---


- pretty.jpg
--


---


-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: Session Tracking

2002-07-22 Thread Richard Lynch

>This may be a pretty naive question.
>Do we have to use the key word
>session_register("variablename");
>in every single page, in which we plan to use the "variablename"?. Or is it
>possible that we register the variablename once, and in the subsequent pages
>continue to access it using  $variablename ?

Just register it one time.

You will still need session_start() on each page for the data to be there.

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: $HTTP_SERVER_VARS not accessible in Functions

2002-07-22 Thread Richard Lynch

>I'm trying to access some settings in the $HTTP_SERVER_VARS[] array, but,
>within a custom function() this array appears empty. In the calling script,
>however, the $HTTP_SERVER_VARS[] array is defined.
>
>I thought this was supposed to be "superglobal" and available on every
>level? If not, is there another command I can use? I also tried $_SERVER[]
>but this appears to be always empty no matter what level I call it on.

$_SERVER, if you are in a current version, would be a super global.
$_HTTP_SERVER_VARS would *NOT* be super global.

You'll need:
global $HTTP_SERVER_VARS;
inside your function to import the data.

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: Faster: Includes or DB Queries??

2002-07-22 Thread Richard Lynch

>Is there much of a difference in speed or efficiency between INCLUDEing
>files in a script or loading data from a database? I'm building a dynamic
>menu system for a website and not sure if it would be faster to store button
>data in a DB or just do it with Included files.

How fast is your hard drive?
Is the DB on the same box, or one with a 100Mbit Ethernet, or halfway across
the planet?
Do you already *have* a DB connection open?

Assuming a reasonable-speed hard drive, and a one-box PHP/MySQL setup, then
only the last question matters:
If the DB is already "there", it's faster.  If not, probably the hard
drive...  Maybe.

Test it yourself to be sure with your hardware.

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: Traversing an appendable file

2002-07-22 Thread Richard Lynch

>Is there any way to fseek (or something to the exact same effect) a file
>opened with "a" or "a+"?
>
>I've tried rewinding and fseeking appendable files, but neither work.
>
>Opening up in "r+" gives me part of the desired result, but if where I want
>to write is not at the end, it writes over things, which I obviously do not
>want.

It may be obvious to you that you don't want that, but it's not to anybody
else :-)

Use r+ and fseek to the end of the file.  You can use PHP's filesize
(filelength?) function to find out where that is.

I think a+ is only if you are "promising" not to go backwards into the old
data...  Maybe it's for some kind of OS optimization or something...

-- 
Like Music?  http://l-i-e.com/artists.htm


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




Re: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processe s

2002-07-22 Thread Jeremy

That's basically what happens in forking and threading. More "PHP.EXE"
processes appear, even on *nix.

- Original Message -
From: "David Buerer" <[EMAIL PROTECTED]>
To: "'Evan Nemerson'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, July 23, 2002 6:35 AM
Subject: RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processe s


> I thought about this and it's actually not such a bad idea.  I struggle
with
> it a little though because it seems like kind of a brute force method.
I'll
> end up with an awful lot of PHP.EXE processes going at the same time.
> Although it would get the job done, I'm not certain that it's the right
> solution. I was hoping for something a little more elegant.  I really like
> the pcntl_xxx() functions, but they are only available on UNIX platforms.
> And no, UNIX is not an option for this client...they are on Windows and
> that's where they're going to stay.
>
> Anyone else have any other ideas?
>
> -Original Message-
> From: Evan Nemerson [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 22, 2002 3:47 PM
> To: David Buerer; [EMAIL PROTECTED]
> Subject: Re: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processe
s
>
>
> Either exec(), system(), or one of the functions like them (check the
> manual)
> doesn't wait for anything to return- it just begins executing a new
process
> and sends it on its way. Perhaps you could use this and just make whatever
> you want to do a seperate file?
>
>
>
> On Monday 22 July 2002 15:09 pm, David Buerer wrote:
> > Yes, that's exactly what I want to do.  But HOW do I do it?
> >
> > i.e.  I'm sitting in my accept connectinos loop in the chat daemon
> >
> > While(true)
> > {
> > //waitforenwconnection
> > $new_connection_id=socket_accept();
> >
> > //got a new connection, go process it
> > go_do_this_in_a_new_thread($new_connection_id);
> > }
> >
> > What do I put in place of go_do_this_in_a_new_thread()
> >
> > -Original Message-
> > From: Demitrious S. Kelly [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, July 22, 2002 3:01 PM
> > To: 'David Buerer'; [EMAIL PROTECTED]
> > Subject: RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate
> > processes
> >
> >
> > Yes. Write a daemon which listens on a socket and manages the
> > communications it gets from the satellite scripts and works the
> > database for them...
> >
> > The scripts send off data, and process replies. They don't do the
> > heavy work...
> >
> > -Original Message-
> > From: David Buerer [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, July 22, 2002 2:30 PM
> > To: '[EMAIL PROTECTED]'
> > Subject: RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate
> > processes
> >
> > How to I inovoke a new Thread from the middle of a PHP script?
> >
> > -Original Message-
> > From: Paul Maine [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, July 22, 2002 10:08 AM
> > To: David Buerer; [EMAIL PROTECTED]
> > Subject: RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate
> > processes
> >
> >
> > You can use threads with NT to accomplish what you are asking.
> >
> > -Original Message-
> > From: David Buerer [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, July 22, 2002 11:29 AM
> > To: '[EMAIL PROTECTED]'
> > Subject: [PHP] Windows NT Server, FORK, SOCKETS, and seperate
> > processes
> >
> >
> > I've got effectivly a glorified chat server which upon the arrival of
> > a message thorugh a socket connection goes off and runs a bunch of
> > database processed.  My questions is this:  How can I seperate the
> > database processing into a seperate processor process?  I really don't
> > want the chat server to have to wait until after the database
> > processing is done to go intercept and process another request--this
> > just doesn't seem right.  I want the chat server process to be able to
> > deal with getting and receiving messages, and another process to deal
> > with the database processing. That way if one of the processes get's
> > slow, the other isn't affected. Something like the fork command would
> > work really well, but fork doesn't exist in NT.
> >
> > Anyone have any ideas?
> >
> > I'm running Windows NT4.0 sp6a
> > Apache Server 1.3.xx
> > MySQL
> > and of course, PHP 4.2.1
>
> --
> Man discovers truth by reason only, not by faith.
>
> Leo Nikolaevich Tolstoy
>
>


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




[PHP] Re: Digit Grouping

2002-07-22 Thread Pete James

number_format()

Wouter Van Vliet wrote:
> 
> Heey Listers,
> 
> I've got a small question. Does php provide any function to group a number
> like 3193576 into 3.193.576  ? Just reads easier when the hits for my
> website are being displayed ... Or if php doesn't have a function for it ..
> anybody any good suggestions on how to do it?
> 
> (it's not fully mine... technical team of two, one chief editor and some
> editors in estonia, latvia, sweden, germany, spain .. total of 20 folks in
> the esctoday.com team)
> 
> Thanks,
> Wouter
> 
> --
> Alle door mij verzonden email is careware. Dit houdt in dat het alleen
> herlezen en bewaard mag worden als je goed omgaat met al het leven op aarde
> en daar buiten. Als je het hier niet mee eens bent dien je mijn mailtje
> binnen 24 uur terug te sturen, met opgaaf van reden van onenigheid.
> 
> All email sent by me is careware. This means that it can only be reread and
> kept if you are good for all the life here on earth and beyond. If you don't
> agree to these terms, you should return this email in no more than 24 hours
> stating the reason of disagreement.


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


RE: [PHP] Formating datevariables...

2002-07-22 Thread Wouter van Vliet

Yeah .. the php function date shud do it .. if only the timestamp would be
in the correct format. I've been wrestling with it too, best way to do it
for me was using some substr() calles to extract year, month and day from
it.

anybody better ideas?


--
Alle door mij verzonden email is careware. Dit houdt in dat het alleen
herlezen en bewaard mag worden als je goed omgaat met al het leven op aarde
en daar buiten. Als je het hier niet mee eens bent dien je mijn mailtje
binnen 24 uur terug te sturen, met opgaaf van reden van onenigheid.

All email sent by me is careware. This means that it can only be reread and
kept if you are good for all the life here on earth and beyond. If you don't
agree to these terms, you should return this email in no more than 24 hours
stating the reason of disagreement.


-Oorspronkelijk bericht-
Van: Demitrious S. Kelly [mailto:[EMAIL PROTECTED]]
Verzonden: dinsdag 23 juli 2002 01:51
Aan: 'Ragnar'; [EMAIL PROTECTED]
Onderwerp: RE: [PHP] Formating datevariables...


Why not let mysql do it? It has a function do to exactly that, I
think...

But php's date() is the function you're looking for...

-Original Message-
From: Ragnar [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 22, 2002 4:42 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Formating datevariables...

I have a column in a mysql table with a timestamp. The value of this
column
is for instance:

20020722185242

How do i change the format on this to "DDMM" (22072002) in php?

Thanx

-R



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




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


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




RE: [PHP] Formating datevariables...

2002-07-22 Thread David Buerer

Select TIMESTAMP(date_column) AS mydate

Then when you display it use the date function
DATE('mdY',mydate)

-Original Message-
From: Ragnar [mailto:[EMAIL PROTECTED]] 
Sent: Monday, July 22, 2002 4:42 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Formating datevariables...


I have a column in a mysql table with a timestamp. The value of this column
is for instance:

20020722185242

How do i change the format on this to "DDMM" (22072002) in php?

Thanx

-R



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




[PHP] Digit Grouping

2002-07-22 Thread Wouter van Vliet

Heey Listers,

I've got a small question. Does php provide any function to group a number
like 3193576 into 3.193.576  ? Just reads easier when the hits for my
website are being displayed ... Or if php doesn't have a function for it ..
anybody any good suggestions on how to do it?

(it's not fully mine... technical team of two, one chief editor and some
editors in estonia, latvia, sweden, germany, spain .. total of 20 folks in
the esctoday.com team)

Thanks,
Wouter

--
Alle door mij verzonden email is careware. Dit houdt in dat het alleen
herlezen en bewaard mag worden als je goed omgaat met al het leven op aarde
en daar buiten. Als je het hier niet mee eens bent dien je mijn mailtje
binnen 24 uur terug te sturen, met opgaaf van reden van onenigheid.

All email sent by me is careware. This means that it can only be reread and
kept if you are good for all the life here on earth and beyond. If you don't
agree to these terms, you should return this email in no more than 24 hours
stating the reason of disagreement.


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




RE: [PHP] Formating datevariables...

2002-07-22 Thread Demitrious S. Kelly

Why not let mysql do it? It has a function do to exactly that, I
think...

But php's date() is the function you're looking for...

-Original Message-
From: Ragnar [mailto:[EMAIL PROTECTED]] 
Sent: Monday, July 22, 2002 4:42 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Formating datevariables...

I have a column in a mysql table with a timestamp. The value of this
column
is for instance:

20020722185242

How do i change the format on this to "DDMM" (22072002) in php?

Thanx

-R



-- 
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] Formating datevariables...

2002-07-22 Thread Ragnar

I have a column in a mysql table with a timestamp. The value of this column
is for instance:

20020722185242

How do i change the format on this to "DDMM" (22072002) in php?

Thanx

-R



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




Re: [PHP] upgrade 4.1.2 to 4.2.2 (passing vars problem with 4.2.2)

2002-07-22 Thread Pete James

Evan Nemerson wrote:
> 
> If you need register globals on for your old stuff, but want to write better
> new code, you can just use  in your new
> stuff.

You can't do this in a php file... by the time it gets to this line,
it's too late.

According to the set_ini function on php.net, register_globals is only
set-able in the ini file or in .htaccess.

P.


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


RE: [PHP] Comma question

2002-07-22 Thread Martin Towell

I remember from a previous post, the dot operator will create a temporary
string in memory, and then echo that out. The comma operator will just
output as it goes - ie. it doesn't create a temporary string.


As for Lee Doolan's reply:
  echo "{$obj->strName[$i]}";
interesting - never thought of doing that, I alway's broke out of the quotes
to do object dereferencing. Should make my future code more readable I
think...

Martin

-Original Message-
From: B i g D o g [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 23, 2002 9:06 AM
To: PHP GEN
Subject: Re: [PHP] Comma question


Thanks all for the info...

I figured that the comma was to concatenate but is was wondering if the
parser handled it different.

I knew the {} helped the parser now which was the variable...but i have
never seen it like that...

I have only seen it like ${var}...

Just wondering the difference...



.: B i g D o G :.


- Original Message -
From: "Kevin Stone" <[EMAIL PROTECTED]>
To: "B i g D o g" <[EMAIL PROTECTED]>; "PHP GEN"
<[EMAIL PROTECTED]>
Sent: Monday, July 22, 2002 5:00 PM
Subject: Re: [PHP] Comma question


> Curly braces {} are sometimes required for PHP to properly parse variables
> within quoted strings.  Good example might be defining variable-variables
> within a quoted string  "${$myvarvar}".  However I do not believe that
curly
> braces are required in this particular string.
>
> As for the comma I believe it does the same thing as the period.  It will
> concatonate the quoted string with the output of the htmlspecialchars()
> function within the echo statement.
>
> -Kevin
>
> - Original Message -
> From: "B i g D o g" <[EMAIL PROTECTED]>
> To: "PHP GEN" <[EMAIL PROTECTED]>
> Sent: Monday, July 22, 2002 4:34 PM
> Subject: [PHP] Comma question
>
>
> > Tried to check the archive, but it is offline...
> >
> >
> > What does the "," and "{}" do in this type of statement?
> >
> > Example:  echo "{$strName}", htmlspecialchars(
> $teststr );
> >
> > Thanks,
> >
> >
> > .: B i g D o g :.
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >


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

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




Re: [PHP] Simple question I guess.

2002-07-22 Thread Evan Nemerson

Okay im not sure i understand you- you want to create a page where it will 
suck an item out of a database, and use it to choose which item in a drop 
down menu should be selected?

If so, you can try something like

>Action
>Comedy
>Etc.




On Monday 22 July 2002 16:07 pm, Raymond Lilleodegard wrote:
> Hi!
>
> I have a site with all my movies and stuff stored in a database. And I have
> made a admin page where I can add, delete and update records. When I add
> new records, I have made a listbox for the category (ex. action, comedy
> etc.) so I dont have to write it every time I add a new record. But when I
> push the update button and the data thats stored in the database is printed
> its printed just in a textarea. I know its possible to list the data in a
> listbox, but how do I get the right category selected for the movie I
> choose?
>
> Best regards Raymond

-- 
What I conclude is that religion has nothing to do with experience or reason 
but with deep and irrational needs

Richard Taylor


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




RE: [PHP] Simple question I guess.

2002-07-22 Thread John Holmes

> I have a site with all my movies and stuff stored in a database. And I
> have
> made a admin page where I can add, delete and update records. When I
add
> new
> records, I have made a listbox for the category (ex. action, comedy
etc.)
> so
> I dont have to write it every time I add a new record. But when I push
the
> update button and the data thats stored in the database is printed its
> printed just in a textarea. I know its possible to list the data in a
> listbox, but how do I get the right category selected for the movie I
> choose?


>One
>Two
etc...


Put it into a function and the possible values into an array to make it
easier...

---John Holmes...



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




Re: [PHP] Comma question

2002-07-22 Thread B i g D o g

Thanks all for the info...

I figured that the comma was to concatenate but is was wondering if the
parser handled it different.

I knew the {} helped the parser now which was the variable...but i have
never seen it like that...

I have only seen it like ${var}...

Just wondering the difference...



.: B i g D o G :.


- Original Message -
From: "Kevin Stone" <[EMAIL PROTECTED]>
To: "B i g D o g" <[EMAIL PROTECTED]>; "PHP GEN"
<[EMAIL PROTECTED]>
Sent: Monday, July 22, 2002 5:00 PM
Subject: Re: [PHP] Comma question


> Curly braces {} are sometimes required for PHP to properly parse variables
> within quoted strings.  Good example might be defining variable-variables
> within a quoted string  "${$myvarvar}".  However I do not believe that
curly
> braces are required in this particular string.
>
> As for the comma I believe it does the same thing as the period.  It will
> concatonate the quoted string with the output of the htmlspecialchars()
> function within the echo statement.
>
> -Kevin
>
> - Original Message -
> From: "B i g D o g" <[EMAIL PROTECTED]>
> To: "PHP GEN" <[EMAIL PROTECTED]>
> Sent: Monday, July 22, 2002 4:34 PM
> Subject: [PHP] Comma question
>
>
> > Tried to check the archive, but it is offline...
> >
> >
> > What does the "," and "{}" do in this type of statement?
> >
> > Example:  echo "{$strName}", htmlspecialchars(
> $teststr );
> >
> > Thanks,
> >
> >
> > .: B i g D o g :.
> >
> >
> >
> > --
> > 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




  1   2   3   >