[PHP] array help please

2003-01-05 Thread John Fishworld
can someone give me a bit of help / walthrough the following for me !
this first bits is okay
$mysql query1
result
array[cityid][cityname]

mysql query2
result
array[cityid][cityname]

now what i want to do is kick out any doubles in my array and resort them
alphebetically by cityname ?!


help !



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




[PHP] if question

2002-12-17 Thread John Fishworld
Help !

Can anyone tell me why this doesn't seem to work ??

if (($stelle_who != '1') OR ($stelle_who != '2') OR ($stelle_who != '3') OR
($stelle_who != '5') ) {

and what can i use as an alternative syntex ??

thanks in advance



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




Re: [PHP] if question

2002-12-17 Thread John Fishworld
DUH !

Thanks all !
Obviously a slight case of brain death there !

 Hi John,

  Can anyone tell me why this doesn't seem to work ??

 It probably is working, but it's obviously not doing what you want :-)

  if (($stelle_who != '1') OR ($stelle_who != '2') OR
  ($stelle_who != '3') OR ($stelle_who != '5') ) {

 This will always evaluate to true:

 if $stelle_who is 1, it doesn't equal 2 or 3 or 5
 if $stelle_who is 4, it doesn't equal 1 or 2 or 3 or 5

  and what can i use as an alternative syntex ??

 Depends what you're trying to do... most likely switch your ORs to ANDs,
 though (that'll evaluate to true if $stelle_who is neither 1 nor 2 nor 3
nor
 5, and to false if it is any of these).

 Cheers
 Jon

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





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




[PHP] help variables !

2002-11-14 Thread John Fishworld
Hi,

I've got some variable variables which i need to check that they are not the
same !
There can be up to 9 of them !

for ($i = 1; $i = $city_only_one; $i++) {
$citydb = stellen_city_.$i ;
$new_city_db.$i = $$citydb;
 }


Any help appreciated
thanks



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




[PHP] Fw: help please

2002-11-14 Thread John Fishworld
 Hi,

 I've got some variable variables which i need to check that they are not
the
 same !
 There can be up to 9 of them !

 for ($i = 1; $i = $city_only_one; $i++) {
 $citydb = stellen_city_.$i ;
 $new_city_db.$i = $$citydb;

 and what i need to do is check that
 $new_city_db1 does not equal $new_city_db2 or 3 etc
 and then
 $new_city_db2 does not equal 3 + 4 etc...
  }

 Whats the best way of doing this !??


 Any help appreciated
 thanks





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




[PHP] Passing an array on

2002-05-22 Thread John Fishworld

Whats the best way to pass on array on in a link ?

eg
offset is where we are (what page)
but state is an array, with a variable size

href=joblist.php?offset=$offsetstate=$state

thanks



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




[PHP] Best way for date/time

2002-05-11 Thread John Fishworld

Due to the large variety of MySQL and PHP date time formats
I'd like to have a couple of opinions from people out there !

Building a job database - and one of my fields is of course date time !
Which I want to be able to use latter in show all from last week, last month
etc !

Also I want to show the date later in the european from
ie day/month/year !


What is the best format to use ??

Thanks in advance
reagrds
John



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




Re: [PHP] Best way for date/time

2002-05-11 Thread John Fishworld

lol ! no thats not what I meant !
what's best to put into MySQL
datetime from MySQL
now()
or from php date !

Regarding the format - its a german site so not expecting many yanks there !
:-))


 On Saturday 11 May 2002 19:42, John Fishworld wrote:
  Due to the large variety of MySQL and PHP date time formats
  I'd like to have a couple of opinions from people out there !
 
  Building a job database - and one of my fields is of course date time !
  Which I want to be able to use latter in show all from last week, last
  month etc !
 
  Also I want to show the date later in the european from
  ie day/month/year !
 
 
  What is the best format to use ??

 IMHO the best is /MM/DD, should (hopefully) be obvious to anyone.

 Using DD/MM/ would confuse the poor yanks :)

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

 /*
 The PINK SOCKS were ORIGINALLY from 1952!!  But they went to MARS
 around 1953!!
 */

 --
 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] Best way for date/time

2002-05-11 Thread John Fishworld

Okay so I've then got

2002-05-08
and whats then the best way to manipulate it regarding
plus 3 days or plus 4 weeks ?




  lol ! no thats not what I meant !
  what's best to put into MySQL
  datetime from MySQL
  now()
  or from php date !
 
  Regarding the format - its a german site so not expecting many yanks
there
  !

 Sorry :)

 In that case it's best to stick to mysql's native format.

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

 /*
 I use not only all the brains I have, but all those I can borrow as well.
 -- Woodrow Wilson
 */

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





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




[PHP] Confirm Remote File exists !

2002-05-06 Thread John Fishworld

I've got a form where people can enter a link into !

What's the best and quickest way of confirming if the link exists !
Just use fpassthru and see if you get an error ?
Or has anyone got any better suggestions ??



Regards
John



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




Re: [PHP] Re: Forum with PHP, without using mySQL..

2002-05-06 Thread John Fishworld

Why bother posting a perl forum here !

YaBB is a leading FREE, downloadable Perl forum that allows you to provide a
real-time chat and support system for your visitors. While chat programs
allow people to talk directly, you have to be on them 24/7 to please
everyone. With forum software like YaBB, you can talk any time, and everyone
can join or read the conversation. So get visitors coming back, for
interesting discussions, fun chit chat, or needed support without having to
spend thousands of dollars.



 www.yabbforum.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




[PHP] function sql question

2002-05-05 Thread John Fishworld

I've got a small function which checks city name with post codes
And because this needs to be checked in several scripts I want to have it in
my common functions file
and include it !
  require (common_funtions.inc);

and then use it
if (!check_city_from_plz($t_zipcode)){
echo  TRTD colspan=\2\BIYour city does not exist with the
plz!/I/BBR/TD/TR
;
}

It doesn't work though, I'm sure it something simple but can someone please
point me in the right direction !

This is the function itself

function check_city_from_plz($str) {
connect and select database
$city_query = select distinct t_city_name,t_city_id_city from
t_city,t_zipcodecity where
(t_city_id_city = t_zipcodecity_id_city) and (t_zipcodecity_zipcode like
'$str');

$city_result = mysql_db_query(DBWEB, $city_query);
if ($city_result) {
while ($q = mysql_fetch_array($city_result)) {
$city_id = $q[t_city_id_city];
$cityname = $q[t_city_name];

if ($cityname !=) {
   return 1;
   return $city_id;
   return $cityname;
   } else {
   return 0;
   }

   } // close if
   } // close while
   } //  close function

Thanks in advance !




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




Re: [PHP] function sql question

2002-05-05 Thread John Fishworld

duh !
yeah that makes sense !
but it doesn't work !
I've no idea why but it refuses to give any information back !

I've managed to get round this by now no loger declaring it a function
but just actually requiring it where i need it

require (get_city_1.inc);
print_r(array_values ($city));

I've also chopped the return part
and just return the values

 $city[0] = $city_id;
 $city_name[1] = $city_name;

Strange


 return 1;
 return $city_id;
 return $cityname;

 You can't return 3 values...try returning an array, instead.

 $ret[0] = $city_id;
 $ret[1] = $cityname;
 return $ret;

 or...

 $ret[City_ID] = $city_id;
 $ret[CityName] = $cityname;
 return $ret;

 ---John Holmes...





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




[PHP] Opinions Wanted

2002-05-02 Thread John Fishworld

Just a general question of the best way to do it !
I've got a job search site with mysql at the back of it !
You choose on the first page - type of job, where and other bits,
go to the next page where query is done and then lists the jobs available!

Whats the best way of keeping this page temporarily in existence ??

I don't want the query to run every time when they have changed no
information and I don't want the Warning Page has expired please re-submit
details when the reload the page !

At the moment I'm thinking I can create a temporary static version of the
page ?
but would like to here some other opinions about it !

Thanks



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




Re: [PHP] PHP Editors

2002-05-01 Thread John Fishworld

I've used Edit  Plus and Dreamweaver as a combination for a while !
And the new Dreamweaver is worth getting !
I've set it up in 10 minutes with my Linux box using there PHP and MySQL and
first impressions are very good !
Much better than Ultradev was and a hell of lot quicker and more stable than
the new GoLive !
Good I've only been using it a day and half and so these are purely first
impressions - but seeing as at least until June its free I'd recomend at
least trying it !

(oh I also quite like TextPad but have somehow always got on better with
EditPlus )



  I would love to hear other people's experiences with these editors
though.

 Second that. Has anyone used this new Dreamweaver? What's it like? I guess
 I'll have to download it tonite. Dreamweaver used to be my favorite, but
it
 sucks for PHP so now I'm hooked on TextPad. Let us know if you have any
 experience using Dreamweaver MX.

 ---John Holmes...


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





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




[PHP] regular expressions help please

2002-04-30 Thread John Fishworld

I'm trying to find files in my array
for example
=lg_imode.gif
and
=/db/imodeklein/edgar-IMODE-1-.gif

I want to differentiate between the files with slash at the front and ones
without so that
I can add a server path !
but as usual I' m having problems with the correct regex

At the moment I've got this to find files with forward slash
eregi_replace(([^\]+[/+]+[a-z_/-]+[gif]+[/$]) ,
and it seems to work.(although I think it's wrong)

And I'm trying this to find the files without the slash at the front
eregi_replace(([^\]+(a-z_)+[gif]$) ,

which is definately not working.

help !




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




Re: [PHP] regular expressions help please

2002-04-30 Thread John Fishworld

Okay right I'm experimenting with an i-mode parser !
I copy the file (url entered) to a local location !
Then read through the whole file line at a time and change/replace the
things that need replaceing !
On of the things that I need to replace is the links to the pictures so that
they still show even !
I've already got from the original file the original location
http://www.whatever.com
and now want to insert that in front of the gif files
ie
$imode_code[$i] = eregi_replace((img src=).+\.gif\ ,
\\1$next_path\\2,$imode_code[$i]);

There are just gif files in this !

Does that make more sense ?

 On Tuesday 30 April 2002 16:31, John Fishworld wrote:
  I'm trying to find files in my array
  for example
  =lg_imode.gif
  and
  =/db/imodeklein/edgar-IMODE-1-.gif

 Perhaps you should clarify your problem. First of all does your array
contain
 just gif files (ie *.gif) or does it contain all sorts of files? (ie
 readme.txt, important.doc, funny.gif etc)

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

 /*
 In a consumer society there are inevitably two kinds of slaves:
 the prisoners of addiction and the prisoners of envy.
 */

 --
 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] regular expressions help please

2002-04-30 Thread John Fishworld

$imode_code = file($url_file);
$file_name = basename($url_file);
$path = dirname($url_file);
$stripped_path = eregi_replace(^(.{2,6}://)?[^/]*/, , $path);

$next_path = eregi_replace($stripped_path, , $path);
$next_path_1 = eregi_replace(/$ , , $next_path);

// create and open a file to write to
$new_file = files/.$file_name;
$fh = fopen($new_file , w);

$lines = count($imode_code);
// echo Lines = $lines;

for ($i; $i$lines; $i++) {

// add server path to gifs with front slashes /hello/john.gif
// $imode_code[$i] = eregi_replace(([^\]+[/+]+[a-z_/-]+[gif]+[/$]),
$next_path_1\\0,$imode_code[$i]);

// add server path to gifs withour front slashes john.gif
// $imode_code[$i] = eregi_replace(\.gif ,
$next_path/\\0,$imode_code[$i]);

// changes links so also for server paths for html + chtml + php

// $imode_code[$i] = eregi_replace(([a-z_]+[.]+[chtml]),
$next_path_1\\0,$imode_code[$i]);
// $imode_code[$i] = eregi_replace(([^\]+[a-z_]+[\.html]+[\$]),
$next_path_1\\0,$imode_code[$i]);
// $imode_code[$i] = eregi_replace(([^\]+[a-z_]+[\.php]+[\$]),
$next_path_1\\0,$imode_code[$i]);

// replace imode pictos with a real gif
$imode_code[$i] = ereg_replace(#([0-9]{5}); , img
src=\pictos/\\1.gif\ border=\0\ , $imode_code[$i] );

// write the whole lot to file
fputs ($fh, $imode_code[$i]);
}
// close file
fclose($fh);
// display file
echo IFRAME border=0 marginWidth=0 src=\files/$file_name\ frameBorder=0
width=150 height=131 marginheigth=0
   /IFRAME;

?
/body
/html


 On Tuesday 30 April 2002 19:17, John Fishworld wrote:
  Okay right I'm experimenting with an i-mode parser !
  I copy the file (url entered) to a local location !
  Then read through the whole file line at a time and change/replace the
  things that need replaceing !
  On of the things that I need to replace is the links to the pictures so
  that they still show even !
  I've already got from the original file the original location
  http://www.whatever.com
  and now want to insert that in front of the gif files
  ie
  $imode_code[$i] = eregi_replace((img src=).+\.gif\ ,
  \\1$next_path\\2,$imode_code[$i]);
 
  There are just gif files in this !
 
  Does that make more sense ?

 Unfortunately, no. Could you post say 20 lines of this file you're talking
 about.

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

 /*
 You are in a maze of little twisting passages, all different.
 */

 --
 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] regular expressions help please

2002-04-30 Thread John Fishworld

Duh ! lol sorry !

Example 1

html
head
 meta http-equiv=content-type content=text/html;charset=iso-8859-1
 meta name=generator content=Edit Plus
 titleLocations/title
 /head
 body bgcolor=#6699FF
  div align=center
  pfont color=blackWelcome tobr
/fontfont color=redimg src=lg_imode.gif alt= height=36
width=120 align=baseline border=0br
 div align=leftYour Preference:/divbr
 a accesskey=1 href=schwul.php4#63879; Schwul/abr
 a accesskey=2 href=lesbisch.chtmlLesbisch/abr
/fontp/p
  /div
 /body
/html

Example 2

htmlheadtitlei-mode/title/head
body
div align=centerimg SRC=/imode/img/logo_40.gif vspace=3
alt=logobrimg src=/imode/img/desc.gif alt=E-Cards
verschicken/div

hr noshade size=2
nbsp;#59106;nbsp;a accesskey=1 href=#sAuswahl/abr
nbsp;#59107;nbsp;a accesskey=2
href=imode.fpl?op=categorylistuid=55%2eFAGAEpartner=Mehr Karten/abr
nbsp;#59108;nbsp;a accesskey=3
href=imode.fpl?op=searchlistuid=55%2eFAGAEpartner=Karten suchen/abr
nbsp;#59109;nbsp;a accesskey=4
href=imode.fpl?op=impressumuid=55%2eFAGAEpartner=Impressum/abr

hr noshade size=2
nbsp;a name=sfont color=#ccEdgars Auswahl/font/abr
div align=center
img src=/db/imodeklein/edgar-IMODE-1-.gif vspace=2br#59091;nbsp;a
href=imode.fpl?op=imodecardprefix=IMODEnummer=1suffx=uid=55%2eFAGAEpar
tner=verschicken/abr
img src=/db/imodeklein/edgar-IMODE-6-.gif vspace=2br#59091;nbsp;a
href=imode.fpl?op=imodecardprefix=IMODEnummer=6suffx=uid=55%2eFAGAEpar
tner=verschicken/abr
img src=/db/imodeklein/edgar-IMODE-2-.gif vspace=2br#59091;nbsp;a
href=imode.fpl?op=imodecardprefix=IMODEnummer=2suffx=uid=55%2eFAGAEpar
tner=verschicken/abr
img src=/db/imodeklein/edgar-IMODE-7-.gif vspace=2br#59091;nbsp;a
href=imode.fpl?op=imodecardprefix=IMODEnummer=7suffx=uid=55%2eFAGAEpar
tner=verschicken/abr

/div

hr noshade size=2
nbsp;#59115;nbsp;a accesskey=0
href=http://www.baesurl.com/imenu/;i-menu/a

/body
/html


 On Tuesday 30 April 2002 19:43, John Fishworld wrote:

  $imode_code = file($url_file);
  $file_name = basename($url_file);
  $path = dirname($url_file);
  $stripped_path = eregi_replace(^(.{2,6}://)?[^/]*/, , $path);

   On Tuesday 30 April 2002 19:17, John Fishworld wrote:
Okay right I'm experimenting with an i-mode parser !
I copy the file (url entered) to a local location !
Then read through the whole file line at a time and change/replace
the
things that need replaceing !
On of the things that I need to replace is the links to the pictures
so
that they still show even !
I've already got from the original file the original location
http://www.whatever.com
and now want to insert that in front of the gif files
ie
$imode_code[$i] = eregi_replace((img src=).+\.gif\ ,
\\1$next_path\\2,$imode_code[$i]);
   
There are just gif files in this !
   
Does that make more sense ?
  
   Unfortunately, no. Could you post say 20 lines of this file you're
   talking about.

 I mean the file that you're readingparsing, not your program.

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

 /*
 The absent ones are always at fault.
 */

 --
 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] regular expressions help please

2002-04-30 Thread John Fishworld

Thanks after playing about with that I've got the following which does seem
to work !

$imode_code[$i] = eregi_replace((src=)(\)([a-z0-9_\/-]+\.gif)(\),
\\1\\2$path/\\3\\2, $imode_code[$i]);

Very very very slowly getting the hang of regexs !

What does your /i do at the end ???

Thanks

 Try this:

   preg_match_all(/src=(\'[a-z0-9_\/-]+\.gif\')/i, $input, $MATCH);
   print_r($MATCH);

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

 /*
 Money is its own reward.
 */

 --
 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] regular expressions help please

2002-04-30 Thread John Fishworld

aha !
thats very strange then because mine works at the moment but if I add the /i
at the end then it doesn't !

 On Wed, 1 May 2002, John Fishworld wrote:
  Thanks after playing about with that I've got the following which does
seem
  to work !
 
  $imode_code[$i] = eregi_replace((src=)(\)([a-z0-9_\/-]+\.gif)(\),
  \\1\\2$path/\\3\\2, $imode_code[$i]);
 
  Very very very slowly getting the hang of regexs !
 
  What does your /i do at the end ???

 Makes it case-insensitive, so gif and GIF are treated identically.

 miguel





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




[PHP] reg-ex again

2002-04-29 Thread John Fishworld

I'm trying to find files in my array
for example
=lg_imode.gif
and
=/db/imodeklein/edgar-IMODE-1-.gif

I want to differentiate between the files with slash at the front and ones
without so that
I can add a server path !
but as usual I' m having problems with the correct regex

At the moment I've got this to find files with forward slash
eregi_replace(([^\]+[/+]+[a-z_/-]+[gif]+[/$])
and it seems to work.(although I think it's wrong)

And I'm trying this to find the files without the slash at the front
eregi_replace(([^\]+(a-z_)+[gif]$)

which is definately not working.

help !
thanks !






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




Re: [PHP] Re: reg-ex again

2002-04-29 Thread John Fishworld

No the problem is I'm reading a file into an array and then need
to change any of the links in the file from relative links to absolute links
!
So that my lg_mode.gif gets the full server path in front of it
http://www.ltest.com/lg_mode.gif

and exactly the same with the other one but of course I don't won't

http://www.test.com//folder/name.gif


   I'm trying to find files in my array
   for example
   =lg_imode.gif
   and
   =/db/imodeklein/edgar-IMODE-1-.gif
 
   I want to differentiate between the files with slash at the front and
ones
   without so that
   I can add a server path !
   but as usual I' m having problems with the correct regex

 what about something simple as:

 $str = /db/skod.gif;

 if (strpos($str, /) == 0) {
echo Slash first;
 } else {
   echo Slash not first;
 }

 --
 Henrik Hansen

 --
 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: reg-ex again

2002-04-29 Thread John Fishworld

Sorry don't think I've explained this very clearly ! :-))

Start again 

People can enter a url with code in, this gets copied to a different server
and read as an array !
At this point, the original server path needs to be added to the links in
the copied file.
The basics of this do actually already work - I just need the regex
expression to find any files
with name.gif (only allowing letters,numbers and _)
and to find files /pics/name.gif - that is same rule but starting with a
forward slash

And at that point they all get replaced with the server path and written to
the file !


 On Monday 29 April 2002 17:10, John Fishworld wrote:
  No the problem is I'm reading a file into an array and then need
  to change any of the links in the file from relative links to absolute
  links !
  So that my lg_mode.gif gets the full server path in front of it
  http://www.ltest.com/lg_mode.gif
 
  and exactly the same with the other one but of course I don't won't
 
  http://www.test.com//folder/name.gif
 
 I'm trying to find files in my array
 for example
 =lg_imode.gif
 and
 =/db/imodeklein/edgar-IMODE-1-.gif

 I want to differentiate between the files with slash at the front
and
 
  ones
 
 without so that
 I can add a server path !
 but as usual I' m having problems with the correct regex

 Not sure if I understand your problem correctly.

 Define your server path as: http://www.myserver.com/some/path  (NB no
 trailing slash)

 If the first char of file contains '/' use:

   $server_path$file

 otherwise use:

   $server_path/$file

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

 /*
 Why is the alphabet in that order?  Is it because of that song?
 -- Steven Wright
 */

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





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




[PHP] More reg-ex probs

2002-04-29 Thread John Fishworld

I'm trying to find files in my array
for example
=lg_imode.gif
and
=/db/imodeklein/edgar-IMODE-1-.gif

I want to differentiate between the files with slash at the front and ones
without so that
I can add a server path !
but as usual I' m having problems with the correct regex

At the moment I've got this to find files with forward slash
eregi_replace(([^\]+[/+]+[a-z_/-]+[gif]+[/$]) ,
and it seems to work.(although I think it's wrong)

And I'm trying this to find the files without the slash at the front
eregi_replace(([^\]+(a-z_)+[gif]$) ,

which is definately not working.

help !
thanks !









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




Re: [PHP] create textfile if not existing?

2002-04-29 Thread John Fishworld

This works but the w means that it writes over whats already in the file
(look at the manual about fopen for more details)

$new_file = txt/whatever.txt;
$fh = fopen($new_file , w);

// write the changed new file
fputs ($fh, $new_code);

// now close the file
fclose($fh);

Regards
John

 lets say I have 30 lines of text and I want to store it in a folder called
 txt with the filename $name.txt and, if $name.txt exists, create a
 $name1.txt or similiar?

 Håkan



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





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




[PHP] reg-ex please

2002-04-27 Thread John Fishworld

Help please from one of the reg-ex experts out there please !

I'm trying to find the pattern #(5 number);
example #69880;

This works
$code[$i] = ereg_replace(#([0-9])+ , replace\\0.bing , $code[$i] );

and I get back replace #69880;.bing

but I also want to lose the # and the ;
so I get back 69880.bing

At the moment I just re search and remove the like this
$code[$i] = ereg_replace('#','',$code[$i]);
$code[$i] = ereg_replace(';','',$code[$i]);

but I'm sure that theortetically I can do it in one step !
Can anyone help !
Thanks in advance



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




Re: [PHP] reg-ex please

2002-04-27 Thread John Fishworld

Excellent  :-)))
Thanks !
Can I trouble you again with one more !


I get an url http://whatever/file.whatever (text/html/chtml)

Now trying to do the following get just the http://whatever bit
and go through my array and find .gif or .html or .chtml
and replace the eg pics/my.gif with http://whatever/pics/my.gif

I've only just started with this one so haven't got very far but you were so
quick I thought I'd ask ! :-))

This is my start but its definately wrong !

$code[$i] = ereg_replace(^.+.gif, $url_file\\0,$code[$i]);

er...thanks ! :-))



 Woops , one to many whitespace :)

 --
 Try it like this :
 $code[$i] = ereg_replace(#([0-9]{5}); , \\1.bing , $code[$i] );



 -Ursprüngliche Nachricht-
 Von: Red Wingate [mailto:[EMAIL PROTECTED]]
 Gesendet: Samstag, 27. April 2002 1:26 PM
 An: [EMAIL PROTECTED]
 Betreff: AW: [PHP] reg-ex please

 Try it like this :
 $code[$i] = ereg_replace(#([0-9] {5}); , \\1.bing ,
 $code[$i] );

 -Ursprüngliche Nachricht-
 Von: John Fishworld [mailto:[EMAIL PROTECTED]]
 Gesendet: Samstag, 27. April 2002 1:11 PM
 An: [EMAIL PROTECTED]
 Betreff: [PHP] reg-ex please

 Help please from one of the reg-ex experts out there please !

 I'm trying to find the pattern #(5 number);
 example #69880;

 This works
 $code[$i] = ereg_replace(#([0-9])+ , replace\\0.bing , $code[$i] );

 and I get back replace #69880;.bing

 but I also want to lose the # and the ;
 so I get back 69880.bing

 At the moment I just re search and remove the like this
 $code[$i] = ereg_replace('#','',$code[$i]);
 $code[$i] = ereg_replace(';','',$code[$i]);

 but I'm sure that theortetically I can do it in one step !
 Can anyone help !
 Thanks in advance



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



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



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





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




[PHP] syntax

2002-03-27 Thread John Fishworld

Can someone please remind me what the correct syntax for this is !
in a loop
and want individual

$ned_1_city = blah
$ned_2_city = blur

I've been trying this but its wrong

$ned_.$i._city = $ned_city ;

thanks
john




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




Re: [PHP] syntax

2002-03-27 Thread John Fishworld

Sorry I think I've badly explained this !

I'm getting results from mysql in a while loop
but I need the results outside of the loops
and so what I want to do is take the first variable from the db
and rename it as variable 1
and then before the end of the while loop have a $i++;

so i want
$newvar_$i = result 1
$newvar_$i = result 2

so I can use them outside the loops as
$newvar_1 and $newvar_2

hope that makes more sense !



 Can someone please remind me what the correct syntax for this is !
 in a loop
 and want individual

 $ned_1_city = blah
 $ned_2_city = blur

 I've been trying this but its wrong

 $ned_.$i._city = $ned_city ;

 thanks
 john




 --
 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] Auto password generation

2002-03-26 Thread John Fishworld

something like this

function randString($length=16){
 mt_srand((double)microtime()*100);
 $newstring=;

 if($length0){
  while(strlen($newstring)$length){
   switch(mt_rand(1,3)){
case 1: $newstring.=chr(mt_rand(48,57)); break;  // 0-9
case 2: $newstring.=chr(mt_rand(65,90)); break;  // A-Z
case 3: $newstring.=chr(mt_rand(97,122)); break; // a-z
   }
  }
 }
 return $newstring;
}

$contact_person_pass = randString();

$msg = Your Name:\t$contact_person_name\n;
$msg .= Please use the following details to login in future\n\n;
$msg .= Your E-Mail:\t$contact_person_mail\n;
$msg .= Your Password:\t$contact_person_pass\n\n;
$msg .= You change your password later when you click on 'Firm
Profile'\n\n;

$recipient = $contact_person_mail;

$subject = Login Details;

$mailheaders = From: LesGay whatever@whatever \n;

mail($recipient, $subject, $msg, $mailheaders);



 Hello friends,

 I have a form for registering by the users. This runs on php/mysql.

 Can someone tell me how I could include auto password generation and
 emailing of this password to users?

 Thanks
 denis



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





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




[PHP] Array Question

2002-03-26 Thread John Fishworld

I have some multiple select boxes in a form
ie
 SELECT name=state[] multiple size=5 style=width:360;
  option value=allall Regions /option
  option value=16Region19 /option
  option value=14Region14/option
  option value=5Region15/option

these then get passed and I want to use them in mysql query

blah blah
WHERE
  (t_state_id_state = $state[0])

Whats the best way of finding out how many items are in my array ?
And how can I step through the ones the exist ?
And can I only use LIKE % when my value is all ?

thanks



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




Re: [PHP] Personal web server that runs PHP

2002-03-26 Thread John Fishworld

Also good http://www.omnicron.ca but not free !


 In fact, using Apache Win32 Module on a Windows 98 PC
 is a much better choice  option rather then PWS.
 Apache server gives greater flexibility  support.

 I don't see any reason why you should choose PWS over
 Apache Win32 for your Win 98 PC?

 T. Edison Jr.


 --- R'twick Niceorgaw [EMAIL PROTECTED] wrote:
  u can use Apache on win 98 I believe ?
 
  - Original Message -
  From: Don [EMAIL PROTECTED]
  To: php list [EMAIL PROTECTED]
  Sent: Tuesday, March 26, 2002 12:56 PM
  Subject: [PHP] Personal web server that runs PHP
 
 
  Hi,
 
  Does anyone know of a personal web server that I can
  installon my Win 98
  machine that supports PHP 4.x?
 
  Thanks,
  Don
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 


 =
 Rahul S. Johari (Director)
 **
 Abraxas Technologies Inc.
 Homepage : http://www.abraxastech.com
 Email : [EMAIL PROTECTED]
 Tel : 91-4546512/4522124
 ***

 __
 Do You Yahoo!?
 Yahoo! Movies - coverage of the 74th Academy Awards®
 http://movies.yahoo.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] Array in a Loop Question

2002-03-26 Thread John Fishworld


Brilliant thanks !
I've got three of these in my form ! lol

 I think to get the results you are wanting, you might try this.

 input type='text' name='address[]' value=''
 the address[]  tells the form that this element is an array and when
 submitted, will be converted into an indexed array on the process page.

 so you take this new array on the process page and do something like this.


 foreach($address AS $k = $v)
 {
 echo $k : $v;
 }

 Jim Lucas
 www.bend.com

 - Original Message -
 From: Jeff Hatcher [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, March 26, 2002 10:18 AM
 Subject: [PHP] Array in a Loop Question


 I have a form that gets repeated depending on number of members in a
 group(1 form surrounds all members). I separate the entries by assigning
 a count value to the names of the inputs (Ex. input type=text
 name=address$count value=). Does anyone know how I can pull the values
 back out of the $_POST[]?

 Example of ideal scenario that does not work:
 case process1:
 for ($i=0;$i$_POST[count];$i++)
 {
 $_POST[address$i]
 }

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




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





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




[PHP] reg-ex

2002-03-25 Thread John Fishworld

How can I change this to accept spaces as well ?

(ereg(^[A-Za-zÀ-ÖØ-öø-ÿ]*$, $str))



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




[PHP] Another Session Question

2002-03-25 Thread John Fishworld

I've seen various tutorials on sessions where they specify the session id
instead of just using one
generated by php !

Why ?



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




[PHP] Form Validation Reg EX

2002-03-23 Thread John Fishworld

Hi

I'm just trying to validate an url !
Without tracing or confiming it I just want

www.whatever.max 4 letters

This is what I had but its wrong ! :-))

function check_url($str) {
if (ereg(w{3}.^[a-z0-9-]+(\.[a-z0-9-]+)*$, $str)) {
return 1;
} else {
return 0;
}
}

I just know that some RegEx guru will go of course it should be ...

thanks
john



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




[PHP] Still REG EX

2002-03-23 Thread John Fishworld

I'm still playing about trying to validate an url
www(dot)something(dot)something !

I thought this would work but know

if (ereg(^(w{3})(\\.)([a-zA-Z]+)(\\.)([a-z]{2,4})$, $str))

can anyone explain why not ???

^(w{3}) = three w at start of string ??

(\\.) = literal dot ??

([a-zA-Z]+) match any word with letters ??

(\\.) = literal dot ??

([a-z]{2,4})$ = at least 2 leters eg de but upto 4 eg info

but it doesn't !

thanks in advance
john





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




Re: [PHP] Still REG EX

2002-03-23 Thread John Fishworld

Okay good point but still why doesn't it work ?

thanks
john


 On Sun, 24 Mar 2002, John Fishworld wrote:
  I'm still playing about trying to validate an url
  www(dot)something(dot)something !
 
  I thought this would work but know
 
  if (ereg(^(w{3})(\\.)([a-zA-Z]+)(\\.)([a-z]{2,4})$, $str))

 First of all, web server hostnames don't need to start with www. Secondly,
 they can have any number of components (separated by periods) from 1 to
 dozens. Thirdly, the last term doesn't have to be 4 characters or less.

  ([a-z]{2,4})$ = at least 2 leters eg de but upto 4 eg info

 .museum...

 miguel





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




Re: [PHP] FAQ

2002-03-22 Thread John Fishworld

Yep good idea !
Oh and by the books - a couple of opinions wouldn't be bad either !

regards
john

 I've been working on that at http://www.php-faq.com/ Want to help?

  -Original Message-
  From: James Taylor [mailto:[EMAIL PROTECTED]]
  Sent: Friday, March 22, 2002 2:30 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] FAQ
 
  Has anyone given any thought to possibly maintaining a FAQ
  containing the answers to the most commonly asked PHP questions on this
  list? I notice
  duplicates roll through every couple of days, and it would
  probably be a
  really nice PHP resource.
 
  Or, does one already exist? Ha.

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





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




[PHP] - not meant to scare people !

2002-02-28 Thread John Fishworld

Maybe of interest !

http://securitye-mattersde/advisories/012002html



-- 
PHP General Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp




Re: [PHP] Miliseconds with PHP4

2002-02-22 Thread John Fishworld


how out of interest ?


 Hello there,
 
 I want to know the execution time of some scripts I made, I'm using the
 difference of seconds (time() function) between the start and the end of
 the script.
 
 But, I would like to get a greater precision... so, I was wondering if
 there is a chance to get miliseconds.
 
 TIA
 
 William
 
 
 _
 Do You Yahoo!?
 Get your free @yahoo.com address at http://mail.yahoo.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] PHP Work in New York

2002-02-12 Thread John Fishworld

Well as an englishman in Germany - php is pretty damm big here !
A lot more than in the UK !
So maybe he should have stayed in Germany ! lol
Although the market has collapsed a bit at the moment !


 I guess I'm lucky living in Australia then - there's quite a few places
 using ASP but there's a HUGE increase in the number of businesses who are
 starting to use PHP. Maybe you should all move to Oz?? hehehe :)
 
 Martin
 
 
 -Original Message-
 From: Jason Murray [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, February 13, 2002 9:32 AM
 To: 'Jason Lotito'; NDPTAL85; [EMAIL PROTECTED]
 Subject: RE: [PHP] PHP Work in New York
 
 
 Jason L wrote: 
  Of course, I am lucky enough to be working in a place which uses 
  PHP/MySQL for practically everything, and Perl in a few others.  
  And say ASP, and you are liable to get your head shot off.
 
 Same here, everything web-related anyway ... but the head-shot-off
 attitude is in place :)
 
 J
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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




[PHP] table row

2002-01-31 Thread John Fishworld

apologies for a stupid question ! but it's late !

everthings fine, mysql query, results etc

but I want to produce a table with two columns instead of just one long
column

ie answer1answer2

can someone please give me a hint how to do it ?

while ($r = mysql_fetch_array($result0))
  {
$cityid = $r[t_city_id_city];
$cityname = $r[t_city_name];
echo 
td class=\text\a
href=\city_person.php?city_id=$cityid\$cityname/a/td
  ;
  } // from while result 0
echo/table;

thanks in advance



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

2002-01-31 Thread John Fishworld

duh ! 
yep exactly like ! 
thanks ! :-))


 something like ?
 
 $cntr = 0;
 echo tr;
 while ($r = mysql_fetch_array($result0))
   {
 $cntr++;
 $cityid = $r[t_city_id_city];
 $cityname = $r[t_city_name];
 echo 
 td class=\text\a
 href=\city_person.php?city_id=$cityid\$cityname/a/td
   ;
 if ($cntr % 2 == 0)  echo /trtr;
   } // from while result 0
 echo/tr/table;
 
 
 -Original Message-
 From: John Fishworld [mailto:[EMAIL PROTECTED]]
 Sent: Friday, February 01, 2002 9:45 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] table row
 
 
 apologies for a stupid question ! but it's late !
 
 everthings fine, mysql query, results etc
 
 but I want to produce a table with two columns instead of just one long
 column
 
 ie answer1answer2
 
 can someone please give me a hint how to do it ?
 
 while ($r = mysql_fetch_array($result0))
   {
 $cityid = $r[t_city_id_city];
 $cityname = $r[t_city_name];
 echo 
 td class=\text\a
 href=\city_person.php?city_id=$cityid\$cityname/a/td
   ;
   } // from while result 0
 echo/table;
 
 thanks in advance
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 


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