Re: [PHP] can I mail unlimited in one click?

2002-12-16 Thread Greg Donald
On Mon, 16 Dec 2002,  wrote:
>I wonder if I can mail 300 customers in one click?
>
>part of script:
>
>while($listrow = mysql_fetch_array($listresult))  {
>
>$recipient = $listrow[epost];
>$subject = "$subj";
>$message = "$mess";
>$headers .= "From: $admail\n";
>$headers .= "Reply-To: $admail\n";
>$headers .= "X-Mailer: PHP\n";
>mail($recipient, $subject, $message, $headers);
>}
>
>or is there a limit?

You may need to increase your max_execution_time, the default seems to be 
30 seconds, pretty low for 300 emails:

>cat `locate php.ini`|grep max_execution_time
max_execution_time = 30 ; Maximum execution time of each script, in 
seconds


--
Greg Donald
http://destiney.com/



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




Re: [PHP] PHP Sessions Not Saving

2003-02-03 Thread Greg Donald
On Mon, 3 Feb 2003, Jonathan Wright wrote:

>Aside from this, PHP's running like a dream. I haven't had a single
>problem (other than mail() not working, but I found that's because I use
>/usr/sbin/sendmail, not /sbin/sendmail, so I'll just need to recompile).

Recompile, why?  How about a link?

ln -s /sbin/sendmail /usr/sbin/sendmail


-- 
Greg Donald
http://destiney.com


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




Re: [PHP] PHP Sessions Not Saving

2003-02-03 Thread Greg Donald
> During the ./configure part of the installation, PHP checks for
> sendmail, but only in /sbin/sendmail. If it doesn't find it, the
> function mail() isn't complied in.
> 
> I just get 'call to undefined function mail()' in x/y.php on z.

Ok, make your link this way then:

ln -s /usr/sbin/sendmail /sbin/sendmail 

--
Greg Donald



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




Re: [PHP] calculating kilobytes

2003-02-14 Thread Greg Donald
On Fri, 14 Feb 2003, joe wrote:

>i searched and i tried and i failed. most of the functions dont work in safe
>mode, some didnt do what i wanted (returned the whole drive size instead of
>one directroy) etc.
>my head hurts already and i think i am on the verge on nervous breakdown
>because i have been trying to solve this problem for days so could
>somebody please drop me a function here?
>thank you...

Most people who write code for other people on request are compensated in 
one form or another.  This is a listserv, I doubt anyone here will do 
your work for you for free.  This is place where people get _assistance_ 
with code they already attempted to write themselves.  If you tried and 
failed already like you say, post your broken code and people will help 
you figure out your errors.  That's pretty much how it works.

Also, what you ask may simply not be possible in safe mode, but there's no 
way to tell since you posted no code.


-- 
Greg Donald
http://destiney.com


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




Re: [PHP] redirect

2003-02-14 Thread Greg Donald
> What is the syntax to have php redirect to another web site?


http://domain.com/";);
?>


--
Greg Donald
http://destiney.com/



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




Re: [PHP] MD5 Passwords (How it works?)

2003-02-17 Thread Greg Donald
On Mon, 17 Feb 2003, Vernon wrote:

>I'm thinking that the MD5 function more than likely encrypts a password to
>store into a database, and when you log in using the MD5 function it will
>simply encrypt the value being passed along again the same way. Now I'm
>wondering what happens when I user has lost there password and needs to
>retrieve it, there is no way to reverse the process is there?

md5 is one-way encryption.  I use a password 'hint' field in conjunction 
with md5.


-- 
Greg Donald
http://destiney.com


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




Re: [PHP] PHP 5

2003-02-17 Thread Greg Donald
On Mon, 17 Feb 2003, Stephan Seidt wrote:

>Well, something very important in php5 is ZendEngine2:
>http://cvs.php.net/co.php/ZendEngine2/ZEND_CHANGES

Looks like PHP5 will be a lot like java/c++ when released.  Exception 
handling, true object support, and an inline debugger, oh my!

When is the expected release date?  Or is still too soon to tell still?

Thanks,


-- 
Greg Donald
http://destiney.com


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




Re: [PHP] Data from DB

2003-02-17 Thread Greg Donald
On Mon, 17 Feb 2003, Miguel Brás wrote:
>
>I have a table with users and passwords with over than 100 rows.
>I have 7 specific users that I wanna display on a page, as well their data.
>
>How can I display this specific users on the page?

You probably want to execute some SQL queries.  Then the data that is 
returned you will want to place into an array.  Then finally you 
will want to iterate over the array creating some html from each row for 
display.


-- 
Greg Donald
http://destiney.com


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




Re: [PHP] Protecting files

2003-02-17 Thread Greg Donald
On Mon, 17 Feb 2003, PR wrote:

>How can I protect my php files among other files like templates
>(.inc) and mysql config  (config.inc) files being copied/read/imported (front
>page)/used by other applications other than my
>site...
>
>can this be done by htaccess? is so , could anyone point me into right
>direction?

The best way is to not allow anyone else access to your files to begin 
with.  I assume you mean you are in a shared hosting environment?  Your 
system administrators can and should have permissions setup so no one can 
mess with your stuff by default.  If that is not the case, I'd move.

What kind of system is it?  If it's unix you can make use of chown and 
chmod to protect your stuff.  If it's windows, I don't know.


-- 
Greg Donald
http://destiney.com


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




Re: [PHP] IRR Function in PHP

2003-02-17 Thread Greg Donald
On Mon, 17 Feb 2003, Jonathan Pitcher wrote:

>This process involves an IRR Calculation. Or Internal Rate of Return.

Sorry, I don't think there are any accountants lurking on the list, so 
please explain what the actual calculation for an IRR should be.


-- 
Greg Donald
http://destiney.com


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




Re: [PHP] Threading

2003-02-18 Thread Greg Donald
On Tue, 18 Feb 2003, Bruce Miller wrote:

>Will PHP allow multiple-thread execution?

PHP4 does not have thread support.


-- 
Greg Donald
http://destiney.com


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




Re: [PHP] simple ereg question

2003-02-20 Thread Greg Donald
On Thu, 20 Feb 2003, Robert E. Harvey, M.D. wrote:

>I'd like to verify input data transferred from a form and make sure it 
>is numeric data or null before my program executes.  I am using this 
>syntax, which doesn't work:
>
>for ($i=1;$i<=3;$i++)
>{
>  if (ereg('[0-9]+','$_POST["gamt_$i"]'))
> {
>   continue;
> }
>  else
>{
>  die("Non-numeric data entered in grass entry field(s).");
>}
>}

Try changing '$_POST["gamt_$i"]' to $_POST['gamt_$i']


-- 
Greg Donald
http://destiney.com


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




Re: [PHP] Keeping existing data in textarea's

2003-03-03 Thread Greg Donald
On Mon, 3 Mar 2003, Mirco Ellis wrote:

>Hi, I have a  developed a simple Helpdesk for our small company. When users
>log calls they get an alert message warning them that they must fill in all
>the fields if they have missed a field. At the moment if they happen to
>forget a field, they receive the alert message, but then have to start all
>over again. How do I keep the existing data in the textareas from
>dissapearing after the alert message?

$fill = isset($_GET['textareafield']) ? $_GET['textareafield'] : "";

$html = <<$fill
EOF;


-- 
Greg Donald
http://destiney.com


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



Re: [PHP] Need help with ?> vs. php?>

2003-03-05 Thread Greg Donald
On Wed, 5 Mar 2003, LeTortorec, Jean-Louis wrote:

>My pages starting and ending with "" don't work anymore. I would
>have to change them to "".
>
>Do you know if there is a way for keeping "http://destiney.com


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



Re: [PHP] Re: Red Hat 9, Apache 2, and PHP

2003-07-03 Thread Greg Donald

> I usually don't like to use the new of anything until it have been out for
> sometime and I don't see any see bug reports.

And just when would this rare event occur, if ever?

Every version of Apache, PHP, or Linux distro ever released has had bugs or 
exploits of some form.  If you're waiting for a perfect version of any of 
those, it'll still be a long while.

The best thing to do is just pick a distro that releases patches quickly, and 
keep up to date on patches.


-- 
Greg Donald
http://destiney.com/



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



Re: [PHP] Re: Red Hat 9, Apache 2, and PHP

2003-07-03 Thread Greg Donald

> Does anyone know why Red Hat would switch to Apache 2.x.x when it is 
> well known that 2.x.x is NOT a production version?

This question seems more appropriate for [EMAIL PROTECTED] or such since PHP 
has nothing to do with RedHat version control.

But to answer your question, RedHat has always pushed out the new stuff sooner 
than most anyone except maybe Mandrake.  If you're a RedHat user and this makes 
you uncomfortable you might try a distro that is a bit more slow to release new 
stuff, Debian or one of the BSDs for example.

-- 
Greg Donald
http://destiney.com/



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



Re: [PHP] Can I use PHP to draw a chart?

2003-07-06 Thread Greg Donald

> It's the first time I use PHP as my project server-side language,
> and I wanna know if PHP can be used to draw a chart or any other
> suggestions. Thx

Yeah, PHP will do that.

I use JPGraph myself: http://www.aditus.nu/jpgraph/


-- 
Greg Donald
http://destiney.com/



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



Re: [PHP] print vs. heredoc

2003-07-06 Thread Greg Donald

> I'm looking for opinions as to which is better, print or heredoc.

I prefer heredoc mostly because I do not enjoy editing html that is full of 
backslashes.  I build up the html and only output anything at the end.  This 
allows for custom compression, whitespace stripping, etc.

> print makes the code layout look nice and eazy to debug, where heredoc IS
> faster but makes the code look like a nightmare and I'm pretty picky about
> what looks good.

Sounds like you already have your mind made up.


-- 
Greg Donald
http://destiney.com/



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



Re: [PHP] Refresh in PHP

2003-07-07 Thread Greg Donald

> My user has reported a problem when he loads a page. The page grabs data
> from MSSQL and displays this on the screen. However, it is not updated.
> Is there any way in getting the page to automatically refresh itself
> ONCE when it is loaded, without ending up in a loop?

Javascript will do that.


-- 
Greg Donald
http://destiney.com/



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



Re: [PHP] daemonized php

2003-07-07 Thread Greg Donald

> Can somebody give me any workable example how to run some script written in
> PHP in Unix console.

#!/usr/local/bin/php -q


> I wan't to write some server aplication. So it has to be run in the
> backgroud.

Have a look at the process control functions:
http://php.net/pcntl


-- 
Greg Donald
http://destiney.com/



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



Re: Re[2]: [PHP] daemonized php

2003-07-07 Thread Greg Donald

> Ok let be more specific about my idea. Because I'm better php programer
> than C I decided to write this in php. I use comandline php.
> 
> I want to write some daemon to be started
> 
> ./myprog &
> 
> Than this has to be run until I cancel it. But I also want to check
> somehow, what this proces is doing right now.

ps ax will tell you if it is still running or not.  If you need more info you 
can check out /proc.

> for example like in apache.
> 
> you start it with apachectl start. than you can say apachectl restart to
> reread config. And for example you could use apachectl status to output
> some info about runing server.

They coded it that way.  If ps ax and /proc are not enough info for you then 
you'll need to code whatever else you need into your script.

> This program I'll make will be run in infinite loop. It will be reading
> some file on disk and doing something with this data.
> 
> Do I have to use any usleep function. What is with CPU % when i run such
> script.

usleep sleeps, there is very little overhead in sleeping.  The cpu usage will 
be determined more by what you make it do when it's not sleeping than when it 
is.

> Is there any real examples.

Yes, I already gave you the url: http://php.net/pcntl
There's an example right there on the page.  It lets you handle hangups, 
restarts, etc.  Copy and paste that and add your own code in the while(1) loop.

> I read on devshed article about TCP socket
> listenig, but I don't like this.

That's pretty much how it's done.  If you want to listen to a program you have 
to use some type of socket, tcp is they way I'd go.


-- 
Greg Donald
http://destiney.com/



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



Re: Re[4]: [PHP] daemonized php

2003-07-07 Thread Greg Donald

> But I sill wan't to hear from you php experts. Anybody do such thing in
> real example or this is can only be my dream.

Although I may not be the PHP expert you seek, I do have lots of command line 
PHP scripts: mailings, spam filter, db maintenance.. I even have an IRC bot 
written in PHP. 

-- 
Greg Donald
http://destiney.com/



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



Re: [PHP] Quick SQL Question

2003-06-17 Thread Greg Donald

> I'm using the "ORDER BY RAND() LIMIT 0,1" to give be a random record from a
> recordset but it seems like it puts a real heavy load on the server. Is
> there a better way to pull a random record from a database?

I used order by rand() with MySQL quite often and do not notice any load issues 
with it.  What's your whole query look like?


-- 
Greg Donald
http://destiney.com/



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



Re: [PHP] Quick SQL Question

2003-06-17 Thread Greg Donald

> Here it is:
> 
> SELECT penpals.username, penpals.zoneid, penpals_photos.album,
> penpals_photos.rating, zones.zone_id, zones.zone_code,
> penpals_photos.filename, penpals.city
> FROM penpals, penpals_photos, zones
> WHERE penpals.username = penpals_photos.album AND penpals_photos.rating !=
> 'X' AND penpals.zoneid = zones.zone_id
> ORDER BY RAND() LIMIT 0,1

If it's the username that is to be random, I'd grab it first then go get all 
the other data with a second query.  If that is undesirable for whatever reason 
then I'd use left joins so as to select much less data.

As an aside, limit 0,1 is the same as limit 1.


-- 
Greg Donald
http://destiney.com/



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



Re: [PHP] patch of php

2002-07-25 Thread Greg Donald

On Thu, 25 Jul 2002, Hong Tian wrote:

>I download patch of php-4.2.0-to-4.2.2.patch.gz from http://www.php.net and
>try to update our PHP 4.2.0 to 4.2.2. But I can't find instructions how to
>update PHP by using this patch of php-4.2.0-to-4.2.2.patch.gz. Could anyone
>tell me how to patch it or where can I find this information to update PHP
>by this patch?

gunzip php-4.2.0-to-4.2.2.patch.gz
cd /path/to/php_source
cat /path/to/php-4.2.0-to-4.2.2.patch |patch

you might also try 'man patch'


-- 
Greg Donald
http://destiney.com


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




Re: [PHP] Editor

2002-06-13 Thread Greg Donald

On Thu, 13 Jun 2002, Daniele Baroncelli wrote:

>Can anyone suggest me a different editor ?

Depending on my OS I amd sitting in front of:

vim - www.vim.org
editplus - www.editplus.com

-- 
---
Greg Donald
http://destiney.com/public.key
---



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




Re: [PHP] New Newsgroups

2002-06-26 Thread Greg Donald

On Wed, 26 Jun 2002, Peter wrote:

>Does anyone else out there use Outlook Express to get the posts from this
>newsgroup?
>Yesterday a dialog popped up to say there were new newsgroups (php.docs.de
>etc), I acknowledged this but the same message came up again just now!
>Did this happen to anyone else or was it just me?!

It must be your news client.  I use pine remotely and got no such popup.

-- 
-------
Greg Donald
http://destiney.com/public.key
---



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




Re: [PHP] Recognition: Richard Lynch

2002-07-03 Thread Greg Donald

On Wed, 3 Jul 2002, Lazor, Ed wrote:

>Richard Lynch:  It's amazing to see how many helpful and informative
>messages you're able to rattle off on a daily basis.  You're a major
>contribution to the community - Good job!

Absolutely.
  
..and not only does Richard offer lots of great answers in a timely 
manner, he does so with great wit and a true 'get the job done' programmer 
style that I myself have come to embrace.  Richard has assisted me on more 
than one occasion.

Great job Richard.  Glad your around man.


-- 
-------
Greg Donald
http://destiney.com/
---



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




[PHP] ini_set() broken?

2002-07-07 Thread Greg Donald


This code doesn't work:



At http://php.net/ini_set it states the following setting is possible:

register_globals "0" PHP_INI_ALL

Translated, PHP_INI_ALL means: Entry can be set anywhere

So does anyone know why my code doesn't work then?  ini_set() seems 
broken.  Can anyone confirm or deny?

I am using PHP 4.2.1 and on this particular project I am moving existing 
code from a Linux/Apache setup where I developed it, to it's home on a 
microsoft/iis server.  Obviously I do not have access to the php.ini file.

Thanks in advance.. :)


-- 
-------
Greg Donald
http://destiney.com/public.key
---



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




Re: [PHP] ini_set() broken?

2002-07-07 Thread Greg Donald

On Sun, 7 Jul 2002, Miguel Cruz wrote:

>> > if(ini_set("register_globals", "0"))
>>   echo "ini_set success";
>> else
>>   echo "ini_set failed";
>> ?>
>
>Please don't say "this code doesn't work." Say why you think it didn't 
>work, whether that's because you received an error message, or a specific 

Uhh.. I don't have any thoughts as to why it doesn't work, that's why I 
posted.  The function itself appears broken, my code is a test to that 
notion.  If you can't be helpful then feel free to shutup..

>expected outcome was not realized, or whatever. Otherwise it doesn't 
>really tell us anything. Obviously it doesn't work or you wouldn't be 
>posting it.

Yes, the obvious is always pretty easy to restate.  If you need more 
explanation than the code itself I don't knwo what to tell you.

>> At http://php.net/ini_set it states the following setting is possible:
>> 
>> register_globals "0" PHP_INI_ALL
>> 
>> Translated, PHP_INI_ALL means: Entry can be set anywhere
>> 
>> So does anyone know why my code doesn't work then?  ini_set() seems 
>> broken.  Can anyone confirm or deny?
>
>I believe the issue here is that by the time your PHP code starts
>executing and gets to the ini_set call, it's too late to register the

"gets to the ini_set call" - what do you mean?  The code I posted is all 
there is to the entire script.  Where else would I use the ini_set() 
function except at the very beginning of a script?

>globals (which must happen before execution begins). Therefore I'd suggest
>looking into .htaccess or whatever the IIS equivalent is. If there's no

Thanks but I have no idea about IIS, that's why I posted, to see if this 
might be an IIS specific issue some other windows users experienced. 

>equivalent then I'd suggest throwing the server out the window.

Yes..


-- 
---
Greg Donald
http://destiney.com/public.key
---



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




RE: [PHP] ini_set() broken?

2002-07-07 Thread Greg Donald

On Mon, 8 Jul 2002, Martin Towell wrote:

>>> >> if(ini_set("register_globals", "0"))
>>>   echo "ini_set success";
>>> else
>>>   echo "ini_set failed";
>>> ?>
>
>I haven't tried this code

Then why comment on it?

>but I assume you're trying to say that "ini_set
>failed" is displayed, but you're expecting the other output to be displayed.
>Am I correct there?

Yes, is it not obvious enough from just reading the code?  I am showing 
that the ini_set() function is not working properly, as per the manual. 
The manual states that ini_set() returns the old value on success and 
FALSE on failure.  My script always returns false.  Any idea why?

>What happens if you use http://localhost/file.php?var=something or whatever
>your test script's path is and have this line at the end of the script
>  echo "var = |$var|";

What does this prove or disprove in relation to the ini_set() function?  
If you knew anything about the function then you would see I am passing it 
a big fat zero in the second parameter, just as the manual states I can. I 
also tried "Off" and "off", same results.

>does $var contain anything. If it doesn't, then ini_set() worked...
>otherwise.. um... find other way of doing it(??)

Yes..  another way, any suggestions?


-- 
---
Greg Donald
http://destiney.com/public.key
---



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




Re: [PHP] ini_set() broken?

2002-07-07 Thread Greg Donald

On Sun, 7 Jul 2002, Chris Shiflett wrote:

>I refer you to this URL:
>
>http://www.tuxedo.org/~esr/faqs/smart-questions.html

I refer you to this URL: http://php.net/ini_set and ask why does this 
function not work as per the manual? 

Again, here is my code:




-- 
-------
Greg Donald
http://destiney.com/public.key
---



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




Re: [PHP] ini_set() broken?

2002-07-07 Thread Greg Donald

On Mon, 8 Jul 2002, Jason Wong wrote:

> if (ini_set("register_globals", "0") !== FALSE)
>   echo "ini_set success";
> else
>   echo "ini_set failed";
>?>

Finally someone interested in helping find my error.

Thanks alot!


-- 
-------
Greg Donald
http://destiney.com/public.key
---



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




Re: [PHP] another pair of eyes?

2002-07-12 Thread Greg Donald

On Fri, 12 Jul 2002, Jas wrote:

>Hello all,
>I have a parse error and I am not sure why, I think my eyes are giving up on
>me, or its a friday.  Any help is appreciated.
>// just trying to compare the session var $date to timeout if older than 5
>minutes
>[snippit]
>/* Begin Session and register timeout, random image & client info variables
>*/
>   session_start();
>   session_register('$var1);
>   session_register('$var2');
>   session_register('$var3');
>   session_register('$var4');
>   session_register('$var5');
>  } elseif (isset($HTTP_SESSION_VARS[$hour]) => $hour + 5*60)) {
>   header("Location: https://localhost/index.php"};
>  } else {
>  endif(); }
>[end snippit]

The syntax should be:

$var1 = "some value";
session_register("var1");


-- 
---
Greg Donald
http://destiney.com/public.key
---



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




Re: [PHP] fputs - need help!

2002-07-15 Thread Greg Donald

On Mon, 15 Jul 2002, MAAS wrote:

Try adding a \r.

fputs ($sysname_log, "$time - SystemName: $sysname\r\n");



-- 
---
Greg Donald
http://destiney.com/public.key
---



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




Re: [PHP] Self Modifying PHP Code Working on IIS

2002-07-15 Thread Greg Donald

On Mon, 15 Jul 2002, Kondwani Spike Mkandawire wrote:

>Am I the only one who seems to be irritated by the tremendous amount
>of settings you have to do on the IIS Server if testing a PHP Script...

You are not alone, I am irritated by IIS everytime I am forced develop 
for it.

>I am testing a Self modifying Script runs perfectly on Apache 1.3 /PHP4.2.1
>However it is meant to sick Chunks of code at the beginning of my File...
>Hence with NewLine Characters and everything else...  It kind of messes
>up and sticks chunks of code in the wrong places generating errors...
>
>Any advice?!

Use apache if possible.


-- 
---
Greg Donald
http://destiney.com/public.key
---



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




Re: [PHP] newbie: mysql statement

2002-07-15 Thread Greg Donald

On Mon, 15 Jul 2002, Alexander Ross wrote:

>I want to update the most recent record (based on the timestamp in field
>posted) where the parent field == a specified value (in a table called
>header).
>
>I tried the following mysql statement:
>
>"UPDATE header WHERE parent = '$this->postid' ORDER by posted SET
>parent='$this->parent' LIMIT1";
>
>but apparently you can't use ORDER in an UPDATE statement.  If I take order
>out, the statement works.  That being true (and please correct me if its
>not) how can I ensure that the newest record is the one being acted upon?
>Thanks.

By using a where clause to identify the postid in the table, something 
like this perhaps:

UPDATE header SET parent='$this->parent' where postid='$this->postid';


-- 
---
Greg Donald
http://destiney.com/public.key
---



-- 
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.0and 4.2.1

2002-07-22 Thread Greg Donald

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`...

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?


-- 
Greg Donald
http://destiney.com


-- 
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.0and 4.2.1

2002-07-22 Thread Greg Donald

On 22 Jul 2002, Adam Voigt wrote:

>Hey man, if you can't stand the heat, get out of the freakin sun.
>Atleast PHP tells you about holes, not like Microsoft who will fix it
>six months down the line (if they even admit a hole exists). Plus, if

Who said anything about M$?  I don't use their crappy products so I 
don't have to deal with their security issues.

>your running anything past 4.1.2 on production systems, it's your own
>damn fault because several times it has been said that the 4.2 series
>wasn't considered safe for production use. And by the way, don't want to

If PHP 4.2 is unsafe then why is it listed at the top of the page for 
download?  There is not a shread of text saying do not use in production, 
no unsafe warnings whatsoever.  How am I supposed to magically find the 
'do not use' warnings?

>use PHP anymore because of this? Then don't. PHP doesn't need you, the
>rest of the people who can handle an update without whining will be
>fine.

It's not about that..  It's about the hell I've already been through with 
the new register_globals setting.  Then two huge ass security holes 
following in the next couple of months after that.

If it doesn't bother you the hassles 'the php group' is putting me, you, 
and alot of others through then I guess that's just you.  I can't 
help but get pissed about it.  I did not have the time to do these 
upgrades, but now I have to make time.


-- 
Greg Donald
http://destiney.com


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




Re: [PHP] Pipe an email to PHP

2003-08-27 Thread Greg Donald

>  
> I'm sure this question has been visited before, but I've had some troubles
> searching through 
> the archives.
>  
> This is at least a two part question.
>  
> I wish to use a pipe instead of the pop3 class, because I wish the email to
> start the script 
> instead of waiting for a cronjob.
>  
> 1)  The pipe itself:
> On a cPanel server, I wish to setup an email address with a pipe like:
> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> :
> |/home/account/public_html/mailtools/emailscript.php

I would read the data from the pipe with STDIN:

$fp = fopen("php://stdin", "r");
while(!feof($fp)) $buffer .= fgets($fp, 4096);
fclose($fp);

> This always gives me an error saying it cannot foraward.
>  
> If I pipe it to "|/usr/bin/php
> /home/account/public_html/mailtools/emailscript.php"
> it tells me: "No input file specified."

I use something like that in my .procmailrc:

:0 fw
| /usr/bin/spamassassin

:0
* ^X-Spam-Status: Yes
{
:0 c
| $HOME/.spamassassin/spamcop.php
:0
spam
}


-- 
Greg Donald
http://destiney.com/

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



RE: [PHP] Subcategories in php

2003-09-20 Thread Greg Donald

> I don't know how to create the script that inserts any 
> subcategory(in this case let's say ItsSubCat 3) in its parent 
> category.
> Please, can someone help me


I'd use the parent category id as a hidden field in the form when adding a
sub category.

Here is a complete script that contains all the code you would need:

http://destiney.com/pub/phplinks_2.1.2.tar.gz



--
Greg Donald
[EMAIL PROTECTED]
615-746-9414 home
615-594-6052 cell

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



Re: [PHP] Templates/Separate content from presentation

2003-10-31 Thread Greg Donald
> I've coded in PHP for a while, but I had to leave it for some time. Now
> I'm back, and I'd like to know what's currently being used to separate
> content from presentation, besides Smarty (that seems to be Google's top
> choice)?

I tried Smarty for several weeks and found it was more than I needed, so I
went back to my simpler template system.

I have templates that look like this for example:

> cat userImage.tpl



$userType
$commentsCountHTML
$totalPoints
$timesRated
$averageRating



Then in my php scripts I call a template like this:

$userImage = getTemplate("userImage");
eval("\$userImage = \"$userImage\";");
$html .= $userImage;

The function being:

function getTemplate($template){
global $Site;
  $html = '';
  $file = $Site['TemplatePath'] . '/' . $template . '.tpl';
  if($handle = fopen($file, "r")){
while(!feof($handle)){
  $html .= fgets($handle, 4096);
}
fclose($handle);
$html = str_replace("\\'","'", addslashes($html));
  } else {
die('Fatal: cannot open template ' . $file . '\n');
  }
  return $html;
}

Of course I have no template caching system like Smarty has, but I use
TurkeMM Cache: http://www.turcksoft.com/ and query caching from MySQL 4.  I
also clean my html before output, removing all tabs and newline characters,
and I have zlib.output_compression enabled.  Seems to work well.


--
Greg Donald
http://destiney.com/

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



Re: [PHP] I need answers for the questions

2003-11-18 Thread Greg Donald
On Tue, 18 Nov 2003, Ryan Thompson wrote:

>What you can't find at php.net/manual/en you can find on google. But I have a 
>question for you. Correct me if I'm wrong but isn't a subnet mask of 
>255.255.248.0 invalid??? I thought it had to be 255's and 0's.

Umm..  no.  For a given network, say 10.0.0.0, a subnet mask of 
255.255.248.0 yields the following range of possible node addresses: 
10.0.0.1 to 10.0.7.254.

>This seems like laziness..

Or homework.


-- 
Greg Donald
http://destiney.com

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



Re: [PHP] Custom Session usind MySQL

2003-11-18 Thread Greg Donald
On Wed, 19 Nov 2003, Manisha Sathe wrote:

>I want the session to be accessed from different websites, so i got the
>answer in this forum only to make use of customised session with mysql.
>
>I searched the web and came to know that 'session.save_handler' of php.ini
>needs to be as 'user' but instead, on my server it is 'files'. As server is
>a shared server so i may not be able to change it, what can i do to resolve
>this ?
>

Basically you just need to override the default session handler and 
provide your own session functions that will use a MySQL table instead of 
/tmp.  Try this:

http://destiney.com/pub/php_db_sessions.tar.gz


-- 
Greg Donald
http://destiney.com

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



Re: [PHP] Mysql question

2003-11-18 Thread Greg Donald
On Tue, 18 Nov 2003, Lists wrote:

>I have a db in sql, and I need a php/mysql query/command to copy the 
>entire db (schema and data) to a new db.  I know how to do this with a 
>table, but I can not figure out how to do this with a whole db.  I also 
>know that I could do it using mysql dump, but I don't want to have to run 
>a shell command.

Have you tried mysqlhotcopy?

http://www.mysql.com/doc/en/mysqlhotcopy.html


-- 
Greg Donald
http://destiney.com

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



Re: [PHP] distinct values from a mulit-dimensional array

2003-12-23 Thread Greg Donald

array_unique perhaps?

http://php.net/array_unique

--
Greg Donald
http://destiney.com/


- Original Message - 
From: "Chakravarthy Cuddapah" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, December 22, 2003 11:22 PM
Subject: [PHP] distinct values from a mulit-dimensional array


Can anyone pls tell me with an example on how to select distinct values from
a multi-dimensional array. Moving distinct values into another array is ok.

Thanks !

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



Re: [PHP] odd error with if !(cond){}

2004-01-19 Thread Greg Donald
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Tristan Gutsche wrote:
| Hello im hoping someone might have an insight into this one im getting an
| odd error when I use a not condition in an if statement
|
| The code is as follows:
| if !(isset($_REQUEST["license"]))
| {
|   $license = "off";
| }
|
| The error I am receiving is:
|
| Parse error: parse error, unexpected '!', expecting '(' in
| c:\inetpub\wwwroot\php\car.php on line 9
|
| To avoid the error im simply using a script that doesnt use the ! mark but
| the fact that using an ! in this position is occuring is worrying.. Has
| anyone else encountered this?
Do

if(!isset($_REQUEST["license"]))

- --
**
*  ____  _   *
*  ___/ /__ ___ / /_(_)__  ___ __ __ ___  __ _   *
* / _  / -_)_-
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFAC5IHoAq8t3CabwcRAqKoAJ0RfFIBJJnWREgY9PUViRj8wlrcmwCgpN8d
AZdz70SMYVJnNd9/C/o/KFQ=
=b7NS
-END PGP SIGNATURE-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] dreaded sessions

2004-01-19 Thread Greg Donald
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Matt Horner wrote:
| Simply here is my problem:
|
| After logging into the system, I set a session with information for
| the Username and Password for verifiying
| the user's login into the system, that way I don't have to
| continually ask for the information or pass
| in the forms.
|
| Currently I am using a database to store sessions, which I have
| however encountered the same errors with file
| based sessions.  When I restart the session, it performs a selection
| from the database on SESS ID.  However,
| in very consistently inconsistent points the selection returns 0
| results.  However, I checked the database for the
| session data and found that the session information was gone from
| the previous write.  But
| I am using an Innodb table and committing the transaction.  Odd?
|
| I am calling the session_write_close function at the end of the
| transaction, to push the session through.  Also,
| in the session_destroy handler I put a debugging message to see if
| the session was being destroyed and that is
| not the situation either.
|
| Anybody have similar problems with delayed in session writing or
| lost session data?  I register all of the data into
| the session that I need leave the session alone except for reading
| of the session data.
I'd say it has something to do with you transactions.  Can you duplicate
the errors using the same code on a system where the Innodb transactions
do not require committing?
Here is my own drop-in PHP session handling code if you care to compare
notes:
http://destiney.com/pub/php_db_sessions.tar.gz

I've never had a problem with it and I am using it with Innodb tables on
several projects currently.
I've also heard the Pear DB Session stuff is pretty good too, but I've
never tried it.
- --
**
*  ____  _   *
*  ___/ /__ ___ / /_(_)__  ___ __ __ ___  __ _   *
* / _  / -_)_-
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFADFxtoAq8t3CabwcRAsKBAKCIY8Xp8GxXjVpg+fY6uy84t0WRAgCdH/Ao
mP6LQ6cy3qCuFeYLcS11exM=
=mUJI
-END PGP SIGNATURE-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Generating an Excel file?

2004-01-19 Thread Greg Donald
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Ben Ramsey wrote:
| I'm pretty sure I know how to use header() create a CSV file for a
| client to download data from a database, but I think it would really
| impress this client if I could generate a Microsoft Excel file instead
| of a CSV file.  Anyone know how to do this?
We get this request from clients at work quite often.  Most people don't
realize .csv files are Excel friendly.  Just make the data comma
delimited and name it .csv.  It'll work.
- --
**
*  ____  _   *
*  ___/ /__ ___ / /_(_)__  ___ __ __ ___  __ _   *
* / _  / -_)_-
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFADG+HoAq8t3CabwcRAm3eAJ48cC3E6+Mh5HezwKKIsvflAe62dACfUfE/
jFqr+KcMIUsEG2Hw/rCuUKA=
=8jBi
-END PGP SIGNATURE-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] dreaded sessions

2004-01-19 Thread Greg Donald
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Brian V Bonini wrote:
| Kind of funny... Back before PHP had sessions this was how everyone did
| it and everyone wished for session support in PHP, now that it's had it
| for a while :)
I hear ya.  I recall a job interview in like 1999 or something where I
was asked if I had used phplib before.  They were using FreeBSD and
STABLE still only had PHP3 available at the time.
- --
**
*  ____  _   *
*  ___/ /__ ___ / /_(_)__  ___ __ __ ___  __ _   *
* / _  / -_)_-
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFADHBfoAq8t3CabwcRAqfFAKCfZx0569fHld9e5F14UnVSOZe2EACgodYI
17jm+trWEQr1oFwEvsMK688=
=meaR
-END PGP SIGNATURE-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Counting Words In a String

2001-04-22 Thread Greg Donald


> I want to check a string and return the amount of words present 
> in it. These
> strings could be quite large, some higher than 100,000 
> characters. I realize
> I could explode the string on the whitespace and count the number 
> of values.
> However, I'm not sure this would be the most optimized way to do this,
> especially considering there will be some quite large strings passed. Any
> ideas on the most efficient to count the number of words in a 
> large string?

$string = "Here is a very long string";
$array = explode(" ", $string);
$count = sizeof($array);
echo $count;


destiney - (des-ti-ny) - n. 1. deity of all things "html", 2. common
internet addict, 3. lover of late 80's heavy metal music, 4. Activist
for the terminally un-elite; see also - cool guy, des, mr. php...

It's 4:00am, your web site is still up, why are you?
http://phplinks.org/ http://destiney.com/   
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] How to turn off warnings ???

2001-04-23 Thread Greg Donald


> I am a newbie to PHP and I am trying to get a number of scripts to work.
>
> Whenever I try to execute some code I receive 'warnings', that basically
> clutter up the screen. Since I am assuming that these are not fatal - is
> there  any way to turn them off?
>
> Any help would be appreciated.

The manual details the settings for the php.ini here:
http://www.php.net/manual/en/configuration.php

You may want to alter your error reporting level there, or at the top of
each script as needed.


destiney - (des-ti-ny) - n. 1. deity of all things "html", 2. common
internet addict, 3. lover of late 80's heavy metal music, 4. Activist
for the terminally un-elite; see also - cool guy, des, mr. php...

It's 4:00am, your web site is still up, why are you?
http://phplinks.org/ http://destiney.com/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Sessions that last for ever

2002-02-16 Thread Greg Donald

> But very many commercial sites, including Apple and Amazon to name two,
> do exactly this.  When you re-enter the site they 'remember' who you are
> using a cookie.  In my case, I'm building a multi-player strategy game
> and while I want the players to go through an initial briefing the first
> time they ever join the game, thereafter they should be able to get
> straight into the game if they are still using the same PC.  But as I
> said, the specifics of my use aren't so important - lots of sites leave
> permanent cookies around and the results don't seem to be catastrophic.
>
> The question is still: how to do it?

If each user has a unique user id, then make a table called seen_briefing:

create table seen_briefing (
  id int(11) unsigned not null default '0',
  primary key (id)
)

Make an entry once a user has seen whatever they need to. Then, on their
next login, do a join against the seen_briefing table, check for an entry...


--
Greg Donald


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




Re: [PHP] PHP Help Requested

2002-02-16 Thread Greg Donald

> I have a template stored in a database which contains variables.  Then,
> in a separate file, I have the variables set, and I call the template and
run
> it through eval().  Unfortunately, it only is parsing a few of them.
Could
> somebody take a look and give me some input?

Here's what my template table looks like:

CREATE TABLE templates (
  id tinyint(4) unsigned NOT NULL auto_increment,
  name varchar(16) NOT NULL default '',
  template text NOT NULL,
  PRIMARY KEY  (id),
  UNIQUE KEY name (name)
)

Then here is my template function that preps the data for use with eval():

function template($name, $set="main"){
global $tb_templates;
$sql = "
 select
  *
 from
  $tb_templates
 where
  name = '$name'
";
if($query = sql_query($sql)){
 if(sql_num_rows($query)==1){
  $array = sql_fetch_array($query);
  $template = str_replace("\\'","'",addslashes($array["template"]));
 } else {
  $template = $name . " template not found.";
 }
}
return $template;
}

Then here is how to use eval() properly:

$template_name = template("template_name");
eval("\$template_name = \"$template_name\";");

This will parse all your $vars you store in the templates.



Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/





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




Re: [PHP] Text editor for linux

2002-02-16 Thread Greg Donald

> Anyone know of a good text editor for linux, WITH syntax highlighting for
> php/html + other languages?

Vim - http://www.vim.org/

If you use X, then use gvim.

 
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/



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




Re: [PHP] Running php from shell - passing parameters

2002-02-17 Thread Greg Donald

> I have to run php script from Linux shell.
>
> I have no trouble except with passing the parameters.
> What is the right sintax to pass them to the script?
>
> I would like to do something like this:
> /usr/local/bin/php ./test.php param=value


What you want is $argc and $argv as described in the predefined variables
documentation:

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

----
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/



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




Re: [PHP] session password problems.

2002-02-17 Thread Greg Donald

> I have a php user authorise script.
>
> I have 2 fields in a mysql database. user_name and user_password. Password
> is encrypted with the mysql password('$password') function.
>
> This is my PHP authorise section of the script.
>
> $sql_authorisation = "SELECT * FROM account_details WHERE
> account_name='$login_username' AND
> account_password=PASSWORD('$login_password');
> $sql_authorisation_result = mysql_query($sql_authorisation);
>
> if (!$sql_authorisation_result) {
> error("A Database Error Occurred while trying to authorise login
details");
> }
>
> if (mysql_num_rows($sql_authorisation_result) == 0) {
> session_unregister("login_username");
> session_unregister("login_password");
> ?>
>
> 
> 
>  Access Denied 
> 
> 
>  Access Denied 
>  Your user ID and Password could not be verified. This could be an
> incorrect username or password, or you are not a registered user on this
> site. Try logging in again checking your details, or enter the signup
> process to join us
> 
> 
> 
> exit;
> }
>
> ?>
>
> This script does NOT work.
>
> However if I change the sql function $sql_authorisation to
>
> $sql_authorisation = "SELECT * FROM account_details WHERE
> account_name='$login_username' );
>
> so that is only selects the username - it works. there for there is a
> problem with me selecting and comparing the password'd user_password.
>
> Any suggestions.

You have to use the query with mysql_num_rows(), not the result of the
query, try:

if (mysql_num_rows($sql_authorisation) == 0) {

And it woudl be better to test for a single row, not the fact that no rows
returned.  I would use:

if (mysql_num_rows($sql_authorisation) == 1) {
  $user_array = mysql_fetch_array($sql_authorisation_result);
  $login_username = $user_array[account_name];
  session_register("login_username");
}



Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/




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




Re: [PHP] get_browser();

2002-02-18 Thread Greg Donald

> Ultimately, I'm trying to figure out how I can determine if the
> user is using NS 4.x or not...

Use this to identify Netscape 4.x:

if(strstr($HTTP_USER_AGENT,"Mozilla/4") &&
!strstr($HTTP_USER_AGENT,"MSIE")){
// is Netscape 4
} else {
// is something else
}


--------
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/



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




Re: [PHP] Logging Users In - What is the Best Way

2002-02-18 Thread Greg Donald

> Okay Gents and Ladies,
>
> I am looking for more information on how best to do this.
>
> I have a MyQSL back end.
> It houses a users user_name and password.
>
> I have a secure area of the site that I only want members to view.
>
> The way I have it now is that the user logs in.
> If user_name and password match cookies are set.
>
> Each page in the secure are checks for a variable in the cookie. If set
the
> user can view the page, if not set the page redirects back to the login
page.
>
> Now first question is - how secure is this?

Cookies are pretty secure.  I wouldn't store credit card numbers in them,
but for what you described they sound fine.

> Second question - what is a better more secure way to handle this. Then
> most importantly where do I get information on how to go about doing that?
> I know nothing about sessions and would need some good links for that
arena.

Sessions are basically just server side cookies, but you can do neat stuff
like store them in a db such MySQL.  The best place to learn about PHP
sessions is by reading the manual and writting some code:
http://www.php.net/manual/en/ref.session.php

> Also I do not know much of anything about Object Oriented Programming.

Me neither :)

> Thanks for the feedback.

No problem...

----
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/




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




Re: [PHP] get_browser();

2002-02-18 Thread Greg Donald

> > Use this to identify Netscape 4.x:
> >
> > if(strstr($HTTP_USER_AGENT,"Mozilla/4") &&
> > !strstr($HTTP_USER_AGENT,"MSIE")){
> > // is Netscape 4
> > } else {
> > // is something else
> > }
> >
>
> Is that going to catch the Mozilla spoofers, like webtv and opera?

Err, no...  if they are being spoofed then why would it?

Open a phpinfo() page in each of the browsers you wish to correctly
identify, then you can see what user agent you need to search for to do
whatever with...  :)


Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/



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




Re: [PHP] Avoid the session mechanism?

2002-02-18 Thread Greg Donald

> Found this article and need the experts to consult on the statement "avoid
> the session mechanism".  Is this a true problem?  And what should we do if
> we cannot have a dedicated server to ourselves?
>
> http://www.dwheeler.com/secure-programs/Secure-Programs-HOWTO/php.html
>
>
> Avoid the session mechanism. The ``session'' mechanism is handy for
storing
> persistent data, but its current implementation has many problems. First,
by
> default sessions store information in temporary files - so if you're on a
> multi-hosted system, you open yourself up to many attacks and revelations.
> Even those who aren't currently multi-hosted may find themselves
> multi-hosted later! You can "tie" this information into a database instead
> of the filesystem, but if others on a multi-hosted database can access
that
> database with the same permissions, the problem is the same. There are
also
> ambiguities if you're not careful (``is this the session value or an
> attacker's value''?) and this is another case where an attacker can force
a
> file or key to reside on the server with content of their choosing - a
> dangerous situation - and the attacker can even control to some extent the
> name of the file or key where this data will be placed.

The thing to do would be to store the sessions in a more private place such
as in a MySQL database.  Here's what I use to handle sessions

 UNIX_TIMESTAMP()
 ";
 $result = sql_query($query);
 if($record = mysql_fetch_row($result)){
  return $record[0];
 } else {
  return false;
 }
}
function sess_write($key, $val){
 global $sdbh, $dbname, $tb_sessions, $expire;
 $value = addslashes($val);
 $query = "
  replace into
   $tb_sessions
  values (
   '$key',
   '$value',
   UNIX_TIMESTAMP() + $expire
  )
 ";
 $result = sql_query($query);
 echo mysql_error();
 return $result;
}
function sess_destroy($key){
 global $sdbh, $dbname, $tb_sessions;
 $query = "
  delete from
   $tb_sessions
  where
   id = '$key'
 ";
 $result = sql_query($query);
 return $result;
}
function sess_gc($maxlifetime){
 global $sdbh, $dbname, $tb_sessions;
 $query = "
  delete from
   $tb_sessions
  where
   expire < UNIX_TIMESTAMP()
 ";
 $result = sql_query($query);
 return mysql_affected_rows($sdbh);
}
session_set_save_handler("sess_open","sess_close","sess_read","sess_write","
sess_destroy","sess_gc");
session_start();
$sn = session_name();
$sid = session_id();
?>

The sessions table should look like:

CREATE TABLE sessions (
  id varchar(32) NOT NULL default '',
  data text NOT NULL,
  expire int(11) unsigned NOT NULL default '0',
  PRIMARY KEY  (id)
)


Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/



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




Re: [PHP] Sendmail and setting From

2002-02-18 Thread Greg Donald

> I have RH 7.2 with Apache and PHP.  The mail() function in PHP worked
> out of the box!! Fantastic! The setting in the php.ini is being over
> written with Apache.
> 
> Where can I change the setting?

What setting is being overwritten by apache?  the mta setting?

On my RH 7.2 box, my php.ini is in /etc.  That's where you change the mta.

Or do you mean the ServerAdmin email setting as defined in the httpd.conf?

-------- 
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/



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




Re: [PHP] PHP_SELF Undefined

2002-02-18 Thread Greg Donald

> When I execute the code below, why is PHP_SELF undefined? I will
appretiate
> any help on this. I can get its value by:
>  echo $_SERVER["PHP_SELF"];Thanks in advance! -Teresa

Is your PHP install >= version 4.1.0 ?

You can test with a call to phpinfo();

If your version is less than 4.1.0, try the global variable $PHP_SELF
instead.

--------
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/




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




Re: [PHP] "nullifying" php and html tags?

2002-02-18 Thread Greg Donald

> Hello. I just finished creating a simple input form in
> which the contents of a textarea get written to a file
> which in turn gets read by a particular page. is there
> anyway to "disable" any html or php tags that the user
> might have typed in? it seems pretty dangerous to
> allow a user to enter any amount of php programming at
> their will.
> something as simple as a function that strips all <'s
> and >'s would work just as well i would imagine.

Look at ereg_replace() and html_special_chars() in the fine manual:

http://www.php.net/manual/en/function.ereg-replace.php

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

---- 
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/



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




Re: [PHP] Sendmail and setting From

2002-02-19 Thread Greg Donald

> On careful reading of the php.ini file, I now realize that the settings
> for the "From" is for WIN32 *only*.  So, as a newbie to the world or
> Linux/Unix, I am not sure where I place the setting for the default
> "From".  I can add it as the fourth argument in the mail() function, but
> I would prefer not to have to put it into every message.
> 
> However, unless I do, my messages have "From: Apache".
> 
> Hopefully, I am making some sense..

Construct a proper From: header, then pass it to the mail() function.

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

---- 
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/



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




Re: [PHP] PHP binary file

2002-02-19 Thread Greg Donald

> Has anyone compiled php on linux and found the binary executable file?

I usually compile it and copy it to where I want it manually...

----
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/



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




Re: [PHP] Re: PHP Editors

2002-05-01 Thread Greg Donald


>> It's no BBEdit, but what can you do?

vim?  It's free and runs on every system I ever heard of.


-- 
---
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/
---



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




Re: [PHP] Anyone use frames and PHP solution?

2002-05-06 Thread Greg Donald

On Mon, 6 May 2002, Jeff Lewis wrote:

>I've looked through the archive and seen that people have attempted it but I
>am wondering if anyone has actually gone forward with using PHP and frames
>together.
>
>I ask as I am using a very simple frame interface.  Left side contains a
>menu system with all content etc on right.  I have a login box on the left
>but when pressing submit it logs in ok but in the menu.
>
>So wondering if anyone has managed to find a good solution for the two
>combined...

PHP has nothing to do with frames.  You can have a .php file as the frame 
source for any given frame, just like if it were an .htm or .html page.

-- 
-------
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/
---



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




Re: [PHP] Stupid Question

2002-02-28 Thread Greg Donald

> Yes, this is probably in the manual, but I can't find it.
>
> If I want to upgrade from 4.0.6 to 4.1.2, do I have to re-compile apache
as
> well?

No.  I just upgraded 3 machines this morning, and left Apache the same on
all of them.

----
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/



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




Re: [PHP] Stupid Question

2002-02-28 Thread Greg Donald

> I thought that you do have to recompile if you are running PHP as a
module,
> but not if you are running PHP as CGI.  I could be wrong.

No, you do not have to recompile apache.  I did this on all three of my
machines:

./configure --with-apxs=/usr/sbin/apxs --with-mysql
make
make install
/usr/sbin/apachectl stop
/usr/sbin/apachectl start


----
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/



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




Re: [PHP] PNG Lib

2002-02-28 Thread Greg Donald

> Does anyone know where the PNG library went?
> The manual points to cdrom.com/pub/png, but that does not exist anymore.

http://www.libpng.org/pub/png/

----
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/



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





Re: [PHP] Help with functions.

2002-02-28 Thread Greg Donald

> I need some help with functions. Does anyone know of a good place to learn
> about functions? Will someone be willing to teach me what I need to know
about
> functions in PHP? Thank you,

Here's a really simple example:

\n";

// build up some more html
$html .= "\$global_var + \$local_var + \$passed_var = " . $global_var +
$local_var + $passed_var . "\n";

// pass the $html back to the caller
return $html;
}

// call the function
echo function_name ($passed_var);

?>

Usually you wanna use funtions for code you intend to use multiple times.

--------
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/



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




Re: [PHP] PHP directing pages/frames to urls.

2002-03-02 Thread Greg Donald

On Sat, 2 Mar 2002, Matthew Darcy wrote:

>I asked the group for a suggestion of how to direct 2 frames to 2 different
>locations on the click of a link. A suggestion using javascript was sent
>back to me.
>
>I am looking for other options can anyone suggest anything.

That's how you do it, javascript.

-- 
---
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/
---



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




RE: [PHP] PHP directing pages/frames to urls.

2002-03-02 Thread Greg Donald

On Sat, 2 Mar 2002, Matthew Darcy wrote:

>I have the java script option, I was wondering if using java script was the
>only way to do this ?
>I am now guessing it is.

It's the only way I can think of.  You're wanting to manipulate client
side stuff, so you have to use a client side language.


-- 
-------
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/
---



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




Re: [PHP] PHP Help

2002-03-02 Thread Greg Donald

On Sat, 2 Mar 2002, Josiah Wallingford wrote:

>I do not know very much about MySql or PHP but need to build a pretty
>complex database and script. I need a program like (I hate to say this)
>Front Page or UltraDev that will allow me to do it visually. I am on a
>Mac but can run the software on a PC. I hate Front Page so I hope nobody
>says that. Anybody know of anything like that? I have the whole project
>in my head and can explain it in detail if I need to. If this program is
>written in php that would be awsome!
>Thanks.

Are you looking to hire someone?

PHP is a scripting language, and as such you'll have a hard time finding a
gui editor that can do "everything" you need done.  Everytime I see or
hear about a new "PHP" editor, I go check it out.  And in every case
so far, after a few hours or less, I find myself uninstalling it and going
back to using vim and editplus.

Learn the code or hire someone, not much way around it else.

-- 
-------
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/
---



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




Re: [PHP] fopen(FTP....)

2002-03-02 Thread Greg Donald

On Sat, 2 Mar 2002, Gonzalo wrote:

>A very basic thing.. I'm trying to success with an instruction
>
>fopen (FTP://$PHP_AUTH_USER:$PHP_AUTH_PW@localhost$filename, "r")
>
>being $php_aut_user = [EMAIL PROTECTED] because of the site administrator settings.
>
>I'm having problems because I can't open any file. I allways get the message "No such 
>file or directory in "
>Someone told me to conect to the ftp site with site#site.xxx instead of [EMAIL PROTECTED] 
>but it doesn't work.
>
>¿Could anyone help me?

Does it work when you try with actual values instead of posted variables?

-- 
---
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/
---



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




Re: [PHP] fopen

2002-03-02 Thread Greg Donald

On Sat, 2 Mar 2002, Craig Westerman wrote:

>How can I use fopen to retrieve just one html table out of a whole web page.
>
>I need to extract just this table (shown below) from this web page:
>http://quotes.nasdaq.com/quote.dll?page=multi&mode=stock&symbol=drooy

fopen() will pull the page, yes.  But then you will have to parse through
it and get just the part you want, or get rid of the parts you don't want.
 You will need regular expressions and probably some string functions:

http://www.php.net/manual/en/ref.regex.php
http://www.php.net/manual/en/ref.strings.php

-- 
-------
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/
---


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




Re: [PHP] Checking how many users are logged in?

2002-03-02 Thread Greg Donald

On Sat, 2 Mar 2002, Leif K-Brooks wrote:

>I have a site with logins, etc.  I was wondering if there's any way to see
>how many users are logged in.  I know I could change a database and add one
>to a number when a user logs in, and subtract one when they log off, but
>what if they just go to another site or close their browser?

I use database managed sessions and count the number of "active"
sessions, like how many sessions have had activity in the last 5 minutes
or so.

You can get this code out of phplinks if you want, from
http://phplinks.org/.;

-- 
-------
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/
---



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




Re: [PHP] Returning error code from a function

2002-03-02 Thread Greg Donald

On Sat, 2 Mar 2002, Anas Mughal wrote:

>I am wondering if someone could shed some light on
>this aspect of PHP. It might be something obvious, but
>I am not able to figure it out.
>
>I have a function that returns a dynamically generated
>HTML string. However, I need a way to let the caller
>know if that function has failed. One way I thought
>of, is to have an empty return:
>
>  return;
>
>hoping that I could check for isset(). However, isset
>reports "1". (In the C world, I could easily check for
>NULL.)
>Is there a way in PHP to return a failure flag back to
>the caller? (Of course, I could use an argument as a
>success flag. But, I am wondering if there is a way to
>do it in the return variable.)

i would use something like

if(strlen($get_html())>0)
//do something
else
// do nothing


-- 
-------
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/
---



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




Re: [PHP] Apache & PHPMyAdmin

2002-03-03 Thread Greg Donald

On Sun, 3 Mar 2002, jtjohnston wrote:

>No one seems to be home at my favourite apache newsgroup :) so I'll ask
>here.
>I'm trying to reconfigure my PHPMyAdmin.
>
>What do I add to my conf file so as in http://phpmyadmin.somehere.com/
>points
>to a specific directory on my (windows) drive?
>
>For example, how would I point http://www.somehere.com// to a
>different directory than http://somehere.com/ , or
>http://123.somehere.com// to a different directory than
>http://456.somehere.com/ ?

This has nothing to do with phpMyAdmin or PHP.  This is a DNS issue.  What
you want is a canonical domain name, some folks refer to them as 'C' names
also.  You will need to request this addition with your isp.  Also, a new
virtual host will need to be added to Apache's config file.

-- 
-------
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/
---



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




Re: [PHP] header generation problem

2002-03-03 Thread Greg Donald

On Sun, 3 Mar 2002, Jon Feldhammer wrote:

>I'm trying to create a single dynamic header for a wide range of web
>pages which I'll just include as I need it.  There are a few things that
>change per web page in the header, but I've settled all the issues
>except a good way of how to modify a single image that changes based on
>the web page being displayed.
>
>For example:
>I'm displaying index.php, which includes 'header.php', the variable
>$wpid indicates that the current web page is index.php.  Now index.php
>needs to display: (changing index_off.gif to index_on.gif)
>index_on.gif anotherpage_off.gif yetanotherpage_off.gif
>
>(the tricky part is that each image will change to on depending on what
>page is being displayed)
>
>I really haven't come up with an adequate solution.  Ideas?  Thanks.

I usually program dynamic image names when I encounter this.




-- 
---
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/
---



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




Re: [PHP] Sessions Help

2002-03-03 Thread Greg Donald

On Sun, 3 Mar 2002, Ramesh Nagendra Pillai wrote:

>I am very new to PHP develope Can any one please help
>me to use session variables.
>I am able to register an variable.
>My probelm is how to get the values of that registered
>variable in the successive pages?

You probably need to pass the session_name() and session_id() in the url,
or if you're submitting a form you can send them ahead as hidden
variables:

Make your links like this:

click
here

Or your hidden form fields like this:



Also, there is a specific compile time option that can influence if
this is automatic or not, --enable-trans-sid, have a look at:

http://www.php.net/manual/en/ref.session.php
http://www.php.net/manual/en/install.configure.php


-- 
---
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/
---



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




Re: [PHP] live Counter

2002-03-04 Thread Greg Donald

On Mon, 4 Mar 2002, olev rumm wrote:

>Hello
>How can I monitor how many visitors are currently on line, with out
>refreshing the frame - like a live monitor.
>Olev

PHP is a server side scripting language, once it leaves the server it is
static text, usually html and other stuff. To have something dynamic like
you described, you would need to incorporate something with dynamic client
side capabilities, something like javascript, or java.

-- 
---
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/
---



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




Re: [PHP] form variables

2002-03-04 Thread Greg Donald

On Mon, 4 Mar 2002, Craig Westerman wrote:

>  
>
>
>
>
>  
>
>
>The above form passes $quote to the page quotestest.php
>How can I also pass the $quote to the URL so that the page with variable can
>be bookmarked?
>
>Do I have to modify both pages or just the input form?




-- 
-------
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/
---



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




Re: [PHP] phpMyAdmin Change Root pwd ... Now no access

2002-03-11 Thread Greg Donald

On Mon, 11 Mar 2002, Daniel Negron/KBE wrote:

>OK, here its goes.  I learned of this neat little app "phpMyadmin"  added a
>password to root and now I get no access.
>checked the my.ini and php.ini for possible problems there.  they are set
>with passwords to the root.  both .ini's
>
>What am I missing here...should I juyst remove the password from "root" ?

Edit config.inc.php, line 49-ish, change the root user's password from
null to whatever..

-- 
---
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/
---



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




Re: [PHP] WHOIS in PHP

2002-03-18 Thread Greg Donald

On Mon, 18 Mar 2002, Brian wrote:

>Hi:
>Does anyone out there know how to execute a WHOIS query from within PHP?

quick and dirty:

#!/usr/bin/php -q




-- 
---
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/
---



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




Re: [PHP] web spider?

2002-04-15 Thread Greg Donald

On Mon, 15 Apr 2002, Ryan Govostes wrote:

>i was wondering if it would be possible to make a web spider in PHP.
>they work by download a website, then following all the links on the
>website to other pages, and then following the links on that page...
>
>is this possible in PHP without a whole lot of work? i just want to keep
>a counter of how many links (not e-mail addresses or file downloads) it
>finds. if someone has the time, could you write up a quick recursive
>script that i could use as a basis of my project?

Well, I love PHP, but this sounds more like a job for C/C++.  The reason
being is the socket support in C/C++ is way better than that found in PHP.
Harder to code mind you, but better in the end.

Also, you might want to check out some exisiting applications that already
do this sort of thing, there's no need in re-inventing the wheel.  I use
htdig and it works swell for small projects where you need to index a
small to medium sized website for later searching.


-- 
-------
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/
---



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




Re: [PHP] fgets and eval

2001-12-18 Thread Greg Donald


> Okay here is the situation. I am reading a file using fgets up until I hit
a certain delimiter within the text. No problem there. This text file may or
may not
> contain php in the format . So I now have two variables $header
and $footer which may or may not contain some php within them. I need to
echo
> the variables at the top and bottom of other files but need any php that
may be in there to execute.
>
>  I tried echo(eval($header))
>
> and I also tried
>
> $header = addslashes($header);
> eval("\$header = \"$header\";");
> $header= stripslashes($header);
> echo($header);
>
> The first produces and error, the second produces no error however only
variables evaluate while actual commands, such as echo just get written into
the
> code.
>
> Any idea  what I may be doing wrong here?

Try this, it's from a template parsing function I wrote:

$header = str_replace("\\'","'",addslashes($header));
eval("\$header = \"$header\";");

Greg



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] outputting db content

2001-12-19 Thread Greg Donald


> Does anyone have a quick example of how you would show X numbers of
database records at a time from a query?  (you know, list 25 of 400 records
with  next/previous navigation)...



Feel free to rip the navigation out of phpLinks and use it:
http://phplinks.org/

Have a look in functions.php, I think I named the function like 'nav' or
something.



Greg


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Size Limit for PHP scripts

2001-03-30 Thread Greg Donald

You might check to see if there is some kind of endless loop, it's not like
PHP to just die without a reason.  Looks like you got plenty of hardware
there, so it must be your code... ;)

> -Original Message-
> From: Wally Hartshorn [mailto:[EMAIL PROTECTED]]
> Sent: Friday, March 30, 2001 1:53 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Size Limit for PHP scripts
>
>
> Is there a limit to the size of PHP scripts? I'm having a problem
> in which scriptA.php is including() scriptB.php, which then
> requires() scriptC.php. The result is that PHP itself dies. If I
> remove some code from scriptA.php to reduce the size of the
> script, it works fine. (The code that I'm removing wasn't being
> executed during this testing, so the code itself wasn't the problem.)
>
> If there is some limit, is there a parameter I can set to change it?
>
> Here's my setup:
>   PHP 4.0.4 pl1
>   iPlanet 4.1 sp5
>   Solaris 2.7
>   Sun ES 250, 1GB RAM
>
> Thanks,
> Wally Hartshorn
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] No-refresh

2001-03-30 Thread Greg Donald


> Does anyone know of a way to stop the user from refreshing a page several
> times.
> 
> i.e if I add a value to a database using a form and PHP, I don't want the
> user to be able to simply press refresh and add the value to the database
> again.
> 
> Please help,
> Dvaid.

Many methods exist, cookies and sessions come to mind first...

Greg

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] More questions about installing.....

2001-03-30 Thread Greg Donald



> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Jon Jacob
> Sent: Friday, March 30, 2001 9:05 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] More questions about installing.
>
>
> Sorry for the newbie level questions, but I am having more weird install
> problems.  Its just been so long since I did all this installing crap I
> guess I forgot a couple of things..
>
> I have recompiled Apache and PHP according to the instructions in the
> INSTALL doc, but when I run it now the document shows the source.  What
> did I forget?

You forgot to set that particular file extension in your httpd.conf to be
parsed as PHP...

Here's mine:
AddType application/x-httpd-php .php4 .php3 .phtml .php .inc

Greg


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] More questions about installing.....

2001-03-30 Thread Greg Donald


> Ah, but there my friend is the rub.  I did put that in.
> 
> .And, all the conditions for the modules are there and 
> specifically the
> module for php4 is present and the conditional is there.  I tried 
> putting the
> line above in the wide open (outside a conditional) but that made narry a
> difference.

Is the module loading?

do a httpd -l


destiney - (des-ti-ny) - n. 1. deity of all things "html", 2. common
internet addict, 3. lover of late 80's heavy metal music, 4. Activist
for the terminally un-elite; see also - cool guy, des, mr. php...

It's 4:00am, your web site is still up, why are you?
http://phplinks.org/ http://destiney.com/   
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] phpLinks 2.0b Released

2001-04-01 Thread Greg Donald

phpLinks v2.0b is released. - http://phplinks.org/

Changes - http://phplinks.org/changelog
  
Download - http://phplinks.org/?show=download
  
Please note, this is a beta release.

  
Regards,
Greg



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Search engine php/mysql

2001-06-20 Thread Greg Donald


Hello list,

I am coding a search engine that allow indexing and searching internet sites
based on php/mysql.

My problm is:

How can i index a given site, I mean:

input: URL, like http://www.blabla.com/
Output: meta, body content, description that will be stored in a tables.



Regular expressions and string functions:

http://php.net/manual/en/ref.regex.php

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

Greg


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] fgetc()

2001-06-22 Thread Greg Donald

Is it possible to read in binary data as the client side of a stream using
fgetc()?

In particular, is it possible to delimate string separation using \0 as a
delimiter? All attempts to recognize and or read the \0 character fails.

Thanks,
Greg


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] passing variables from - to frames

2001-06-26 Thread Greg Donald

> Hello, sorry this question here (it is not true PHP question), but I use
> some variables into PHP scripts and need
> pass these variables from one frame to another.
>
> I want pass variable values between frames, these definded via input
> hidden tags into form definition.
> I have first frame name=framea containing form name=forma
> then second frame name=frameb form name=formb
> I have forma input type=hidden name=vara value=valuea and want to pass
> this value to formb type=hidden name=varb
>
> I wrote little javascript into framea something like
> frameb.formb.varb.value = framea.forma.vara.value  but only got
> 'javascript error'. Java doesnt reckognizes frameb.formb.varb names at
> all. I tried also by creating  into frameb header
> but this also didnt work.
> Is there some other solution?


If you're using Apache, you can use $QUERY_STRING



destiney - (des-ti-ny) - n. 1. deity of all things "html", 2. common
internet addict, 3. lover of late 80's heavy metal music, 4. Activist
for the terminally un-elite; see also - cool guy, des, mr. php...

It's 4:00am, your web site is still up, why are you?
http://phplinks.org/ http://destiney.com/





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] phpLinks

2001-07-14 Thread Greg Donald

phpLinks 2.1 beta is released.

http://phplinks.org/


Thanks,
Greg


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Anybody using Miva or hosted at Hosting4All?

2001-07-15 Thread Greg Donald

> Is anybody on this list hosting an e-commerce site with Hosting4All?
> Or, has anybody had any experience with the "Miva Engine" which
> Hosting4All provide "free of charge" (i.e. as part of the
> subscription fee)?


I used Miva before.  It was slower than java...  It sucked. 


destiney - (des-ti-ny) - n. 1. deity of all things "html", 2. common
internet addict, 3. lover of late 80's heavy metal music, 4. Activist
for the terminally un-elite; see also - cool guy, des, mr. php...

It's 4:00am, your web site is still up, why are you?
http://phplinks.org/ http://destiney.com/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] fopen() issue

2001-07-19 Thread Greg Donald

Why would fopen() refuse to open this url with numbers in it:
http://www.555-1212.com/ ?

The same code has no issues with urls like http://www.yahoo.com/ or
http://slashdot.org/.

And it resolves ok on the same box:

+-(greg@bajor)
+-(~)> nslookup 555-1212.com
Server:  bajor
Address:  0.0.0.0

Non-authoritative answer:
Name:555-1212.com
Address:  209.10.239.243

I'm running PHP 4.06/Zend Optimizer v1.1.0/Apache 1.3.19/RH 7.1

Any ideas?  Thanks...


destiney - (des-ti-ny) - n. 1. deity of all things "html", 2. common
internet addict, 3. lover of late 80's heavy metal music, 4. Activist
for the terminally un-elite; see also - cool guy, des, mr. php...

It's 4:00am, your web site is still up, why are you?
http://phplinks.org/ http://destiney.com/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




  1   2   3   4   5   6   7   8   9   10   >