[PHP] OT - representing data

2002-03-29 Thread Alastair Battrick

Hi All

I have over 26000 urls in a table. They are all urls and query strings of
hits to the same 10 - 20 sites.

I need to have a way to allow the user to select one of these, and then do
some processing on it, and I'm struggling to find a way.

I did have a select dropdown with a list of them, but that has become
unmanageable, even when coupled with a restrictor text box. For example, the
user types 'david' in the restrictor, and then the dropdown only lists those
urls with '%david%'

Has anyone got a genius way of allowing the user to select one easily and
without having to download all 26000.

TIA

Alastair Battrick
Senior Developer
Lightwood Consultancy Ltd
http://www.lightwood.net


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




RE: [PHP] fsockopen

2002-03-26 Thread Alastair Battrick

Is $tempPort set ?

Alastair Battrick
Senior Developer
Lightwood Consultancy Ltd
http://www.lightwood.net


 -Original Message-
 From: Christoph Starkmann [mailto:[EMAIL PROTECTED]]
 Sent: 26 March 2002 12:40
 To: '[EMAIL PROTECTED]'
 Subject: [PHP] fsockopen


 Hi!

 I'm trying to check the validity of given hyperlinks...
 I thought this code should work (Apache 1.3.9, Win98)

 $tempUrl = ereg_replace(http://;, , $url);

 $fp = fsockopen ($tempUrl, $tempPort, $errno, $errstr, 30);

 if (!$fp)
 {
 echo brerror opening $url: \$errstr=$errstr, \$errno=$errnobr\n;
 }
 else
 {
 fputs ($fp, GET / HTTP/1.0\r\n\r\n);
   echo brs . fgets($fp,1024);
 fclose($fp);
 }

 For each and every url,

 $fp = false;
 $errstr = ;
 $errno = 0;

 Where is my mistake? I guess I'm simply getting sth wrong...

 Any hint would be great.

 Cheers,
 Kiko

 -
 It's not a bug, it's a feature.
 christoph starkmann
 mailto:[EMAIL PROTECTED]
 http://www.fh-augsburg.de/~kiko
 ICQ: 100601600
 -

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

2002-03-26 Thread Alastair Battrick

There are a few things that it could be.

Change the ereg_replace to str_replace

Try adding Host: $server_name on the line after the GET:

fputs ($fp, GET / HTTP/1.0\r\nHost: $server_name\r\n\r\n);

iirc, if the server uses virtual hosts, the GET won't work properly without
it.

If that's not it, try adding this instead of your single echo line:

while (!feof ($fp)) {
  $line = fgets($fp, 4096);
  echo $line;
}

As that will return and echo all the page, not just the header.

Alastair

 -Original Message-
 From: Christoph Starkmann [mailto:[EMAIL PROTECTED]]
 Sent: 26 March 2002 12:48
 To: '[EMAIL PROTECTED]'; Christoph Starkmann; [EMAIL PROTECTED]
 Subject: RE: [PHP] fsockopen


 Hi!

  Is $tempPort set ?

 Yes... 80 as default...

   $tempUrl = ereg_replace(http://;, , $url);
  
   $fp = fsockopen ($tempUrl, $tempPort, $errno, $errstr, 30);
  
   if (!$fp)
   {
   echo brerror opening $url: \$errstr=$errstr,
  \$errno=$errnobr\n;
   }
   else
   {
   fputs ($fp, GET / HTTP/1.0\r\n\r\n);
 echo brs . fgets($fp,1024);
   fclose($fp);
   }

 Cheers...
 Kiko

 -
 It's not a bug, it's a feature.
 christoph starkmann
 mailto:[EMAIL PROTECTED]
 http://www.fh-augsburg.de/~kiko
 ICQ: 100601600
 -


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




RE: [PHP] sessions

2002-03-20 Thread Alastair Battrick

There must be some whitespace in the script before the opening ?php

Lose that and the error should go with it.

Alastair Battrick
Senior Developer
Lightwood Consultancy Ltd
http://www.lightwood.net 

 I am kind of confused by an error I am getting when trying to destroy a
 session.  Here is the error that I am receiving along with the 
 code that is
 causing the problem.
 
 Warning: Cannot send session cache limiter - headers already sent (output
 started at /home/www/wildwebtech/cumc/default.php:9) in
 /home/www/wildwebtech/cumc/default.php on line 10
 
 ?
   session_start();
 
   $old_user = $cumc_user;  // store  to test if they *were* logged in
   $result = session_unregister(cumc_user);
   session_destroy();
 ?


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




RE: [PHP] Re: Can't display PNG images

2002-03-12 Thread Alastair Battrick

Echoing text to the screen is a very useful debugging tool when creating
images from php, if you type the full location of the image script in the
address bar, rather than specifying it as an image that is opened by a html
page.

If you do this Teresa, you should get the PHP error message, and if you give
this to us it would help.

Alastair Battrick
Senior Developer
Lightwood Consultancy Ltd
http://www.lightwood.net

 -Original Message-
 From: Jordan S. Jones [mailto:[EMAIL PROTECTED]]
 Sent: 12 March 2002 11:29
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: Can't display PNG images


 The icon essentially means that it was a broken image, or that
 they code did
 not work.  I know that wasn't much help.

 On another point, in my opinion, it doesn't make a whole lot of logical
 sense to have a die(Error text) statement in code that creates
 an image..
 If an error does occur, it will still display the same broken image icon.
 However, I am not the definitive word on the matter, and if you or anyone
 else has a different opinion on the matter, I would be more than happy to
 hear it.

 Jordan

 Teresa Narvaez [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hello,
  Background info:
  
  I'm running
  o PHP 4.1.1 on a linux server kernel(2.2.16).
  o Using Netscape Communicator 4.75
  o Compiled and installed the gd(1.8.4) library
 
  Problem(2 problems):
  
  1.- The following code won't display an image(I get an icon of some type
 of
  piece of paper).
  ?php
 header (Content-type: image/png);
 $im = @ImageCreate (50, 100)
or die (Cannot Initialize new GD image stream);
 $background_color = ImageColorAllocate ($im, 255, 255, 255);
 $text_color = ImageColorAllocate ($im, 233, 14, 91);
 ImageString ($im, 1, 5, 5,  A Simple Text String, $text_color);
 ImagePng ($im);
  ?
 
  2.- The configure Command from phpinfo() is different than what
 I actually
  typed at the
  command line.  Also, phpinfo() area for GD does not show PNG or JPEG
  support.  why?
 from phpinfo()
 --
   './configure' '--with-mysql' '--with-apxs=/var/apache/bin/apxs'
   '--with-gd=/home/builder/downloads/untarred/gd-1.8.4'
  '--enable-sockets'
   '--enable-calendar' '--enable-ftp' '--enable-trans-sid'
 What I typed at the command line:
 -
   ./configure --with-mysql --with-apxs=/var/apache/bin/apxs
--with-gd=/home/builder/downloads/untarred/gd-1.8.4
--with-png-dir=/usr/lib --enable-gd-native-ttf --with-ttf
--with-jpeg-dir=/home/builder/downloads/untarred/jpeg-6b
--with-t1lib=/home/builder/downloads/untarred/t1lib-1.3.1
--enable-sockets --with-zlib-dir --with-xpm-dir
 --enable-calenda
 r
--enable-ftp --enable-trans-sid
 
  OUTPUT from phpinfo()
  ---
  GD Supportenabled
  GD Version1.6.2 or higher
  WBMP Support  enabled
 
  I would really appretiate any ideas you could give me.
  Thanks in advance! -Teresa
 
 
 
 



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

2002-03-08 Thread Alastair Battrick

why not multiply the number by 1000 and then use
str_pad($in,6,0,STR_PAD_LEFT)

Alastair Battrick
Senior Developer
Lightwood Consultancy Ltd
http://www.lightwood.net

 -Original Message-
 From: Scott St. John [mailto:[EMAIL PROTECTED]]
 Sent: 08 March 2002 17:02
 To: [EMAIL PROTECTED]
 Subject: [PHP] number_format


 Hi everyone,

 I am trying to format a number for a report, the one consistant thing is
 the three decimal places.  But I need to strip them, then fill in zero's
 from the left.

 So, if the number coming in is 8.000 I need to convert to 00800, 11.070
 would convert to 01107.

 I have tried a combination of number_format and usually end up with 8000
 or 00110.

 Help!  Thank you!  Mind in slow motion this morning.

 -Scott


 --
 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] mktime() into TIMESTAMP ?

2002-03-04 Thread Alastair Battrick

Just make sure that whichever way you choose, you always use the same style,
so things don't get messy.

Personally, I always use INT(11) MySQL columns and store the unix timestamp
and this makes things easy for me. The only exception is when storing dates
that are before 1970, but I very rarely have to do this.

In the end, I guess it depends if you want to do the formatting of the date
field when you're inserting the data (use TIMESTAMP) or when you're pulling
it out (use INT).


Alastair Battrick
Lightwood Consultancy Ltd
http://www.lightwood.net

 -Original Message-
 From: Erik Price [mailto:[EMAIL PROTECTED]]
 Sent: 04 March 2002 22:12
 To: PHP (E-mail)
 Subject: [PHP] mktime() into TIMESTAMP ?


 PHP's mktime() function uses a timestamp that is the number of seconds
 since the Unix epoch.  MySQL uses the MMDDhhmmss format for its
 TIMESTAMP column type.

 I'm not complaining that they're not the same, but curious as to which I
 should use for storing timestamps -- does it matter?  PHP has a lot of
 nice formatting conventions with date(), so I am leaning towards using
 mktime() to store PHP-style timestamps into a MySQL TIMESTAMP column.
 But MySQL does have the ability to format dates, and its TIMESTAMP
 column type bumps up if I don't manually insert a value.

 Any suggestions?


 Erik




 

 Erik Price
 Web Developer Temp
 Media Lab, H.H. Brown
 [EMAIL PROTECTED]


 --
 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] get_browser();

2002-02-18 Thread Alastair Battrick

Have you got the browscap.ini file installed properly ?

and

have you got a up to date version of browscap.ini ?

and

What is reported by IE visitng the script ?


Alastair

 -Original Message-
 From: Chris Boget [mailto:[EMAIL PROTECTED]]
 Sent: 18 February 2002 17:48
 To: [EMAIL PROTECTED]
 Subject: [PHP] get_browser();
 
 
 The following example that is in the onsite documentation:
 
 ?
 function list_array ($array) {
 while (list ($key, $value) = each ($array)) {
 $str .= b$key:/b $valuebr\n;
 }
 return $str;
 }
 echo $HTTP_USER_AGENThr\n;
 $browser = get_browser();
 echo list_array ((array) $browser);
 ?
 
 Isn't working as described in the example output provided on
 the page.  In fact, half the time, get_browser() is returning
 nothing.  And HTTP_USER_AGENT is only returning:
 
 Mozilla/4.7 [en] (Win95; I)
 
 for Netscape.  Why isn't it (get_browser()) providing all the
 information as displayed in the example provided in the docs?
 
 Ultimately, I'm trying to figure out how I can determine if the
 user is using NS 4.x or not...
 
 Chris
 
 
 -- 
 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] how a function 'return' statement works

2002-02-14 Thread Alastair Battrick

Do you not have to make $_SERVER a global variable in the function ?

Alastair
Lightwood Consultancy Ltd

 Hm... I tried quite a few variations on this.  I can't seem to get any 
 displayable value out of this function.
 
 function get_current_page_name()
 {
 $current_page_name = explode(/, $_SERVER['PHP_SELF']);
 $current_page_name = $current_page_name[-1];
 return $current_page_name ;
 }
 
 $errorcode = get_current_page_name();
 echo $errorcode;
 
 Nothing.
 
 The only thing that works is $errorcode = 
 basename($_SERVER['PHP_SELF']), but that's not the point -- I still 
 don't understand why the function above doesn't return anything.  In 
 this case, I'm positive that I've specified the last element of the 
 array.  (Haven't I?)
 
 
 Erik
 
 
 
 
 On Wednesday, February 13, 2002, at 05:03  PM, Darren Gamble wrote:
 
  I think what you're trying to do is return one particular element out 
  of the
  array.  If that's the case, just use something like:
 
  return $current_page_name[-1]
 
  to return the last element in the array.
 
  
 
 
 
 Erik Price
 Web Developer Temp
 Media Lab, H.H. Brown
 [EMAIL PROTECTED]
 
 
 -- 
 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] Cheap, PHP, mySQL hosting!

2002-02-13 Thread Alastair Battrick

 Lookin for about 50 Megs with php4, mySQL and the
 works. Any economical hosts??

You could try:
http://www.datasnke.co.uk
And I am biased...

Alastair
Lightwood Consultancy Ltd


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