Fwd: [PHP] MySQL, MD5 and SHA1

2009-04-21 Thread Steve Holmes
Oops, meant to copy the list.

-- Forwarded message --
From: Steve Holmes sholme...@mac.com
Date: Tue, Apr 21, 2009 at 10:13 PM
Subject: Re: [PHP] MySQL, MD5 and SHA1
To: Per Jessen p...@computer.org




On Tue, Apr 21, 2009 at 1:35 PM, Per Jessen p...@computer.org wrote:

 Jan G.B. wrote:

  A web application that uses an external db server would be quite ...
  uhm... slow! Anyone did this, yet? ;)

 Certainly, and it's not slow.  It depends entirely on your connection to
 the public internet.



 --
 Per Jessen, Zürich (18.2°C)


Ditto. No problem at all for us.
Steve Holmes
Purdue University



-- 
Pride, like laudanum and other poisonous medicines, is beneficial in small,
though injurious in large, quantities. No man who is not pleased with
himself, even in a personal sense, can please others. -Frederick Saunders,
librarian and essayist (1807-1902)

Truth never damages a cause that is just. -Mohandas Karamchand Gandhi
(1869-1948)


Re: [PHP] /home/{user}/directory

2009-03-18 Thread Steve Holmes
On Tue, Mar 17, 2009 at 9:51 AM, Thiago H. Pojda thiago.po...@gmail.comwrote:

 On Tue, Mar 17, 2009 at 10:42 AM, George Larson
 george.g.lar...@gmail.comwrote:

  In my scripts, I usually define a boolean constant DEBUG.  True looks for
  local copies of includes and echoes queries as they're used.
 
  My question is:
 
  Is there any way for me to reflect the actual home folder of the person
  running the script?  So it will be /home/george/foo when I run it but,
  for
  another user, it would be /home/their-username/foo?
 

 Just checking, you're running PHP on CLI then, right?

 If it's running on normal apache setup the user would always be the user
 which apache is running.


 Thiago Henrique Pojda
 http://nerdnaweb.blogspot DOT com



Unless apache has suphp.Steve.


Re: [PHP] ltrim behavior.

2009-03-12 Thread Steve Holmes
On Thu, Mar 12, 2009 at 9:47 AM, tedd tedd.sperl...@gmail.com wrote:

 At 3:38 PM -0400 3/11/09, Robert Cummings wrote:


 Just because I'm a nice guy... :)


 Yeah, me too -- here are three routines I use for cutting the right, left
 and middle portions of strings. These were keyword routines I used in
 FutureBasic -- they seemed to make sense to me so I carried them into php.

 ?php

 // == returns the right-most number of characters from a string
 // $string = 123456789
 // right($string, 3) returns 123

 function right($string, $length)
{
$str = substr($string, -$length, $length);
return $str;
}

 // == returns the left-most number of characters from a string
 // $string = 123456789
 // left($string, 3) returns 789

 function left($string, $length)
{
$str = substr($string, 0, $length);
return $str;
}

 // == returns the middle number of characters from a string starting
 from the left
 // $string = 123456789
 // mid($string, 3, 4) returns 4567

 function mid($string, $left_start, $length)
{
$str = substr($string, $left_start, $length);
return $str;
}
 ?

 Cheers,

 tedd
 --
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com


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


Tedd,
Just because I'm a nit-picker, your comments are wrong. Exchange the right
and left comments and it's right.
Steve.


Re: [PHP] Reverse IP lookup

2009-02-16 Thread Steve Holmes
On Sun, Feb 15, 2009 at 9:17 PM, Andrew Ballard aball...@gmail.com wrote:

 On Sun, Feb 15, 2009 at 1:22 PM, דניאל דנון danondan...@gmail.com wrote:

  Hello,
 
  Is there anyway to get a list of sitess that are on a specific IP?
 
  I looked, But I couldn't find anything.
 
  I tried to make some with dns_get_record and gethostbyaddr, but couldn't
  make anything
 
  Thank
 
  Daniel
 

 You mean like this one?

 http://www.yougetsignal.com/tools/web-sites-on-web-server/

 I don't know how reliable or up-to-date it is.


 Andrew


From my test I can say it doesn't work. I put in our web server (which has a
couple of virtual hosts on it) and got 16 host names back most of which are
for completely different servers - all at purdue.edu, but not even in the
same department.

Steve.


Re: [PHP] Robert Cummings

2008-09-30 Thread Steve Holmes
On Tue, Sep 30, 2008 at 2:12 PM, Daniel Brown [EMAIL PROTECTED] wrote:

All:

What was pointed as a passing mention in one thread I thought was
 worth note in a thread of its own.  As quoted by Rob:

  BTW, while we're off topic... my wife delivered our third child (second
  boy) 3 minutes after midnight yesterday :)


Congratulations Rob and family! And many blessings as well.
Steve.Holmes
Purdue University


Re: [PHP] php not reading file properly

2008-08-20 Thread Steve Holmes
On Wed, Aug 20, 2008 at 3:15 PM, sean greenslade [EMAIL PROTECTED]wrote:

 I have this snippet of code that is supposed to read the apache access log
 and display it:
 ?php
$myFile = /var/log/httpd/access_log;
$fh = fopen($myFile, 'r');
$theData = fread($fh, filesize($myFile));
fclose($fh);
echo
This weeks apache log (clears every sunday morning):.
substr($theData,0,2000);
 ?
 For some reason, it displays the logs when I run the php file thru
 terminal:
 php -f /web/apache.php

 but not when I access it thru the web. when I browse to it, it just
 displays
 the static text (This weeks apache log (clears every sunday morning):),
 not the log text.

 Very confused,
 zootboy


Check permissions on the file for the user the web server is running under.
I.e. if the webserver is running as user Nobody, make sure the file can be
read by Nobody (you know what I mean).

Steve


[PHP] need pop-up in progress alert

2008-04-18 Thread Steve Holmes
Greetings, I'm relatively new to PHP and I've been lurking for a while on
the list, but now I need a pointer or two.
I have an application which has one function that does a lengthy process
(installing a piece of software) and I don't want the user to panic thinking
nothing is going on. So I want to put up a 'working' box or a progress bar.
I have no idea how to do that. I haven't dipped my toes into pear yet. I
don't even know how to install or use a pear module. If there is something
available that doesn't require pear knowledge so much the better, I guess,
but if this is the straw that gets me into pear, so be it.
So if someone could point me in the right direction I'd really appreciate
it.

Thanks,
Steve Holmes
Purdue University


Re: [PHP] need pop-up in progress alert

2008-04-18 Thread Steve Holmes
Thanks (to both). Ajax is yet another thing I don't know anything about.
:-). Time to do some studyin' up I guess.If there are any canned ajax
solutions, I'd like to hear about them.

Steve.


On Fri, Apr 18, 2008 at 11:04 AM, James Dempster [EMAIL PROTECTED] wrote:

 As a suggestion you could store a progress of the function in the session
 and make regular calls via ajax back to the server for the progress.

 --
 /James


 On Fri, Apr 18, 2008 at 3:42 PM, Steve Holmes [EMAIL PROTECTED] wrote:

  Greetings, I'm relatively new to PHP and I've been lurking for a while
  on
  the list, but now I need a pointer or two.
  I have an application which has one function that does a lengthy process
  (installing a piece of software) and I don't want the user to panic
  thinking
  nothing is going on. So I want to put up a 'working' box or a progress
  bar.
  I have no idea how to do that. I haven't dipped my toes into pear yet. I
  don't even know how to install or use a pear module. If there is
  something
  available that doesn't require pear knowledge so much the better, I
  guess,
  but if this is the straw that gets me into pear, so be it.
  So if someone could point me in the right direction I'd really
  appreciate
  it.
 
  Thanks,
  Steve Holmes
  Purdue University
 




-- 
There is no greater gift to an insecure leader that quite matches a vague
enemy who can be used to whip up fear and hatred among the population.
-Paul Rusesabagina, humanitarian (b. 1954)

Human beings are perhaps never more frightening than when they are
convinced beyond doubt that they are right. -Laurens van der Post, explorer
and writer (1906-1996)


Re: [PHP] need pop-up in progress alert

2008-04-18 Thread Steve Holmes
On Fri, Apr 18, 2008 at 11:39 AM, Eric Butera [EMAIL PROTECTED] wrote:

 On Fri, Apr 18, 2008 at 10:42 AM, Steve Holmes [EMAIL PROTECTED] wrote:
  Greetings, I'm relatively new to PHP and I've been lurking for a while
 on
   the list, but now I need a pointer or two.
   I have an application which has one function that does a lengthy
 process
   (installing a piece of software) and I don't want the user to panic
 thinking
   nothing is going on. So I want to put up a 'working' box or a progress
 bar.
   I have no idea how to do that. I haven't dipped my toes into pear yet.
 I
   don't even know how to install or use a pear module. If there is
 something
   available that doesn't require pear knowledge so much the better, I
 guess,
   but if this is the straw that gets me into pear, so be it.
   So if someone could point me in the right direction I'd really
 appreciate
   it.
 
   Thanks,
   Steve Holmes
   Purdue University
 

 It might be a better idea to have this installation happen via some
 other means such as a cron job that isn't influenced by the browser.
 Then just keep refreshing the page or doing an ajax poll until the job
 has returned success.  Internet connections get dropped, people hit
 refresh, or whatever and that shouldn't break what is going on (in an
 ideal world ;)).


Thanks for the suggestion, but I'm pretty far along in this project and the
idea is that the software install happens on demand. What we are trying to
do is get the student/faculty population (tens of thousands of users) to
keep their blog/bb/etc. software up to date by giving them a point and click
method of updating them (wordpress, phpBB, drupal, etc). We can't *force*
them to update, that's against policy, but they keep getting hacked and
don't know/care enough to bother doing the update.


 If you can't figure that out at least put in an ignore_user_abort to
 prevent the user from hitting stop and messing up the installation
 process.  Just make sure to create some way of knowing that an
 installation has been started and check a session value/flat file to
 see if the installation is still going in case the user does request
 the page again.  Once everything is done make sure your script unsets
 the session variable/flat file to know you can proceed to the next
 step.


Great suggestion. I will have to do this at a minimum.



 Good luck!



Thanks.Steve.


Re: [PHP] need pop-up in progress alert

2008-04-18 Thread Steve Holmes
On Fri, Apr 18, 2008 at 12:43 PM, bruce [EMAIL PROTECTED] wrote:



 what did a google search on php/ajax progress bar return?

 peace


Once I know kind of what to search for (thanks for that) I found some very
interesting things. In particular I like:

http://www.bram.us/projects/js_bramus/jsprogressbarhandler/

I know this isn't a pop-up but I can make it work. As long as the user knows
something is happening (and I protect them from their own stupidity :-) I'll
be fine.

Thanks for all the quick help!
Steve


Re: [PHP] Database abstraction?

2008-04-16 Thread Steve Holmes
Assuming a recent release of MySQL:
open the schema information_schema then

select TABLE_NAME, COLUMN_NAME from COLUMNS where TABLE_NAME = '$table';

Steve

On Wed, Apr 16, 2008 at 10:55 AM, Richard Heyes [EMAIL PROTECTED]
wrote:

 I'm back with yet another question But getting closer to sounding like
  I know what I'm talking about and that's all thanks to all of you. A free
  beer (Or beverage of choice)* for everyone who has helped me over the years!
 

 I would prefer hard (or soft) cash... :-)

  Here's my question... I have a program, where I want to take out the
  field names in a database table and display them... In other words instead
  of writing:
  $Query =SELECT First, Last, Middle, Add1 FROM mytable order by $order;
 
  I want to write something more like:
  $Query =SELECT $FIELDNAMES FROM mytable order by $order;
 
  So I need to know how to get the field names from the database so that I
  can populate $FIELDNAMES. I played a little bit and it looks like I might be
  able to get what I want by doing 2 queries...
 
  $QueryFieldNames = DESCRIBE $table;
 
  And then some sort of a foreach or maybe a while to populate
  $FIELDNAMES? Maybe an array so I could do $FIELDNAMES['First'] if I needed
  to later.
 
  then I can use my SELECT $FIELDNAMES FROM $table order by $order query
  to do my query...
 
  Am I on the right path? Way off base? Not even in the ball park?
 
  Hopefully it makes sense... Cause it's right on the edge of my knowledge
  so I'm not totally sure how to ask it right yet :)
 

 You could do it adequately with a DESCRIBE, but there might be something
 that's better. I would suggest looking through the code of my TableEditor:

 http://www.phpguru.org/static/TableEditor.html

 --
 Richard Heyes
 Employ me:
 http://www.phpguru.org/cv


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




-- 
There is no greater gift to an insecure leader that quite matches a vague
enemy who can be used to whip up fear and hatred among the population.
-Paul Rusesabagina, humanitarian (b. 1954)

Human beings are perhaps never more frightening than when they are
convinced beyond doubt that they are right. -Laurens van der Post, explorer
and writer (1906-1996)


Re: [PHP] Quarters

2008-04-11 Thread Steve Holmes
Works great in Safari. Except I can't win :-).Steve

On Fri, Apr 11, 2008 at 9:49 AM, tedd [EMAIL PROTECTED] wrote:

 Hi gang:

 Check out my new game:

 http://webbytedd.com/quarters/

 What do you think?

 Cheers,

 tedd

 PS: I originally wrote the game for the Mac over eight years ago.
 --
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com

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




-- 
There is no greater gift to an insecure leader that quite matches a vague
enemy who can be used to whip up fear and hatred among the population.
-Paul Rusesabagina, humanitarian (b. 1954)

Human beings are perhaps never more frightening than when they are
convinced beyond doubt that they are right. -Laurens van der Post, explorer
and writer (1906-1996)