Re: [PHP] Array question

2007-02-27 Thread Gerry D

Mike,

See entire function under topic Array question - maybe UTF?...

I am trying to change accented characters to their equivalent without accents.

And yes, the arrays look fine after var_dump()...

Gerry

On 2/27/07, Ford, Mike [EMAIL PROTECTED] wrote:

On 27 February 2007 04:23, Gerry D wrote:

 I have a question on how to retrieve the value that corresponds to a
 key in an array.

 $fruit = array('a' = 'apple', 'b' = 'banana', 'c' = 'cranberry');

   $key = array_search($c, $fruit);
   if ( $key === FALSE )
   $n = $c;
   else
   {
   $n = $fruit[$key];  // how to get the value???
   }

 the array_search works ok, but how do I get the value?

 all I get back is 'a' or 'b', not 'apple' or 'banana'...

Please show a little more code, as it looks to me as though this should work 
how you think it should.

Specifically:  how do we know what is in $c? how do you know the array_search 
works? how do you know $n is only getting 'a', 'b', or 'c'?  (Hint: var_dump() 
is your friend!)


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



[PHP] Array question

2007-02-26 Thread Gerry D

I have a question on how to retrieve the value that corresponds to a
key in an array.

$fruit = array('a' = 'apple', 'b' = 'banana', 'c' = 'cranberry');

$key = array_search($c, $fruit);
if ( $key === FALSE )
$n = $c;
else
{
$n = $fruit[$key];  // how to get the value???
}

the array_search works ok, but how do I get the value?

all I get back is 'a' or 'b', not 'apple' or 'banana'...

TIA

Gerry

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



Re: [PHP] JPEG info needed

2007-01-25 Thread Gerry Danen

I *have* tried, Richard. It is not returning the state of the file.
Files that Irfanview recognizes are prograssive, your example code
does not.

Looking at C code in gd-2.0.33/gd_jpeg.c downloaded from
http://www.boutell.com/gd/ there is a comment:

 /* REMOVED by TBB 2/12/01. This field of the structure is
documented as private, and sure enough it's gone in the
latest libjpeg, replaced by something else. Unfortunately
there is still no right way to find out if the file was
progressive or not; just declare your intent before you
write one by calling gdImageInterlace(im, 1) yourself.
After all, we're not really supposed to rework JPEGs and
write them out again anyway. Lossy compression, remember? */

The docs at http://www.boutell.com/gd/manual2.0.33.html#gdImageInterlace say

gdImageInterlace is used to determine whether an image should be
stored in a linear fashion, in which lines will appear on the display
from first to last, or in an interlaced fashion, in which the image
will fade in over several passes. By default, images are not
interlaced. (When writing JPEG images, interlacing implies generating
progressive JPEG files, which are represented as a series of scans of
increasing quality. Noninterlaced gd images result in regular
[sequential] JPEG data streams.)

A nonzero value for the interlace argument turns on interlace; a zero
value turns it off. Note that interlace has no effect on other
functions, and has no meaning unless you save the image in PNG or JPEG
format; the gd and xbm formats do not support interlace.

When a PNG is loaded with gdImageCreateFromPng or a JPEG is loaded
with gdImageCreateFromJpeg, interlace will be set according to the
setting in the PNG or JPEG file.
--

To me that means the code authors cannot determine what the state of
the file is, and are not returning a state they cannot determine.

Gerry




On 1/25/07, Richard Lynch [EMAIL PROTECTED] wrote:

Re-read the docs more carefully.

The second arg is optional, and it returns the PRIOR state of the
interlaced-ness (or progressive-ness for a JPEG).

Standard computer-science function trick to return prior state when
altering state, and to simply return state if the second arg is not
passed in.

So if you do not pass in a second arg, you should be getting the state
of the JPEG.

Try it.

On Wed, January 24, 2007 7:20 pm, Gerry Danen wrote:
 Richard,

 imageinterlace() turns the interlace bit on or off. It only returns 1
 if you set it to 1 as the second parameter...



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



Re: [PHP] JPEG info needed

2007-01-24 Thread Gerry Danen

Richard,

imageinterlace() turns the interlace bit on or off. It only returns 1
if you set it to 1 as the second parameter...

Thanks

Gerry

On 1/24/07, Richard Lynch [EMAIL PROTECTED] wrote:

On Wed, January 24, 2007 12:08 am, Gerry Danen wrote:
 One other possibility is to see what happens if you do
 imagefromjpeg()
 on a progressive JPEG -- There amy be functions in GD that will tell
 you if the JPEG is progressive, once you have sucked it into PHP...

 Any idea which ones to look at?

No, but a quick search on php.net for JPEG progress with online
documentation from the popup yeilded:

http://us3.php.net/manual/en/function.imageinterlace.php
If the interlace bit is set and the image is used as a JPEG image,
the image is created as a progressive JPEG.

This function returns whether the interlace bit is set for the image. 

Presumably, then, this would work:

?php
  $filename = '/full/path/to/filename.jpg';
  $jpeg = imagecreatefromjpeg($filename);
  $progressive = imageinterlace($jpeg);
  if ($progressive) echo $filename is progressive.\n;
  else echo $filename is NOT progressive.\n;
?



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



[PHP] JPEG info needed

2007-01-22 Thread Gerry D

I need PHP to find out if a jpeg file uses progressive encoding. None
of the standard exif or image functions seem to be able to tell me
that. (please correct me if I'm wrong)

Can anybody help me?

TIA

Gerry

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



Re: [PHP] Shopping cart

2006-08-21 Thread Gerry D

So if I understand you gentlemen correctly, these pre-builds serve as
examples how NOT to do it?

Gerry

On 8/20/06, Larry Garfield [EMAIL PROTECTED] wrote:

On Sunday 20 August 2006 20:17, Gerry D wrote:
 On 8/19/06, Larry Garfield [EMAIL PROTECTED] wrote:
  OSCommerce is crap.  Don't bother.

 Why do you say that, Larry? I may want to get into an app like that
 because I think one of my clients is ready for it. What are the cons,
 and what are my options? What are Drupal's limitations?

I tried using it for a client last summer, because it was available free on
the client's web host.  It is extremely rigid.  If you want a program that
works the way they want and looks kinda like Buy.com with a table-based
layout in 3 columns with certain visual effects, it's fine.  If you want to
change or customize anything, good luck.  Nearly everything is hard coded
with HTML and presentation PHP and business logic PHP all mixed in together.
With a table based layout.

Ugh.

As for using pre-build vs. rolling your own, the main reason I favor
ready-made is the bank hookups.  Anytime financial stuff is involved, I'd
rather use something someone else already debugged than roll my own.


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



Re: [PHP] Shopping cart

2006-08-20 Thread Gerry D

On 8/19/06, Larry Garfield [EMAIL PROTECTED] wrote:

OSCommerce is crap.  Don't bother.



Why do you say that, Larry? I may want to get into an app like that
because I think one of my clients is ready for it. What are the cons,
and what are my options? What are Drupal's limitations?

TIA

Gerry

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



Re: [PHP] How to run one php app from another?

2006-08-13 Thread Gerry D

I don't know if you solved this already, but I use it to redirect to
different pages depending on whther the user is logged in or not.

Something like header(location:/page/?p=login); works fine. You were
on the right track.

Gerry

On 6/15/06, tedd [EMAIL PROTECTED] wrote:

Hi gang:

This seems like so obvious a question, I am reluctant to ask.

In any event, I simply want my php application to run another, like so:

switch (option)
   {
   case a:
   run a.php;
   exit;
   break;

   case b:
   run b.php;
   exit;
   break;

   case c:
   run c.php;
   exit;
   break;
  }

I know that from within an application I can run another php application via a user click 
(.e., button), or from javascript event (onclick), or even from cron. But, what if you 
want to run another application from the results of a calculation inside your main 
application without a user trigger. How do you do that?

I have tried header(Location: http://www.example.com/;); ob_start(), 
ob_flush() and such, but I can't get anything to work.

Is there a way?

Thanks.

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




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



Re: [PHP] Re: How to run one php app from another? RECAP

2006-08-13 Thread Gerry D

On 6/16/06, tedd [EMAIL PROTECTED] wrote:

At 2:35 PM +0200 6/16/06, Barry wrote:
But once output is made. You can't remove it.

That isn't possible with PHP.

I think I get it now.

PHP does everything before the user see's anything. Any links (direct or via a 
form) are objects that the browser can act upon per the user through html or 
js, but not php. Interesting.


Perfectly doable in PHP. Just have the form action go to a new php
script and do your logic, then use header(location:...) to redirect.

Gerry

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



Re: [PHP] page redirecting

2006-08-13 Thread Gerry D

On 6/28/06, Richard Lynch [EMAIL PROTECTED] wrote:

On Wed, June 28, 2006 5:17 am, kristianto adi widiatmoko wrote:
 i need to redirecting page, it could be done by using header function
 like this

 header(Location : page2.php?var1=foo);

Then, the URL should be a full, complete URL, and not just a local
reference.


Sure you can use a local page, I do it all the time.


You could just use session_start() at the top of both pages, and slam
the data into $_SESSION, and then your Location: redirect would work


Yep.

Gerry

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



Re: [PHP] Preventing double-clicks

2006-08-13 Thread Gerry D

Jay,

I use a technique to prevent hitting the back button and
resubmitting data. I use a 2-script process, one with the form and
submit button (I set a session var here), and a second form (the
action script). The action script makes sure the session variable is
set, processes the info, then clears the session var. If the session
var is not set, an error is displayed.

Gerry

On 6/26/06, Jay Blanchard [EMAIL PROTECTED] wrote:

I am going to do some thinking (typing) out loud here because I need to
come up with a solution to double-clicking on a form button issue.

The steps are;

1. Fill out form
2. Click 'Submit'
3. Data gets stored (including unique data and time stamp data in this
casewhich should work out well)
If the process sees the unique data and a timestamp sometime within the
last minute it should ignore the subsequent attempt.
4. A reply is returned to the user based on the first click. The data
returned to the user would be different for each click, that is why this
is so important. The first data returned is the correct data.

My confusion is in this (as I have mentioned in the past couple of
weeks, most of the confusion is as a result of a lack of rest, which
leads to not thinking clearly, which leads to me feeling ignorant); upon
the second click, where I check to see if the data has been entered and
find that it has how do I get it to return the data back to the user. I
think I see it now..let's see.if I;

Select * from foo where data is what it is and time is within last
interval that I decide upon;

if(1 == mysql_num_rows(that query up there)){
   get that data for return to the user;
} else {
   Insert data, do calcs, return data back to user;
}

Does that look reasonable, or am I missing something?

Thanks for any insight!

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




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



Re: [PHP] Functions

2006-08-13 Thread Gerry D

On 6/30/06, Richard Lynch [EMAIL PROTECTED] wrote:


#2. Don't alter the case of the input data, if at all possible.
Accept what the user has given, and take it as it is.  You can make
your application not care about case, and you can format the case on
ouput (maybe even with fancy CSS stuff) but don't mess with their
input.


Why not clean up crappy input right at the source, Richard?

Gerry

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



Re: [PHP] Chicago PHP Conference

2006-08-12 Thread Gerry D

Richard,

Within the US that might be ok, but given latest developments, who
wants to fly into the US from elsewhere? I could drive from Canada if
I take 2 weeks vacation...

I don't want to be a show stopper, but I think you need to explain
what your target audience is re global travel, not just weather in
Chicago.

Having said that, I like your idea.

Gerry

On 8/12/06, Richard Lynch [EMAIL PROTECTED] wrote:

It may have started as a joke on PHP-General, but this just isn't
funny anymore.

I'm in the pre-planning phase of organizing a PHP Conference in Chicago.

Due to Chicago weather patterns, the ideal time would be Spring or
Autumn.

Given that cheap airfare generally requires significant advance
notice, I am pre-emptorily eliminating Autumn 2006 as a viable option.

If you are interested in attending please reply OFF-LIST with your
name, email, and some basic input for ideal time-frames in the FALL or
SPRING of 2007.

Suggested Topics would be great, and offers to be a Speaker by
well-known responders would also be MOST welcome.


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



Re: [PHP] Comment form spammer

2006-08-12 Thread Gerry D

My implementation of captcha eliminated chinese spam.

See http://www.lilyregister.com/page/?p=contact

Gerry

On 8/9/06, Micky Hulse [EMAIL PROTECTED] wrote:

Hi,

Recently, a client of mine was getting a ton of spam email from a site
called hotbox.com. I updated her form to one with more spam security,
but she is still receiving junk email.

Anyone feel like sharing code snippets that will help beef-up spam
protection for a contact script?

Do you all enable a CAPTCHA system?

Here is what I am currently using in my contact form script to protect
from spam:



# Error text:
$no_go = 'Forbidden - You are not authorized to view this page!';

# First, make sure the form was posted from a browser.
# For basic web-forms, we don't care about anything other than requests
from a browser:
if(!isset($_SERVER['HTTP_USER_AGENT'])) { die($no_go); exit(); }
# Make sure the form was indeed POST'ed (requires your html form to use
action=post):
if(!$_SERVER['REQUEST_METHOD'] == POST) { die($no_go); exit(); }
# Host names from where the form is authorized to be posted from:
$auth_hosts = array(site1.com, site2.com);
# Where have we been posted from?
$from_array = parse_url(strtolower($_SERVER['HTTP_REFERER']));
# Test to see if the $from_array used www to get here.
$www_used = strpos($from_array['host'], www.);
# Make sure the form was posted from an approved host name:
if(!in_array(($www_used === false ? $from_array['host'] :
substr(stristr($from_array['host'], '.'), 1)), $auth_hosts)) {
//log_bad_request();
header(HTTP/1.0 403 Forbidden);
exit();
}
# Attempt to defend against header injections:
$bad_strings = array(Content-Type:, MIME-Version:,
Content-Transfer-Encoding:, bcc:, cc:);
# Loop through each POST'ed value and test if it contains one of the
$bad_strings:
foreach($_POST as $k = $v) {
foreach($bad_strings as $v2) {
if(strpos($v, $v2) !== false) {
log_bad_request();
header(HTTP/1.0 403 Forbidden);
exit();
}
}
}
# Made it past spammer test, free up some memory and continue rest of
script:
unset($k, $v, $v2, $bad_strings, $auth_hosts, $from_array, $www_used);

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




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



Re: [PHP] A way to stop spam on this list

2006-08-12 Thread Gerry D

They're not Jap but Chi. And they drove me crazy on my websites until
I fixed them.

http://www.lilyregister.com/page/?p=contact is what stopped the idiots.

Gerry

On 6/19/06, Denis Gerasimov [EMAIL PROTECTED] wrote:

Hello List Members,



I am very tired of deleting spam messages received from PHP mailing lists
and I think we all are.



As I can see most of the spam messages are in Chinese / Japanese.  Since
this is an English-only mailing list I would like to suggest blocking all
messages containing such Chinese / Japanese characters in body, or at least
marking all of them with the word [SPAM] in subject (so mail clients will be
able to deliver it to the Spam folder). AFAIK PHP lists use some home-grown
moderator so doing this should be an easy task.



Of course that may affect some legal users that have such characters in
their signatures, but in this case it sounds reasonable just to reply with
an email explaining blocking policy so any legal user will know what to do
to get his message go through the moderator.



What do you think?



Have a great day,



Denis S Gerasimov
Web Developer
Team Force LLC

Web:http://www.team-force.org/ www.team-force.org

RU  Int'l:   +7 8362-213555

email:[EMAIL PROTECTED]







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



Re: [PHP] Unicode

2006-08-12 Thread Gerry D

Tedd,

Interesting that nobody knows the answer... I am struggling with this
very issue for an international lily register...
http://www.lilyregister.com/

Gerry

On 6/5/06, tedd [EMAIL PROTECTED] wrote:

At 7:08 PM -0700 6/4/06, Rasmus Lerdorf wrote:
Larry Garfield wrote:
In C or C++, yes.  In PHP, do not assume the same string-number mapping.  
Numeric definition is irrelevant.

Right, and now bring Unicode into the picture and this becomes even more true.

-Rasmus

I know there's always RTFM, but if you would care to discuss it, I would like 
to know why. How does php handle Unicode code-points and char-sets?


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



Re: [PHP] New Help with Javascript Navigation

2006-04-29 Thread Gerry D

Yah, and why are people still mindlessly clicking OK to install ActiveX plugins?

On 4/27/06, Porpoise [EMAIL PROTECTED] wrote:


Gerry D [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Interesting discussions... :)

I see two issues:

1. if you are exposing php scripts to the client, how does the server
side processing know what it should do and what the client should see?

2. and why can't JS write to the client's file system? Or read from
files? Come to my website and let me first read all your private
information, then trash it... Hackers and other cyber vandals would
love you to implement this feature... LOL
/Gerry D

Isn't that feature called ActiveX??


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



Re: [PHP] New Help with Javascript Navigation

2006-04-27 Thread Gerry D
Interesting discussions... :)

I see two issues:

1. if you are exposing php scripts to the client, how does the server
side processing know what it should do and what the client should see?

2. and why can't JS write to the client's file system? Or read from
files? Come to my website and let me first read all your private
information, then trash it... Hackers and other cyber vandals would
love you to implement this feature... LOL

Gerry

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



[PHP] Removing special chars

2006-04-25 Thread Gerry Danen
I would like to replace all chars in a string that are not a-z or 0-9
with a space. I can use a series of str_replace functions, but there
has to be a faster way.

I know there is a solution but my chemo-brain is slowing me down today. Sorry...

Any suggestions?

TIA

Gerry

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



[PHP] Removing special chars

2006-04-25 Thread Gerry D
I would like to replace all chars in a string that are not a-z or 0-9
with a space. I can use a series of str_replace functions, but there
has to be a faster way.

I know there is a solution but my chemo-brain is slowing me down today. Sorry...

Any suggestions?

TIA

Gerry

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



Re: [PHP] Creating a Photo Album

2006-04-07 Thread Gerry Danen
Sure you can, Paul. See
http://www.lily-gallery.com/h/showlily.php?id=53div=1 for an example.
There are 5 thumbnails and they all link to photo.php to display the
larger version.

On 4/7/06, Paul Goepfert [EMAIL PROTECTED] wrote:
 Hi all,

 I am postilng pictures up on a website.  So far I have a picture per
 page. This will get not be very efficient as time goes on.  Is there
 anyway that I can have one page with only the image updating?  Can
 this be done in PHP.  If it can would someone explain it to me.  The
 only thing I k.now how to do well in PHP is mysql queries and data
 validatlion.



--
Gerry
http://dev.danen.org/

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



Re: [PHP] microsoft PHP ?

2006-04-01 Thread Gerry Danen
Come on, you should have played along... ;-)

Gerry

On 4/1/06, Stut [EMAIL PROTECTED] wrote:

 Zouari Fourat wrote:
  here's the link
  http://phpro.org/articles/Microsoft-Purchases-Zend-for-$113-Million.html

 Seriously... consider the date.

 -Stut

  On 4/1/06, Stut [EMAIL PROTECTED] wrote:
  Zouari Fourat wrote:
  I've just heard about Microsoft deal, the geant bought the Zend
  platform at 113 million US$.
  What will be the php future ? it's gonna switch to proprietary licence
  ? closed source ? or it was a Zend product deal ? (zend studio,
  platform ...) not affecting the php language in itself ?
  Does this mean that all efforts done in open source by thousands of
  people around the world to get a web scripting language at a high
  entreprise level is now bought by Micrsoft ?
  Where did you hear this? Have you considered the date? Have you
  considered how unlikely it is? Have you ever sought professional help?
 
  -Stut




Re: [PHP] microsoft PHP ?

2006-04-01 Thread Gerry Danen
On 4/1/06, Stut [EMAIL PROTECTED] wrote:
 Gerry Danen wrote:
  Come on, you should have played along... ;-)

 I'd had my fill by the time that arrived. It seems to me that people go
 overboard now. Slashdot used to have one a year, and it was always
 something that was vaguely possible, this year they've even changed the
 colour scheme on the site. Shame really.

Stut,

I agree that some jokes are taken too far. I have just returned to
work after a heart episode but it did not send me back to the
hospital. I agree that the last thing Zend deserves is the mshaft, but
let's take the joke for what it was...

I'm in GMT -7 so I get the jokes a bit later. Sorry if I added to your grief.

Gerry

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



Re: [PHP] microsoft PHP ?

2006-04-01 Thread Gerry Danen
On 4/1/06, Stut [EMAIL PROTECTED] wrote:

 Here's assuming that was a joke so I won't get into the factual errors.
 I wonder how Zend and the other core developers will feel about being
 referred to as an unorganized bunch of hobbyists.

Now that is slander we don't need. Group hug with the Zend folks, please.

G

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



Fwd: [PHP] private $foo

2006-03-29 Thread Gerry Danen
On 3/29/06, Philip Thompson [EMAIL PROTECTED] wrote:

 People have been programming since the 70's?!!?!! I didn't think it
 was possible until the early 90's! Wow I must be young! ;)

What do you mean '70's?  LOL

How about Grace Murray Hopper?

http://www.jamesshuggins.com/h/tek1/grace_hopper.htm

And here we are in the 1940's: http://www.computer50.org/

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



Re: [PHP] setcookie security concerns

2006-03-14 Thread Gerry Danen
Which someone could do this, is another question I have. The user? He's do
something to his own computer, no?

Gerry

On 3/14/06, tedd [EMAIL PROTECTED] wrote:

 Hi:

 I've been using a php style switcher allowing users to change css.
 The code follows:

 Within the head tags.

 link rel=stylesheet type=text/css media=screen href=?php
 echo (!$thestyle)?'style1':$thestyle ?.css 

 Within the body tags, allowing the user to select which style they want:

 a href=switch.php?set=style2Green/a or a
 href=switch.php?set=style1Red/a

 And, the corresponding (switch.php) php code is:

 ?php
 setcookie ('thestyle', $set, time()+31536000, '/', '', 0);
 header(Location: $HTTP_REFERER);
 ?

 It's pretty simple. But recently, I had one person hammer me stating
 it was a security problem because I didn't validate the user input.
 As such, he says that someone could inject an arbitrary code and
 cause problems.

 1. Is he right?

 2. How does that work?

 3. If so, what do I do to correct this?

 Many thanks for any replies.

 tedd
 --

 
 http://sperling.com

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




--
Gerry
http://portal.danen.org/


Re: [PHP] Is this password protection script secure?

2006-03-14 Thread Gerry Danen
On 3/14/06, IG [EMAIL PROTECTED] wrote:

 Hello.

 I got a password protected login script of t'internet a while back and
 have implemented it. I just want to make sure it is secure. I am aware
 that the password is stored directly in the database and I don't think
 this is a good thing. If the following could be looked at to see if
 there are any improvements I would be most grateful. The script is then
 called on each page that requires password protection thus-


Here's a fragment from my login routine:

if ( isset($_POST['s1']) )
{
$md5_pass= md5($_POST['p1']);
$u_user_id= db_format($_POST['u1']);

$q1 = select * from users where u_user_id = '$u_user_id' and u_pass =
'$md5_pass' and u_appr = '1' ;
$r1 = mysql_query($q1) or db_error( $q1, mysql_error(), mysql_errno(),
__FILE__ );
$a1 = mysql_fetch_array($r1);

if ( mysql_num_rows($r1) == '1' )
{
$hostip = $_SERVER['REMOTE_ADDR'];

$_SESSION['sess_login_id']= $a1['u_user_id'];
$_SESSION['sess_uid']= $a1['u_id'];
$_SESSION['sess_email']= $a1['u_email'];


[PHP] Displaying documents stored under web root

2006-03-10 Thread Gerry Danen
Adrian,

I use something like this:

?php
if ( $is_member) // global var set during login
{
  include(/home/belowdocroot/project_a/memberprofile.php);  // or whatever
your page is
}
else
{
  echo Sorry, members only. Please login or register.;
   header(location:/members/login.php );
}


HTH

Gerry
http://groups.yahoo.com/group/php_and_mysql/

On 3/10/06, Adrian Bruce [EMAIL PROTECTED] wrote:

 Hi

 After some advice (surprise!)

 I currently store restricted documents beneath the web root so they are
 not accessible via the URL, when a valid user wishes to view a document
 i copy it to a temporary folder above the root and load it in a new
 page.  the only way i can then manage to delete the copy is
 automatically deleting all temp files when any user goes to the log out
 page.

 This is obviously not a very good way of doing this but unless i can
 establish when a user is no longer viewing the doc then i dont know when
 to delete it.  I was wandering how others deal with these problems like
 this



Re: [PHP] session handling

2006-03-09 Thread Gerry Danen
$ID is not a global, but $_SESSION[ID] would be...

Gerry
http://groups.yahoo.com/group/php_and_mysql/

On 3/9/06, suresh kumar [EMAIL PROTECTED] wrote:

 i am having one problem in session handling.
 I am having 2 files,login page and hame page.
 when user enterd user name and password in login page
 .i used session to store the user id .in my second
 home page.i retrieve the user id.now i want the user
 id to be availble in my thrid page.plz help me.this is
 my code.

 login.php
 session_start();
 $ID=$userid;
 session_register(ID);

 homepage.php
 session_start():
 echo $ID   //this is working fine



 thirdpage.php
   session_start();
   echo $ID //not working



Re: [PHP] Re: Incremental Date Based ID

2006-03-07 Thread Gerry Danen
Kevin,

You can do it with a Unix timestamp, but that would just confuse the issue.

Have you considered using two fields instead of one? An article ID and
and article sub-ID would be retrieved as article ID = date, and all
sub-ID's descending. The first record in the list would contain the
highest sub-ID, irregardless of gaps.

Gerry
http://groups.yahoo.com/group/php_and_mysql/

On 3/7/06, Kevin Murphy [EMAIL PROTECTED] wrote:
 Well, part of the issue is that I want to be able to use this as part
 of the link:

 /news.php?article=2006-03-05a
 /news.php?article=2006-03-05b

 which i will eventually do a htacess rewrite to make it look like

 /news/2006-03-05a.php
 /news/2006-03-05a.php

 I don't think I can do that with just the Unix timestamp.

 On Mar 7, 2006, at 4:56 PM, Al wrote:

  Kevin Murphy wrote:
  I'm trying to set up an ID field that works like this for news
  articles that are posted to a website.
  2006-03-05a
  2006-03-05b
  I know how to generate the date, and I am pretty sure I can
  generate the letter code based on counting the number of rows and
  then assigning the next letter (we will never have more than 26 in
  a day... usually its closer to 1 or 2 per day).
  The problem is if there has been something deleted.
  2006-03-05a
  2006-03-05c
  If I then Count the rows with this date I get an answer of 2, and
  so the next letter should be c but there already is a c
  because b got deleted.
  So, is there any way of generating this style ID number
  automatically?
  --Kevin Murphy
  Webmaster - Information and Marketing Services
  Western Nevada Community College
  www.wncc.edu
  (775) 445-3326
 
 
  Why not simply use the Unix time stamp. time() If more than one can
  arrive within the same second, append a letter.
 
  If users need to see the key, use date() to decode it for them

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




--
Gerry
http://portal.danen.org/

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



Re: [PHP] Re: Incremental Date Based ID

2006-03-07 Thread Gerry Danen
Should have read the whole thread first, I guess... :)

Gerry
http://groups.yahoo.com/group/php_and_mysql/

On 3/7/06, Shaunak Kashyap [EMAIL PROTECTED] wrote:
 A possible solution:

 Make a composite primary key where the first field is the date and the
 second field would be of type enumeration (A..Z, in ascending order).
 Then use MAX(second field) WHERE first field = today's date to
 figure out the next primary key.

 Shaunak Kashyap

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



Re: [PHP] PHP upgrade on Go Daddy virtual server

2006-02-26 Thread Gerry Danen
Have you tried GoDaddy support?

On 2/25/06, Nicolas Verhaeghe [EMAIL PROTECTED] wrote:

 Has anybody heard (or done it himself) how to upgrade PHP on a Go Daddy
 virtual server?

 Current version is 4.3.11 and I'd like to upgrade to 5.1.2.

 All I know is that this server is a Red Hat Fedora 2.

 I have SSH access and root as well.



Re: [PHP] HN CAPTCHA at http://www.phpclasses.org

2006-02-19 Thread Gerry Danen
You got me. Where are you hiding it?

Gerry

On 2/19/06, tedd [EMAIL PROTECTED] wrote:
 Manuel:

 A good CAPTCHA must be fuzzy. If you know other fuzzy CAPTCHA besides
 these, it may help to sharing that knowledge.

 Try this:

 http://xn--ovg.com/no_bot

 The point of CAPTCHA is to provide something that a bot can't figure
 out, but a human can, right?

 Well, for a bot to figure out the answer, the bot must be able to get
 at the source code, right? Take a look at this source code and from
 it determine the answer. Also, try to view the content source code
 from any page on this site. I think this data is bot-proof, isn't it?
 Or have I blundered?

 Many thanks for any review and/or suggestions.

--
Gerry
http://portal.danen.org/

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



Re: [PHP] HN CAPTCHA at http://www.phpclasses.org

2006-02-19 Thread Gerry Danen
How would a bot find it though?

On 2/19/06, comex [EMAIL PROTECTED] wrote:
  You got me. Where are you hiding it?

 In test.js:
 http://www.xn--ovg.com/no_bot/rpc.php?action=one

 Unless you hide it in a different place each time, how useful is that?

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



Re: [PHP] ! in front of a variable?

2006-02-18 Thread Gerry Danen
! reverses a true/false input. I use it to flip a setting on or off.

Gerry

On 2/17/06, Jeff [EMAIL PROTECTED] wrote:
 Hey all,

 I've got some code from someone else I've inherited and need to sort out
 some problems with.  The programmer that wrote it originally was much
 better than I and programmed a little over my head to say the least.

 One function that I've come across that has 5 variables as input:

 function($var1,$var2,!$var2,$var3-cc,$var3-bcc);

 The question I have is on the 3rd input variable, what does the ! in
 front of $var2 do to that variable?

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



Re: [PHP] Saving a BLOB image to a file (SOLVED)

2006-02-17 Thread Gerry Danen
On 2/16/06, tedd [EMAIL PROTECTED] wrote:

 However, after given it some thought, I would imagine that one could
 get a unique generated string, create a file with that string, give
 the file the correct permissions, then pull the image from the dB and
 save, do image processing, and then reload the image into a web page,
 and delete the file without any conflict. I can envision lot's of
 users doing that simultaneously without problems. BUT, I haven't
 tried it yet!

I have used a user's IP address (dots removed) and microtime appended
to create a unique file name. The target directory is world writable.
Not the most elegant solution... I found that sometimes the file had
not been written yet and trying to display it on a page right away
resulted in file not found... Rendering the image to the screen
without saving to a file works best for me.

--
Gerry
http://portal.danen.org/

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



Re: [PHP] Saving a BLOB image to a file (SOLVED)

2006-02-16 Thread Gerry Danen
What if several users try to access a different picture at the same
time? Won't that render the wrong image for some?

Gerry

On 2/16/06, tedd [EMAIL PROTECTED] wrote:
 Hi gang:

 In a previous post (i.e., [PHP] Strange response to MySQL query) I
 was trying to save a BLOB as a file, namely using an INTO DUMPFILE
 query.

 If you are the system admin, and have all the system permissions,
 then this is not a big problem. However, if you aren't, then getting
 MySQL to dump a file becomes very problematic with respect to getting
 the right permissions to accomplish the task.

 So, I found a way around it. I am sure that others have thought of
 this before me, so I'm not claiming credit and I am sure that this
 solution is obvious to some -- but, it's just that I searched
 literally hundreds of posts and spent considerable time without
 finding an answer.  The following is the result of my tinkering. So
 here goes:

 First, on your site create a file called my_image.png

 Second, give it 777 permissions.

 Third, in your code after opening the dB, grab the image from MySQL:

 $dbQuery = SELECT image;
 $dbQuery .= FROM $your_table ;
 $dbQuery .= WHERE image_Id = $pageNum;

 $result = mysql_query($dbQuery) or die(Error: .mysql_error());

 Forth, drop the image into a variable:

 $fileContent = @mysql_result($result, 0, image);

 Fifth, create an image from a string (a great function here):

 $original=imagecreatefromstring($fileContent);

 Sixth, save the image.

 imagepng($original, my_image.png);

 And Bingo, the image is now the my_image.png file.

 Any comments or suggestions are welcomed.

 tedd

 --
 
 http://sperling.com/

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




--
Gerry
http://portal.danen.org/

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



Re: [PHP] Finding out DPI using GD

2006-02-15 Thread Gerry Danen
Isn't DPI a function of the output device? Has nothing to do with the
image, it just has x pixels by y pixels...

On 2/15/06, Kim Christensen [EMAIL PROTECTED] wrote:
 On 2/15/06, Karuna [EMAIL PROTECTED] wrote:
  Thanks. I might give the new versions a try :)
 
  IIRC, I think the unix exif function returns dpi as well but I'm working on
  a windows machine without cygwin, so can't be certain.

 You might want to check this package:
 http://www.ozhiker.com/electronics/pjmt/index.html

Gerry

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



Re: [PHP] Onclick event and PHP function

2006-02-15 Thread Gerry Danen
Alain, have you tried cookies?

On http://www.lily-gallery.com/ you will see 2 colored dots (bottom
left) that allows for alternate page colors. Once a user chooses one,
I remember his choice with a cookie. I use the cookie to control a
style sheet.

Gerry

On 2/15/06, Alain Roger [EMAIL PROTECTED] wrote:
 Hi,

 I have some link on which if user click, should do the following things:

 - open a particular page
 - setup to sessions some particular variable value

 however, PHP function should be declared before HTML headers.

 so i was thinking about something like that

 ?php
function vardef($lg)
{
  ... store lg to my session variables ...
}
 ?

 HTML
 ...
 A Href=none Onclick=?php vardef(eng) ?english/A
 A Href=none Onclick=?php vardef(fre) ?french/A
 ...
 /HTML

 but this does not work because my session variable is always setup to the
 last value (in this case fre), even if i click only on english :-(

 could you help me with this PHP issue ?
 thanks a lot,

 Alain

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



Re: [PHP] Onclick event and PHP function

2006-02-15 Thread Gerry Danen
Pretty much the same technique I am using, tedd. I may have even used
your example as inspiration... :)

At the top of each page, I use

$currentstylecolor = isset( $_COOKIE['currentstyle'] ) ?
$_COOKIE['currentstyle'] : brown; //  brown = default style
$currentstyle = /skins/style_ . $currentstylecolor . .css ;

then

link rel=stylesheet type=text/css href=?php echo $currentstyle ? 


Gerry

On 2/15/06, tedd [EMAIL PROTECTED] wrote:
 Alain, have you tried cookies?
 
 On http://www.lily-gallery.com/ you will see 2 colored dots (bottom
 left) that allows for alternate page colors. Once a user chooses one,
 I remember his choice with a cookie. I use the cookie to control a
 style sheet.
 
 Gerry


 I didn't realize that he was wanting a clickie cookie thingie.

 Check out:

 http://www.sperling.com/examples/styleswitch/

 tedd
 --
 
 http://sperling.com/


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



Re: [PHP] image location hiding techniques

2006-02-09 Thread Gerry Danen
I am attempting to call a script that actually renders the image and
then check for a session variable. However, the session variable does
not seem to be there...

?php
$fn = $_GET['id']; // filename
$p = $_GET['p']; // path
$img = /srv/pix/ . $p . / . $fn ; // where the photos are + path + filename

if ( $_SESSION['photoid'] != md5(validphoto) ) // set by caller script
 die( Invalid photo request ); // or redirect to alternate image
$_SESSION['photoid'] = ;

$render = @imagecreatefromjpeg( $img );
header(Content-type: image/jpeg);
imagejpeg($render,'',100);
imagedestroy ($render);
?

Does anybody have an idea why the session var is not available?

The script above is called with this:

$_SESSION['photoid'] = md5(validphoto);
echo pimg border=0 src='showimage.php?id=$get_picp=$from'
alt=\Photo $get_pic being located...\/p;

Gerry


On 2/7/06, hbeaumont hbeaumont [EMAIL PROTECTED] wrote:
 Hi,

 I have a site with images that I want people to download but not have
 the direct path to. ie. I do not want them to be able to just view the
 source, find the dir and then download everything or direct link to
 them.

 However I can see no way to do this other than keeping the images on
 disk, having a php script read them and then spit them out. example:

 view.php?92348924  where 92348924  is a code that translates to the
 image on disk.

 Can anyone think of a better method? If not, what is the most
 efficient way to do this (ie. avoid the most i/o)

 Thanks!


 P.S. I also realize I could use .htaccess to stop direct linking and
 turn off directory indexes. Still I think there might be some other
 problems with .htaccess

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




--
Gerry
http://portal.danen.org/

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



Re: [PHP] How to output multiple tables nicely(!) from PHP in Excel format?

2006-02-08 Thread Gerry Danen
Oli,

Looks interesting enough to play with. The page mentions look at the
code yet I cannot find the code. Is it available?

Gerry

On 2/8/06, Oli Howson [EMAIL PROTECTED] wrote:
 The example given outputs to two tabs,  sheeta and sheetb

 Quoting Olaf Greve [EMAIL PROTECTED]:

  Hi all,
 
  I've written a ArrayToExcel(XML) class, you're welcome to use if you
  wish. May need a bit of tweaking to get the colspan working (I
  haven't touched it in quite a while). But the process itself I think
  is rather nice :)
  
   http://projects.londonis.co.uk/arraytoexcel/

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



Re: [PHP] php.ini version changed, code broke

2006-02-08 Thread Gerry Danen
You should use $_POST...

On 2/8/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Hello all from a newbie.  We have a Nitix server (from Net Integration
 Technologies, Inc.) that hosts various web site.  Recently they released a
 software upgrade, and in the release notes was this warning:

 A number of PHP options (in the php.ini file) were changed, either to
 improve security or to more closely follow the recommendations of the PHP
 developers. This should make it easier to run third-party PHP packages on
 Nitix, but could break existing installations that have been adapted for
 Nitix.

 After installing this release, the simplest of all simple things would no
 longer work - a basic HTML menu with 6 choices passed to a PHP script that
 prints out the selection chosen by the user!!  The variable name when
 printed (echo'd) in the PHP script was empty.

 The HTML:

 form name=form1 method=post action=a.php
 select name=aName size=1 id=select
 optionDeb/option
 optionFrank/option
 optionJeff/option
 optionLynne/option
 optionNick/option
 optionTom/option
 /select
 input type=submit name=Submit value=Submit
 /form

 The PHP:

 ?php

 echo $aName . ttt;

 ?

 What displays???  Just ttt of course.  What exactly could have changed to
 make this simple script fail?

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



Re: [PHP] Submitting form without JavaScript

2006-02-06 Thread Gerry Danen
You should talk to your provider. PayPal does not leave anything
legible on my html page, just an encrypted string. Once you end up on
PayPal's secure page, the email address is visible. I use a special
account, just for that purpose.

I'm afraid your provider dictates your solution...

Gerry

On 2/6/06, Peter Lauri [EMAIL PROTECTED] wrote:
 Best mailing list member,

 I have an external payment gateway provider (similar to PayPal) and need to
 send POST variables to them to initiate the Payment Process.

 Is there any function in PHP that can send POST variables to a URL without
 using form and then a javascript that submits it when the page is loaded?

 My dream is to have a function (or class) that would be used this way:

 $url=url_to_submit_post_variables_to;
 $ps = new SubmitPost($url);
 $ps-addPostVar($name, $value);
 $ps-submitPost();

 Anyone with ideas about this?

 Best regards,
 Peter Lauri

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




--
Gerry
http://portal.danen.org/

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



Re: [PHP] system('bell'); ?

2006-02-04 Thread Gerry Danen
bell is his C program... :)   Outputs an ascii 7 (bell) at the machine
where it runs. It basically outputs a character to stdout or stderr.

He probably has that machine next to his cash drawer...

Gerry

On 2/4/06, tedd [EMAIL PROTECTED] wrote:
 I simple wrote a small C program that basically sent a bell, 0x07
 and it opened my cash drawer. In php I just did system('bell'); and
 it worked fine.
 
 Kevin

 Hi:

 Interesting! The statement system('bell'); is new to me.

 If I'm writing code on a hosted domain, and using that statement,
 who's bell am I ringing?

 tedd

 --
 
 http://sperling.com/

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




--
Gerry
http://portal.danen.org/

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



Re: [PHP] Include after image or a way to reset header

2006-02-03 Thread Gerry Danen
Call the image rendering from another page and then let that page continue:

caller.php:
if ( $is_logged_in )
{
echo p align=\center\img border=0
src='showimage.php?id=$get_picp=$from' alt=\Photo name:
$get_pic\/p;
if ( $get_name !=  )
echo p align=\center\$get_name/p;
}

showimage.php:
?php
$_htmlfiles = /home/domain/html/ ;
$fn = $_GET['id'];
$p = $_GET['p'];
$img = $_htmlfiles . p/ . $p . / . $fn ;
$render = @imagecreatefromjpeg( $img );
header(Content-type: image/jpeg);
imagejpeg($render,'',100);
imagedestroy ($render);
?

Gerry


On 2/3/06, tedd [EMAIL PROTECTED] wrote:
 Hi:

 This is probably an obvious question, but after you create an image,
 how can you include another php  script?

 For example, if my code ends like so:

 header(Content-type: image/png); // Set display mode as PNG
 imagepng($im); // Display image
 imagedestroy($im); // Delete image from memory cache
 ?

 How can I redirect program flow to the next script, such to include
 part2.php;

 If I place an include statement after imagedestroy statement, nothing happens.

 I suspect that it's because I have already set and sent the header --
 so, is there a way for me to reset the header so that I can launch
 the next script?

 Many thanks for any replies.

 tedd

 --
 
 http://sperling.com/

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




--
Gerry
http://portal.danen.org/

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



Re: [PHP] Hide email addresses from spam bots

2006-02-02 Thread Gerry Danen
tedd,

I don't find your implementation hard to read. There are
implementations where zeros and Ohs are used and it typically takes
several tries to get it right.

http://www.nals2007.org/ shows how I just captured a single image and
then hid the email address. I'd like to see a spambot reap that
address. Gotta be a pretty smart bot...

Gerry

On 2/2/06, tedd [EMAIL PROTECTED] wrote:
 David:

 Your points are well taken. I was impressed by your javascript answer.

 It seems to me that there should be something that could circumvent
 the CAPTCHA problem.


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



Re: [PHP] How to get a network drive name

2006-02-02 Thread Gerry Danen
Please define network drive name. There are drive letters, volume
labels and share names. What exactly are you looking for?

Gerry

On 2/2/06, Ibrahima TALL [EMAIL PROTECTED] wrote:
 Hi everybody !

 I would need a help in php or a portable javascript solution (for several 
 browsers).

 My problem is :  i have no solution about how to get a network drive name.
 For exemple, getting COMMON in COMMON(X:).

 The only solution i saw was using activeX controls with javascript but the 
 problem is that this controls are only compatible with IE.
 I'm working with php under XP.

 Sorry for my bad english, i hope i was clear however, any suggests are 
 welcome, thanks !

 Ibrahima




--
Gerry
http://portal.danen.org/

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



[PHP] Hide email addresses from spam bots

2006-02-01 Thread Gerry Danen
A user of mine insists that her email address shows on a web page. I
need to protect that address from spam bots. There are lots of
solutions around that I have come acros. I am looking for a clean,
reusable, non-javascript solution.

Any help is appreciated.

Gerry

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



Re: [PHP] Collecting info about columns in a table

2006-01-29 Thread Gerry Danen
I think Afan means they are values in an enum field. But I may be mistaken... :)

Gerry

On 1/29/06, tedd [EMAIL PROTECTED] wrote:
 Hi to all,
 I need to collect info about columns from a selected table.
 I use this:
 
 $result = mysql_query(SELECT * FROM . $TableName);
 $fields = mysql_num_fields($result);
 for ($i=0; $i  $fields; $i++)
 {
$type  = mysql_field_type($result, $i);
$name  = mysql_field_name($result, $i);
$len  = mysql_field_len($result, $i);
$flags = mysql_field_flags($result, $i);
 
 echo $type .  |  . $name .  |  . $len .  |  . $flags .\n;
 }
 
 If I have columns type ENUM('live', 'hidden', 'pending'), $flags
 will show ONLY 'enum'.
 How can I get all ENUM values?
 
 Thanks for any help or direction.
 
 -afan

 -afan:

 $type  = mysql_field_type($result, 'live');
 $name  = mysql_field_name($result, 'hidden');
 $len  = mysql_field_len($result, 'pending');

 Provided that 'live', 'hidden', 'pending' are fields in your table.

--
Gerry
http://portal.danen.org/

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



Re: [PHP] Collecting info about columns in a table

2006-01-29 Thread Gerry Danen
Afan,

Here's some code that will show enum values:


$q2 = describe . $tname .  ;;
$r2 = mysql_query($q2) or die(mysql_error());
while ( $a2 = mysql_fetch_array($r2) )
{
$els = count($a2);
echo br;
for ($i2 = 0; $i2  $els; $i2++)
{
$f = $a2[$i2] ;
if ($f == ) $f = nbsp;;
echo $f .  | ;
}
echo \n;
}

Perhaps combining it with your code will give you what you need.

Gerry

On 1/29/06, Afan Pasalic [EMAIL PROTECTED] wrote:
 Hi to all,
 I need to collect info about columns from a selected table.
 I use this:

 $result = mysql_query(SELECT * FROM . $TableName);
 $fields = mysql_num_fields($result);
 for ($i=0; $i  $fields; $i++)
 {
 $type  = mysql_field_type($result, $i);
 $name  = mysql_field_name($result, $i);
 $len  = mysql_field_len($result, $i);
 $flags = mysql_field_flags($result, $i);

 echo $type .  |  . $name .  |  . $len .  |  . $flags .\n;
 }

 If I have columns type ENUM('live', 'hidden', 'pending'), $flags will show
 ONLY 'enum'.
 How can I get all ENUM values?

 Thanks for any help or direction.

 -afan

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




--
Gerry
http://portal.danen.org/

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



Re: [PHP] PHP / Apache + Error 500

2006-01-25 Thread Gerry Danen
Interestingly, I installed mod_security the other day and noticed
error 500 show up. As it turns out, mod_security generates those when
they block nasties.

Gerry

On 1/25/06, Thomas [EMAIL PROTECTED] wrote:

 Hi there!

 I am sitting with something of a mystery and was wondering if there is
 someone out that might have dealt with this before:

 I have developed a site that runs well and fine on my machine
 (XP/Apache2/PHP5/MySQL5). I am using PEAR::HTML_Template_Flexy as well as
 Cache_Lite.

 The site has been put up on the live server and works (mostly) fine there
 too, with the exception of Internal Server errors 500, ever so often. It's
 pretty random and can happen to any of the scripts (they all run through a
 single index.php script that instantiates objects that then spit out the
 resulting html).

 I had a look at the Apache log file I got from the SP ... no clue. All I
 know is that they use Apache 1.x/PHP5/Linux/MySQL(v4?).

 They say that it is not their server but my scripts, however, if that was
 the case I would get these errors on my machine too. Also, the randomness of
 this also indicates that it can't really be my php scripts, otherwise it
 would happen all the time.

 Does anybody have any suggestion as to how I can solve this issue? I know
 this is pretty vague information, but it's all I have (hence the confusion).

 Thanks,
 Thomas


 SPIRAL EYE STUDIOS
 P.O. Box 37907, Faerie Glen, 0043

 Tel: +27 12 362 3486
 Fax: +27 12 362 3493
 Mobile: +27 82 442 9228
 Email: [EMAIL PROTECTED]
 Web: www.spiraleye.co.za

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




--
Gerry
http://portal.danen.org/

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



Re: [PHP] Re: security of uploaded gif files

2006-01-23 Thread Gerry Danen
There's a couple of things a person can do.

1. check for .gif extention
2. see if exif_imagetype() returns type IMAGETYPE_GIF
3. see if getimagesize() returns reasonable values and not FALSE
4. check the file content for binary vs text content

Gerry

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



Re: [PHP] Adventures in Cookies

2006-01-23 Thread Gerry Danen
After some googling, it's a browser thing, not a php thing, as Austin
pointed out. There are just rules (well, suggestions maybe) to be
aware of.

Are we flogging a dead horse here?


On 1/23/06, tedd [EMAIL PROTECTED] wrote:
 Austin Denyer wrote:
 This is a function of the way cookies work, and is not a php issue.

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



Re: [PHP] Str to Int

2006-01-20 Thread Gerry Danen
You probably want to do an is_int() first...

After that, you know it's an int and treat it that way. Why do you need to
typecast it?

BTW, change $cardID = $HTTP_GET_VARS[cardID]; to $cardID = $_GET['cardID'];
for PHP5 compatibility... ;-)

Gerry

On 1/20/06, Ron Eggler (Paykiosks) [EMAIL PROTECTED] wrote:

 Hi,

 I need to do a type cast from string to int in folllowing code:
 [php]
 getPIN cardID='.intval(trim($cardID)).' quantity=1 /
 [/php]
 I need $cardID have converted to int. I thought it should work that way
 but it does not!
 But it's working if I'm putting
 [php]
 getPIN cardID=180 quantity=1 /
 [/php]
 in there. I got card ID as a var that is passed as get like:
 [php]
 $cardID = $HTTP_GET_VARS[cardID];
 [/php]

 Can anyone help me in that issue? Thank you!

 __

 Ron Eggler
 Intern
 866-999-4179
 www.paykiosks.net






--
Gerry
http://portal.danen.org/


[PHP] PHP mail form spam checking

2006-01-19 Thread Gerry Danen
A couple of days ago somebody posted a message with a routine to check
input fields for potential spam/hacking. I believe it was on this
list, but not sure.

Of course I can't find that message any more...

Could the original poster, please repost?

Thanks.

Gerry

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



Re: [PHP] generate database driven web pages

2006-01-17 Thread Gerry Danen
Bing,

I think I have implemented at http://www.arls-lilies.org/h/board.php
what you are looking for. If so, let me know.

On 1/17/06, Bing Du [EMAIL PROTECTED] wrote:
 Hello everyone,

 Here is what I want to accomplish.  Query the backend database and
 generate a page listing all the staff members in table format that has
 name, title, phone and office address.  Staff name should be a link.
 Clicking the link should query the database again and use the
 information retrieved (e.g. projects, educations, etc.) to generate a
 page for each staff member.  A staff list page can be generated pretty
 easily.

 Now my question is how to keep the staffID (although it is not shown on
 the staff list page, but is queried along with name, title, etc.) so
 that when a staff name is clicked, his/her staffID will then be used to
 query the DB for personal information.

 Anybody have any handy working examples to give me some hints?


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



Re: [PHP] test variable value?

2006-01-11 Thread Gerry Danen
On 1/11/06, M. Sokolewicz [EMAIL PROTECTED] wrote:

 remember though that
 if(!$x) {
echo 'nothing here';
 }

 will also output 'nothing here' when provided with the string '0'!


That's because (!$x) means ($x == false) and '0' is false...

Gerry


Re: [PHP] Floating numbers truncating to two digits without rounding

2006-01-10 Thread Gerry Danen
sprintf creates a string ready for you to manipulate. So does
number_format. Pick whatever is best for your purpose.

See http://uk2.php.net/manual/en/function.sprintf.php and
http://uk2.php.net/manual/en/function.number-format.php for more info.

Gerry


On 1/10/06, Mark Steudel [EMAIL PROTECTED] wrote:
 Can I do this all with sprintf or do I then need to convert it to a string
 and chop off what I don't want?

 -Original Message-
 From: Gerry Danen [mailto:[EMAIL PROTECTED]
 Sent: Monday, January 09, 2006 3:35 PM
 To: php-general@lists.php.net
 Subject: Re: [PHP] Floating numbers truncating to two digits without
 rounding

 Mark,

 Why not use sprintf() with an arbitrary large number of decimals and then
 discard all but the 2 you want. I.e., format with 10 decimals and then drop
 the last 8.



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



Re: [PHP] include() problem

2006-01-09 Thread Gerry Danen
Here's a snippet of what's at the start of most of my php files:

$pagetitle  = Lily Articles;
$pagefname   = __FILE__; // for later logging
$pagedocroot = $_SERVER['DOCUMENT_ROOT'];
require_once ($pagedocroot/include_db/db_connect.php);
require_once ($pagedocroot/include/funcs.php);

Hope that helps.

Gerry


On 1/9/06, Nuno Trancoso [EMAIL PROTECTED] wrote:

 This may sound dumb, but i have been up all night going through
 php/apache docs, and still have not found an answer..

 Throughout a site i need to include files that are scattered in subdirs,
 sometimes up in the dir tree, sometimes down. Bad design i know but i
 have to live w/ it...

 Problem is in the way Apache/PHP see stuff. If i include /somefile.htm
 in html, it means somefile.htm wich is at site root dir. In PHP it looks
 like it means somefile.htm at SERVER root dir.



Re: [PHP] Floating numbers truncating to two digits without rounding

2006-01-09 Thread Gerry Danen
Mark,

Why not use sprintf() with an arbitrary large number of decimals and then
discard all but the 2 you want. I.e., format with 10 decimals and then drop
the last 8.

On 1/9/06, Mark Steudel [EMAIL PROTECTED] wrote:

 I am calculating things like tax and want to format them so they only have
 2
 digits past the decimal point. I've been using sprintf but just noticed
 that
 it tends to round up. I want the same functionlity without rounding.

 Thanks




--
Gerry
http://portal.danen.org/


Re: [PHP] PHP4 vs PHP5

2006-01-07 Thread Gerry Danen
Kevin,

[client 192.168.0.2] PHP Notice:  Undefined index:  HTTP_REFERER in
/home/arls_lilies_test/html/include_db/db_connect.php on line 67

is what shows in the error log...

The actual code is

$glb_http_ref =  $_SERVER['HTTP_REFERER'];

Gerry



On 1/7/06, Kevin Waterson [EMAIL PROTECTED] wrote:

 This one time, at band camp, Gerry Danen [EMAIL PROTECTED] wrote:

  I'm wondering if $_SERVER['HTTP_REFERER'] is no longer supported, or
 perhaps
  has a new name?

 still there, same name.

 print_r($_SERVER);

 Kevin


 --
 Democracy is two wolves and a lamb voting on what to have for lunch.
 Liberty is a well-armed lamb contesting the vote.

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




--
Gerry
http://portal.danen.org/


Re: [PHP] PHP4 vs PHP5

2006-01-07 Thread Gerry Danen
On 1/7/06, Kevin Waterson [EMAIL PROTECTED] wrote:

 This one time, at band camp, Gerry Danen [EMAIL PROTECTED] wrote:

  I'm wondering if $_SERVER['HTTP_REFERER'] is no longer supported, or
 perhaps
  has a new name?

 still there, same name.

 print_r($_SERVER);


Ah, yes. It's there when the page is actually referred from somewhere,
otherwise it's not.

Thanks, Kevin.

Now my simple assignment becomes a conditional assignment to avoid clutter
in the error log:

if ( isset($_SERVER['HTTP_REFERER']) )
$glb_http_ref=$_SERVER['HTTP_REFERER'];
else
$glb_http_ref=;

instead of

$glb_http_ref =  $_SERVER['HTTP_REFERER'];

Learning as I go... :)

Gerry


[PHP] PHP4 vs PHP5

2006-01-06 Thread Gerry Danen
I'm wondering if $_SERVER['HTTP_REFERER'] is no longer supported, or perhaps
has a new name?

TIA

Gerry


[PHP] Re: \|/ $PHP_SELF

2001-11-20 Thread Gerry Figueroa Anadon

Any Ideas as to how I could be able to acomplish this?
or 
How could I get the path of the main page and pass it on to the included file for 
processing?.

thanks!

Fred wrote:

 $PHP_SELF will always give the name and path of the main file, even if the
 variable is set in an included file.  The reason is that the included file
 is included before the variable is evaluated.
 
 Fred

-- 
Gerry Figueroa
Dynamic Intermedia

-- 
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] \|/ $PHP_SELF

2001-11-19 Thread Gerry Figueroa Anadon

Does $PHP_SELF always get's the path of the document it resides in even if the 
document is an include?

I'm trying to set one of those breadcrumb path navigation scripts and I don't want to 
copy the
script to every directory, I just want to include it in my header.inc.

As a result I only get the home directory link that way.

I tryed using a variable like  $string=$PHP_SELF; then in the script I replaced the 
line:

$str=$PHP_SELF; with $str=$string; , but it turn out as an empty variable.

Here is the original unaltered php:

$site = http://.$HTTP_HOST./;; 
 //$site = http://site.com;; 
 
$str=$PHP_SELF;

ereg(^(.+)/.+\\..+$, $str, $part); 
$str = $part[1]; 
$str = substr($str, 1); 

$label =  array(home=Home,
anunciate=Anunciate, 
 encuentreMedico=Encuentre un Medico, 
 anunciateHospital=Anunciate Hospital, 
 anunciateMedico=Anunciate Medico, 
 article=Article, 
 encuentreHospital=Encuentre un Hospital); 
 
if (ereg('/', $str)){ 
$arr = split(/, $str); 
$num = count($arr); 
for($i=0; $i  $num; ++$i){ 
echo(  a
href=\. $site . $arr[$i] ./\.$label[$arr[$i]]./a); 
$site = $site . $arr[$i] ./; 
} 
}elseif (ereg([a-zA-Z_]{1,}$,$str)){ 
$arr = $str; 
echo(  a
href=\http://.$HTTP_HOST./.$arr./\;.$label[$arr]./a); 
}else{ 
echo(); 
} 

Thanks:

Gerry Figueroa
Dynamic Intermedia

-- 
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] Results of survey I asked

2001-08-13 Thread Gerry Kirk

Earlier, I asked some questions about what you use in developing PHP 
applications. First, the questions, and then the answers:

Questions
1. Code libraries used:
a) Metabase (for database abstraction)
b) PHPLib
c) PEAR
d) BinaryCloud
e) other

2. What code editor do you use?

3. How many are using templates, and if so, are you using a template 
framework:
a) PHPLib
b) Smarty
c) other?

Answers (number of respondents in brackets)
1.  adodb (1)
 BinaryCloud (1)
 A mixture of PEAR's database abstraction, PHPLIB's template class 
and my own libraries and classes (1)

2. UltraEdit (1), DreamWeaver 4 (2), AceHTML4 Pro from visicom.com (1), 
Homesite (2), vim (1), FrontPage (1), PHPCoder http://www.phpide.de (2), 
emacs (1), TextPad (1), ConTEXT (1), EditPlus (1)

3. Smarty (1)

Summary: not a huge statistical sample, but interestingly there were hardly 
any duplicate responses. Also, it seems using published templates and code 
libraries is not that popular, i.e. most people are writing their own code 
from scratch.

Gerry


[PHP] Feasibility of using XML, PHP for a database-driven web application

2001-08-06 Thread Gerry Kirk

Hello,

I've been doing some research to assess the feasibility of using PHP and 
XML for a web-based database-driven application. From what I've read, it 
seems that presently the costs of using XML outweigh the benefits.

Here are the costs I see:
1. XML standards are still maturing
2. XSLT is complex and difficult to understand
3. Their is minimal support for XML in relational databases, and none for MySQL
4. PHP's XML tools are still in their infancy
5. The processing time to go from SQL to XML to HTML via XSLT is often high.

The benefits?
1. Greater abstraction between data, logic and presentation which can be 
easier to design, develop and maintain.

Your thoughts?

Thanks,
Gerry Kirk


-- 
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] What tools do you use to develop PHP?

2001-07-30 Thread Gerry Kirk

Hi,

I'm putting together a PHP development framework for our small group. We
have worked on a couple of small apps, so now it's time to do things a
little more methodically, i.e. make life easier for everyone. :)

So, I scanned the web and found quite a few options for code libraries,
and a few for PHP code editors. 

I'm interested to know what tools / libraries people prefer -

1. Code libraries:
a) Metabase (for database abstraction)
b) PHPLib
c) PEAR
d) BinaryCloud
e) other

2. What code editor do you use?

3. Source code control. CVS appears to be the only real option here.

TIA,
Gerry


-- 
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] What tools do you use to develop with PHP? (more questions)

2001-07-30 Thread Gerry Kirk

I forgot to also ask, how many are using templates, and if so, are you
using a template framework:
a) PHPLib
b) Smarty
c) other?

Gerry


-- 
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] Compiler advice please!

2001-05-24 Thread Gerry

Hi this is probably of the scope of the list since it is a c++ question. (sorry)

 I'm trying to learn a few things about c++ and I'm using gcc on my
Linux box. The problem I encountered is with the floating point
manipulation classes or functions like fixed and showpoint, I get a
compile error saying they are not declared. I triyed the gcc.gnu site
but I could not find a support maillist like this one. After endless
fruitless searches on the web I decided to give you a shot since you
have answered many of my PHP questions and I know some of you do a lot
more than just PHP related development. 

Could someone point me in the right direction please, maybe a site or
mailgroup where I could ask about this?

Thanks in advance and sorry for the inconvenience!

Gerry

-- 
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] Working with numbers

2001-05-09 Thread Gerry

Could you suggest a function for displaying decimal zeros.

For example I have this:
$num = 2.00;
$num2 = 3.00;
$result = $num + $num2;
echo $result;

I get 5 but not 5.00


Anyone outhere?

Thanks in advance!

Gerry Figueroa

-- 
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] Calling a function that resides elsewhere

2001-04-11 Thread Gerry

I hope you understand:

It is too long to include here so I'll give you an idea.

file.B
---
?php
$all_cats = "1, 2, 3";
function html_options($output, 
$values = NULL,
$selected = NOT_NULL,
$first_option_output = false)
}
return($html_output);
}

echo"select name=\"cat\" size=\"1\"";
//-cats
$cats = explode(',',$all_cats);
//--values
$cats_vals = explode(',',$all_cats);
print html_options($cats, $cats_vals, $selected, "--Select one--");
echo"/SELECT";
?


file.A code:
?php
$connect to db;
$get result;
$cat = $row["cat"];
$selected = "$cat"; 
---
include ("file.B");
---
done
?
From here on I get the menu with --select one-- option first then 1, 2,
3, but it ignores the fact the I told it $selected = "$cat". I figure it
has to do with including the function file instead of having the
function inside of "A". How can I call file.B from different files and
have it accept the variable $selected from such files?

Thaks in advance:

Gerry Figueroa

-- 
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] PHP+MySQL SEARCH

2001-02-18 Thread Gerry

I got this from a book but given the fact that it would only search for
one type of information I modified it and it works great, but I wanted
to know what you think about it if anything. Could an array be maid to
trim it down?


if ($search_in == "1"){
   $query1 = "SELECT * FROM FISH where  ID LIKE '%$search_text%'
OR name LIKE '%$search_text%' OR Category LIKE '%$search_text%' OR Color
LIKE '%$search_text%' OR Size LIKE '%$search_text%'";
}

Any feedback would be a preciated.
-- 
Gerry Figueroa
-- - -  -   --*
War does not determine who is right, war determine who is left.

-- 
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] File_exists function question.

2001-02-15 Thread Gerry

Hello everyone:

I'm trying to build a table with the last row being a check function for
an image, where it checks if the item image exists in the image
directory and either echos "no image" or places a small icon of
something (I guess you could say Ebay style). 

The problem is that the fuction checks for an image matching the first
row item id and then it copies the same result to  the remaning item
rows weather they have images or not. I read that I could use the
clearstatcache() to clear the cache and start again but there must be
something wrong with the way I persive the use of this.

this is the code:

$fn = "directory/images/$id.gif";
if (!file_exists($fn)) {
echo "no image";
} else {
echo"img src=\"$siteurl/images/camara.gif\""; 

clearstatcache();
}

Could anyone that sees what's wrong with this drop me a line?

Thanks in advance:
-- 
Gerry Figueroa
-- - -  -   --*
War does not determine who is right, war determine who is left.
|XXX|-^|XX|

-- 
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] File_exists function question.

2001-02-15 Thread Gerry

Hello again:

Ben Peter wrote:
 
 Gerry,
 
 could you give us a bit more code, esp. the while or for loop that
 surrounds the code you have quoted?
 
 Cheers,
 Ben


Sorry for the confusion, and yes I did mispelled camera in english. Here
is more of my sloppy code. I might have an extra }...not sure though
since I have anther couple of "ifs" above it. the code works fine, but
not the "(!$file_exists)" part since it seams it is not checking and it
gives the same result all over the table--"no image". I did change
things as suggested I think, but stll get the same thing. 


 echo"table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"
width=\"100%\" bgcolor=\"ff\"\n";
echo"tr/n"; 

while ($row = mysql_fetch_array($sql_result)) {

echo"/tdtd width=\"20%\" align=\"center\" valign=\"top\"font size=\"2\"/n";
echo $row["name"];
echo "/font\n";
echo"/tdtd width=\"20%\" align=\"center\" valign=\"top\"font size=\"2\"/n";
echo $row["Color"];
echo "/font\n";
echo"/tdtd width=\"20%\" align=\"center\" valign=\"top\"font size=\"2\"";
echo $row["Size"];
echo "/font\n";
echo"/tdtd width=\"20%\" align=\"center\" valign=\"top\" /form ";
echo"td width=\"20%\" align=\"center\" valign=\"top\"font size=\"2\"";
$fn = "/images/$ID.jpg";
if (!file_exists($fn)) {
echo "not working yet";
} else {
echo'img src=\"http://site.com/images/camera.gif\"'; 
clearstatcache();
}
 echo"trtd colspan=\"5\" valign=\"top\"hr size=\"1\"/td/tr";
}
echo"/table";
}

-- 
Gerry Figueroa
-- - -  -   --*
War does not determine who is right, war determine who is left.

|XXX|--^|XX|

-- 
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] Select list with PHP

2001-02-03 Thread Gerry

Hello:

I'm trying to create dinamic color SELECT lists with php. I have my
database set up as follows:

Paint = good
bucket = good
weight = 100kg
Colors = green, blue, red

and here is my php:

while ($row = mysql_fetch_array($sql_result)) {
echo"trtd";
echo $row["paint"];
echo"/tdtd";
echo $row["bucket"];
echo"/tdtd";
echo"form action=\"http://www.\" method=\"POST\"";
$Color  = $row["Color"];
if ($Color == $Color) {
$option .= "OPTION value=\"$Color\" selected$Color/OPTION";
} else {
$option .= "OPTION value=\"$Color\"$Color/OPTION";
}
echo"select name=\"Colors\"";
echo "$option";
echo"/select"; 

as you can see I end up with a select menu with this "green, blue, red"
as the only option.

is there a way I can tell php3 to break it down at "," so I can actually
have a drop down menu 

Thanks ahead:
Gerry Figueroa
--
Modern Confucius:
Man who run in front of car get tired.
--

-- 
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] Newbie frustration!

2001-01-23 Thread Gerry

Hi Mick:

You wrote:
 
Can't the
 index.php script pull content from any number of different directories?,
 eg:
 
 index.php?page=Yarns/stuff
 index.php?page=Rovings/stuff
 index.php/page=dir3/stuff

Well the thing is that there is probably a few ways to do this and I
thought of the way you just presented to me. I can see a redirect to
page=Yarns/stuff. What is stuff by the way? Where do I find this script? 

My way of doing this (novice way), is  I made my index.php and added
variables to call the header, navigation, content and footer. The
content is loaded with a variable like include "content.html"; not much
to it but at this point is useless if I have to do this inside every
directory (eg. Yarns/index.php3) add all the variables and also place a
content.html in every directory. I can see I'm doing it all wrong now.
All I need is to be able to learn how to load everything from a script
and  how to call the script with a URL to the directory.
eg. ? if (Yarns/) 
{
include "header,nav, fetch content,footer";
else "?";
}
?

a href="http://mysite.com/Yarns/" Yarns/a

Right! I can see this would not work, because I'm missing some things.
Don't worry if you got it wrong, I don't know if you did! I wish it
where this simple anyway.

Thanks!

Gerry Figueroa

-- 
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] Anything similar to phpmyedit?

2001-01-16 Thread Gerry Chu

I'm looking for something exactly like phpmyedit (mysql database
displayer/editor) but where I can edit more than one database row at a
time.  Is there anything like this?

Thanks,

Gerry


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