[PHP] sourceforge garage sale shopping carts?

2007-03-21 Thread jtjohnston

Are there any shopping carts at Sourceforge that you would recommend? Or
other Open Source script? I don't mean to be cheap, just find a fast
solution for a friend.
Something simple, a simple garage sale with a few options and categories.
I created the shopping cart for www.compcanlit.ca, and would not have
the time to recreate another.
I'm always happy to share code, especially if that one suits someone.
John
www.jtjohnston.ca

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



Re: [PHP] PHP Notice: Undefined index

2006-05-22 Thread jtjohnston

Now I get it. Must be the version change?

Richard Lynch a écrit:


On Fri, May 19, 2006 6:08 pm, John Taylor-Johnston wrote:
 


Any idea why this bit of code

if(yes == $_POST['submitter'])
{

is provoking this message in my Apache error log?

[Fri May 19 19:05:10 2006] [error] PHP Notice: Undefined index:
submitter in
/home/jtjohnston/domains/jtjohnston.ca/public_html/comments.php on
line 29
   



Because $_POST['submitter'] is not set?

Because your script assumes it IS set?

Because sometimes your script is called to display the form, before
$_POST['submitter'] has anything in it, and sometimes it's called
after they hit submit and it has something in it?

if (isset($_POST['submitter'])  yes == $_POST['submitter']){

http://php.net/isset
 



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



[PHP] Quickie array question

2003-06-11 Thread jtjohnston
foreach($newlines as $newline) {

#how do I get the index of the array each time $newline is printed out?

echo ??;
}


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



[PHP] 4 hours staring - can't see clear.

2003-06-11 Thread jtjohnston
Can someone see clearly through what I'm trying to do please?
I've been at this for 4 hours trying to see where I have gone wrong.

# contents of a text file #
Enregistrement
TI: ... So They Understand ...: Cultural Issues
AU: Schneider,-William
PB: Logan, UT : Utah State UP, 2002. 198 pp.
Enregistrement
TI: La Favilla and Italian Ethnicity in Canada
AU: Gualtieri,-Antonio-Roberto
SOM: Canadian-Ethnic-Studies/Etudes-Ethniques-au-Canada
###

I have the text above in a textfile that I upload:
I want to separate it into two records.
Then I want to parse each line so that each value:

$TI, $AU, $PB and $SOM

equal the contents of the rest of the line, so I can build some SQL.

AU: Gualtieri,-Antonio-Roberto

$AU = Gualtieri,-Antonio-Roberto;

The problem is that in the end, $sql holds nothing meaningful.

And because I'm filtering from one database type to my own set of
values,

$TI, $AU, $PB and $SOM

MUST become:

$ST, $AU, $BT and $JR

so I refer to this array:

###
###
$var = array (
 'TI' = array (
 'Description' = 'Title: (TI)',
 'Option'  = 'ST',
 ),
 'AU' = array (
 'Description' = 'Author(s): (AU)',
 'Option'  = 'AU',
 ),
 'PB' = array (
 'Description' = 'Publication Information: (PB)',
 'Option'  = 'BT',
 ),
 'SOM' = array (
 'Description' = 'Source (Bibliographic Citation): (SO)',
 'Option'  = 'JR',
 )
);
###
###

Here is my code, or what is left of it.
Please help me make sense so I make $sql work.:

###
###

$fh=fopen($_FILES['userfile']['tmp_name'], 'r');
...
$fileContents=fread($fh, filesize($_FILES['userfile']['tmp_name']));
...
$lines=explode(Enregistrement,$fileContents);

foreach($lines as $line) {

 $line = stripslashes($line);
 $line = str_replace(\r, , $line);

 $newlines=explode(\n,$line);

  foreach($newlines as $newline)
  {
   foreach ($var as $key = $value)
   {
# This foreach should parse each record line,
# looking in $var to find the corresponding
# value so that:
# $TI, $AU, $PB and $SOM
# become:
# $ST, $AU, $BT and $JR

   if(!$$key){$$key = filter_strings($key:,$line);}

# breaking each line into two values so that:
# $TI = So They Understand ...
# $AU = Schneider...
# $BT = Logan, UT...
# etc.

#I'm f***ing up in here someplace. What should I put back in?

$sql = insert into .$dbtable. (ST,AU,BT,JR) VALUES
('.$ST.','.$AU.','.$BT.','.$JR.');;

   }
  }#end of foreach($newlines as $newline)

}#end of foreach($lines as $line)


echo $sql;


function filter_strings($tofilter,$line){
  if(eregi('^'.$tofilter.'(.*)$',$line,$m)) {
$filtered=$m[1];
return $filtered;
 }
}


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



[PHP] PHP Problem or MySQL (Match ... against)?

2002-12-02 Thread jtjohnston
I'm stuck. I have been to the MySQL lists for this.

Now I'm reconsidering my PHP code.
http://ccl.flsh.usherb.ca/print/display.table.inc.phps

I just don't know where I'm going wrong anymore.

If I run this SQL in PHPMyAdmin, it works. jdaxell.ccl should have one
entry for ready maria.

SELECT id,AU,ST,BT,AT FROM jdaxell.ccl WHERE MATCH
(TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST
('ready maria' IN BOOLEAN MODE) ORDER
BY id asc

When I run the same (copied and pasted) SQL in PHP, it is as though
MySQL is doing a boolean search for `+ready +maria` without the double
quotes and finding results in every database. if you search for ready
maria it should only find one entry.

http://ccl.flsh.usherb.ca/print/index.html?search=%26quot%3Bready+maria%26quot%3B

So what have I done wrong now :(

John


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




Re: [PHP] PHP Problem or MySQL (Match ... against)?

2002-12-02 Thread jtjohnston
Chris, or anyone,

I have tried to escape the slashes. Debugging ...

$sql = 'SELECT ... ...
AGAINST (\'ready maria\' IN BOOLEAN MODE) ...';

This works. But if I addslashes or stripslashes, or do nothing, it does not
work.

See these 3 variations. Neither work. What should I do? A part from hang
myself :)

$sql = 'SELECT id,AU,ST,BT,AT FROM '.$table.' WHERE MATCH
(TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST
(\''.addslashes($search).'\' IN BOOLEAN MODE) ORDER BY id asc';

$sql = 'SELECT id,AU,ST,BT,AT FROM '.$table.' WHERE MATCH
(TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST
(\''.stripslashes($search).'\' IN BOOLEAN MODE) ORDER BY id asc';

$sql = 'SELECT id,AU,ST,BT,AT FROM '.$table.' WHERE MATCH
(TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST
(\''.$search.'\' IN BOOLEAN MODE) ORDER BY id asc';

John




  SELECT id,AU,ST,BT,AT FROM jdaxell.ccl WHERE MATCH
 (TNum,YR,AU,ST,SD,BT,BC,AT,PL,PR,PG,LG,AUS,KW,GEO,AN,RB,CO) AGAINST
  ('ready maria' IN BOOLEAN MODE) ORDER
  BY id asc
 
  When I run the same (copied and pasted) SQL in PHP, it is as though
  MySQL is doing a boolean search for `+ready +maria` without the double
  quotes and finding results in every database. if you search for ready
  maria it should only find one entry.

 Escape the double quotes.('\ready maria\' IN BOOLEAN 

 g.luck,
 ~Chris


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




[PHP] Calendar

2002-05-26 Thread jtjohnston

Can somone take a look at this? I found this on sourceforge, but cannot
reach author.

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.php

This month won't display properly. It's missing /trtr somewhere.
Every other month seems to work.

Can someone help please? Here is the code:

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.php
http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.phps

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/BaseCalendar.inc

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/BaseCalendar.inc.phps

The problem should be in here, but I can't see it:

  // Plancing day i on calendar
  if ($shift==0  $today_ts==$day_i_ts) {
   echo td
bgcolor=.($this-calBGCellToday).strongcenter.$link_i./center/strong/td;

  }
  else {
   echo td
bgcolor=.($this-calBGCellColor).center.$link_i./center/td\n;

  if ($day_i==7  $i$daysInMonth) {
   echo /trtr\n;
   }
   else if ($day_i==7  $i==$daysInMonth) {
   echo /tr\n;
   }
  else if ($i==$daysInMonth) {
   for ($h=$dayMonth_end; $h7; $h++) {
   echo tdnbsp;/td\n;
}
   echo /tr\n;
  }
  } //end else




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




[PHP] Calendar

2002-05-26 Thread jtjohnston

Can somone take a look at this? I found this on sourceforge, but cannot
reach author.

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.php

This month won't display properly. It's missing /trtr somewhere.
Every other month seems to work.

Can someone help please? Here is the code:

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.php
http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.phps

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/BaseCalendar.inc

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/BaseCalendar.inc.phps

The problem should be in here, but I can't see it:

  // Plancing day i on calendar
  if ($shift==0  $today_ts==$day_i_ts) {
   echo td
bgcolor=.($this-calBGCellToday).strongcenter.$link_i./center/strong/td;

  }
  else {
   echo td
bgcolor=.($this-calBGCellColor).center.$link_i./center/td\n;

  if ($day_i==7  $i$daysInMonth) {
   echo /trtr\n;
   }
   else if ($day_i==7  $i==$daysInMonth) {
   echo /tr\n;
   }
  else if ($i==$daysInMonth) {
   for ($h=$dayMonth_end; $h7; $h++) {
   echo tdnbsp;/td\n;
}
   echo /tr\n;
  }
  } //end else




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




[PHP] Calendar

2002-05-26 Thread jtjohnston

Can somone take a look at this? I found this on sourceforge, but cannot
reach author.

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.php

This month won't display properly. It's missing /trtr somewhere.
Every other month seems to work.

Can someone help please? Here is the code:

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.php
http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.phps

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/BaseCalendar.inc

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/BaseCalendar.inc.phps

The problem should be in here, but I can't see it:

  // Plancing day i on calendar
  if ($shift==0  $today_ts==$day_i_ts) {
   echo td
bgcolor=.($this-calBGCellToday).strongcenter.$link_i./center/strong/td;

  }
  else {
   echo td
bgcolor=.($this-calBGCellColor).center.$link_i./center/td\n;

  if ($day_i==7  $i$daysInMonth) {
   echo /trtr\n;
   }
   else if ($day_i==7  $i==$daysInMonth) {
   echo /tr\n;
   }
  else if ($i==$daysInMonth) {
   for ($h=$dayMonth_end; $h7; $h++) {
   echo tdnbsp;/td\n;
}
   echo /tr\n;
  }
  } //end else




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




[PHP] Calendar

2002-05-26 Thread jtjohnston

Can somone take a look at this? I found this on sourceforge, but cannot
reach author.

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.php

This month won't display properly. It's missing /trtr somewhere.
Every other month seems to work.

Can someone help please? Here is the code:

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.php
http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.phps

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/BaseCalendar.inc

http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/BaseCalendar.inc.phps

The problem should be in here, but I can't see it:

  // Plancing day i on calendar
  if ($shift==0  $today_ts==$day_i_ts) {
   echo td
bgcolor=.($this-calBGCellToday).strongcenter.$link_i./center/strong/td;

  }
  else {
   echo td
bgcolor=.($this-calBGCellColor).center.$link_i./center/td\n;

  if ($day_i==7  $i$daysInMonth) {
   echo /trtr\n;
   }
   else if ($day_i==7  $i==$daysInMonth) {
   echo /tr\n;
   }
  else if ($i==$daysInMonth) {
   for ($h=$dayMonth_end; $h7; $h++) {
   echo tdnbsp;/td\n;
}
   echo /tr\n;
  }
  } //end else




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




[PHP] inspirational

2002-05-25 Thread jtjohnston

I want to detect the url my .php lies in.

This is over kill and BS:

$myurlvar = http://.$SERVER_NAME.parse($SCRIPT_NAME);

How do I get http://foo.com/dir1/dir2/dir3/;.

There seems to be nothing in phpinfo() that will give me a full url to
play with.

Flame me if you will, but I browsed TFM and found nothing inspirational.

Looked at phpinfo() too and got discouraged.

I need a full url.

John



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




[PHP] eval()

2002-05-20 Thread jtjohnston

I know I'm not doing this right, but ..

What I want to do is display the value of $q1 through $q3.
How? I can't get eval() to do it, can I?

for ($i = 1; $i = 3; $i++)
{
$x= eval (\$q.$i);
echob$x/b\n;
echobrinput type=\hidden\ name=\a.$i.\ value=\\\n;
}

John


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




[PHP] setcookie()

2002-05-11 Thread jtjohnston

This is a bug Feature/Change Request I made to:
http://bugs.php.net/bug.php?id=17158

setcookie() states cookies must be sent before any other headers
are sent (this is a restriction of cookies, not PHP).

I argue this is a restriction of PHP, not cookies.

Here is my proof:

http://www.collegeSherbrooke.qc.ca/languesmodernes/cookie.htm

I can do this any time in body :

script
   setCookie(TestCookie,first time,expdate);
   var DisplayData = getCookie(TestCookie);
   document.write(DisplayData);
   setCookie(TestCookie,second time,expdate);
   var DisplayData = getCookie(TestCookie);
   document.write(DisplayData);
 /script

I want to be able to setcookie() anytime I want, before and after I
declare any HTML.
This will never get changed, unless we ask for it.

I would appreciate your vote of support at:

http://bugs.php.net/bug.php?id=17158

before the bug people close this thread.


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




Re: [PHP] setcookie()

2002-05-11 Thread jtjohnston

Rasmus
server-side / client-side, that's not the point.

My point is PHP can, could and should be able to set a cookie after HTML is
set.
But of course, Jan has already closed the issue, as usual.
http://bugs.php.net/bug.php?id=17158




 PHP is a server-side language and as such it deals with server-side
 issues.  If you want to write javascript that sets a client-side
 Javascript cookie, go ahead.  It has nothing to do with PHP and PHP will
 certainly not get in your way.

 -Rasmus

 On Sat, 11 May 2002, jtjohnston wrote:

  This is a bug Feature/Change Request I made to:
  http://bugs.php.net/bug.php?id=17158
 
  setcookie() states cookies must be sent before any other headers
  are sent (this is a restriction of cookies, not PHP).
 
  I argue this is a restriction of PHP, not cookies.
 
  Here is my proof:
 
  http://www.collegeSherbrooke.qc.ca/languesmodernes/cookie.htm
 
  I can do this any time in body :
 
  script
 setCookie(TestCookie,first time,expdate);
 var DisplayData = getCookie(TestCookie);
 document.write(DisplayData);
 setCookie(TestCookie,second time,expdate);
 var DisplayData = getCookie(TestCookie);
 document.write(DisplayData);
   /script
 
  I want to be able to setcookie() anytime I want, before and after I
  declare any HTML.
  This will never get changed, unless we ask for it.
 
  I would appreciate your vote of support at:
 
  http://bugs.php.net/bug.php?id=17158
 
  before the bug people close this thread.
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 

--
John Taylor-Johnston
-

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



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




Re: [PHP] setcookie()

2002-05-11 Thread jtjohnston

If the issue has pissed you off in tha past,
complain. Vote: http://bugs.php.net/bug.php?id=17158


 Rasmus
 server-side / client-side, that's not the point.

 My point is PHP can, could and should be able to set a cookie after HTML is
 set.
 But of course, Jan has already closed the issue, as usual.
 http://bugs.php.net/bug.php?id=17158

  PHP is a server-side language and as such it deals with server-side
  issues.  If you want to write javascript that sets a client-side
  Javascript cookie, go ahead.  It has nothing to do with PHP and PHP will
  certainly not get in your way.
 
  -Rasmus
 
  On Sat, 11 May 2002, jtjohnston wrote:
 
   This is a bug Feature/Change Request I made to:
   http://bugs.php.net/bug.php?id=17158
  
   setcookie() states cookies must be sent before any other headers
   are sent (this is a restriction of cookies, not PHP).
  
   I argue this is a restriction of PHP, not cookies.
  
   Here is my proof:
  
   http://www.collegeSherbrooke.qc.ca/languesmodernes/cookie.htm
  
   I can do this any time in body :
  
   script
  setCookie(TestCookie,first time,expdate);
  var DisplayData = getCookie(TestCookie);
  document.write(DisplayData);
  setCookie(TestCookie,second time,expdate);
  var DisplayData = getCookie(TestCookie);
  document.write(DisplayData);
/script
  
   I want to be able to setcookie() anytime I want, before and after I
   declare any HTML.
   This will never get changed, unless we ask for it.
  
   I would appreciate your vote of support at:
  
   http://bugs.php.net/bug.php?id=17158
  
   before the bug people close this thread.
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  

 --
 John Taylor-Johnston
 -

   ' ' '   Collège de Sherbrooke:
  ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
- Université de Sherbrooke:
   http://compcanlit.ca/
   819-569-2064

--
John Taylor-Johnston
-
  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



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




[PHP] HTML Question

2002-03-31 Thread jtjohnston

I suppse this is an HTML question more than PHP.
I have a server elsewhere that does not have PHP accessible. Stupid 
cheap of them, but true.
I want to display a page within a page, WITHOUT using ?php ... ? which
won't work.

I tried stuff like:

IFRAME SRC=http://www.somewhere.ca/test.php; frameborder=no
border=0 MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=no
/IFRAME

Does not work of course.

Can I even do this?


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




[PHP] Re: Php.ini

2002-03-31 Thread jtjohnston

Once upon a time on another (Windows) server I could place a php.ini in a
directory and it would choose that one first before it defaulted to
c:\windows\php.ini. It doesn't work on my Apache server today, but who
knows?

Chris Kay wrote:

 Question I have is,

 Is it possible to specify a php.ini in each virtual host?
 That way allowing each website to run a different configuration.

 Cause I have a website that I want to use
 Session_set_save_handler = user but I want another website to use the
 default php
 Files handle.

 Also for things like session auto start ect

 Just a thought that it would make it easier.

 Thanks in advance.

 ---
 Chris Kay, Eleet Internet Services
 [EMAIL PROTECTED]
 ---

--
John Taylor-Johnston
-

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



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




[PHP] server side includes

2002-03-31 Thread jtjohnston

I guess what I'm getting at is that a php server acts like a server side
includes server, right?

On webrings they use something like: script
scr=http://foo.com/test.php;/script

test.php would have to spit out javascript like this:

http://ss.webring.com/navbar?f=j;y=tombeaudreau;u=10035307

document.write(table border=0 cellpadding=0 cellspacing=0 width=250
align=centertrtdblah, blah/td/tr/table);

I'm thinking NS4.7x and IE 5.5.

Not that I'm going to start a webring, but I have loftier ideas?

John


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




Re: [PHP] return

2002-03-31 Thread jtjohnston

Gary,
To add to the conversation ...

You created a function to pass something through it, to process something and
now you want to get something back, right? That's what return does. It gets
something back for your effort.

You could simply:

echo addslashes($var);

But let's say you do it a hundred times in the course of a script. You don't
want to take up a hundred lines of code doing:

echo addslashes($var);

... so you create a function like Eric has below, which takes up 3 or 4 lines of
code, but has the capacity to repeat the same line of code 100 times.

John

 The purpose of return, is to return a value..
 function test($var)
 {
  return addslashes($var);
 }

 $foo = Yes, I'am Very Awsome;
 $foo = test($foo);
 echo($foo);
 // echo's, Yes I\'am Very Awsome


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




[PHP] Re: PHP / cgiwrap - weird problem

2002-03-31 Thread jtjohnston

Why are you using cgiwrap? seriously?

Are you using an old httpd server and not apache?

CGIWRAp from my perling experiences was good for firewalling, keeping users out
of areas of your server.

But cgiwrap is a pain in the ass for your users. If you have your/their
permissions set up right, why bother?

Seriously, I'm curious. Why use cgiwrap at all?

John

Frank wrote:

 Dear List,

 I have been using cgiwrap for many years, always with the .php extension
 added like an AddType like this.

 httpd.conf:
  Action application/php-script   /cgi-bin/php.cgi
  AddHandler application/php-script  .php4 .php3 .php

 Works perfectly.

 But in this case I don't want to serve the .php-extension in general. I
 have also moved the executable binary php out of the web tree, compiled it
 with --enable-discard-path and added #!/usr/local/bin/php in the scripts.

 So instead of above, httpd.conf has

   ScriptAlias /cgi-bin/ /usr/home/httpd/bin/

 and scripts can be invoked in the browser like:

 http://www.myname.com/myscript1.cgi

 E.g. myscript1.cgi could be

 #/usr/local/bin/php
 ?php  phpinfo() ?

 This works fine.

 And cgiwrap works fine. I can call other scripts as intended - e.g. I can
 call this script

 #!/bin/sh
 echo Content-type: text/html\n\n
 ls /

 or Perl

 #!/usr/bin/perl
 print(Content-type: text/html\n\n);
 print(Hello, World!);

 as http://www.myname.com/cgi-bin/cgiwrapd/frank/myscript2.cgi

 So everything as expected.

 But with PHP something very strange happen: The above script
 myscript1.php seems to output the cgi-wrap's code when I load it in the
 browser as

 http://www.myname.com/cgi-bin/cgiwrapd/frank/myscript1.cgi

 and not info about PHP.

 Why is that?  Since scripts with #!/bin/sh worked I have even tried to call
 php from such a script and output the result to a file:

 #/bin/sh
 /usr/local/bin/php /somepath/testphp.php  /somepath/testphp.htm
 ls /

 Same result.  testphp.htm contains nice phpinfo when the script is called
 from the command line - and lots of binary code when the script called by
 cgiwrap. But the result of ls / reaches the browser correctly!

 What is special about PHP in combination with cgiwrap here? What can
 cgiwrap do to php to make it output unintended code where sh and Perl
 behaves normally? Is something missing in the environment when called from
 cgiwrap? If so what?

 I am completely clueless, despite spending 10 hours on the problem.

 Oh. and one more thing: When PHP is compiled wrongly for this purpose -
 like with --enable-force-cgi-redirect - then there's suddenly nothing
 strange - the script correctly outputs an error-message from PHP, also when
 called over cgiwrap!

 If anyone can point me in the right direction or suggest some good things
 to try I'd me more than grateful - I'd be impressed! :-)

 Best regards

 Frank


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




Re: [PHP] Apache

2002-03-21 Thread jtjohnston

Scott ,
I am. :) I'm looking at IndexIgnore but not sure if it's what I want?
John

 Errmm... i don't know any apache groups, but
 if you want to do what you ask, just read the
 documentation, it's easy :-)

 jtjohnston wrote:
  Anyone know of a good apache group?
  I want to hide the structure of a directory when there is no idex.html
  present g
 
  J
 
 
 

--
John Taylor-Johnston
-

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



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




Re: [PHP] Apache

2002-03-21 Thread jtjohnston

I'm also looking at this in my .conf. I know putting something here is the
answer, but what :)

Directory /
Options FollowSymLinks
AllowOverride All
/Directory

J

Scott Furt wrote:

 Errmm... i don't know any apache groups, but
 if you want to do what you ask, just read the
 documentation, it's easy :-)

 jtjohnston wrote:
  Anyone know of a good apache group?
  I want to hide the structure of a directory when there is no idex.html
  present g
 
  J
 
 
 

--
John Taylor-Johnston
-

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



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




Re: [PHP] Apache

2002-03-21 Thread jtjohnston

Thanks all :)

I went with:
 http://httpd.apache.org/docs/mod/core.html#options
Directory /your/absolute/path/dir
/Directory
and not put Indexes between.

John


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




[PHP] easyphp question

2002-03-21 Thread jtjohnston

Anyone using easyphp?

I want to know if the new 4.1.2 binary at
http://www.php.net/downloads.php is what I want or is it good for
Apache? Doesn't seem to mention anything about versions for Apache,
only the zip package.

John


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




[PHP] Apache

2002-03-20 Thread jtjohnston

Anyone know of a good apache group?
I want to hide the structure of a directory when there is no idex.html
present g

J


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




[PHP] Re: Invalid Argument ??? Not sure how to debug this

2002-03-17 Thread jtjohnston

Daniel,

$myrow[artist] and $myrow[title]
might be a good place to start. It looks like all your ; are in place.
I don't think you can place  inside [] like that:

echo trtd.$myrow[artist].td.$myrow[title];


 I have been struggling with this code:  I was wondering if someone could
 lend me a hand.
 Line 12 happens to be the WHILE statement.  I am not sure if it is the
 while statement or the results its looking for.

 TIA  So far, i havent been able to sleep atleast until I get this.

 html
 ?
 if (isset($searchstring))
  {

  $db = mysql_connect(localhost,webuser,);
  mysql_select_db(cd_collection,$db);
  $sql= SELECT * FROM cd_list WHERE $searchstring LIKE '%searchstring%'
 ORDER BY artist ASC;
  $result = mysql_query($sql,$db);
  echo TABLE BORDER=2;
  echo trtdbArtist/btdbTitle/btdbOptions/b/tr;
  while ($myrow = mysql_fetch_array($result))
  {
echo trtd.$myrow[artist].td.$myrow[title];
echo tda href=\edit.php?id=.$myrow[cd_id].
 \View/a;
   }
   echo /TABLE;
  }
 else
  {
   ?
   form method=POST action=? $PHP_SELF ?
   table border=2 cellspacing=2
   trtdInsert Your Search String Here./td
   tdSearch Type/td/tr
   tr
   tdinput type=text name=searchstring size=28/td
   tdselect size=1 name=searchtype
option selected value=artistArtist/option
option value=titleTitle/option
option value=categoryCategory/option
   /select/td
   /tr
   /table
   pinput type = submit value=Submit name=B1
   input type=reset value=Reset/p
   /form
   ?
  }
  ?

  /html

 **DAN**

--
John Taylor-Johnston
-
  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



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




Re: [PHP] Copy *.*

2002-03-17 Thread jtjohnston

Windows :)
John

[EMAIL PROTECTED] wrote:

 At 17.03.2002  03:10, you wrote:
 
 Does anyone know of another snippet any place where I can copy *.*
 (files and all sub-directories) from one drive to another? In other
 words, a backing-up function. The snippet I got from
 http://www.php.net/manual/en/function.copy.php has been a disaster.
 
 John
 Which OS are you using ?

--
John Taylor-Johnston
-

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



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




[PHP] pathname

2002-03-17 Thread jtjohnston

I need a function to traverse a pathname
to check if the path exists, if not start from scratch
and create (MkDir) the path.

Let's say:

$to_path = c:\\aaa\\bbb\\ccc\\ddd\\;
or
$to_path = c:/aaa/bbb/ccc/ddd/;

if(!is_dir($to_path))
{
#I need to explode by both \\ AND / to find out
mkdir($to_path, 0777);
}

How do I parse it and MkDir the path?

Thanks,
John


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




[PHP] rec_copy

2002-03-17 Thread jtjohnston

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

Thanks all! I needed to check if pathname exists:

if (!is_dir($to_path))
{
  echo Creating destination pathbr;
 create_path($to_path);
}

John Steele helped out with a few lines of code. I added a comment to
http://www.php.net/manual/en/function.copy.php

Here is the result:

?
###
$date = date (Ymd);

###
#$from_path = c:\\tmp\\cp\\from;
$from_path = c:/program files/easyphp/ccl_www;
$to_path = c:/tmp/cp/to/$date/ccl_www;

###
if (!is_dir($to_path))
{
  echo Creating destination pathbr;
 create_path($to_path);
}
###
if(!is_dir($from_path))
{
  echo failed;
  exit;
}
else
{
  rec_copy($from_path, $to_path);
  echo Files copied from $from_path and backed up to $to_path\n;
}

#

function rec_copy($from_path, $to_path)
{
  if (!is_dir($to_path))
#   create_path($to_path);
mkdir($to_path, 0777);

  $this_path = getcwd();

  if (is_dir($from_path))
  {
chdir($from_path);
$handle = opendir('.');

while (($file = readdir($handle)) !== false)
{
  if (($file != .)  ($file != ..))
  {
if (is_dir($file))
{
  rec_copy ($from_path.\\.$file,  $to_path.\\.$file);
  chdir($from_path);
}
if (is_file($file))
{
  copy($from_path.\\.$file, $to_path.\\.$file);
}
  }
}
closedir($handle);
  }
  else
  {
echo if (is_dir($from_path))br;
  }
}

function create_path($to_path)
{
$path_array = explode('/', $to_path);  // split the path by directories
/*
echo 'pre';// show everything in the $path_array variable
var_dump($path_array);
echo '/pre';
*/
$dir=''; // start with empty directory
foreach($path_array as $key = $val) {
  // echo $key = $valbr;
  if (!strpos($val, ':')) {  // if it's not a drive letter
$dir .= '/'. $val;
if (!is_dir($dir)) {
  // echo Not a dir: $dirbr;
  if (!mkdir($dir, 0777))
echo Failed creating directory: $dirbr;
  else
echo Created directory: $dirbr;
  }
}
  }
}
?


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




[PHP] Update: [PHP] Weird?

2002-03-16 Thread jtjohnston

I have created date :)
$date = date (MD);
That's not it. It seems to fail at one level or another, I think, becuase the
function calls itself - and probably gets lost somehow.
John

 ... i think you might have to create the
 $date directory before writing a file to it.
 writing to /tmp/dir/file.txt will fail if
 the directory dir doesn't exist.

?php

###
$date = date (MD);
###
###  Don't forget trailing slash  #
###
$from_path = c:\\program files\\easyphp\\ccl_www\\;
$to_path = c:\\ccl_www\\.$date.ccl_www\\;
###

if(!is_dir($from_path))
{
echo failed;
exit;
}else{
rec_copy($from_path, $to_path);
echo files copies from $from_path and backed up to $to_path;
}

#
function rec_copy ($from_path, $to_path) {
if(!is_dir($to_path))
mkdir($to_path, 0777);

$this_path = getcwd();
 if (is_dir($from_path))
 {
chdir($from_path);
$handle=opendir('.');

while (($file = readdir($handle))!==false)
{
 if (($file != .)  ($file != ..)) {
  if (is_dir($file))
  {
  rec_copy ($from_path.$file./,  $to_path.$file./);
   chdir($from_path);
  }else{
#  echo error if (is_dir($file))br;
  }
  if (is_file($file))
  {
  copy($from_path.$file, $to_path.$file);
  }else{
#  echo error copy($from_path.$file, $to_path.$file)br;
  }
 }#end (($file != .)
}#end while (($file

closedir($handle);
 }# end if (is_dir
 else{
# echo if (is_dir($from_path))br;
 }
}# end function

?


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




[PHP] PHPMyAdmin: [PHP] From: Newman, using and ' or ` in My Sql

2002-03-16 Thread jtjohnston

 The standard quote (') should be used to delimit string literals in MYSQL
 statements. Use it to surround strings you're inserting into or comparing
 against VARCHARs, CHARs, TEXTs, etc.

  $sql = UPDATE mytable SET name='Best Table Of All' WHERE id=3;

That is ok if you call MySQL in your .php. But in PHPMyAdmin, it seems preferable to 
use `.


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




[PHP] No Sense: [PHP] Update: [PHP] Weird?

2002-03-16 Thread jtjohnston

No!? $date is a string?!

$date = date (MD);

How does that make a difference?

$to_path = c:\\ccl_www\\.$date.\\ccl_www\\;

You want me to change it to:

$to_path = c:\\ccl_www\\$date\\ccl_www\\;

Does anyone follow why?

Scott Furt wrote:

 I meant, have you created a physical directory
 named $date?
 That's your problem.  There's no directory named $date on your computer, and
 you're
 trying to write files into a non-existent directory.

 jtjohnston wrote:
  I have created date :)
  $date = date (MD);
  That's not it. It seems to fail at one level or another, I think, becuase the
  function calls itself - and probably gets lost somehow.
  John
 
 
 ... i think you might have to create the
 $date directory before writing a file to it.
 writing to /tmp/dir/file.txt will fail if
 the directory dir doesn't exist.
 
 
  ?php
 
  ###
  $date = date (MD);
  ###
  ###  Don't forget trailing slash  #
  ###
  $from_path = c:\\program files\\easyphp\\ccl_www\\;
  $to_path = c:\\ccl_www\\.$date.ccl_www\\;
  ###
 
  if(!is_dir($from_path))
  {
  echo failed;
  exit;
  }else{
  rec_copy($from_path, $to_path);
  echo files copies from $from_path and backed up to $to_path;
  }
 
  #
  function rec_copy ($from_path, $to_path) {
  if(!is_dir($to_path))
  mkdir($to_path, 0777);
 
  $this_path = getcwd();
   if (is_dir($from_path))
   {
  chdir($from_path);
  $handle=opendir('.');
 
  while (($file = readdir($handle))!==false)
  {
   if (($file != .)  ($file != ..)) {
if (is_dir($file))
{
rec_copy ($from_path.$file./,  $to_path.$file./);
 chdir($from_path);
}else{
  #  echo error if (is_dir($file))br;
}
if (is_file($file))
{
copy($from_path.$file, $to_path.$file);
}else{
  #  echo error copy($from_path.$file, $to_path.$file)br;
}
   }#end (($file != .)
  }#end while (($file
 
  closedir($handle);
   }# end if (is_dir
   else{
  # echo if (is_dir($from_path))br;
   }
  }# end function
 
  ?
 
 

--
John Taylor-Johnston
-
  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



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




[PHP] Re: [PHP] Weird?

2002-03-16 Thread jtjohnston

Dave,

That's just the problem with the code. See the snippet,
http://www.php.net/manual/en/function.copy.php

The function should MKDIR for me one level at a time as
the function calls itself. It should MKDIR and copy *.*
  if (is_dir($file))
  {
  rec_copy ($from_path.$file./,  $to_path.$file./);
   chdir($from_path);
  }

Somehow, some place the code fails.
:) I've been going nuts trying to make it work.

David Robley wrote:

  Scott Furt wrote:
   I meant, have you created a physical directory
   named $date?
   That's your problem.  There's no directory named $date on your
 computer, and
   you're trying to write files into a non-existent directory.
 I think what is being suggested is that you may not have a directory
 named whatever c:\\ccl_www\\.$date.\\ccl_www\\ expands to;
 frinstance
 if $date were 0203 you would need to have an existing directory
 c:\\ccl_www\\0203\\ccl_www\\
 Of course, I could be misunderstanding...

snip-
?php

###
$date = date (Ymd);
###
###  Don't forget trailing slash  #
###
$from_path = c:/program files/easyphp/ccl_www/;
$to_path = c:/$date/ccl_www/;
###

if(!is_dir($from_path))
{
echo failed;
exit;
}else{
rec_copy($from_path, $to_path);
echo files copies from $from_path and backed up to $to_path;
}

#

function rec_copy ($from_path, $to_path) {
#if(!is_dir($to_path))
mkdir($to_path, 0777);

$this_path = getcwd();
 if (is_dir($from_path))
 {
chdir($from_path);
$handle=opendir('.');

while (($file = readdir($handle))!==false)
{
 if (($file != .)  ($file != ..)) {
  if (is_dir($file))
  {
  rec_copy ($from_path.$file./,  $to_path.$file./);
   chdir($from_path);
  }else{
#  echo error if (is_dir($file))br;
  }
  if (is_file($file))
  {
  copy($from_path.$file, $to_path.$file);
  }else{
#  echo error copy($from_path.$file, $to_path.$file)br;
  }
 }#end (($file != .)
}#end while (($file

closedir($handle);
 }# end if (is_dir
 else{
# echo if (is_dir($from_path))br;
 }
}# end function

?



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




[PHP] Copy *.*

2002-03-16 Thread jtjohnston

Does anyone know of another snippet any place where I can copy *.*
(files and all sub-directories) from one drive to another? In other
words, a backing-up function. The snippet I got from
http://www.php.net/manual/en/function.copy.php has been a disaster.

John


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




[PHP] Weird?

2002-03-15 Thread jtjohnston

Does anyone have time to run this code?
This is definitely weird. Either a Windows or a code problem. If I set:

$to_path = c:\\ccl_www\\.$date.ccl_www\\;

to:

$to_path = c:\\ccl_www\\.$date.\\ccl_www\\;
(I add \\)

It fails to create c:\ccl_www\20020315\ccl_www, but otherwise will
create c:\ccl_www\20020315ccl_www

I've tried debugging this thing backwards, but have not found my
problem.

If for example, I tried creating manually:

c:\ccl_www

thinking it was a root thing. It worked, then it didn't.

:x( John
P.S. By the by, I tried this on a Unix box, and thought it worked, but
then it didn't when I went back to it this morning. I'm confused!


snip
$date = date (MD);
###
###  Don't forget trailing slash  #
###
$from_path = c:\\program files\\easyphp\\ccl_www\\;
$to_path = c:\\ccl_www\\.$date.ccl_www\\;
###

if(!is_dir($from_path))
{
echo failed;
exit;
}else{
rec_copy($from_path, $to_path);
echo files copies from $from_path and backed up to $to_path;
}

#

function rec_copy ($from_path, $to_path) {
if(!is_dir($to_path))
mkdir($to_path, 0777);

$this_path = getcwd();
 if (is_dir($from_path))
 {
chdir($from_path);
$handle=opendir('.');

while (($file = readdir($handle))!==false)
{
 if (($file != .)  ($file != ..)) {
  if (is_dir($file))
  {
  rec_copy ($from_path.$file./,  $to_path.$file./);
   chdir($from_path);
  }else{
#  echo error if (is_dir($file))br;
  }
  if (is_file($file))
  {
  copy($from_path.$file, $to_path.$file);
  }else{
#  echo error copy($from_path.$file, $to_path.$file)br;
  }
 }#end (($file != .)
}#end while (($file

closedir($handle);
 }# end if (is_dir
 else{
# echo if (is_dir($from_path))br;
 }
}# end function




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




[PHP] [More] Re: Weird?

2002-03-15 Thread jtjohnston

Miguel,
No, You're right I wasn't running E=All.  It's a windows machine, so I have
all the write priveledges I want.
These are the errors I'm getting:

 Warning: stat failed for c:\ccl_www\MarFriccl_www\ (errno=2 - No such
file or
 directory) in C:\WINDOWS\Bureau\php\microweb\backup4.php on line 23
 Warning: MkDir failed (No such file or directory) in
 C:\WINDOWS\Bureau\php\microweb\backup4.php on line 24
 Warning: stat failed for c:\ccl_www\MarFriccl_www\Nouveau dossier/
 (errno=2 - No such file or directory) in
 C:\WINDOWS\Bureau\php\microweb\backup4.php on line 23
 Warning: MkDir failed (No such file or directory) in
 C:\WINDOWS\Bureau\php\microweb\backup4.php on line 24
 Warning: Unable to create 'c:\ccl_www\MarFriccl_www\Nouveau
 dossier/aa.txt': No such file or directory in
 C:\WINDOWS\Bureau\php\microweb\backup4.php on line 44
 Warning: Unable to create 'c:\ccl_www\MarFriccl_www\aa.txt': No such
file or
 directory in  C:\WINDOWS\Bureau\php\microweb\backup4.php on line 44
 files copies from c:\program files\easyphp\ccl_www\ and backed up to
 c:\ccl_www\MarFriccl_www\

The code calls itself each time it enters another level.
If I create c:\ccl_www myself, I get this error:

 Warning: stat failed for c:\ccl_www\MarFriccl_www\ (errno=2 - No such
file or
 directory) in C:\WINDOWS\Bureau\php\microweb\backup4.php on line 23
 Warning: stat failed for c:\ccl_www\MarFriccl_www\Nouveau dossier/
 (errno=2 - No such file or directory) in
C:\WINDOWS\Bureau\php\microweb\backup4.php on line 23
 files copies from c:\program files\easyphp\ccl_www\ and backed up to
 c:\ccl_www\MarFriccl_www\

But despite (errno=2 - No such file or directory) the code does create
c:\ccl_www\MarFriccl_www and does copy the necessary files.

Can anyone help?


-snip--
$date = date (MD);
$from_path = c:\\program files\\easyphp\\ccl_www\\;
$to_path = c:\\ccl_www\\.$date.ccl_www\\;

if(!is_dir($from_path))
{
echo failed;
exit;
}else{
rec_copy($from_path, $to_path);
echo files copies from $from_path and backed up to $to_path;
}

#
function rec_copy ($from_path, $to_path) {
if(!is_dir($to_path))
mkdir($to_path, 0777);

$this_path = getcwd();
 if (is_dir($from_path))
 {
chdir($from_path);
$handle=opendir('.');

while (($file = readdir($handle))!==false)
{
 if (($file != .)  ($file != ..)) {
  if (is_dir($file))
  {
  rec_copy ($from_path.$file./,  $to_path.$file./);
   chdir($from_path);
  }else{
#  echo error if (is_dir($file))br;
  }
  if (is_file($file))
  {
  copy($from_path.$file, $to_path.$file);
  }else{
#  echo error copy($from_path.$file, $to_path.$file)br;
  }
 }#end (($file != .)
}#end while (($file

closedir($handle);
 }# end if (is_dir
 else{
# echo if (is_dir($from_path))br;
 }
}# end function



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




[PHP] New Day, New Problem

2002-03-14 Thread jtjohnston

If I change:

$to_path = c:\\.$date.www\\;

to

$to_path = c:\\.$date.\\www\\;

It doesn't work? Otherwise, it works.
Can anyone help? Undoubtably something f-ed in the code, or is it a
Windows thing?



###
$date = date (Ymd);
###
###  Don't forget trailing slash  #
###
$from_path = c:\\program files\\easyphp\\ccl_www\\;
$to_path = c:\\.$date.ww\\;
###

if(!is_dir($from_path))
{
echo failed;
exit;
}else{
rec_copy($from_path, $to_path);
echo files copies from $from_path and backed up to $to_path;
}

#

function rec_copy ($from_path, $to_path) {
if(!is_dir($to_path))
mkdir($to_path, 0777);

$this_path = getcwd();
 if (is_dir($from_path))
 {
chdir($from_path);
$handle=opendir('.');

while (($file = readdir($handle))!==false)
{
 if (($file != .)  ($file != ..)) {
  if (is_dir($file))
  {
  rec_copy ($from_path.$file./,  $to_path.$file./);
   chdir($from_path);
  }else{
#  echo error if (is_dir($file))br;
  }
  if (is_file($file))
  {
  copy($from_path.$file, $to_path.$file);
  }else{
#  echo error copy($from_path.$file, $to_path.$file)br;
  }
 }#end (($file != .)
}#end while (($file

closedir($handle);
 }# end if (is_dir
 else{
# echo if (is_dir($from_path))br;
 }
}# end function




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




[PHP] rec_copy

2002-03-13 Thread jtjohnston

You might have seen a version of this function:

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

I would like to rework this line:

  mkdir($to_path, 0777);

where mkdir will ignore $to_path if
the directory already exists. I have already tried this:

#if(!mkdir($to_path, 0777))
# {mkdir($to_path, 0777);}

but that doesn't work. I suppose that is because the
function calls itself when it creates sub-directories.

Any ideas?

John

##--- snip 
$date = date (Ymd);
rec_copy($from_path, $to_path);

echo files copies from $from_path and backed up to $to_path;


function rec_copy ($from_path, $to_path) {
mkdir($to_path, 0777);

#if(!mkdir($to_path, 0777))
# {mkdir($to_path, 0777);}

$this_path = getcwd();
 if (is_dir($from_path))
 {
chdir($from_path);
$handle=opendir('.');

while (($file = readdir($handle))!==false)
{
 if (($file != .)  ($file != ..)) {
  if (is_dir($file))
  {
  rec_copy ($from_path.$file./,  $to_path.$file./);
   chdir($from_path);
  }else{
#  echo error if (is_dir($file))br;
  }
  if (is_file($file))
  {
  copy($from_path.$file, $to_path.$file);
  }else{
#  echo error copy($from_path.$file, $to_path.$file)br;
  }
 }#end (($file != .)
}#end while (($file

closedir($handle);
 }# end if (is_dir
 else{
 echo if (is_dir($from_path))br;
 }
}# end function



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




Re: [PHP] rec_copy

2002-03-13 Thread jtjohnston

So I just declare at the beginning:

if(!is_dir($to_path))
mkdir($to_path, 0777);

The code works. But how can I make sure $from_path exists first and fails if
not?
Same thing?

if(!is_dir($from_path))
{
echo failed;
exit;
}

The first time I ran it, I ran it with a non-existing $from_path directory
and the function ran anyways.
I thought the function had a built-in safe-guard?

-snip--
if(!is_dir($from_path))
{
echo failed;
exit;
}else{
rec_copy($from_path, $to_path);
echo files copies from $from_path and backed up to $to_path;
}

#
function rec_copy ($from_path, $to_path) {
if(!is_dir($to_path))
mkdir($to_path, 0777);

#if(mkdir($to_path, 0777))
# {mkdir($to_path, 0777);}

$this_path = getcwd();
 if (is_dir($from_path))
 {
chdir($from_path);
$handle=opendir('.');

while (($file = readdir($handle))!==false)
{
 if (($file != .)  ($file != ..)) {
  if (is_dir($file))
  {
  rec_copy ($from_path.$file./,  $to_path.$file./);
   chdir($from_path);
  }else{
#  echo error if (is_dir($file))br;
  }
  if (is_file($file))
  {
  copy($from_path.$file, $to_path.$file);
  }else{
#  echo error copy($from_path.$file, $to_path.$file)br;
  }
 }#end (($file != .)
}#end while (($file

closedir($handle);
 }# end if (is_dir
 else{
# echo if (is_dir($from_path))br;
 }
}# end function





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


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




[PHP] Double slash

2002-03-13 Thread jtjohnston

On a windows server,

echo getcwd().br;

gives me:

C:\WINDOWS\Bureau\php\microweb

How do I double slash it? Is this ok:

$test_path = getcwd().\\test1\\;
echo $test_path;

It seems ok, when I echo it? Any screwy Windows thing I need to know
about?

John


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




Re: [PHP] Double slash

2002-03-13 Thread jtjohnston

looks good to me - only screwy thing I can think of is the backslash thing -
REALLY annoying - and confusing sometimes

Yeah, no kidding. Thanks Martin!

What about if I try copying $to_path onto a Network server?

Do you see any problems with the code and $to_path?

(Not that I have a server to test it on yet. Not that Works 
Services are going to take 2 weeks :-( to replace my stolen server!
But I have to prepare for the inevitable.)

---snip-
$date = date (Ymd);
$from_path = getcwd().\\mysql\\;
$to_path = /sirius/data/usager/ccl/backups/.$date./;

if(!is_dir($from_path))
{
echo failed;
exit;
}else{
rec_copy($from_path, $to_path);
echo files copies from $from_path and backed up to $to_path;
}

#
function rec_copy ($from_path, $to_path) {
if(!is_dir($to_path))
mkdir($to_path, 0777);

#if(mkdir($to_path, 0777))
# {mkdir($to_path, 0777);}

$this_path = getcwd();
 if (is_dir($from_path))
 {
chdir($from_path);
$handle=opendir('.');

while (($file = readdir($handle))!==false)
{
 if (($file != .)  ($file != ..)) {
  if (is_dir($file))
  {
  rec_copy ($from_path.$file./,  $to_path.$file./);
   chdir($from_path);
  }else{
#  echo error if (is_dir($file))br;
  }
  if (is_file($file))
  {
  copy($from_path.$file, $to_path.$file);
  }else{
#  echo error copy($from_path.$file, $to_path.$file)br;
  }
 }#end (($file != .)
}#end while (($file

closedir($handle);
 }# end if (is_dir
 else{
# echo if (is_dir($from_path))br;
 }
}# end function



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




[PHP] Re: What permissions for uploading?

2002-03-13 Thread jtjohnston

Not to but in, but you might want to check on your version. www.php.net
published an advisory on a possible flaw on that very issue:

http://www.php.net/release_4_1_2_win32.php
http://security.e-matters.de/advisories/012002.html

Leif K-Brooks wrote:

 I have a script that allows the user to upload a file.   Right now, though,
 it says permission denied when I try to upload.  The permissions for the
 folder I want to upload to is 755 right now.  What should I change it to?

--
John Taylor-Johnston
-
  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



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




[PHP] Broadcasting

2002-03-10 Thread jtjohnston

Not really a php thing, more a loss of php :) !

My PHP-MySQL server has been stolen from my office (last night).
Security has not been doing their job!

I noticed in the logs once where people were trying to get in by FTP on
occasion, or adding weird things to a url, when it was running just as
an IP. My question is: does my Apache server broadcast itself or its IP
for when script kiddies come check out my machine to see if they can
crash it? What does it broadcast? How did the script kiddies find me?
Can I reverse process this and see if my stolen machine still exists
anywhere? What would I look for?

I have a ghost backup going back around four week ago, but ...

Sigh :(
John


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




[PHP] Broadcasting

2002-03-10 Thread jtjohnston

Not really a php thing, more a loss of php :) !

My PHP-MySQL server has been stolen from my office (last night).
Security has not been doing their job!

I noticed in the logs once where people were trying to get in by FTP on
occasion, or adding weird things to a url, when it was running just as
an IP. My question is: does my Apache server broadcast itself or its IP
for when script kiddies come check out my machine to see if they can
crash it? What does it broadcast? How did the script kiddies find me?
Can I reverse process this and see if my stolen machine still exists
anywhere? What would I look for?

I have a ghost backup going back around four week ago, but ...

Sigh :(
John


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




[PHP] Broadcasting

2002-03-10 Thread jtjohnston

Not really a php thing, more a loss of php :) !

My PHP-MySQL server has been stolen from my office (last night).
Security has not been doing their job!

I noticed in the logs once where people were trying to get in by FTP on
occasion, or adding weird things to a url, when it was running just as
an IP. My question is: does my Apache server broadcast itself or its IP
for when script kiddies come check out my machine to see if they can
crash it? What does it broadcast? How did the script kiddies find me?
Can I reverse process this and see if my stolen machine still exists
anywhere? What would I look for?

I have a ghost backup going back around four week ago, but ...

Sigh :(
John


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




[PHP] CSS Group

2002-03-09 Thread jtjohnston

Can anyone recommend a good CSS news group?



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




[PHP] CSS

2002-03-08 Thread jtjohnston

Has anyone any code that creates a CSS file? A GUI?

As in:

style type=text/css
!--
body  {font-family: helvetica, arial, geneva, sans-serif;
font-size: small; color: #00}
//--
/style



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




[PHP] Use an ini file

2002-03-07 Thread jtjohnston

Anyone know of an easy to use library/or code that will read and write
an ini file?



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




[PHP] Re: Use an ini file

2002-03-07 Thread jtjohnston

  Anyone know of an easy to use library/or code that will read and write
  an ini file?
 See parse_ini_file() together with the file handling functions.

Dave,
http://www.php.net/manual/en/function.parse-ini-file.php
Good, but no code to write to an ini file?
:) John


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




[PHP] $db_list = mysql_list_dbs

2002-03-06 Thread jtjohnston

mysql-list-dbs works but displays all databases. How do I limit to
display those that a user has access rights to?

http://www.php.net/manual/en/function.mysql-list-dbs.php

$link = mysql_connect($server, $user, $password);
 $db_list = mysql_list_dbs($link);

 while ($row = mysql_fetch_object($db_list))
 {
 echo $row-Database . \n;
 }




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




[PHP] how to access an ini file using PHP

2002-03-06 Thread jtjohnston

[Posted and Replied]
Salut Marc,

You could find an ini file function. Something like:

http://www.zend.com/apidoc/c1948.php
http://ca.google.yahoo.com/bin/query_ca?p=how+to+access+an+ini+file+using+PHPy=onhc=0hs=0

You would have to add one line:

[MyData]
name=foo
age=100
sex=y

I've done it with Perl, but have never found anything for PHP.
Have you thought of a mysql database? That's all I use now.



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




[PHP] Re: File/Directory Permissions

2002-03-06 Thread jtjohnston


I know you would want to code your chmod, but I use my CuteFTP window to
auto-calculate which permissions I want to use/code. Not necessary on Windows,
but on Unix it's an absolute.
I use 644 (Read Owner, Read Group, Read Public,Write Owner, on a Unix
server with no trouble for normal *.PHP files.




[PHP] Is flock necessary?

2002-03-06 Thread jtjohnston

Group: Is flock even necessary?
Allan: You look like you have Perled. It was necessary for Perl.
Have you thought of MySQL instead?


Alan McFarlane wrote:

 I've just written a couple of simple routines which read an write small text
 files to the server:

 function readData( $filename, $data )
 {
  if (!$fd = fopen($filename, r))
  {
   return false;
  }

  flock($fd, LOCK_SH);
  $data = fread($fd, filesize($filename));
  fclose($fd);

  return true;
 }

 function writeData( $filename, $data )
 {
  if (!$fd = fopen($filename, w))
  {
   return false;
  }

  flock($fd, LOCK_EX);
  fwrite($fd, $data);
  fclose($fd);

  return true;
 }

 Now, the question is... How much time elapses between the fopen() statement
 and the flock() statements?

 Looking at the code, it would appear that two separate threads may call
 writeData() almost simultaneously giving the following execution:

  assume $filename = sample.txt;

 Thread #1 - $fd = fopen($filename, w);  // succeeds
 Thread #2 - $fd = fopen($filename, w);  // succeeds (I think)
 Thread #1 - flock($fd, LOCK_EX);  // Does this succeed or fail?
 Thread #2 - flock($fd, LOCK_EX);  // fails (I think)

--
John Taylor-Johnston
-
  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



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




[PHP] exists?

2002-03-05 Thread jtjohnston

It's late, I'm tired
I want to parse $searchenquiry

if(% exists in $searchenquiry)
{
do 
}else{
do 
}



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




[PHP] Does anyone follow?

2002-03-04 Thread jtjohnston

Does anyone follow what I'm trying to do?

I have a list of authors I explode from a field called AUS I sort them
sort($authors);

The layout is agreeable What I would like now to do is change:

   array_push($authors,$singleauthor);

for

   array_push($authors,$singleauthor,$mydata-id);

But how do I sort them now? These two lines permitted me to:

sort($authors);
foreach (array_count_values ($authors) as $author=$count)

sort, count and display each occurence only once

O'Henry, James (5)  #--- there were 5 occurences of O'Henry in my
database explode

Now what I want to do is display the id number (record number) of each
occurence of O'Henry:

O'Henry, James (5) [record 1, record 4, record, 87, record 119, record
120]

How do I re-evaluate this code, modify it to display authors one time
only,
count the number of occurences in my database
and somehow integrate $mydata-id  ?

Does anyone follow what I'm trying to do?

--snip---
$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);

$news = mysql_query(select id,AUS from $table);

$authors = array();

while ($mydata = mysql_fetch_object($news))
{
$mydata-AUS = str_replace( ;, ;, $mydata-AUS);
$mydata-AUS = str_replace(; , ;, $mydata-AUS);
$tempauthors = explode(;, $mydata-AUS);
 foreach ($tempauthors as $singleauthor)
  {
   if ($singleauthor  )
   array_push($authors,$singleauthor);
  }
 }

sort($authors);
foreach (array_count_values ($authors) as $author=$count)
{
echo a
href=\matchphp?searchenquiry=urlencode($author)match=partial+match\$author/a
($count)br\n;
}

mysql_close($myconnection);




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




Re: [PHP] Does anyone follow?

2002-03-04 Thread jtjohnston

Can you show me how :) ? I'm in over my head
I get working with arrays, but need more practice,
examples etc to learn how to code from How would two arays work?
John


 Does anyone follow what I'm trying to do?

 I have a list of authors I explode from a field called AUS I sort them
 sort($authors);

 The layout is agreeable What I would like now to do is change:

array_push($authors,$singleauthor);

 for

array_push($authors,$singleauthor,$mydata-id);

 But how do I sort them now? These two lines permitted me to:

 sort($authors);
 foreach (array_count_values ($authors) as $author=$count)

 sort, count and display each occurence only once

 O'Henry, James (5)  #--- there were 5 occurences of O'Henry in my
 database explode

 Now what I want to do is display the id number (record number) of each
 occurence of O'Henry:

 O'Henry, James (5) [record 1, record 4, record, 87, record 119, record
 120]

 How do I re-evaluate this code, modify it to display authors one time
 only,
 count the number of occurences in my database
 and somehow integrate $mydata-id  ?

 Does anyone follow what I'm trying to do?

 --snip---
 $myconnection = mysql_connect($server,$user,$pass);
 mysql_select_db($db,$myconnection);

 $news = mysql_query(select id,AUS from $table);

 $authors = array();

 while ($mydata = mysql_fetch_object($news))
 {
 $mydata-AUS = str_replace( ;, ;, $mydata-AUS);
 $mydata-AUS = str_replace(; , ;, $mydata-AUS);
 $tempauthors = explode(;, $mydata-AUS);
  foreach ($tempauthors as $singleauthor)
   {
if ($singleauthor  )
array_push($authors,$singleauthor);
   }
  }

 sort($authors);
 foreach (array_count_values ($authors) as $author=$count)
 {
 echo a
 href=\matchphp?searchenquiry=urlencode($author)match=partial+match\
 $author/a
 ($count)br\n;
 }

 mysql_close($myconnection);


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




[PHP] Ifrst

2002-03-04 Thread jtjohnston

Is this over kill? Is there a better way? I have an array
I want to display all occurences of strings that start with a or A

http://wwwphpnet/manual/en/functionsubstrphp
$rest = substr($mystring, 0, 1); // returns a

?


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




[PHP] case insenstive

2002-03-04 Thread jtjohnston

I need to make this case insensitive This seems like over kill?

 if((substr($author, 0, 1) == a) or (substr($author, 0, 1) == a))
{
}


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




[PHP] sort()

2002-03-04 Thread jtjohnston

Thanks!
Has this ever been improved? It sorts but case insensitively Is this
over kill :)

usort($authors, create_function('$a,$b','return strcasecmp($a,$b);'));

D'Alpuget, Blanche
d'Alpuget, Blanche
da Silva e Orta, Teresa Margarida
Dabydeen, Cyril
de Campos, Haroldo
De Certeau, Michel
de Certeau, Michel


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




[PHP] Apache PHPMyAdmin

2002-03-02 Thread jtjohnston

Hi,
No one seems to be home at my favourite apache newsgroup :) so I'll ask
here.
I'm trying to reconfigure my PHPMyAdmin.

What do I add to my conf file so as in http://phpmyadmin.somehere.com/
points
to a specific directory on my (windows) drive?

For example, how would I point http://www.somehere.com// to a
different directory than http://somehere.com/ , or
http://123.somehere.com// to a different directory than
http://456.somehere.com/ ?

John Taylor-Johnston

-

  ' ' '   Université de Sherbrooke:
 ô¿ô   http://compcanlit.ca/
   ~


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




[PHP] if(isset($submit))

2002-02-27 Thread jtjohnston

Has anyone tried:

input type=\image\  name=\submit\ value=\submit\
src=\nextgif\ border=\0\ align=\ABSCENTER\

instead of :

input type=\submit\ name=\submit\ value=\\

I can't get this to work:
if(isset($submit))

with:

input type=\image\  name=\submit\ value=\submit\
src=\nextgif\ border=\0\ align=\ABSCENTER\

I'm not coding correctly?


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




[PHP] Re: PHP MAIL function...why wont it work????

2002-02-27 Thread jtjohnston

Your smtp is valid? Try error checking for that? See you php.ini. If you are
running it on localhost you might try the same smtp that is used in your
emailer. I gaffed on that once. :)

Brad Wright wrote:

 Hi all... I have a line in a page that should send me an email when the page
 is loaded.

 Here is the line i am using:

  mail([EMAIL PROTECTED], worked, Line 1\nLine 2\nLine 3);

 when i load the page...i get NO error msgs, but the function does not send
 the mail. There is no record of any activity in the mail log...any ideas...

 I AM GOING INSANE

 Thanks in advance,
 Brad

--
John Taylor-Johnston
-
  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



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




Re: [PHP] if(isset($submit))

2002-02-27 Thread jtjohnston

I s'pose, but where/why are you getting submit.x=118submit.y=20

Martin Towell wrote:

 I used this code

 form action=/inetpub/wwwroot/top.html method=get
 input type=image src=none.gif width=125 height=25 name=submit
 value=submit
 /form

 when I clicked on the image, I got this url

 file:///C:/inetpub/wwwroot/top.html?submit.x=118submit.y=20

 so php would get this as $submit_x and $submit_y

 HTH
 Martin

 -Original Message-
 From: jtjohnston [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, February 28, 2002 4:17 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] if(isset($submit))

 Has anyone tried:

 input type=\image\  name=\submit\ value=\submit\
 src=\next.gif\ border=\0\ align=\ABSCENTER\

 instead of :

 input type=\submit\ name=\submit\ value=\\

 I can't get this to work:
 if(isset($submit))

 with:

 input type=\image\  name=\submit\ value=\submit\
 src=\next.gif\ border=\0\ align=\ABSCENTER\

 I'm not coding correctly?

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

--
John Taylor-Johnston
-

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064




Re: [PHP] if(isset($submit))

2002-02-27 Thread jtjohnston

Nope, not following.
:)
More particularily why will isset accept type=submit and not type=image ?

Martin Towell wrote:

 I used this code

 form action=/inetpub/wwwroot/top.html method=get
 input type=image src=none.gif width=125 height=25 name=submit
 value=submit
 /form

 when I clicked on the image, I got this url

 file:///C:/inetpub/wwwroot/top.html?submit.x=118submit.y=20

 so php would get this as $submit_x and $submit_y

 HTH
 Martin

 -Original Message-
 From: jtjohnston [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, February 28, 2002 4:17 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] if(isset($submit))

 Has anyone tried:

 input type=\image\  name=\submit\ value=\submit\
 src=\next.gif\ border=\0\ align=\ABSCENTER\

 instead of :

 input type=\submit\ name=\submit\ value=\\

 I can't get this to work:
 if(isset($submit))

 with:

 input type=\image\  name=\submit\ value=\submit\
 src=\next.gif\ border=\0\ align=\ABSCENTER\

 I'm not coding correctly?

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

--
John Taylor-Johnston
-

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064




Re: [PHP] if(isset($submit))

2002-02-27 Thread jtjohnston

So I can forget using type=image :(
Wah, it's not fair!

:) J

Martin Towell wrote:

 I used this code

 form action=/inetpub/wwwroot/top.html method=get
 input type=image src=none.gif width=125 height=25 name=submit
 value=submit
 /form

 when I clicked on the image, I got this url

 file:///C:/inetpub/wwwroot/top.html?submit.x=118submit.y=20

 so php would get this as $submit_x and $submit_y

 HTH
 Martin

 -Original Message-
 From: jtjohnston [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, February 28, 2002 4:17 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] if(isset($submit))

 Has anyone tried:

 input type=\image\  name=\submit\ value=\submit\
 src=\next.gif\ border=\0\ align=\ABSCENTER\

 instead of :

 input type=\submit\ name=\submit\ value=\\

 I can't get this to work:
 if(isset($submit))

 with:

 input type=\image\  name=\submit\ value=\submit\
 src=\next.gif\ border=\0\ align=\ABSCENTER\

 I'm not coding correctly?

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

--
John Taylor-Johnston
-

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064




[PHP] isset?

2002-02-27 Thread jtjohnston

So what is the good of isset? What does if(isset($submit)) do
differently than if($submit) ??

J


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




Re: [PHP] if(isset($submit))

2002-02-27 Thread jtjohnston

Over kill?

Martin Towell wrote:

 or have a hidden field, maybe, called submit 

 -Original Message-
 From: jtjohnston [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, February 28, 2002 4:33 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] if(isset($submit))

 So I can forget using type=image :(
 Wah, it's not fair!

 :) J

 Martin Towell wrote:

  I used this code
 
  form action=/inetpub/wwwroot/top.html method=get
  input type=image src=none.gif width=125 height=25 name=submit
  value=submit
  /form
 
  when I clicked on the image, I got this url
 
  file:///C:/inetpub/wwwroot/top.html?submit.x=118submit.y=20
 
  so php would get this as $submit_x and $submit_y
 
  HTH
  Martin
 
  -Original Message-
  From: jtjohnston [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, February 28, 2002 4:17 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] if(isset($submit))
 
  Has anyone tried:
 
  input type=\image\  name=\submit\ value=\submit\
  src=\next.gif\ border=\0\ align=\ABSCENTER\
 
  instead of :
 
  input type=\submit\ name=\submit\ value=\\
 
  I can't get this to work:
  if(isset($submit))
 
  with:
 
  input type=\image\  name=\submit\ value=\submit\
  src=\next.gif\ border=\0\ align=\ABSCENTER\
 
  I'm not coding correctly?
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php

 --
 John Taylor-Johnston
 
 -

   ' ' '   Collège de Sherbrooke:
  ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
- Université de Sherbrooke:
   http://compcanlit.ca/
   819-569-2064

--
John Taylor-Johnston
-
  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064




[PHP] Convert An Array

2002-02-24 Thread jtjohnston

http://ccl.flsh.usherb.ca/db/authors_under_study.php
or
$names = array (john, mary, bill, mary, bill, mary, bill,
john, bill, john);

1) How do I count the elements of $names to produce:

bill   4
john   3
mary   3

2) How do I store the counted elements into a new array? How do I create
this:

$new_array = array (bill=4, john=3, mary=3)

I'm looking at http://www.php.net/manual/en/function.array.php
but not sure.




Re: [PHP] Access Array Values?

2002-02-24 Thread jtjohnston

I knew there was areason why I stopped Perling :) THANKS!
How do I disassemble its values? How would I foreach? Something like this?

foreach (array_count_values ($names) as $name and $count) -??
{
echoa href=\search.php?input=.$name.\.$name./a (.$count.)br`;
}

a href=search.php?input=billbill/a (3)br
a href=search.php?input=johnjohn/a (3)br
a href=search.php?input=marymary/a (4)br

http://www.php.net/manual/en/function.array-count-values.php talks about how
it counts. But how do I access each separate value?

John

--snip---
$names = array (john, mary, bill, mary, bill, mary, bill,
john, bill, john);
echopre;
print_r($names);
echo/pre;
echohrpre;
print_r(array_count_values ($names));
echo/pre;


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




Re: [PHP] Email Verification

2002-02-24 Thread jtjohnston

Is this what you want?

function validateEmail ($email) {
return (ereg('^[-!#$%\'*+\\./0-9=?A-Z^_`a-z{|}~]+'. '@'.
'[-!#$%\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.' .
'[-!#$%\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $email));
 }

This will also do the job. It actually connects to the mail server name and
runs it to see if valid :

 http://px.sklar.com/code-pretty.html?code_id=508



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




[PHP] Re: ? re phpwebhosting.com - still in business??

2002-02-24 Thread jtjohnston

What's their deal? How do they offer all that and be so cheap?
Using my site like Geocities to advertise?
http://www.phpwebhosting.com/host_details.html
J


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




Re: [PHP] Access Array Values?

2002-02-24 Thread jtjohnston

:)
foreach (array_count_values ($names) as $name=$count)
Thanks M! :)


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




[PHP] mysql 4 windows

2002-02-24 Thread jtjohnston

Does anyone know if mysql 4 windows is up to snuff yet?
I'm running  http://www.easyphp.org/
Can it be installed as localhost2?

John


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




Re: [PHP] Not Quite: how to build an array

2002-02-23 Thread jtjohnston

I'm splitting mysql entries to build an array of author names called $authors.

 As someone already suggested, you could use:
  array_push($authors, explode(;, $mydata-AS));

http://ccl.flsh.usherb.ca/db/authors_under_study.php

It works, but still gets First argument to array_push() needs to be an array
and fails before it gets to print_r($authors). Am I doing something wrong
here:

 $authors = array_push($authors, explode(;, $mydata-AUS));

---snip
$news = mysql_query(select id,AUS from $table);
$authors = array();
 while ($mydata = mysql_fetch_object($news))
 {
 echo $mydata-id.|.$mydata-AUS.hr\n;
 $authors = array_push($authors, explode(;, $mydata-AUS));
 }
print_r($authors);
-snip-

The data looks like:

id-1 = Zola, Émile;
id-2 = Mendès, Catielle ??; Grutman; Bernabé, Jean; Andrade, Mario de;
Sutherland, Ronald; Faulkner, William Harrison; Nabokov, Vladimir; Klein,
Abraham Moses; Chassay, Jean-François; Glissant, Édouard; Martí, José;
Jonassaint, Jean; Aguiar, Flavio;
id-3 = Roberts, Charles George Douglas; Carman, Bliss; Scott, Francis
Reginald; Gustafson, Ralph; Marriott, Anne; Kenneth, Leslie;
id-4 = Roberts, Charles George Douglas; Carman, Bliss; Scott, Francis
Reginald; Gustafson, Ralph; Marriott, Anne; Kenneth, Leslie;
id-5 = Tremblay, Michel; Glassco, Bill; Freeman, David; Meunier, Claude;
Gaboriau, Linda; Fennario, David;;
id-6 = Tremblay, Michel; Laurendeau, André; Gélinas, Gratien; Glassco, Bill;
Dassylva, Martial; Desbiens, Jean-Paul; Dubé, Marcel; Germain, Jean-Paul;
Renaud, Jacques; Van Burik, John; Renaud Jacques;;



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




[PHP] countless

2002-02-23 Thread jtjohnston

Success. After a bit of tinkering :) and reading up. Thanks for the
ideas.

Now one last question. here is my array $authors:
http://ccl.flsh.usherb.ca/db/authors_under_study.php
sorted alphabetically.

How do I go about sorting again it so it renders:

Aguiar, Flavio1
Andrade, Mario de1
Ashcroft, W.D.  1
Atwood, Margaret 3
Auden, W. H.3
Bernabé, Jean1
Birney, Earle  4

Basically, I want to start a new array (do i have to?)
and count every time an author appears, eliminating repetition.

J


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




[PHP] Re: I need a random number eather one or two

2002-02-23 Thread jtjohnston

rand (1, 2)
http://www.php.net/manual/en/function.rand.php
?
J

Philip J. Newman wrote:

 I'm trying to make a random number kind of a coin toss,

 heads = 1 = left
 tales = 2 = right

 any solutions

 Philip J. Newman
 Philip's Domain - Internet Project.
 http://www.philipsdomain.com/
 [EMAIL PROTECTED]
 Phone: +64 25 6144012

--
John Taylor-Johnston
-

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



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




[PHP] how to build an array

2002-02-22 Thread jtjohnston

I guess it's because I didn't really follow Niklas' post, so I'll ask
the first part of yesterday's question again, if someone can help me
think my way through it. I've been looking at
http://www.php.net/manual/en/ref.array.php but don't really get HOW to
build an array from my MySQL data.

I'm exploding data from $mydata-KW
explode(;, $mydata-KW);
(It's a bunch of author names separated by ; in a bibliographic
database.)

I want to compile everything in One Single array, called $authors and
output it to the screen. Later, I'll aphabetise and sort the output ...

Where/How do I start in building a new array? .= doesn't work:

$authors .= explode(;, $mydata-KW);

How do I construct the array?
Will I be able to alpabetise it?

-snip--
$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);
$news = mysql_query(select KW from $table);

while ($mydata = mysql_fetch_object($news))
{
$authors .= explode(;, $mydata-KW);
}

foreach ($authors as $author)
{
echo $authorbr\n;
}

John


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




[PHP] Not Quite: how to build an array

2002-02-22 Thread jtjohnston

OK. I use:

 while ($mydata = mysql_fetch_object($news))
 {
 $authors = explode(;, $mydata-AS);
 }

Then why Invalid argument supplied for foreach()
Am I indeed building an array as I go through my database?

 foreach($authors as $author)
 {
#echo sort($author).br\n;
 echo $authorbr\n;
 }

http://www.php.net/manual/en/control-structures.foreach.php
foreach ($arr as $value) {
echo Value: $valuebr\n;
}

I have the right syntax? Did I build the array?
Newbie, but have to learn it somehow :)

snip-
$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);

 $news = mysql_query(select AS from $table);

 while ($mydata = mysql_fetch_object($news))
 {
 $authors = explode(;, $mydata-AS);
 }

 foreach($authors as $author)
 {
 echo $authorbr\n;
 }



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




Re: [PHP] Re: how to build an array

2002-02-22 Thread jtjohnston

Yeah but, this doesn't work either? I'm trying :)

 $news = mysql_query(select AS from $table);

 while ($mydata = mysql_fetch_object($news))
 {
# $authors = explode(;, $mydata-AS);
 array_push ($authors, explode(;, $mydata-AS));
 }

 foreach($authors as $author)
 {
 echo $authorbr\n;
 }



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




Re: [PHP] login determines content on page

2002-02-22 Thread jtjohnston

What's the difference between
if (isset($submit_happening))
and
if $submit_happening)

John

[EMAIL PROTECTED] wrote:

 On Fri, 22 Feb 2002 21:38:16 -0500, you wrote:

 I'd to know how difficult it is to achieve the following:
 
 Create login page, when the submit button is clicked, the user info is checked 
against a database as
 to whether is login info is valid. if it is valid, a page is displayed that lists 
all of the classes
 that the user has registered for, meaning each user will see a different list of 
classes.

 At first, I thought this was a homework question, but that seems
 unlikely. Ok, one way to do this is to have a form submit to itself.

 Briefly :

 ?
 if (isset($submit_happening)) {
 if ($username == david  $password=xyzzy) {
 echo(Successfully logged in);
 } else {
 echo(Not logged in);
 }
 } else {
 ?
 form method=post action=?=$PHP_SELF?
 input type=hidden name=submit_happening value=1
 input type=text name=username
 input type=password name=password
 /form
 ?
 }
 ?

 Untested. If you want to store a user's logon status permanently, look
 at sessions. http://www.php.net/manual/en/ref.session.php

 djo

--
John Taylor-Johnston
-
  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



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




[PHP] phpmyadmin

2002-02-21 Thread jtjohnston

I know this is a bit off the wall for most, but for what purpose do you
use phpmyadmin  mysql?
What are your projects?
Does anyone know of any good articles that discuss databasing, PHP,
MySQL and or PHPMyAdmin for academic purposes?
I'm a university researcher and want to collect some data.

John Taylor-Johnston
-

  ' ' '   Université de Sherbrooke:
 ô¿ô   http://compcanlit.ca/
   -


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




[PHP] gzip?

2002-02-21 Thread jtjohnston

What header do I type to gzip something out on the screen? To make the
output go faster, such as this text output:
http://ccl.flsh.usherb.ca/db/export_to_nb_format.php
I don,t want to actually zip the output, just make it go faster. Someone
once told me I could do that so the server spits output faster.

J


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




[PHP] More: gzip?

2002-02-21 Thread jtjohnston

It's called GZIP output buffering whatever that may be?



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




[PHP] This?: ob_start

2002-02-21 Thread jtjohnston

Does this do it?

ob_start();

while ($personne = mysql_fetch_object($news))
 {
$output = ;
$output .= R#:.$personne-id.¶\n;
if($personne-TNum != ){$output .= T#:.$personne-TNum.¶\n;}
$output = ob_get_contents($output);
echo $output;
ob_end_clean();
 }



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




[PHP] Result: ob_start

2002-02-21 Thread jtjohnston

I've narrowed down working code to this, but does it really do the job?
Does this really go faster?

header(Content-type: text/plain);
...
while ($personne = mysql_fetch_object($news))
 {
ob_start();
$output = ;
$output .= R#:.$personne-id.¶\n;
if($personne-TNum != ){$output .= T#:.$personne-TNum.¶\n;}
print_r ($output);
$output = ob_get_contents();
ob_end_clean();
echo $output;
 }


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




[PHP] foreach not in reach

2002-02-21 Thread jtjohnston

Question 1:
How can I append strings to my authors array?
Me thinks this doesn't work :§) ?
$authors .= explode(;, $mydata-KW);
I'm getting Invalid argument supplied for foreach()

Question 2:
Once I get this working, I want to (a) alphabetise the contents of the
array, (b) count repititions, (c) elimintate copies, and create an array
I can print with tow things $author[i]\t$counter[i], so I end up with
something like:

Adam2
Louis5
John3
Mary8



$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);
$news = mysql_query(select KW from $table);

while ($mydata = mysql_fetch_object($news))
{
$authors .= explode(;, $mydata-KW);
}

foreach ($authors as $author)
{
echo $authorbr\n;
}


I'm learning, slowly but surely Martin :)
J


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




[PHP] Need help

2002-02-20 Thread jtjohnston

Yeeesch! I neet help.

I need a method to flush out lists of authors in a MySQL field called
KW.

The field looks a bit like this:


1; Caribbean and West Indies; Guyana;4; Birney,(i) Earle; Harris,(i)
Wilson; Hope,(i) Alec Derwent; King,(i) Bruce; James,(i) Henry;
Olson,(i) Charles; Rushdie,(i) Salman; Purdy,(i) Al; Joyce,(i) James;
Macleish,(i) Archibald; Cummings,(i) Edward Estlin (E.E.); Auden,(i) W.
H.; Atwood,(i) Margaret; Tutuola,(i) Amos; Simon,(i) Claude;7;
comparison of authors and works;


In the section that starts with 4
I need to look for (i) search backward to the prewious ; and search
forward to the next ; and extract into an array the contents between the
semi-colons to arrive at something that looks like:

Birney, Earle
Harris, Wilson
Hope, Alec Derwent
King, Bruce
James, Henry
Olson, Charles
Rushdie, Salman
Purdy, Al
Joyce, James
Macleish, Archibald
Cummings, Edward Estlin (E.E.)
Auden, W. H.
Atwood, Margaret
Tutuola, Amos
Simon, Claude

Can someone please help me get started?

John


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




[PHP] phpmyadmin-mysql

2002-02-17 Thread jtjohnston

Hello,

I'm looking for code to display all my mysql databases in a select.
On change, I want to display all my tables in a select.
Finally, on change, it has to display all record of the table selected:

Print Record


id YR   AU   BT
 1 1997 Fee, Margery Writing Orality: Interpreting Literature
 Display in English by Aboriginal Writers in North
 America, Australia and New Zealand

Can someone give me a hand getting started?
I would normally use phpmyadmin, but I want to customise something they
don't offer.




[PHP] Frustrating ?

2002-02-17 Thread jtjohnston

Heres's a frustrating, and maybe not so stupid question?

I'm getting Warning: Supplied argument is not a valid MySQL result
resource on this line:

while ($mydata = mysql_fetch_object($news))

So what am I doing wrong here:

$where = id like $id;
$news = mysql_query('select * from ccl where '.$where.' order by AU
desc'); //desc = z-a

 while ($mydata = mysql_fetch_object($news))
  {
 echo tr bgcolor=\#CC\td align=centera
href=\index.html?id=$mydata-id\Print
View/a/tdtd$mydata-id/tdtd$mydata-AU/tdtd$mydata-ST/tdtd$mydata-BT/td/tr\n;

  }#end of while

I've tried variations like:

$news = mysql_query('select * from ccl where id like $id order by AU
desc');
$news = mysql_query(select * from ccl where id like $id order by AU
desc);

$id checks out ok. I use index.html?id=4
AU exists; ok. So ... ?

John


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




[PHP] More: Frustrating ?

2002-02-17 Thread jtjohnston

  while ($mydata = mysql_fetch_object($news))
  So what am I doing wrong here:
  $where = id like $id;
  $news = mysql_query('select * from ccl where '.$where.' order by AU desc');
 //desc = z-a

 A) Have you already confirmed that a valid database connection was made?

Yes. A copy and paste of working code:
$news = mysql_query(select * from ccl ORDER by AU asc);
Connection was made.

So I do?

$news = mysql_query(select * from ccl where '.$where.' order by AU desc);

or ?

$news = mysql_query(select * from ccl where '.%$where%.' order by AU desc);

The % are not necessary? because id is an auto_increment number from 0 to
1,000+.

Why the ' inside  ?


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




[PHP] http://

2002-02-07 Thread jtjohnston

I'm looking for a function that will find occurences of urls in any
given string and do this:

http://www.nowhere.com/
becomes
a href=http://www.nowhere.com/;http://www.nowhere.com//a

Could, should also look for
mailto:[EMAIL PROTECTED]
telnet:blah.blah
or even news:blaj.blah

Does such a thing exist?

--
John Taylor-Johnston
-

Collège de Sherbrooke:
http://www.collegesherbrooke.qc.ca/languesmodernes/
Université de Sherbrooke:
http://compcanlit.ca/



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




[PHP] MySQL

2002-02-05 Thread jtjohnston

In MySQL, I have a date field that is formatted 000-00-00 Is there a
function in PHP I did not find yet that does this?
John


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




[PHP] Re: MySQL

2002-02-05 Thread jtjohnston

$date = date (Y-m-d); #works?
:)

Jtjohnston wrote:

 In MySQL, I have a date field that is formatted 000-00-00 Is there a
 function in PHP I did not find yet that does this?
 John


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




[PHP] Previous n Articles

2002-02-05 Thread jtjohnston

I'm using this code to create a Next n Articles  on my index.page
from my mysql database.
I worked most of it out myself. Then I got some help. It works. I
thought I understood my own code enough to be able to construct a 
Previous n Articles. I guess not. My coding skills need help.
So how do I reverse my code to construct the previous n articles from my
sql database.

if(!$offset)
{
$offset = 0;
}
$limit = 5;
$num_rows = 13;#I get this from a mysql operation

#
$new_offset = $offset + $limit;
$disp = $limit;
if ($new_offset + $limit  $num_rows)
{
  $disp = $num_rows - $new_offset;
}
if ($disp  0)
{
  $nextinsert  =  font face=\arial\ size=2A
HREF=\index.html?offset=.$new_offset.\Next .$disp. Articles
gt;gt;/a/font\n;
}

g Thanks if you have a second.

John


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




[PHP] Re: Dynamic Dropdown menu question.

2002-02-05 Thread jtjohnston

Michael,
I think you're trying to kill yourself coding. here's what I do for myself:

select name=from
option value= SELECTEDSelect Someone/option
?php
 $myconnection = mysql_connect($server,$user,$pass);
 mysql_select_db($db,$myconnection);

$news = mysql_query(select * from $table ORDER by LastName asc);

 while ($mydata = mysql_fetch_object($news))
  {
 echooption value=\.$mydata-EM.\.$mydata-FirstName.
.$mydata-LastName./option\n;
 }

mysql_close($myconnection);
?
/select


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




[PHP] autoindex

2002-02-05 Thread jtjohnston

I want to reset the autoindex in a mysql table using php if I can.
I found this. Can anyone help?

http://www.mysql.com/doc/m/y/myisamchk_other_options.html

J


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




Re: [PHP] Previous n Articles

2002-02-05 Thread jtjohnston

Jason,

I'm not ssure I follow.
$offset is the number i read in in my a href
$limit is the number displayed.
$num_rows is the number of rows in my database.

What are you doing with $previous? $previous would be my string, not the
previous offset?
Could you show me again?

  if(!$offset)
  {
  $offset = 0;
  }
  $limit = 5;
  $num_rows = 13;#I get this from a mysql operation
 
  #
  $new_offset = $offset + $limit;
  $disp = $limit;
  if ($new_offset + $limit  $num_rows)
  {
$disp = $num_rows - $new_offset;
  }
  if ($disp  0)
  {
$nextinsert  =  font face=\arial\ size=2A
 HREF=\index.html?offset=.$new_offset.\Next .$disp. Articles
 gt;gt;/a/font\n;
  }
 

 Something like:

   $previous = $offset - $limit;
   if ($previous  0) { $previous = 0; }

 then incorporate $previous into your previous link in a similar fashion to
 the next link.


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




[PHP] Yawn, good morning? night? Whateva! :)

2002-02-03 Thread jtjohnston

Good day, morning, night? It's dark, so that makes it sleepy bye time.
Bit before I do, I'm trying to work this out.
I have a little bit of code to print Next n articles in my database.
Can someone help me straighten out these lines of code, pretty please
... before I go fleeping nuts :)

if(!$rendu)
{
$rendu = 0;
}
$nombre = 10;

$news = mysql_query(select * from $table ORDER by DT desc);
$num_rows = mysql_num_rows($news);

$nouveau = $rendu + $nombre;
if ($nouveau  $num_rows)
{
if ($nombre  $num_rows)
{
$nouveau = $num_rows - $nombre;
#when there are 23 articles, and I am number 20 on the screen, I
want to display the remaining 3, not ten.
}
$myinsert  =  font face=\arial\ size=2A
HREF=\index.html?rendu=.$nouveau.\Next .$nouveau. Articles
gt;gt;/a/font\n;

}

John



?php

if(!$rendu)
{
$rendu = 0;
}
$nombre = 10;


#$myconnection = mysql_pconnect($server,$user,$pass);
 $myconnection = mysql_connect($server,$user,$pass);

 mysql_select_db($db,$myconnection);

 $news = mysql_query(SHOW TABLE STATUS FROM .$db. LIKE '$table');
 while ($news_story = mysql_fetch_array($news))
  {
 $table_comment = $news_story['Comment'];
  }

$news = mysql_query(select * from $table ORDER by DT desc);
$num_rows = mysql_num_rows($news);

$news = mysql_query(select * from $table ORDER by DT desc LIMIT
$rendu,$nombre);

$old_WHO = ;

 while ($mydata = mysql_fetch_object($news))
  {
 $mydata-RQ = str_replace(\r, , $mydata-RQ);
 $mydata-RQ = str_replace(\n, br, $mydata-RQ);
 $mydata-RQ = str_replace(brbr, p, $mydata-RQ);
 $mydata-CM = str_replace(\r, , $mydata-CM);
 $mydata-CM = str_replace(\n, br, $mydata-CM);
 $mydata-CM = str_replace(brbr, p, $mydata-CM);

 ### Display WHO Once 
 if ($old_WHO != $mydata-WHO) #when WHO occurs the first time, echo it
once only.
{
$old_WHO = $mydata-WHO;
$body .= bFrom .$mydata-WHO.:/b;
}
 ## Description ###
 if($mydata-RQ)
 $body .= ol.$mydata-RQ./ol\n;
 ## Description ###
 if($mydata-CM)
 $body .= olsmall.$mydata-DT. - font
color=\blue\i.$mydata-CM./i/font/small/olbr\n;

 }#end of while
 mysql_close($myconnection);


#
$nouveau = $rendu + $nombre;
if ($nouveau  $num_rows)
{
if ($nouveau  $num_rows)
{
$nouveau = $num_rows - $nouveau ;
}
$myinsert  =  font face=\arial\ size=2A
HREF=\index.html?rendu=.$nouveau.\Next .$nouveau. Articles
gt;gt;/a/font\n;

}
#

echo h2 align=center.$table_comment./h2
ul
h3$course_description/h3
.. $myinsertbr
.. $num_rowsbr
.. $nouveau = $rendu + $nombrebr
if ($nouveau  $num_rows)br
ol
$body
/ol
hr
/ul;

?


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




Re: [PHP] Can php Read contents from MS Word in Exactly sameformat

2002-02-03 Thread jtjohnston

Is there a function or class written to convert rtf reliably to html? :)
Let me know,
John
A post  reply would be helpful if you can.

Jason G. wrote:

 MS Word is a proprietary, binary (i think), format...  Have fun.

 There may be a solution out there.

 If you could convince her to save it in Rich Text Format (rtf) and then
 upload it, your life would be much easier...

 -Jason Garber

 At 01:51 PM 2/4/2002 +0800, Jack wrote:
 Dear all
 I had made  a news input page for one of the HR Manger to input the news for
 the whole company to read, she is quick comfort with using MS word as a
 editor, so is there anyway that the php can read the contents from the MS
 Word and display as exactly same format to html?
 
 If there is so, could any one suggest a book to me?
 
 Thx a lot
 Jack
 [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




[PHP] limit 0,30

2002-01-31 Thread jtjohnston

I want to do something like this on a page:

Pages:  1 2 3 [Next]

How can I code SELECT * FROM `bookmarks` LIMIT 0, 30 ?

Thanks?

John


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




  1   2   >