[PHP] Search Engine friendly URLs (/ instead of ? or ) not working in CGI mode

2001-09-13 Thread Jobarr

Hello, I am running windows 2000, apache 1.3.20, and php 4.0.6. I am trying
to set it up so that I could access my webpage as
http://www.site.com/script/1/2 as opposed to
http://www.site.com/script.php?var1=1var2=2. I am using a method similar to
the one descriped here:
http://www.evolt.org/article/Search_Engine_Friendly_URLs_with_PHP_and_Apache
/17/15049/index.html.

For some reason, if I use PHP as a CGI and access any script with a /
after it (http://www.site.com/script.php/) it causes a 500 error and this
message in the error log: Premature end of script headers: c:/php/php.exe.

If I access the same URL using PHP as an apache module, I have no problems.
But, there seems to be some memory leaks in the module so I want to to use
the CGI instead.

Does anyone know why it won't work in CGI mode or maybe what I am doing
wrong?

This is my config for the CGI mode:
ScriptAlias /php/ C:/php/
AddType application/x-httpd-php .php
Action application/x-httpd-php /php/php.exe


Thanks!
-Jobarr





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




[PHP] Sorting an array

2001-09-13 Thread Dotan Cohen

I'm trying to sort a listing of albums alphabetically
for LyricsList.com, the problem is that I want the
initial 'The' and 'A' in some albums (A Hard Days
Night, The Wall) to be ignored. So that the list will
look like: 

Abbey Road 
Dark Side Of the Moon 
The Final Cut 
A Hard Days Night 
Kill 'em All 
The Wall 

ABC order, 'A' and 'The' negated. The info comes from
a database, in three calls: 

// call albums that begin with letter $letter 
$query = SELECT * FROM albums WHERE album LIKE
'$letter%' ORDER BY album; 
$result = mysql_query($query) or die(mysql_error()); 

// call albums that begin with letter A 
$query_a = SELECT * FROM albums WHERE album LIKE 'a'
ORDER BY album; 
$result_a = mysql_query($query_a) or
die(mysql_error()); 

// call albums that begin with letter T 
$query_t = SELECT * FROM albums WHERE album LIKE 't'
ORDER BY album; 
$result_t = mysql_query($query_t) or
die(mysql_error()); 

So I need to get just the albums from $result_t that
begin with 'The ' (easy regex) and from $result_a that
begin with 'A ' (easy regex), but puting the three of
them in order is proving beyond my skill. 

Thanks in advance for any advise. 

Dotan Cohen


__
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/

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




[PHP] Re: limiting rows and pages like google -- again

2001-09-13 Thread Adam

i spent a good day learning how to do this from scratch. I'll post my code
and you can decypher it yourself.



 ?php
$select_all = mysql_query(SELECT id FROM images WHERE
directory='original');
$select_result = mysql_result($select_all,0);
$select_numrows = mysql_num_rows($select_all);
$i=1;
if (!isset($page)) {
 $page = 1;
}
if ($page != 1 ) {
 if (($page-1) == 1) {
  echo 'a href='.$PHP_SELF.'laquo;previous/anbsp;';
 }else{
  echo 'a
href='.$PHP_SELF.'?page='.($page-1).'laquo;previous/anbsp;';
 }
} else {
 echo 'font color=#99laquo;previous/fontnbsp;';
}
while ($select_numrows  0) {
 if ($page != $i) {
  if ($i==1){
   echo 'a href='.$PHP_SELF.''.$i.'/anbsp;';
  } else{
   echo 'a href='.$PHP_SELF.'?page='.$i.''.$i.'/anbsp;';
  }
 } else {
 echo 'font color=#99'.$i.'/fontnbsp;';
}
 $i = $i+1;
 $select_numrows = $select_numrows-20;
}
if ($page  ($i-1)) {
 echo 'a
href='.$PHP_SELF.'?page='.($page+1).'nextraquo;/anbsp;nbsp;';
} else {
 echo 'font color=#99nextraquo;/fontnbsp;nbsp;';
}

   ?


hope this helps. it took 2 days straight to debug and develope. obviously
you would use different database values though.

-Adam
god bless amarica



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




[PHP] Validate CSV file With Table in Database!!

2001-09-13 Thread Coenraad Steenkamp

I need to compare a csv file to a table in the database but only one field
in the database with
one field in the CSV file! Comparing only one field will make it much
easier! When there is any change in the Database compared to the CSV file ,
the database must then be updated or if there are no such a field it must be
added to the table!

I am new in php Please help!




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




Re: [PHP] Validate CSV file With Table in Database!!

2001-09-13 Thread David Robley

On Thu, 13 Sep 2001 16:37, Coenraad Steenkamp wrote:
 I need to compare a csv file to a table in the database but only one
 field in the database with
 one field in the CSV file! Comparing only one field will make it much
 easier! When there is any change in the Database compared to the CSV
 file , the database must then be updated or if there are no such a
 field it must be added to the table!

 I am new in php Please help!

That seems an awful lot of work, if you know that the csv is at least as 
up to date, if not more so, than the actual table. You might as well just 
drop the table and import the contents of the csv.

Unless there's a good reason not to that you haven't mentioned?

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   Birds are trapped by their feet, people by their tongues.

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




Re: [PHP] Problem with Uploading Many Files (22)

2001-09-13 Thread Jani Rautiainen

On Windows it should be the latest, because I just downloaded it 2 weeks
ago... On Linux (my client's server) I assume it's one of the latest also...

Matthew Loff [EMAIL PROTECTED] wrote in message
007501c13bc8$520f7fd0$0ce60281@bang">news:007501c13bc8$520f7fd0$0ce60281@bang...

 What version of PHP are you running?

 There were a few bugs in the file upload code that have been fixed in
 recent relases of PHP...

 --Matt

 -Original Message-
 From: Jani Rautiainen [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, September 12, 2001 3:51 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Problem with Uploading Many Files (22)


 I have been fighting with an annoying problem for couple days.. If I try
 to upload more than 22 files (no matter what size), the last file
 doesn't upload correctly..

 I don't know PHP very well, so I don't know whether there is a way to
 configure the server to get around the problem...

 In the beginning I thought it was a problem with the java applet that is
 used to upload the files, but then I tested with a normal html form
 (below) and problem was still there, so I'm assuming it's PHP (I've
 tested it with both Win/IIS and Linux/Apache configurations)..

 I have the following piece of code to test the feature... The output
 lists all the files, but the last file doesn't have size set (name is
 correct
 though) and the copy function gives an error...

 form action=upload_result.php method=POST
 enctype=multipart/form-data File 1: input name=file1
 type=filebr File 2: input name=file2 type=filebr File 3:
 input name=file3 type=filebr File 4: input name=file4
 type=filebr File 5: input name=file5 type=filebr File 6:
 input name=file6 type=filebr File 7: input name=file7
 type=filebr File 8: input name=file8 type=filebr File 9:
 input name=file9 type=filebr File 10: input name=file10
 type=filebr File 11: input name=file11 type=filebr File 12:
 input name=file12 type=filebr File 13: input name=file13
 type=filebr File 14: input name=file14 type=filebr File 15:
 input name=file15 type=filebr File 16: input name=file16
 type=filebr File 17: input name=file17 type=filebr File 18:
 input name=file18 type=filebr File 19: input name=file19
 type=filebr File 20: input name=file20 type=filebr File 21:
 input name=file21 type=filebr File 22: input name=file22
 type=filebr File 23: input name=file23 type=filebr File 24:
 input name=file24 type=filebr input type=submit /form

 and in the receiving side there is the following code

 ?
  $filedir = c:\\filestorage\\;
  $count = 1;
  foreach ( $HTTP_POST_FILES as $file ) {
   $filename = $file['name'];
   $filesize = $file['size'];
  echo File name $filename? size: $filesizebr\n;
   copy($file['tmp_name'], $filedir.$count..jpg);
   $count++;
 }
 ?




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




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




Re: [PHP] Problem with Uploading Many Files (22)

2001-09-13 Thread Helen

Could that possibly be triggering the max file limit?

Helen

- Original Message -
From: Jani Rautiainen [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, September 13, 2001 5:27 PM
Subject: Re: [PHP] Problem with Uploading Many Files (22)


 On Windows it should be the latest, because I just downloaded it 2 weeks
 ago... On Linux (my client's server) I assume it's one of the latest
also...

 Matthew Loff [EMAIL PROTECTED] wrote in message
 007501c13bc8$520f7fd0$0ce60281@bang">news:007501c13bc8$520f7fd0$0ce60281@bang...
 
  What version of PHP are you running?
 
  There were a few bugs in the file upload code that have been fixed in
  recent relases of PHP...
 
  --Matt
 
  -Original Message-
  From: Jani Rautiainen [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, September 12, 2001 3:51 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] Problem with Uploading Many Files (22)
 
 
  I have been fighting with an annoying problem for couple days.. If I try
  to upload more than 22 files (no matter what size), the last file
  doesn't upload correctly..
 
  I don't know PHP very well, so I don't know whether there is a way to
  configure the server to get around the problem...
 
  In the beginning I thought it was a problem with the java applet that is
  used to upload the files, but then I tested with a normal html form
  (below) and problem was still there, so I'm assuming it's PHP (I've
  tested it with both Win/IIS and Linux/Apache configurations)..
 
  I have the following piece of code to test the feature... The output
  lists all the files, but the last file doesn't have size set (name is
  correct
  though) and the copy function gives an error...
 
  form action=upload_result.php method=POST
  enctype=multipart/form-data File 1: input name=file1
  type=filebr File 2: input name=file2 type=filebr File 3:
  input name=file3 type=filebr File 4: input name=file4
  type=filebr File 5: input name=file5 type=filebr File 6:
  input name=file6 type=filebr File 7: input name=file7
  type=filebr File 8: input name=file8 type=filebr File 9:
  input name=file9 type=filebr File 10: input name=file10
  type=filebr File 11: input name=file11 type=filebr File 12:
  input name=file12 type=filebr File 13: input name=file13
  type=filebr File 14: input name=file14 type=filebr File 15:
  input name=file15 type=filebr File 16: input name=file16
  type=filebr File 17: input name=file17 type=filebr File 18:
  input name=file18 type=filebr File 19: input name=file19
  type=filebr File 20: input name=file20 type=filebr File 21:
  input name=file21 type=filebr File 22: input name=file22
  type=filebr File 23: input name=file23 type=filebr File 24:
  input name=file24 type=filebr input type=submit /form
 
  and in the receiving side there is the following code
 
  ?
   $filedir = c:\\filestorage\\;
   $count = 1;
   foreach ( $HTTP_POST_FILES as $file ) {
$filename = $file['name'];
$filesize = $file['size'];
   echo File name $filename? size: $filesizebr\n;
copy($file['tmp_name'], $filedir.$count..jpg);
$count++;
  }
  ?
 
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED] To
  contact the list administrators, e-mail: [EMAIL PROTECTED]
 



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


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




[PHP] further info - seg fault

2001-09-13 Thread Jack Dempsey

hello,

i sent an e-mail before generally describing a seg fault issue i was
having...i did gdb bt and found this:

(this is at the end of the data after running gdb)
Loaded symbols for /lib/libnss_dns.so.2
#0  0x403dab14 in chunk_realloc (ar_ptr=0x4048aba0, oldp=0x82450f0,
oldsize=1444, nb=1560) at malloc.c:3335
3335malloc.c: No such file or directory.
in malloc.c

(then i ran bt and receive this)
(gdb) bt
#0  0x403dab14 in chunk_realloc (ar_ptr=0x4048aba0, oldp=0x82450f0,
oldsize=1444, nb=1560) at malloc.c:3335
#1  0x403daa11 in __libc_realloc (oldmem=0x82450f8, bytes=1556) at
malloc.c:3295
#2  0x080e9c5f in _erealloc () at eval.c:41
#3  0x080c5504 in php_strtr () at eval.c:41
#4  0x080c56af in php_if_strtr () at eval.c:41
#5  0x08107f61 in execute () at eval.c:41
#6  0x08108148 in execute () at eval.c:41
#7  0x080e9882 in zend_execute_scripts () at eval.c:41
#8  0x08067d0f in php_execute_script () at eval.c:41
#9  0x08064598 in main () at eval.c:41

i can see the no such file or directory and am concerned about where this
came from...anyone with some lowlevel knowledge of php have any thoughts?

thanks
jack


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




Re: [PHP] Validate CSV file With Table in Database!!

2001-09-13 Thread David Robley

On Thu, 13 Sep 2001 16:52, you wrote:
 There is a very good reason !
 The csv file contains world currency's
 The system is updated with the changed currency's only !
 The Master field contains all country currency's , this makes it
 difficult because if i drop the master table and upload the csv there
 will only be a few currency's!

 Thanks
 Coenraad Steenkamp


 - Original Message -
 From: David Robley [EMAIL PROTECTED]
 Newsgroups: php.general
 To: Coenraad Steenkamp [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 Sent: Thursday, September 13, 2001 9:18 AM
 Subject: Re: [PHP] Validate CSV file With Table in Database!!

  On Thu, 13 Sep 2001 16:37, Coenraad Steenkamp wrote:
   I need to compare a csv file to a table in the database but only
   one field in the database with
   one field in the CSV file! Comparing only one field will make it
   much easier! When there is any change in the Database compared to
   the CSV file , the database must then be updated or if there are no
   such a field it must be added to the table!
  
   I am new in php Please help!
 
  That seems an awful lot of work, if you know that the csv is at least
  as up to date, if not more so, than the actual table. You might as
  well just drop the table and import the contents of the csv.
 
  Unless there's a good reason not to that you haven't mentioned?

OK. So it sounds like you need to do something like:

for each csv file line
  select record where table_key = csvfield_key
  if record found
if table_other_value != csv_other_value
  update table with csv_value
end if
  else (record not found)
insert new record
  end if
end for

where the key might be perhaps the country name and the other value is 
the current currency.

Am I on the right track? Does that help you any?

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   I am functioning within established parameters.

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




Re: [PHP] Validate CSV file With Table in Database!!

2001-09-13 Thread Coenraad Steenkamp

This is the code i came up with! But it is not 100%
?php
 if (isset($Submit)) {
  // File is uploaded
  if ($uFile  ) {
 if (!copy($uFile, $move_to_dir./.$uFile_name)) {
echo No File Uploaded;
 }
 $curr = fopen($move_to_dir./.$uFile_name, r);
 while ($currar = fgetcsv($curr, 1000, ,)) {
$CurrCode = $currar[0];
$Currency = $currar[1];
$From1 = $currar[2];
$To1 = $currar[3];
$ROEX = $currar[4];
$sqlcurr=SELECT * FROM CurrencyNetwork WHERE CNCurr =
'$Currency';
$result = mysql_query($sqlcurr,$db_con);
if (mysql_fetch_array($result)) {
   //Do Nothing
} else {
$sql=INSERT INTO CurrencyNetwork
(CNCode,CNCurr,CNAdBy,CNDtAd,CNROEX)
  values ('$CurrCode', '$Currency', '$From1', '$To1',
'$ROEX');
  mysql_query($sql,$db_con);
}

 }
 mysql_close($db_con);
  }
   }
 else
 {
  // No file uploaded, show the form
  echo div align='center';
  echo Upload this file: input name='uFile' type='file';
  echo input type='submit' name='Submit' value='Upload';
  echo /div;
 }
?



David Robley [EMAIL PROTECTED] wrote in message
01091317241109.14360@www">news:01091317241109.14360@www...
 On Thu, 13 Sep 2001 16:52, you wrote:
  There is a very good reason !
  The csv file contains world currency's
  The system is updated with the changed currency's only !
  The Master field contains all country currency's , this makes it
  difficult because if i drop the master table and upload the csv there
  will only be a few currency's!
 
  Thanks
  Coenraad Steenkamp
 
 
  - Original Message -
  From: David Robley [EMAIL PROTECTED]
  Newsgroups: php.general
  To: Coenraad Steenkamp [EMAIL PROTECTED];
  [EMAIL PROTECTED]
  Sent: Thursday, September 13, 2001 9:18 AM
  Subject: Re: [PHP] Validate CSV file With Table in Database!!
 
   On Thu, 13 Sep 2001 16:37, Coenraad Steenkamp wrote:
I need to compare a csv file to a table in the database but only
one field in the database with
one field in the CSV file! Comparing only one field will make it
much easier! When there is any change in the Database compared to
the CSV file , the database must then be updated or if there are no
such a field it must be added to the table!
   
I am new in php Please help!
  
   That seems an awful lot of work, if you know that the csv is at least
   as up to date, if not more so, than the actual table. You might as
   well just drop the table and import the contents of the csv.
  
   Unless there's a good reason not to that you haven't mentioned?

 OK. So it sounds like you need to do something like:

 for each csv file line
   select record where table_key = csvfield_key
   if record found
 if table_other_value != csv_other_value
   update table with csv_value
 end if
   else (record not found)
 insert new record
   end if
 end for

 where the key might be perhaps the country name and the other value is
 the current currency.

 Am I on the right track? Does that help you any?

 --
 David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
 CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA

I am functioning within established parameters.



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




Re: [PHP] Verify email client can read html email?

2001-09-13 Thread Bob

Thanks!  That's exactly what I wanted and it's easy to add the AltBody.  I
thought it would be harder.  What sort of success have you had with it?  I
don't have access to a pine account.

Here's the example from the site for anyone else who wanted to know
$mail-Body =  This is the message body;
$mail-AltBody = For non html email clients;

AltBody sets the text-only body of the message. This automatically sets the
email to multipart/alternative. This body can be read by mail clients that do
not have HTML email capability such as mutt. Clients that can read HTML will
view the normal Body.


[EMAIL PROTECTED] wrote:

 it is called multipart email and should work across the board.

 should is the operative word in that sentence.
 look at http://phpmailer.sourceforge.net for info on a PHP class to send
 emails.

 I am working with the developer and other programmers to work the bugs out
 of multipart.

 [EMAIL PROTECTED] wrote:
  When sending out email is it possible to know if their email client
  program will be able to read a html email?  If it can't read a html
  email then it would show a text email.  I know it's conventional wisdom
  that this isn't possible but has anyone even heard of someone figuring
  this out?
 
 
 
 
  _
  Do You Yahoo!?
  Get your free @yahoo.com address at http://mail.yahoo.com
 
 
  --
  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]

 
 

 --
 Michael Geier
 CDM Sports, Inc. - Systems Administrator
  email: [EMAIL PROTECTED]
  phone: 314.991.1511 x 6505
  pager: 314.318.9414 || [EMAIL PROTECTED]


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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




[PHP] syntax?

2001-09-13 Thread Peter


HI,

I am new to this PHP thing.

I was working out of my PHP book and website and I noticed some
discrepancies in inputting data into the MySQL database.

I followed the example from my book and I noticed that the syntax for
putting data into a mysql database from PHP was like this:

$sql = INSERT INTO news
VALUES (NULL,'$heading','$body','$date','$auth','$auth_email');

However I read some information on the website and I noticed that they
added the field names right after the name of the table like this:

mysql_query (INSERT INTO tablename (first_name, last_name) 
VALUES ('$first_name', '$last_name')
 );

I have two questions:

In the first example what is the meaning of putting the NULL before the
variables?

I was successful in entering data from my first example without declaring
field names, so why did they declare in field names in the second example?

If anyone can shed some light on this question, I would be most grateful.

Thanks.

Peter


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




Re: [PHP] Mail function....

2001-09-13 Thread B. van Ouwerkerk


Can someone please just run me through the different sections of the mail 
function please cause i understand you can change the from address etc aswell

This is in the manual. Read it, try it and if you can't get it to run 
properly ask your question again. Don't forget to describe what you tried 
and to include your code.

Bye,


B.



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




[PHP] Re: Sorting an array

2001-09-13 Thread _lallous

here's your script,

?
$mem = The Childhood
A Man called lallous
The Long kiss good night
Abbey Road
Dark Side Of the Moon
The Final Cut
The Zombie
A Hard Days Night
Kill 'em All
The Wall;

$mem = split(\n, $mem);
$arr1 = array();

for ($i=0;$icount($mem);$i++)
{
  $line = trim($mem[$i]);
  $prefix = ;
  $affix = $line;
  if (preg_match(/^(the |a )(.+)$/i, $line, $matches))
  {
$prefix = $matches[1];
$affix  = $matches[2];
  }
  $arr1[$affix] = $prefix;
}
ksort($arr1);
$arr2 = array();
while (list($key, $val) = each($arr1))
{
  $arr2[] = $val$key;
}
var_dump($arr2);
?


Dotan Cohen [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I'm trying to sort a listing of albums alphabetically
 for LyricsList.com, the problem is that I want the
 initial 'The' and 'A' in some albums (A Hard Days
 Night, The Wall) to be ignored. So that the list will
 look like:

 Abbey Road
 Dark Side Of the Moon
 The Final Cut
 A Hard Days Night
 Kill 'em All
 The Wall

 ABC order, 'A' and 'The' negated. The info comes from
 a database, in three calls:

 // call albums that begin with letter $letter
 $query = SELECT * FROM albums WHERE album LIKE
 '$letter%' ORDER BY album;
 $result = mysql_query($query) or die(mysql_error());

 // call albums that begin with letter A
 $query_a = SELECT * FROM albums WHERE album LIKE 'a'
 ORDER BY album;
 $result_a = mysql_query($query_a) or
 die(mysql_error());

 // call albums that begin with letter T
 $query_t = SELECT * FROM albums WHERE album LIKE 't'
 ORDER BY album;
 $result_t = mysql_query($query_t) or
 die(mysql_error());

 So I need to get just the albums from $result_t that
 begin with 'The ' (easy regex) and from $result_a that
 begin with 'A ' (easy regex), but puting the three of
 them in order is proving beyond my skill.

 Thanks in advance for any advise.

 Dotan Cohen


 __
 Terrorist Attacks on U.S. - How can you help?
 Donate cash, emergency relief information
 http://dailynews.yahoo.com/fc/US/Emergency_Information/



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




RE: [PHP] syntax?

2001-09-13 Thread Niklas Lampen

In second example you can define which fields to insert, very usefull if you
have a lot of fields.


Niklas

-Original Message-
From: Peter [mailto:[EMAIL PROTECTED]]
Sent: 13. syyskuuta 2001 10:59
To: [EMAIL PROTECTED]
Subject: [PHP] syntax?



HI,

I am new to this PHP thing.

I was working out of my PHP book and website and I noticed some
discrepancies in inputting data into the MySQL database.

I followed the example from my book and I noticed that the syntax for
putting data into a mysql database from PHP was like this:

$sql = INSERT INTO news
VALUES (NULL,'$heading','$body','$date','$auth','$auth_email');

However I read some information on the website and I noticed that they
added the field names right after the name of the table like this:

mysql_query (INSERT INTO tablename (first_name, last_name)
VALUES ('$first_name', '$last_name')
 );

I have two questions:

In the first example what is the meaning of putting the NULL before the
variables?

I was successful in entering data from my first example without declaring
field names, so why did they declare in field names in the second example?

If anyone can shed some light on this question, I would be most grateful.

Thanks.

Peter


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


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




Re: [PHP] Validate CSV file With Table in Database!!

2001-09-13 Thread David Robley

On Thu, 13 Sep 2001 17:27, Coenraad Steenkamp wrote:
 This is the code i came up with! But it is not 100%
 ?php
  if (isset($Submit)) {
   // File is uploaded
   if ($uFile  ) {
  if (!copy($uFile, $move_to_dir./.$uFile_name)) {
 echo No File Uploaded;
  }
  $curr = fopen($move_to_dir./.$uFile_name, r);
  while ($currar = fgetcsv($curr, 1000, ,)) {
 $CurrCode = $currar[0];
 $Currency = $currar[1];
 $From1 = $currar[2];
 $To1 = $currar[3];
 $ROEX = $currar[4];
 $sqlcurr=SELECT * FROM CurrencyNetwork WHERE CNCurr =
 '$Currency';
 $result = mysql_query($sqlcurr,$db_con);
 if (mysql_fetch_array($result)) {
//Do Nothing
 } else {
 $sql=INSERT INTO CurrencyNetwork
 (CNCode,CNCurr,CNAdBy,CNDtAd,CNROEX)
   values ('$CurrCode', '$Currency', '$From1', '$To1',
 '$ROEX');
   mysql_query($sql,$db_con);
 }

  }
  mysql_close($db_con);
   }
}
  else
  {
   // No file uploaded, show the form
   echo div align='center';
   echo Upload this file: input name='uFile' type='file';
   echo input type='submit' name='Submit' value='Upload';
   echo /div;
  }
 ?



 David Robley [EMAIL PROTECTED] wrote in message
 01091317241109.14360@www">news:01091317241109.14360@www...

  On Thu, 13 Sep 2001 16:52, you wrote:
   There is a very good reason !
   The csv file contains world currency's
   The system is updated with the changed currency's only !
   The Master field contains all country currency's , this makes it
   difficult because if i drop the master table and upload the csv
   there will only be a few currency's!
  
   Thanks
   Coenraad Steenkamp
  
  
   - Original Message -
   From: David Robley [EMAIL PROTECTED]
   Newsgroups: php.general
   To: Coenraad Steenkamp [EMAIL PROTECTED];
   [EMAIL PROTECTED]
   Sent: Thursday, September 13, 2001 9:18 AM
   Subject: Re: [PHP] Validate CSV file With Table in Database!!
  
On Thu, 13 Sep 2001 16:37, Coenraad Steenkamp wrote:
 I need to compare a csv file to a table in the database but
 only one field in the database with
 one field in the CSV file! Comparing only one field will make
 it much easier! When there is any change in the Database
 compared to the CSV file , the database must then be updated or
 if there are no such a field it must be added to the table!

 I am new in php Please help!
   
That seems an awful lot of work, if you know that the csv is at
least as up to date, if not more so, than the actual table. You
might as well just drop the table and import the contents of the
csv.
   
Unless there's a good reason not to that you haven't mentioned?
 
  OK. So it sounds like you need to do something like:
 
  for each csv file line
select record where table_key = csvfield_key
if record found
  if table_other_value != csv_other_value
update table with csv_value
  end if
else (record not found)
  insert new record
end if
  end for
 
  where the key might be perhaps the country name and the other value
  is the current currency.
 
  Am I on the right track? Does that help you any?
 
  --
  David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
  CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA
 
 I am functioning within established parameters.

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   A cat will go quack - if you squeeze it hard enough.

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




[PHP] *** Po okazyjnej cenie densytometr Vipdens 950P ! ***

2001-09-13 Thread densytometr

Jeoli jesteo profesjonalist1 w swojej dziedzinie
to w3aonie dla Ciebie jest moja niepowtarzalna oferta.

Vipdens 950 P jest niezrównanym podrecznym instrumentem do badania arkuszy
drukarskich lub ewentualnie do kontroli barwnej pracy wydrukowanej.

Vpidens 950p do nabycia za kwote 4,999z3 netto(cena rynkowa 8,500z3)

Wiecej informacji uzyskasz pod adresem: http://www.densytometr.hg.pl






__
Zobacz kto wygra wybory 2001?
http://wybory.hoga.pl


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




[PHP] Re: syntax?

2001-09-13 Thread _lallous

If you don't put fields name as in: INSERT INTO news VALUES(, )
this means you are going to give values to all the fields in the table (in
their order).
If you specify fields after table name: news(body, date) this means VALUES()
would be adding to these specific fields...

now as for putting NULL, this means that the fields will get the default
value, if it was autoincrement it will be also stored there.

Usualy ID fields are autoincrement and always inserted with NULL values so
that MySql will assign a valid value.


Peter [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 HI,

 I am new to this PHP thing.

 I was working out of my PHP book and website and I noticed some
 discrepancies in inputting data into the MySQL database.

 I followed the example from my book and I noticed that the syntax for
 putting data into a mysql database from PHP was like this:

 $sql = INSERT INTO news
 VALUES (NULL,'$heading','$body','$date','$auth','$auth_email');

 However I read some information on the website and I noticed that they
 added the field names right after the name of the table like this:

 mysql_query (INSERT INTO tablename (first_name, last_name)
 VALUES ('$first_name', '$last_name')
  );

 I have two questions:

 In the first example what is the meaning of putting the NULL before the
 variables?

 I was successful in entering data from my first example without declaring
 field names, so why did they declare in field names in the second example?

 If anyone can shed some light on this question, I would be most grateful.

 Thanks.

 Peter




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




Re: [PHP] Validate CSV file With Table in Database!!

2001-09-13 Thread David Robley

Sorry - pressed send w/out writing anything. Topic followed up direct 
with problem owner.

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   There are 2 ways to handle women and I know neither.

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




[PHP] help!!!

2001-09-13 Thread GaM3R

Cannot load /usr/local/apache_adserv/libexec/libphp4.so into server: 
/usr/local/apache_adserv/libexec/libphp4.so: Undefined symbol mpz_add_ui

. . . configure line of

./configure '--with-apxs=/usr/local/apache_adserv/bin/apxs' '--with-mysql=/usr/local' 
'--enable-versioning' '--enable-inline-optimization' '--with-gd=/usr/local' 
'--with-pgsql=/usr/local/pgsql' --enable-apc --with-gmp 
--with-config-file-path=/usr/local/apache_adserv/php.ini


Cameron
outworld.cx



[PHP] PHP loosing session object, possible PHP bug

2001-09-13 Thread Ben . Edwards

I am having a bit of a problem with PHP loosing a session object.  $SESSIOM
[cart] is instansiated as a cart object and is a session varable.  In
'PHP 4.0.6'  which is installed under windows the cart object works
flawlesley.  But on the production enviroment which is running 'PHP
4.0.3pl1' as an apache module (apache 1.3.14) on FreeBSD it looses the
contence of the cart object.  All other (no object) session varables seem
to work fine.

Has anybody come across this, is it a PHP bug fixed between 4.0.3 and
4.0.6?  Has anybody got a fix.

Regards,
Ben


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




[PHP] Re: Sorting an array

2001-09-13 Thread _lallous

another case-insensitive version:

pre
?
$mem = The childhood
A Man called lallous
The Long kiss good night
Abbey Road
Dark Side Of the Moon
The Final Cut
The Zombie
A Hard Days Night
Kill 'em All
The Wall;

$mem = split(\n, $mem);
$arr1 = array();

for ($i=0;$icount($mem);$i++)
{
  $line = trim($mem[$i]);
  $prefix = ;
  $affix = $line;
  if (preg_match(/^(the |a )(.+)$/i, $line, $matches))
  {
$prefix = $matches[1];
$affix  = $matches[2];
  }
  $arr1[strtolower($affix)][$affix] = $prefix;
}
ksort($arr1);
$arr2 = array();
while (list($key, $val) = each($arr1))
{
  list($key, $val) = each($val);
  $arr2[] = $val$key;
}
var_dump($arr2);
?
/pre


Dotan Cohen [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I'm trying to sort a listing of albums alphabetically
 for LyricsList.com, the problem is that I want the
 initial 'The' and 'A' in some albums (A Hard Days
 Night, The Wall) to be ignored. So that the list will
 look like:

 Abbey Road
 Dark Side Of the Moon
 The Final Cut
 A Hard Days Night
 Kill 'em All
 The Wall

 ABC order, 'A' and 'The' negated. The info comes from
 a database, in three calls:

 // call albums that begin with letter $letter
 $query = SELECT * FROM albums WHERE album LIKE
 '$letter%' ORDER BY album;
 $result = mysql_query($query) or die(mysql_error());

 // call albums that begin with letter A
 $query_a = SELECT * FROM albums WHERE album LIKE 'a'
 ORDER BY album;
 $result_a = mysql_query($query_a) or
 die(mysql_error());

 // call albums that begin with letter T
 $query_t = SELECT * FROM albums WHERE album LIKE 't'
 ORDER BY album;
 $result_t = mysql_query($query_t) or
 die(mysql_error());

 So I need to get just the albums from $result_t that
 begin with 'The ' (easy regex) and from $result_a that
 begin with 'A ' (easy regex), but puting the three of
 them in order is proving beyond my skill.

 Thanks in advance for any advise.

 Dotan Cohen


 __
 Terrorist Attacks on U.S. - How can you help?
 Donate cash, emergency relief information
 http://dailynews.yahoo.com/fc/US/Emergency_Information/



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




[PHP] Get Info From Database Without Refreshing the Page! Pretty Neat!

2001-09-13 Thread Coenraad Steenkamp

I used a Microsoft Object Control to get data from the database and display
it on the page
without refreshing the page!This saves alot of browsing time !
Now there is a little bit of a problem ! I dont know if anyone have done
this before exept me and microsoft. I did it in php microsoft did it in asp!
Microsoft can get the data without refreshing the page and use next ,
previous buttons, I can't get the buttons thingy's to work !
If anyone know how to do this please leave some info!
I know how to do it by refreshing the page but if i can do it without
refreshing it would really kick some ass!

Coenraad Steenkamp



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




Re: [PHP] Unable to find stream pointer

2001-09-13 Thread Andreas Gietl

On Tuesday 11 September 2001 19:00, Andreas Gietl wrote:

why is it that nobody answers my question? Does nobody know an answer?

 Hi PHP-Users,

 I am having problems with php and imap now for several days on several
 servers. I just get the following Error:

 Warning: Unable to find stream pointer in file on line line

 This error does not occur in every execution, but only sometimes.

 I read a lot about this error on the internet, but i still don't know what
 is the reason for this error and how to work around it.

 Does anybody of you know where this error originates?

 thanx

 andreas

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




[PHP] Unknown-Error in Sessions

2001-09-13 Thread Jansen

Hi,
I just started using sessions on my Linux-Server with PHP 4.0.7 and got that
error-message:

Fatal error: Maximum execution time of 30 seconds exceeded in Unknown on
line 0

I used the following scripts:
PHP-Script 1:
?php
session_save_path(directory-where-i-and-php-can-write);
@session_start();
?

PHP-Script 2:
?php
@session_start();
?

What is wrong?

Thanks,
Hans




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




[PHP] URL security...?

2001-09-13 Thread Seb Frost

ok I know if I have a URL like /images/$fileName then someone could be
malicious by using .. to get to the root directory.

What I want to know is, if a URL absolutely starts with /images/ on my
website, is there someway that someone can modify the remainder of the path
such that it actually goes to a different website?  Do you see what I'm
saying?

cheers,

- seb frost

-Original Message-
From: GaM3R [mailto:[EMAIL PROTECTED]]
Sent: 13 September 2001 09:39
To: [EMAIL PROTECTED]
Subject: [PHP] help!!!


Cannot load /usr/local/apache_adserv/libexec/libphp4.so into server:
/usr/local/apache_adserv/libexec/libphp4.so: Undefined symbol mpz_add_ui

. . . configure line of

./configure '--with-apxs=/usr/local/apache_adserv/bin/apxs'
'--with-mysql=/usr/local' '--enable-versioning'
'--enable-inline-optimization' '--with-gd=/usr/local'
'--with-pgsql=/usr/local/pgsql' --enable-apc --with-gmp --with-config-file-p
ath=/usr/local/apache_adserv/php.ini


Cameron
outworld.cx

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.277 / Virus Database: 146 - Release Date: 05/09/2001

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.277 / Virus Database: 146 - Release Date: 05/09/2001


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




Re: [PHP] php4 and apache on SuSE Linux

2001-09-13 Thread Kelly Barrett

Hi Sean,
What webserver are you using?  Is it using the Apache module of PHP or the
CGI version?

Perhaps the extension of your file doesn't have the PHP processor associated
with it (if it is installed as an Apache process)?

Maybe you are using the CGI version incorrectly?

With the command line version, you still need the ?php ? tags before it
will process the PHP code.

e.g.
#!/usr/bin/php

?php
echo Hey, I am working fine.;
?

That should work as you expect.

Cheers,
Kelly.

 I am trying to run a simple php4 script on my SuSE Linux 7.2 (Update)
 system, but I am not getting the correct output.  Instead of the browser
 (Netscape or Konqueror) showing a normal web page, it shows the raw
 commands from the php script portion of the html file.

 Here is the script I am using:

 html
 head
 titlePHP Test Example/title
 /head
 body
 ?php

 echo hr;
 echo date(H:i, jS F);
 echo p;
 echo Hi, I am a PHP script!p;
 echo hr;

 ?
 /body
 /html

 When I open this file with konqueror or Netscape, the browser window
 carries the title PHP Test Example, but the output within the browser
 window looks like this:

 ; echo date(H:i, jS F); echo

 ; echo Hi, I am a PHP script!

 ; echo
 -a horizontal rule___
 ; ?

 Furthermore, if I run a simple script from the command line, something
like
 this (trythis.php):

 #!/usr/bin/php

 echo Hey, I am working fine.;

 this is the output I get:

 tschulze:~/web_dev/schulze ./trythis.php
 X-Powered-By: PHP/4.0.4pl1
 Content-type: text/html


 echo Hey, I am working fine.;

 tschulze:~/web_dev/schulze

 Any idea what I need to do to get this working right?

 TIA,
 Sean

 [EMAIL PROTECTED]

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




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




[PHP] Re: mail problem

2001-09-13 Thread Adrian D'Costa

On Thu, 13 Sep 2001, Peter Houchin Sun Rentals STR Manager wrote:

 php.ini mail related line:
 sendmail_path   =   sendmail -t -i  ;for unix only, may supply 
 arguments as well (default is 'sendmail -t -i')

I suggest you put the full path in the sendmai path.

Adrian


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




RE: [PHP] php4 and apache on SuSE Linux

2001-09-13 Thread Rudolf Visagie

Try:

html
head
titlePHP Test Example/title
/head
body
?php

echo hr;
echo date(H:i, jS F);
echo p;
echo Hi, I am a PHP script!p;
echo hr;

?
/body
/html

Rudolf Visagie
[EMAIL PROTECTED]

-Original Message-
From: T.Sean Schulze [mailto:[EMAIL PROTECTED]]
Sent: 13 September 2001 11:47
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP] php4 and apache on SuSE Linux


I am trying to run a simple php4 script on my SuSE Linux 7.2 (Update) 
system, but I am not getting the correct output.  Instead of the browser 
(Netscape or Konqueror) showing a normal web page, it shows the raw 
commands from the php script portion of the html file.

Here is the script I am using:

html
head
titlePHP Test Example/title
/head
body
?php

echo hr;
echo date(H:i, jS F);
echo p;
echo Hi, I am a PHP script!p;
echo hr;

?
/body
/html

When I open this file with konqueror or Netscape, the browser window 
carries the title PHP Test Example, but the output within the browser 
window looks like this:

; echo date(H:i, jS F); echo 

; echo Hi, I am a PHP script!

; echo 
-a horizontal rule___
; ? 

Furthermore, if I run a simple script from the command line, something like 
this (trythis.php):

#!/usr/bin/php

echo Hey, I am working fine.;

this is the output I get:

tschulze:~/web_dev/schulze ./trythis.php
X-Powered-By: PHP/4.0.4pl1
Content-type: text/html
 
 
echo Hey, I am working fine.;
 
tschulze:~/web_dev/schulze

Any idea what I need to do to get this working right?

TIA,
Sean

[EMAIL PROTECTED]

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

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




Re: [PHP] limiting rows and pages like google -- again

2001-09-13 Thread Adrian D'Costa

On Thu, 13 Sep 2001, Helen wrote:

  The logic would be to check if the script is called the first time, then
  the sql statement would be select travel.*, city.city from travel, city
  where travel.cityid=city.id limit 0,20.
  The second time or based on what has been selected on the page (1-20,
  21-40, etc) add that to the sql statement.  My question is how
 
 Do you want to list all the pages of posts or just a link to the next 20
 items?

On the first page, 20 and links to the other items that when selected will
display the list based on the selection.

One thing to remember is that the ids will not be in squence.

Thanks

Adrian


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




[PHP] in_array

2001-09-13 Thread murat

hi,
i wrote php scripts with php 4. but my server's php version is php 3. i 
used in_array function while i was writing the scripts. i used that 
function to check posted variables is available or not.
is there an another way to check this posted variables or another one 
likes in_array function?

thanks


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




[PHP] posted urls

2001-09-13 Thread murat

hi,
how can i change variables that has two or more words to variables that 
  has + instead of blanks in that variables.
Like this: word1 word2 word3  = word1+word2+word3

thanks


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




Re: [PHP] posted urls

2001-09-13 Thread Jason Brooke

 hi,
 how can i change variables that has two or more words to variables that 
   has + instead of blanks in that variables.
 Like this: word1 word2 word3  = word1+word2+word3
 
 thanks

http://www.php.net/manual/en/ref.url.php 

jason 




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




Re: [PHP] in_array

2001-09-13 Thread David Otton

On Thu, 13 Sep 2001 14:17:12 +0300, you wrote:

i wrote php scripts with php 4. but my server's php version is php 3. i 
used in_array function while i was writing the scripts. i used that 
function to check posted variables is available or not.
is there an another way to check this posted variables or another one 
likes in_array function?

Straight from the manual:

http://www.php.net/manual/en/function.in-array.php

function in_array($needle,$haystack) { 
for($i=0; $icount($haystack)  $haystack[$i] !=$needle; $i++);
return ($i!=count($haystack)); 
}

djo


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




RE: [PHP] Get Info From Database Without Refreshing the Page! PrettyNeat!

2001-09-13 Thread Ralph Guzman

What you are trying to do here sounds like it is done on the client end. I'd
be willing to bet this requires the use of Javascript/Jscript/VBScript and
DHTML.

-Original Message-
From: Coenraad Steenkamp [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 13, 2001 2:29 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Get Info From Database Without Refreshing the Page! Pretty
Neat!

I used a Microsoft Object Control to get data from the database and display
it on the page
without refreshing the page!This saves alot of browsing time !
Now there is a little bit of a problem ! I dont know if anyone have done
this before exept me and microsoft. I did it in php microsoft did it in asp!
Microsoft can get the data without refreshing the page and use next ,
previous buttons, I can't get the buttons thingy's to work !
If anyone know how to do this please leave some info!
I know how to do it by refreshing the page but if i can do it without
refreshing it would really kick some ass!

Coenraad Steenkamp



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


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




Re: [PHP] posted urls

2001-09-13 Thread nayco

$var=urlencode($var);

may solve your problem.


(°-Nayco,
//\[EMAIL PROTECTED]
v_/_ http://nayco.free.fr


- Original Message -
From: murat [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, September 13, 2001 1:34 PM
Subject: [PHP] posted urls


 hi,
 how can i change variables that has two or more words to variables that
   has + instead of blanks in that variables.
 Like this: word1 word2 word3  = word1+word2+word3

 thanks


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




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




Re: [PHP] URL security...?

2001-09-13 Thread Ben . Edwards


If the page they type on the URL is available it will be displayed.
Security is the remit of the web server not (realy) PHP.  However what i do
is have a is_logged_in function which uses session varable.  Something like

if ( is_logged_in() ) {
  ...
  do stuff
  
} esle {
  display_error( 'sod off, you ant logged in!');
}

Better still the is_logged_in in function could display the error message
and you would not need the else.

To extend this you could implenent user levels.  Punter could be 0,
Administrater 5 and Superuser 9.  You could then pass this torough to the
function.  So is_logged_in 5 would return true if user was at least of
level 5 (allowing levels 5,6,7,8,9 access).  For pages for punters wjo must
be logged in use is_logged_in().

Regards,
Ben





Seb Frost [EMAIL PROTECTED] on 13/09/2001 11:36:54



To:   [EMAIL PROTECTED]
cc:
Subject:  [PHP] URL security...?


ok I know if I have a URL like /images/$fileName then someone could be
malicious by using .. to get to the root directory.

What I want to know is, if a URL absolutely starts with /images/ on my
website, is there someway that someone can modify the remainder of the path
such that it actually goes to a different website?  Do you see what I'm
saying?

cheers,

- seb frost

-Original Message-
From: GaM3R [mailto:[EMAIL PROTECTED]]
Sent: 13 September 2001 09:39
To: [EMAIL PROTECTED]
Subject: [PHP] help!!!


Cannot load /usr/local/apache_adserv/libexec/libphp4.so into server:
/usr/local/apache_adserv/libexec/libphp4.so: Undefined symbol mpz_add_ui

. . . configure line of

./configure '--with-apxs=/usr/local/apache_adserv/bin/apxs'
'--with-mysql=/usr/local' '--enable-versioning'
'--enable-inline-optimization' '--with-gd=/usr/local'
'--with-pgsql=/usr/local/pgsql' --enable-apc --with-gmp
--with-config-file-p
ath=/usr/local/apache_adserv/php.ini


Cameron
outworld.cx

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.277 / Virus Database: 146 - Release Date: 05/09/2001

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.277 / Virus Database: 146 - Release Date: 05/09/2001


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








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


Re: [PHP] Get Info From Database Without Refreshing the Page! Pretty Neat!

2001-09-13 Thread Coenraad Steenkamp

It is a little something like this

object id=objlook classid=clsid:333C7BC4-460F-11D0-BC04-0080C7055A83
border=0 width=0 height=0 VIEWASTEXT
   param name=DataURL value=EA_Cone010.php3
   param name=UseHeader value=True
   param name=CaseSensitive value=False
   param name=CharSet value=windows-1252
/object

With datafields getting the return vallues from EA_Cone010.php3


Ralph Guzman [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 What you are trying to do here sounds like it is done on the client end.
I'd
 be willing to bet this requires the use of Javascript/Jscript/VBScript and
 DHTML.

 -Original Message-
 From: Coenraad Steenkamp [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, September 13, 2001 2:29 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Get Info From Database Without Refreshing the Page! Pretty
 Neat!

 I used a Microsoft Object Control to get data from the database and
display
 it on the page
 without refreshing the page!This saves alot of browsing time !
 Now there is a little bit of a problem ! I dont know if anyone have done
 this before exept me and microsoft. I did it in php microsoft did it in
asp!
 Microsoft can get the data without refreshing the page and use next ,
 previous buttons, I can't get the buttons thingy's to work !
 If anyone know how to do this please leave some info!
 I know how to do it by refreshing the page but if i can do it without
 refreshing it would really kick some ass!

 Coenraad Steenkamp



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




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




RE: [PHP] Get Info From Database Without Refreshing the Page! Pretty Neat!

2001-09-13 Thread Martin Lindhe

you could load all nessecary data once and put in a javascript
array or something, not sure i understand what you have done here
and what's so special about it tho

/Martin

 I used a Microsoft Object Control to get data from the 
 database and display
 it on the page
 without refreshing the page!This saves alot of browsing time !
 Now there is a little bit of a problem ! I dont know if 
 anyone have done
 this before exept me and microsoft. I did it in php microsoft 
 did it in asp!
 Microsoft can get the data without refreshing the page and use next ,
 previous buttons, I can't get the buttons thingy's to work !
 If anyone know how to do this please leave some info!
 I know how to do it by refreshing the page but if i can do it without
 refreshing it would really kick some ass!
 
 Coenraad Steenkamp

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




Re: [PHP] URL security...? (correction ignore my last post)

2001-09-13 Thread Ben . Edwards


Sorry, finder troble.  The message should read:-

If the page they type on the URL is available it will be displayed.
Security is the remit of the web server not (realy) PHP.  However what i do
is have a is_logged_in function which uses session varable.  Something like

if ( is_logged_in() ) {
  ...
  do stuff
  
} esle {
  display_error( 'sod off, you ant logged in!');
}

Better still the is_logged_in in function could display the error message
and you would not need the else.

To extend this you could implenent user levels.  Punter could be 0,
Administrater 5 and Superuser 9.  You could then pass this torough to the
function.  So is_logged_in(5) would return true if user was at least of
level 5 (allowing levels 5,6,7,8,9 access).  For pages for punters who must
be logged in use is_logged_in(0).

Regards,
Ben





[EMAIL PROTECTED] on 13/09/2001 12:53:48



To:   Seb Frost [EMAIL PROTECTED], [EMAIL PROTECTED]
cc:
Subject:  Re: [PHP] URL security...?

Seb Frost [EMAIL PROTECTED] on 13/09/2001 11:36:54



To:   [EMAIL PROTECTED]
cc:
Subject:  [PHP] URL security...?


ok I know if I have a URL like /images/$fileName then someone could be
malicious by using .. to get to the root directory.

What I want to know is, if a URL absolutely starts with /images/ on my
website, is there someway that someone can modify the remainder of the path
such that it actually goes to a different website?  Do you see what I'm
saying?

cheers,

- seb frost

-Original Message-
From: GaM3R [mailto:[EMAIL PROTECTED]]
Sent: 13 September 2001 09:39
To: [EMAIL PROTECTED]
Subject: [PHP] help!!!


Cannot load /usr/local/apache_adserv/libexec/libphp4.so into server:
/usr/local/apache_adserv/libexec/libphp4.so: Undefined symbol mpz_add_ui

. . . configure line of

./configure '--with-apxs=/usr/local/apache_adserv/bin/apxs'
'--with-mysql=/usr/local' '--enable-versioning'
'--enable-inline-optimization' '--with-gd=/usr/local'
'--with-pgsql=/usr/local/pgsql' --enable-apc --with-gmp
--with-config-file-p
ath=/usr/local/apache_adserv/php.ini


Cameron
outworld.cx

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.277 / Virus Database: 146 - Release Date: 05/09/2001

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.277 / Virus Database: 146 - Release Date: 05/09/2001


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







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







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


[PHP] how to execute PHP in CGI?

2001-09-13 Thread Gershon

Hello All!!
how to execute PHP in CGI?

Thank You.




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




RE: [PHP] how to execute PHP in CGI?

2001-09-13 Thread Tom Hodder

#!/usr/bin/php


print test;
// More code here etc etc 








-Original Message-
From: Gershon [mailto:[EMAIL PROTECTED]]
Sent: 13 September 2001 14:11
To: [EMAIL PROTECTED]
Subject: [PHP] how to execute PHP in CGI?


Hello All!!
how to execute PHP in CGI?

Thank You.




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



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




Re: [PHP] limiting rows and pages like google -- again

2001-09-13 Thread Helen

  Do you want to list all the pages of posts or just a link to the next 20
  items?

 On the first page, 20 and links to the other items that when selected will
 display the list based on the selection.

 One thing to remember is that the ids will not be in squence.

Here's a function I wrote to do that. I can't promise that it isn't still
buggy, but it's been working on my forum for a while now.

/*/

/* print nextLinks
* Prints a list of next page links for a list of items
* spanning more than one page.
* The links look something like this:
* Page 1 | 2 | 3
* It cycles through the array of IDs supplied by the user
* and prints one every itemsPerPage interval
* param idArray - an array of all the id numbers of the thing that the menu
relates to
* param pageURL - the actual url for the pages that are linked
* param itemsPerPage - the number of items per page
* param currentID - the ID of the last item on the current page
*/

function printNextLinks($idArray, $pageURL, $itemsPerPage, $currentID,
$direction) {
// variables
$postCount = count($idArray);
$postPlace = 0;
$iteration = 1;
$threadLinks = ;
$lastID = $idArray[$postCount - 1];
$firstNextPage = $idArray[0];

// we only want the pages link if there is more than one page
if ($postCount  $itemsPerPage  $firstNextPage != '') {
while($postPlace = $postCount  $firstNextPage != '') {
$thisID = $idArray[$postPlace];
$nextPlace = $postPlace + $itemsPerPage;
$lastCurrentPage = $idArray[$nextPlace - 1];
$firstNextPage = $idArray[$nextPlace];

if($lastCurrentPage == ) {
 $lastCurrentPage = $thisID;
} // end if

if(($currentID == $lastCurrentPage)  ($thisID != '') 
$direction == desc) {
$threadLinks .=  $iteration |;
} else if (($currentID == $lastID)  ($firstNextPage == '') 
$direction == desc) {
$threadLinks .=  $iteration |;
} else if (($currentID == $lastCurrentPage)  ($thisID != ''))
{
$threadLinks .=  $iteration |;
} else if (($currentID == $lastID)  ($firstNextPage == '')) {
$threadLinks .=  $iteration |;
} else {
$threadLinks .=  A
HREF=\.$pageURL.ID=$thisID\$iteration/A |;
} // end else

// move everything along
$postPlace = $nextPlace;
$iteration ++;
} // end while

// remove the last line from the threadlinks
$threadLinks = subStr($threadLinks, 0, -1);
echo  $threadLinks | ;
} // end if
} // end function

Helen


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




[PHP] PHP Security

2001-09-13 Thread Allen May

I have been using the .htpasswd/.htaccess convention to authenticate our
3000 employees.
I want to move away from the .htpasswd/.htaccess convention and use a PHP
form to authenticate against the database.

I can create the PHP authentication page, no problem, but how do I check
authentication on the thousands of HTML pages I already have on the site?
For several reasons I don't want to do cookies. Can I set a session variable
in the PHP and conditionally check it with Javascript, if fail go to PHP
authentication form?

What is the javascript session variable function?

Thanks

-Allen


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




[PHP] Re: Validate CSV file With Table in Database!!

2001-09-13 Thread George Whiffen

Coenraad,

Here are some links to relevant sections of the php manual.  What you want
to do is not too hard at all.

I'm assuming that you want to upload the csv file via a web page.  This
is much less trouble for the user than fooling around with ftp.  They
get to browse their computer for the file and then upload
with a single click.

1. Uploading a file
http://www.php.net/manual/en/features.file-upload.php#features.file-upload.post-method

2. Opening the uploaded file
http://www.php.net/manual/en/function.fopen.php

3. Reading fields from the uploaded file
http://www.php.net/manual/en/function.fgetcsv.php

4. Updating the table
It depends what database you are using as to how you do this.  The obvious
approach is to SELECT for each row in your csv file, and then either UPDATE
it or INSERT a new one, depending on whether you found it. 

So putting it altogether you want something like this.  You'll have to check
the syntax, add error checks etc., and this is based on mysql as the database:-

// refreshdata.php
?php 

if ($mycsvfile != '')
{
   $fp = fopen($mycsvfile);

   mysql_connect();

   while (list($keyfield,$datafield) = fgetcsv($fp))
   {
   $cur_table = mysql_query(select datafield from mytable where keyfield 
='.$keyfield.');
   if (mysql_num_rows($cur_table) == 0)
   {
   $ins_table = mysql_query(insert into mytable (keyfield,datafield) values
('.$keyfield.','.$datafield.');
   } else { 
   $upd_table = mysql_query(update mytable set datafield = '.$datafield.' 
where keyfield
= '.$keyfield.');
   }
   }

   mysql_close();

   fclose($fp);
}
?
HTML
BODY
FORM enctype=multipart/form-data method=post

CSV file : INPUT TYPE=FILE NAME=mycsvfile

INPUT TYPE=SUBMIT
/FORM
/BODY
/HTML



Coenraad Steenkamp wrote:
 
 I need to compare a csv file to a table in the database but only one field
 in the database with
 one field in the CSV file! Comparing only one field will make it much
 easier! When there is any change in the Database compared to the CSV file ,
 the database must then be updated or if there are no such a field it must be
 added to the table!
 
 I am new in php Please help!

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




[PHP] XML DOM: encoding attribute problems and namespaces

2001-09-13 Thread ZeNDeR-X

hi ;)
Recently I've been using the DOM module of php and I have
encountered a few problems. I am working on a quite advanced XML application
and I am forced to use the PHP technology.

I need to dynamically create XML documents. There's no problem with that
when i simply use this statement:
$doc = xmldoc('?xml version=1.0 encoding=iso-8859-1?categories/');

but when i use this:
$doc = xmldoc('?xml version=1.0 encoding=iso-8859-2?categories/');

php doesn't parse my document! it doesn't even give me an error message ;(
does anyone have an idea what to do with it?

also is there a way to declare a document without a root element, but with
the encoding attribute set?
it's possible to do it like this:
$doc = new_xmldoc('1.0');
but i can't set the encoding attribute then.

if i try something like this:
$doc = xmldoc('?xml version=1.0 encoding=iso-8859-1?');
i get this after $doc-dumpmem():
?xml version='?xml version=1.0 encoding=iso-8859-1?'?

i'm also wondering about the use of namespaces in PHP DOM.
is it possible? where can i get some infos about it?

sorry if this post repeats some threads, but i'm new to this group ;)

Chris Jarecki
ps: sorry for possible language mistakes ;)



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




RE: [PHP] php4 and apache on SuSE Linux

2001-09-13 Thread T . Sean Schulze

Rudolf,

I have tried adding the double quotes, and when I do, nothing at all is 
displayed.  Adding single quotes to the script, just adds single quotes to 
the output.

Sean

Rudolf Visagie wrote:

 Try:
 
 html
 head
 titlePHP Test Example/title
 /head
 body
 ?php
 
 echo hr;
 echo date(H:i, jS F);
 echo p;
 echo Hi, I am a PHP script!p;
 echo hr;
 
 ?
 /body
 /html
 
 Rudolf Visagie
 [EMAIL PROTECTED]
 
 -Original Message-
 From: T.Sean Schulze [mailto:[EMAIL PROTECTED]]
 Sent: 13 September 2001 11:47
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: [PHP] php4 and apache on SuSE Linux
 
 
 I am trying to run a simple php4 script on my SuSE Linux 7.2 (Update)
 system, but I am not getting the correct output.  Instead of the browser
 (Netscape or Konqueror) showing a normal web page, it shows the raw
 commands from the php script portion of the html file.
 
 Here is the script I am using:
 
 html
 head
 titlePHP Test Example/title
 /head
 body
 ?php
 
 echo hr;
 echo date(H:i, jS F);
 echo p;
 echo Hi, I am a PHP script!p;
 echo hr;
 
 ?
 /body
 /html
 
 When I open this file with konqueror or Netscape, the browser window
 carries the title PHP Test Example, but the output within the browser
 window looks like this:
 
 ; echo date(H:i, jS F); echo
 
 ; echo Hi, I am a PHP script!
 
 ; echo
 -a horizontal rule___
 ; ?
 
 Furthermore, if I run a simple script from the command line, something
 like this (trythis.php):
 
 #!/usr/bin/php
 
 echo Hey, I am working fine.;
 
 this is the output I get:
 
 tschulze:~/web_dev/schulze ./trythis.php
 X-Powered-By: PHP/4.0.4pl1
 Content-type: text/html
  
  
 echo Hey, I am working fine.;
  
 tschulze:~/web_dev/schulze
 
 Any idea what I need to do to get this working right?
 
 TIA,
 Sean
 
 [EMAIL PROTECTED]
 


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




[PHP] XML DOM: encoding attribute problems and namespaces

2001-09-13 Thread ZeNDeR-X

hi ;)
Recently I've been using the DOM module of php and I have
encountered a few problems. I am working on a quite advanced XML application
and I am forced to use the PHP technology.

I need to dynamically create XML documents. There's no problem with that
when i simply use this statement:
$doc = xmldoc('?xml version=1.0 encoding=iso-8859-1?categories/');

but when i use this:
$doc = xmldoc('?xml version=1.0 encoding=iso-8859-2?categories/');

php doesn't parse my document! it doesn't even give me an error message ;(
does anyone have an idea what to do with it?

also is there a way to declare a document without a root element, but with
the encoding attribute set?
it's possible to do it like this:
$doc = new_xmldoc('1.0');
but i can't set the encoding attribute then.

if i try something like this:
$doc = xmldoc('?xml version=1.0 encoding=iso-8859-1?');
i get this after $doc-dumpmem():
?xml version='?xml version=1.0 encoding=iso-8859-1?'?

i'm also wondering about the use of namespaces in PHP DOM.
is it possible? where can i get some infos about it?

sorry if this post repeats some threads, but i'm new to this group ;)

Chris Jarecki
ps: sorry for possible language mistakes ;)



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




Re: [PHP] php4 and apache on SuSE Linux

2001-09-13 Thread Kelly Barrett

It sounds like the PHP isn't getting parsed.  Check the webserver is
configured correctly for the extension of your file, or that your system
requires you to use the CGI version of the PHP interpreter.

 Rudolf,

 I have tried adding the double quotes, and when I do, nothing at all is
 displayed.  Adding single quotes to the script, just adds single quotes to
 the output.

 Sean

 Rudolf Visagie wrote:

  Try:
 
  html
  head
  titlePHP Test Example/title
  /head
  body
  ?php
 
  echo hr;
  echo date(H:i, jS F);
  echo p;
  echo Hi, I am a PHP script!p;
  echo hr;
 
  ?
  /body
  /html
 
  Rudolf Visagie
  [EMAIL PROTECTED]
 
  -Original Message-
  From: T.Sean Schulze [mailto:[EMAIL PROTECTED]]
  Sent: 13 September 2001 11:47
  To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
  Subject: [PHP] php4 and apache on SuSE Linux
 
 
  I am trying to run a simple php4 script on my SuSE Linux 7.2 (Update)
  system, but I am not getting the correct output.  Instead of the browser
  (Netscape or Konqueror) showing a normal web page, it shows the raw
  commands from the php script portion of the html file.
 
  Here is the script I am using:
 
  html
  head
  titlePHP Test Example/title
  /head
  body
  ?php
 
  echo hr;
  echo date(H:i, jS F);
  echo p;
  echo Hi, I am a PHP script!p;
  echo hr;
 
  ?
  /body
  /html
 
  When I open this file with konqueror or Netscape, the browser window
  carries the title PHP Test Example, but the output within the browser
  window looks like this:
 
  ; echo date(H:i, jS F); echo
 
  ; echo Hi, I am a PHP script!
 
  ; echo
  -a horizontal rule___
  ; ?
 
  Furthermore, if I run a simple script from the command line, something
  like this (trythis.php):
 
  #!/usr/bin/php
 
  echo Hey, I am working fine.;
 
  this is the output I get:
 
  tschulze:~/web_dev/schulze ./trythis.php
  X-Powered-By: PHP/4.0.4pl1
  Content-type: text/html
 
 
  echo Hey, I am working fine.;
 
  tschulze:~/web_dev/schulze
 
  Any idea what I need to do to get this working right?
 
  TIA,
  Sean
 
  [EMAIL PROTECTED]
 


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




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




Re: [PHP] PHP Security

2001-09-13 Thread Kelly Barrett

Hi Allen,
What you should do is check the session variable from within PHP.  If it
doesn't exist, you redirect to a PHP authentication form.

So at the head of each page you need something like:
?php
session_start();
if(session_is_registered(logged_in) == false)
{
header(location: login.php); // redirect to login page
exit();
}

// continue on here
?
And in your PHP authentication form, you register the logged_in variable
after the user details have been authenticated:
?php
// user details have been authenticated at this stage

session_start();
session_register(logged_in);
$logged_in = true;
header(location: somepage.php); // redirect to the page they were
originally going to
exit();
?

Cheers,
Kelly.

 I have been using the .htpasswd/.htaccess convention to authenticate our
 3000 employees.
 I want to move away from the .htpasswd/.htaccess convention and use a PHP
 form to authenticate against the database.

 I can create the PHP authentication page, no problem, but how do I check
 authentication on the thousands of HTML pages I already have on the site?
 For several reasons I don't want to do cookies. Can I set a session
variable
 in the PHP and conditionally check it with Javascript, if fail go to PHP
 authentication form?

 What is the javascript session variable function?

 Thanks

 -Allen


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





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




[PHP] Go and look at this shitt! The page does not refresh at all!

2001-09-13 Thread Coenraad Steenkamp

This is what i was talking about in my previous post!
But now i need to get a way of using next and previous with it!
http://www.dev.co.za/devtest/Example/



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




[PHP] select

2001-09-13 Thread Marcos Mathias

Hello !

I have a php program running under linux that conects into a Sql server 7
under win2k.
When I make a select in a table that doesn't contain any index, my select
returns no results. Otherwise, when the table contains at least one index,
the select works fine.

My question: Is that supposed to happen or i am doing something wrong?

Thanks and best regards!

Marcos Mathias


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




[PHP] PHP + FreeBSD + ODBC -- Progress Database

2001-09-13 Thread Joseph Koenig

This is probably a really stupid question. I've been reading info on
phpbuilder and at iodbc.org and I must just be missing something. What I
want to do is connect to a Progress Database on WinNT from a FreeBSD 4.3
server with PHP 4.0.6. Before I compiled PHP, I was under the impression
I needed iodbc. On my PHP info page, it shows this configure line: 

'./configure' '--with-mysql=/usr/local/mysql'
'--with-pgsql=/usr/local/pgsql' '--enable-trans-sid'
'--with-curl=/usr/local/bin/curl' '--enable-ftp' '--enable-magic-quotes' 
'--with-apxs=/usr/local/sbin/apxs'

However, as I scroll down the page, I find this info:

odbc

ODBC Supportenabled
Active Persistent Links 0
Active Links0
ODBC libraryiodbc
ODBC_INCLUDE-I/usr/local/include
ODBC_LFLAGS -L/usr/local/lib
ODBC_LIBS   -liodbc


Directive   Local Value
 Master Value
odbc.allow_persistent   On 
 On
odbc.check_persistent   On 
 On
odbc.default_db no value   
 no value
odbc.default_pw no value   
 no value
odbc.default_user   no value   
 no value
odbc.defaultbinmode return as isreturn 
as is
odbc.defaultlrl return up to 4096 bytes return up to 
4096 bytes
odbc.max_links  Unlimited  
 Unlimited
odbc.max_persistent Unlimited  
 Unlimited

Now, to me that looks like I could theoretically do what I want to,
correct? Any help with PHP + ODBC on FreeBSD would be much appreciated. Thanks,

Joe

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




RE: [PHP] PHP + FreeBSD + ODBC -- Progress Database

2001-09-13 Thread Andrew Hill

Joseph,

It does appear you have iODBC compiled in already.  To confirm for this do a
find for libiodbc.so.
Yes, you do need iODBC here to act as the Driver Manager (a binding point so
PHP can interface with ODBC) but you will still need an actual ODBC driver.

Try the Multi-Tier driver from our site - the Product Availabilty link will
walk you through the selection process.
You will need to install the MT client components on your BSD box and the MT
server components on your Win box.

The drivers will download for free with a non-expiring 2-connection license,
and free support is available at
http://www.openlinksw.com/support/suppindx.htm if you require assistance
configuring your connection.

Best regards,
Andrew Hill
Director of Technology Evangelism
OpenLink Software  http://www.openlinksw.com
Universal Data Access  Data Integration Technology Providers

 -Original Message-
 From: Joseph Koenig [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, September 13, 2001 10:02 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] PHP + FreeBSD + ODBC -- Progress Database


 This is probably a really stupid question. I've been reading info on
 phpbuilder and at iodbc.org and I must just be missing something. What I
 want to do is connect to a Progress Database on WinNT from a FreeBSD 4.3
 server with PHP 4.0.6. Before I compiled PHP, I was under the impression
 I needed iodbc. On my PHP info page, it shows this configure line:

 './configure' '--with-mysql=/usr/local/mysql'
 '--with-pgsql=/usr/local/pgsql' '--enable-trans-sid'
 '--with-curl=/usr/local/bin/curl' '--enable-ftp'
 '--enable-magic-quotes' '--with-apxs=/usr/local/sbin/apxs'

 However, as I scroll down the page, I find this info:

 odbc

 ODBC Support  enabled
 Active Persistent Links   0
 Active Links  0
 ODBC library  iodbc
 ODBC_INCLUDE  -I/usr/local/include
 ODBC_LFLAGS   -L/usr/local/lib
 ODBC_LIBS -liodbc


 Directive Local Value
   Master Value
 odbc.allow_persistent On
   On
 odbc.check_persistent On
   On
 odbc.default_db   no value
   no value
 odbc.default_pw   no value
   no value
 odbc.default_user no value
   no value
 odbc.defaultbinmode   return as is
   return as is
 odbc.defaultlrl   return up to 4096
 bytes return up to 4096 bytes
 odbc.max_linksUnlimited
   Unlimited
 odbc.max_persistent   Unlimited
   Unlimited

 Now, to me that looks like I could theoretically do what I want to,
 correct? Any help with PHP + ODBC on FreeBSD would be much
 appreciated. Thanks,

 Joe

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




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




[PHP] SEARCHER

2001-09-13 Thread chinmay varma

Sir,

I use the following code (courtesy :Richard Lynch )
to search a file.

?php
$url = 'http://php.net';
$key = 'php';
$html = file($url);
$html = implode('', $html);
if (strstr($html, $key){
echo htmlentities($html);
}
?
As I want to search a complete site ,I send a robo first , picked up the links a 
searched.I dont get the desired result.
Is there a better way to search a complete site ?

Thanking you,
Chinmay Varma



 




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




[PHP] Graphs...

2001-09-13 Thread Nic Skitt

Anybody got any tuts/examples of a working graph with PHP?

Cheers

Nic



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




Re: [PHP] PHP + FreeBSD + ODBC -- Progress Database

2001-09-13 Thread ignacio . estrada


You can go to the google.com searching engine, type ODBCSocketServer and
you will found very good information on ODBC.  However this solution uses
Microsoft Access database.

Atte. Ignacio Estrada F.
Centro Nacional de Control de Energia
Area de Control Occidental
025+6463, 025+6464, 025+6469


   
 
Joseph Koenig  
 
joe@jwebmediTo: [EMAIL PROTECTED] 
 
a.com   cc:   
 
 Subject: [PHP] PHP + FreeBSD + ODBC -- 
Progress Database  
13/09/2001 
 
08:02  
 
Please 
 
respond to 
 
joe
 
   
 
   
 




This is probably a really stupid question. I've been reading info on
phpbuilder and at iodbc.org and I must just be missing something. What I
want to do is connect to a Progress Database on WinNT from a FreeBSD 4.3
server with PHP 4.0.6. Before I compiled PHP, I was under the impression
I needed iodbc. On my PHP info page, it shows this configure line:

'./configure' '--with-mysql=/usr/local/mysql'
'--with-pgsql=/usr/local/pgsql' '--enable-trans-sid'
'--with-curl=/usr/local/bin/curl' '--enable-ftp' '--enable-magic-quotes' '
--with-apxs=/usr/local/sbin/apxs'

However, as I scroll down the page, I find this info:

odbc

ODBC Supportenabled
Active Persistent Links   0
Active Links0
ODBC libraryiodbc
ODBC_INCLUDE-I/usr/local/include
ODBC_LFLAGS -L/usr/local/lib
ODBC_LIBS-liodbc


DirectiveLocal Value
   Master Value
odbc.allow_persistent   On
On
odbc.check_persistent   On
On
odbc.default_db  no value
  no value
odbc.default_pw  no value
  no value
odbc.default_user  no value
   no value
odbc.defaultbinmodereturn as is
 return as is
odbc.defaultlrl  return up to 4096
bytes return up to 4096 bytes
odbc.max_links  Unlimited
Unlimited
odbc.max_persistentUnlimited
   Unlimited

Now, to me that looks like I could theoretically do what I want to,
correct? Any help with PHP + ODBC on FreeBSD would be much appreciated.
Thanks,

Joe

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






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




[PHP] internet explorer and form submission

2001-09-13 Thread Christian Haines

hi all,

i have just discovered a bug with internet explorer form submission.

suppose i have a form with 2 submit buttons to do different things eg-

form name=form method=post action=something.php

input type=submit name=update value=update
input type=submit name=delete value=delete

/form

one to update content and one to delete content then in my processing file i
have

if(isset($update))
{
// do update
}

if(isset($delete))
{
// do delete
}

so if a particular form button is clicked a different process will occcur.

well what happens if i press return to enter my form submission?
nothing is set!

so the processing file does nothing

any thoughts?

christian


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




RE: [PHP] php4 and apache on SuSE Linux

2001-09-13 Thread Rudolf Visagie

Hi Sean,

When I run your code on our Linux Mandrake, Apache server (standard PHP4
installation) without the double quotes it gives:
Parse error: parse error, expecting `','' or `';'' in
/home/httpd/html/rudolf/test.php on line 8

With the double quotes I suggested it gives the expected result, so Kelly is
correct thinking that your code does not even get parsed. Why, I've no idea.

Rudolf

-Original Message-
From: T.Sean Schulze [mailto:[EMAIL PROTECTED]]
Sent: 13 September 2001 03:32
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] php4 and apache on SuSE Linux


Kelly Barrett wrote:

 Hi Sean,
 What webserver are you using?  Is it using the Apache module of PHP or the
 CGI version?
 

I will admit to being a newbie, but I am pretty sure that I am using the 
module version.  My /etc/httpd/httpd.conf file includes these lines:

IfDefine PHP
LoadModule php3_module /usr/lib/apache/libphp3.so
/IfDefine
IfDefine PHP4
LoadModule php4_module /usr/lib/apache/libphp4.so
/IfDefine

and these:

#
# AddType allows you to tweak mime.types without actually editing it, 
or to
# make certain files to be certain types.
#
# For example, the PHP 3.x module (not part of the Apache distribution 
- see# http://www.php.net) will typically use:
#
IfModule mod_php3.c
AddType application/x-httpd-php3 .php3
AddType application/x-httpd-php3-source .phps
AddType application/x-httpd-php3 .phtml
/IfModule
#
# And for PHP 4.x, use:
#
IfModule mod_php4.c
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php4
AddType application/x-httpd-php-source .phps
/IfModule

 Perhaps the extension of your file doesn't have the PHP processor
 associated with it (if it is installed as an Apache process)?
 

See above.

 Maybe you are using the CGI version incorrectly?
 

I think I am using the module.

 With the command line version, you still need the ?php ? tags before it
 will process the PHP code.
 
 e.g.
 #!/usr/bin/php
 
 ?php
 echo Hey, I am working fine.;
 ?
 
 That should work as you expect.
 

Thanks for that tip.  That fixed the command line script I was working on.  
Now, if I could get the module working...

I think I just figured it out.  I think the problem was the location of the 
file.  I was trying to open a file in my home directory, not in apache's 
DocumentRoot directory as defined in the httpd.conf file.  Once I moved the 
file there, it ran fine.

Thanks you all for your help.

Cheers,
Sean

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

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




[PHP] equivelant of ASP's #include file?

2001-09-13 Thread LRW

Hi all. PHP newbie here.
There's a code that one can use in ASP that will print to the browser the
contents of an ascii file:

!-- #include file = filename.txt --

Can anyone tell me what the PHP equivelant might be?

Thanks!
Liam



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




Re: [PHP] equivelant of ASP's #include file?

2001-09-13 Thread Helen

 !-- #include file = filename.txt --
 
 Can anyone tell me what the PHP equivelant might be?

? include(filename.txt); ?

It's interesting ASP uses the same format at SSI includes. 

Helen


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




Re: [PHP] equivelant of ASP's #include file?

2001-09-13 Thread Kurth Bemis

At 10:21 AM 9/13/2001, LRW wrote:

I believe that that is server side includes...NOT asp..i could be wrong tho

the PHP equiv is include('filename')

read the manual -

~kurth

Hi all. PHP newbie here.
There's a code that one can use in ASP that will print to the browser the
contents of an ascii file:

!-- #include file = filename.txt --

Can anyone tell me what the PHP equivelant might be?

Thanks!
Liam



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


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




Re: [PHP] equivelant of ASP's #include file?

2001-09-13 Thread LRW

Yeah, it was just brought to my attention what I thought was an ASP
code...is not. =/

As for the manual, would you be able to recommend any good books for
beginning PHP?

Thanks!
Very embarassed,
Liam


Kurth Bemis wrote in message
[EMAIL PROTECTED]...
At 10:21 AM 9/13/2001, LRW wrote:

I believe that that is server side includes...NOT asp..i could be wrong tho

the PHP equiv is include('filename')

read the manual -

~kurth

Hi all. PHP newbie here.
There's a code that one can use in ASP that will print to the browser the
contents of an ascii file:

!-- #include file = filename.txt --

Can anyone tell me what the PHP equivelant might be?

Thanks!
Liam



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




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




Re: [PHP] equivelant of ASP's #include file?

2001-09-13 Thread Ben . Edwards


include ( file );  However this simply includes the file ( so it would be
displayed as if it was html).  You can also make the include a .php ( dont
forget ? and ? ).

Ben


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




Re: [PHP] equivelant of ASP's #include file?

2001-09-13 Thread Thomas Deliduka

Although, I must note that include() doesn't work quite the same as the ssi
#include

I think require() works much better

Read about the two differences:

http://www.php.net/require
http://www.php.net/include
 (these will redirect to the proper manual page.)


On 9/13/2001 10:32 AM this was written:

 At 10:21 AM 9/13/2001, LRW wrote:
 
 I believe that that is server side includes...NOT asp..i could be wrong tho
 
 the PHP equiv is include('filename')
 
 read the manual -
 
 ~kurth
 
 Hi all. PHP newbie here.
 There's a code that one can use in ASP that will print to the browser the
 contents of an ascii file:
 
 !-- #include file = filename.txt --
 
 Can anyone tell me what the PHP equivelant might be?

-- 

Thomas Deliduka
IT Manager
 -
New Eve Media
The Solution To Your Internet Angst
http://www.neweve.com/



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




[PHP] Test

2001-09-13 Thread Tomá¹ Kubi¹

This is a test.




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




Re: [PHP] equivelant of ASP's #include file?

2001-09-13 Thread Kurth Bemis

At 10:29 AM 9/13/2001, LRW wrote:

the PHP manual at PHP.net!!

the only real manual

~kurth

Yeah, it was just brought to my attention what I thought was an ASP
code...is not. =/

As for the manual, would you be able to recommend any good books for
beginning PHP?

Thanks!
Very embarassed,
Liam


Kurth Bemis wrote in message
[EMAIL PROTECTED]...
 At 10:21 AM 9/13/2001, LRW wrote:
 
 I believe that that is server side includes...NOT asp..i could be wrong tho
 
 the PHP equiv is include('filename')
 
 read the manual -
 
 ~kurth
 
 Hi all. PHP newbie here.
 There's a code that one can use in ASP that will print to the browser the
 contents of an ascii file:
 
 !-- #include file = filename.txt --
 
 Can anyone tell me what the PHP equivelant might be?
 
 Thanks!
 Liam
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 



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


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




[PHP] Book

2001-09-13 Thread Kurth Bemis

I just got the book entitled PHP and MySQL web development by Luke 
Wellington and Luara Thomson.

I wondering how others liked the book...I haven't gotten a chance to look 
at it yet..and I'm wondering if i should :-)

~kurth


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




[PHP] select in PHP + Sql Server

2001-09-13 Thread Marcos Mathias

Hello !

I have a php program running under linux that conects into a Sql server 7
under win2k.
When I make a select in a table that doesn't contain any index, my select
returns no results. Otherwise, when the table contains at least one index,
the select works fine.

My question: Is that supposed to happen or i am doing something wrong?

Thanks and best regards!

Marcos Mathias


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




Re: [PHP] Book

2001-09-13 Thread Data Driven Design

If you own it you should read it.

Data Driven Design
1506 Tuscaloosa Ave
Holly Hill, Florida 32117

http://www.datadrivendesign.com
Phone: (386) 226-8979

Websites That WORK For You
- Original Message -
From: Kurth Bemis [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, September 13, 2001 10:40 AM
Subject: [PHP] Book


 I just got the book entitled PHP and MySQL web development by Luke
 Wellington and Luara Thomson.

 I wondering how others liked the book...I haven't gotten a chance to look
 at it yet..and I'm wondering if i should :-)

 ~kurth


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




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




RE: [PHP] Book

2001-09-13 Thread Matt Williams

 I just got the book entitled PHP and MySQL web development by Luke
 Wellington and Luara Thomson.

 I wondering how others liked the book...I haven't gotten a chance to look
 at it yet..and I'm wondering if i should :-)

Now that you've got it you might as well read it. Then you could tell us
what it's like :-)

M@


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




Re: [PHP] PHP Security

2001-09-13 Thread Ben . Edwards


This is a rehash of a post earlier today!

I implement security with user hierarchies which I will describe here (and
also a more flexible method, user groups, which I will outline later ).

I use a procedure called ensure_logged_in ( $level ).  It is wrapped around
all .PHP where security is required (as an 'if' which is the first line on
the page with '}' as the last ), so

?
if ( ensure_logged_in( 5 ) ) {
  ...
  do stuff
  
}
?

Levels are implemented as such.  Punter could be 0, Administrator 5 and
Suppresser 9.  You could then pass this through to the function.  So
ensure_logged_in(5) would return true if user was at least of level 5
(allowing levels 5,6,7,8,9 access).  For pages for punters who must be
logged in use ensure_logged_in(0).

The ensure_logged_in function checks the level and if the user is not
authorised displays an error and login form (the function returns false).
This will then post to where you currently post for login processing (I
actually include the form in and reuse it for both here and login.php ).

Alternatively ensure_logged_in could just display an error message (and
maybe email the administrator if the person was logged in and trying to
access an unauthorised part of your system ).

There is in fact another function ( is_logged_in ) which ensure_logged_in
uses and also returns Boolean.  This function enables different
functionality for different levels ( i.e. not including certain fields
unless user is of a certain level ).

User level is held in a session variable ( i.e. $SESSION[user][level] )
and set when logged in.

The alternative would be to define groups and say which .PHP modules have
access to which groups.  You can then allocate users to a gropes (or a
number of groups).  Each .PHP module is then wrapped with a function ( say
chack_security() ) which works similar to ensure_logged_in. I have only
done this sort of thing in oracle applications ( client/server non web )
but the principle is the same.  You could also go further and define
database access as well as module using something like  :-


Table module_access
  module_name varchar( 100 )
  allow_update Boolean
  allow_insert Boolean
  allow_delete Boolean

Don't see much point in allow_select ;-)

Sure you could also define which fields users DO  NOT have access to on top
of this with another table ( defining what fields users DO have access is
crazy as this security is built on top of previous ).

Please let me know what you think, at least I then know someone red it -:)

Ben






Regards,
Ben





Allen May [EMAIL PROTECTED] on 13/09/2001 13:40:06



To:   [EMAIL PROTECTED]
cc:
Subject:  [PHP] PHP Security


I have been using the .htpasswd/.htaccess convention to authenticate our
3000 employees.
I want to move away from the .htpasswd/.htaccess convention and use a PHP
form to authenticate against the database.

I can create the PHP authentication page, no problem, but how do I check
authentication on the thousands of HTML pages I already have on the site?
For several reasons I don't want to do cookies. Can I set a session
variable
in the PHP and conditionally check it with Javascript, if fail go to PHP
authentication form?

What is the javascript session variable function?

Thanks

-Allen


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








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


Re: [PHP] select in PHP + Sql Server

2001-09-13 Thread Ben . Edwards


You're doing something wrong!  Indexes are only for performance and
possibly they may be used for helping in ensuring uniquenes.  sorry cant be
any more help without code.




Marcos Mathias [EMAIL PROTECTED] on 13/09/2001 20:40:40

Please respond to [EMAIL PROTECTED]



To:   [EMAIL PROTECTED]
cc:
Subject:  [PHP] select in PHP + Sql Server


Hello !

I have a php program running under linux that conects into a Sql server 7
under win2k.
When I make a select in a table that doesn't contain any index, my select
returns no results. Otherwise, when the table contains at least one index,
the select works fine.

My question: Is that supposed to happen or i am doing something wrong?

Thanks and best regards!

Marcos Mathias


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








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


[PHP] Re: internet explorer and form submission

2001-09-13 Thread Christian Haines

sorry i just figured it out...just panicked...must be the time of year

if(!isset($delete))
{
 // do update
}
 
if(isset($delete))
{
// do delete
}


that should fix the problem

 From: [EMAIL PROTECTED] (Christian Haines)
 Newsgroups: php.general
 Date: Thu, 13 Sep 2001 23:44:30 +1030
 To: [EMAIL PROTECTED]
 Subject: internet explorer and form submission
 
 hi all,
 
 i have just discovered a bug with internet explorer form submission.
 
 suppose i have a form with 2 submit buttons to do different things eg-
 
 form name=form method=post action=something.php
 
 input type=submit name=update value=update
 input type=submit name=delete value=delete
 
 /form
 
 one to update content and one to delete content then in my processing file i
 have
 
 if(isset($update))
 {
 // do update
 }
 
 if(isset($delete))
 {
 // do delete
 }
 
 so if a particular form button is clicked a different process will occcur.
 
 well what happens if i press return to enter my form submission?
 nothing is set!
 
 so the processing file does nothing
 
 any thoughts?
 
 christian
 


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




RE: [PHP] internet explorer and form submission

2001-09-13 Thread Johnson, Kirk

 so if a particular form button is clicked a different process 
 will occcur.
 
 well what happens if i press return to enter my form submission?
 nothing is set!
 
 so the processing file does nothing

This has been pointed out from time to time on this list. It is a fact: if
the user submits a form with the return key, a submit button value may, or
may not, get posted. So don't rely on the submit button.

3 possibilities:

1. If one of the buttons can be considered the default action, then write
your logic as:

  if(non-default button)
do non-default stuff
  else
do default stuff

If no button value gets passed, the default stuff gets done.

2. Again, if one button is default, put a HIDDEN field with the same name
and value as the default submit button just *before* the non-default submit
button. The HIDDEN will always get posted, but will get overwritten if the
user clicks the non-default button.

3. Write your logic as:

  if(non-default button)
do non-default stuff
  elseif(default button)
do default stuff
  else
meta refresh redirect back to original page

In the redirect, put a message asking the user to click a button, with a
pause of 5 seconds or so.

Kirk

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




Re: [PHP] PHP Security

2001-09-13 Thread Sean C. McCarthy

Hi,

I don't think there is any other way, at least so easy to extend. The
only improvement will be to combine the system with calls to NIS or a
Kerberos/RADIUS server. If you have such a server (or maybe LDAP ???)
you should combine it for administration easiness.

[EMAIL PROTECTED] wrote:
 
 This is a rehash of a post earlier today!
 
 I implement security with user hierarchies which I will describe here (and
 also a more flexible method, user groups, which I will outline later ).
 
 I use a procedure called ensure_logged_in ( $level ).  It is wrapped around
 all .PHP where security is required (as an 'if' which is the first line on
 the page with '}' as the last ), so
 
 ?
 if ( ensure_logged_in( 5 ) ) {
   ...
   do stuff
   
 }
 ?
 

A better way will be (I think):

?
if ( !ensure_logged_in( 5 ) ) {

header(Location: $NOT_AUTHENTICATED);
exit;

};
   ...
   do stuff
   
?


That way you could just put it in a file and include it at the header,
not needing to wrap the code around. He was talking about thousands of
pages!!!

 Levels are implemented as such.  Punter could be 0, Administrator 5 and
 Suppresser 9.  You could then pass this through to the function.  So
 ensure_logged_in(5) would return true if user was at least of level 5
 (allowing levels 5,6,7,8,9 access).  For pages for punters who must be
 logged in use ensure_logged_in(0).
 
 The ensure_logged_in function checks the level and if the user is not
 authorised displays an error and login form (the function returns false).
 This will then post to where you currently post for login processing (I
 actually include the form in and reuse it for both here and login.php ).
 
 Alternatively ensure_logged_in could just display an error message (and
 maybe email the administrator if the person was logged in and trying to
 access an unauthorised part of your system ).
 
 There is in fact another function ( is_logged_in ) which ensure_logged_in
 uses and also returns Boolean.  This function enables different
 functionality for different levels ( i.e. not including certain fields
 unless user is of a certain level ).
 
 User level is held in a session variable ( i.e. $SESSION[user][level] )
 and set when logged in.
 
 The alternative would be to define groups and say which .PHP modules have
 access to which groups.  You can then allocate users to a gropes (or a
 number of groups).  Each .PHP module is then wrapped with a function ( say
 chack_security() ) which works similar to ensure_logged_in. I have only
 done this sort of thing in oracle applications ( client/server non web )
 but the principle is the same.  You could also go further and define
 database access as well as module using something like  :-
 
 Table module_access
   module_name varchar( 100 )
   allow_update Boolean
   allow_insert Boolean
   allow_delete Boolean
 
 Don't see much point in allow_select ;-)
 
 Sure you could also define which fields users DO  NOT have access to on top
 of this with another table ( defining what fields users DO have access is
 crazy as this security is built on top of previous ).
 
 Please let me know what you think, at least I then know someone red it -:)
 
 Ben
 
 Regards,
 Ben
 
 Allen May [EMAIL PROTECTED] on 13/09/2001 13:40:06
 
 To:   [EMAIL PROTECTED]
 cc:
 Subject:  [PHP] PHP Security
 
 I have been using the .htpasswd/.htaccess convention to authenticate our
 3000 employees.
 I want to move away from the .htpasswd/.htaccess convention and use a PHP
 form to authenticate against the database.
 
 I can create the PHP authentication page, no problem, but how do I check
 authentication on the thousands of HTML pages I already have on the site?
 For several reasons I don't want to do cookies. Can I set a session
 variable
 in the PHP and conditionally check it with Javascript, if fail go to PHP
 authentication form?
 
 What is the javascript session variable function?
 
 Thanks
 
 -Allen
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
   
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

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




[PHP] importing a table

2001-09-13 Thread Peter

Hi,

This may be more of an Mysql question than a PHP question.  

I am hoping that I can export an Address Book table from my Access
Database and then import that table into Mysql.  I am hoping that I can
then use PHP to carry out queries on the information in the table.

I was wondering is there a command in Mysql that can import tables?

I just need to import one table, not an entire database.


Thanks.

Peter


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




[PHP] Is it *really* an associative array?

2001-09-13 Thread Boget, Chris

Sample code:

script language=php

  $array = array( one, two, three );
  while( list( $key, $val ) = each( $array )) {
if( is_string( $key )) {
  echo Key is a string\n;
  
}
echo Key: $key = $val :Val\n;

  }
  echo \n\n;

  $array = array( SS = one, 15 = two, 19 = three );
  while( list( $key, $val ) = each( $array )) {
if( is_string( $key )) {
  echo Key is a string\n;
  
}
echo Key: $key = $val :Val\n;

  }

/script

Because of the loose typing in PHP, essentially all arrays
are associative arrays.  Running the script above produces
the following results:

 BEGIN RESULTS
Key: 0 = one :Val
Key: 1 = two :Val
Key: 2 = three :Val


Key is a string
Key: SS = one :Val
Key: 15 = two :Val
Key: 19 = three :Val
 END RESULTS

Anyways, I want to be able to pass an array to a function.
This array can be defined by me as associative (as the 
second array in the sample) or regular (as the first).  However,
I need to be able to tell one from the other in my function.
As you can see, I can't do it with the is_string() function
because it doesn't realize that the 15 and the 19 I specify
as keys in the second declaration are actually strings that I
added and not actual element numbers.
Is there some way that I can determine if the keys of an array
are user defined (ie, a user defined associative array) and not
the keys PHP defines due to the fact that they are the element
numbers?

Another, somewhat related issue, notice the funkiness that
happens when you run the following, similar, script:

script language=php

  $array = array( one, two, three );
  while( list( $key, $val ) = each( $array )) {
if( is_string( $key )) {
  echo Key is a string\n;
  
}
echo Key: $key = $val :Val\n;

  }
  echo \n\n;

  for( $i = 0; $i  count( $array ); $i++ ) {
echo Printing element: $i --  . $array[$i] . \n;

  }  
  echo \n\n;

  $array = array( SS = one, 15 = two, three );
  while( list( $key, $val ) = each( $array )) {
if( is_string( $key )) {
  echo Key is a string\n;
  
}
echo Key: $key = $val :Val\n;

  }
  echo \n\n;

  for( $i = 0; $i  20; $i++ ) {
echo Printing element: $i --  . $array[$i] . \n;

  }  

/script

Any help anyone can provide would be *greatly* appreciated!!

Chris



[PHP] sending PDF to the user (www)

2001-09-13 Thread George Pitcher

Hi all,

 I am using Lasso to authenticate user access to PDF files with the actual
delivery being handled by PHP.

I can download the PDF by clicking a 'submit' button. However, in IE or
Netscape, it puts it into the browser with the name of the php script as the
filename. I would like the filename to be the one the file lives with
normally. Can this be done?

Also, I would like it to be downloaded to the user's computer without
opening in the browser. Any suggestions.

My coding in php is:

?php
$fp1 = D:\\Pdf\\ . $fp;
$len = filesize($fp1);
header(Content-type: application/pdf);
header(Content-Disposition: attachment; filename=$fp1);
header(Content-Length: $len);
readfile($fp1);
?

Any suggestions?

George Pitcher
Edinburgh


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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




[PHP] problems with include()

2001-09-13 Thread LRW

I got a plain test to work...made a test.php that included the following:
htmlheadtitlePHP Test/title/head
body
?php echo Hello Worldp;?
br
?include(texttest.txt);?
br
/body/html

(texttest.txt just has some randome words in it.)

But when I try to make a page with tables, and have it place the text in a
cell, I get the following error:
CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers. The headers it did return are:
Followed by nothing.

The code is:
htmlheadtitleNew Page 1/title/head
body
h1Test/h1
div align=left
  table border=2 cellspacing=1 width=100%
tr
  td width=33%Boo/td
  td width=33%nbsp;/td
  td width=34%nbsp;/td
/tr
tr
  td width=33%nbsp;/td
  td width=33%
  ?php
  include(texttest.txt);
  ?/td
  td width=34%nbsp;/td
/tr
tr
  td width=33%nbsp;/td
  td width=33%nbsp;/td
  td width=34%
p align=rightYa/td
/tr
  /table
/div
/body
/html

Pretty simple and straightforward I would think. I named it tabtest.php.

Any ideas why it'll work in the 1st but not the 2nd example?

Thanks for all your help! =)

Liam



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




[PHP] minus in [] groups in ereg

2001-09-13 Thread Andrew Perevodchik

Is this a bug or feature? The only way to include
a minus characher in [] groups in regex is to put
\- right gefore ]

[[A-Za-z0-9\_\-\=\%\.]] won't work with - as it is supposed to
[[A-Za-z0-9\_\=\%\.\-]] is ok

Uh?

-- 
Andrew Perevodchik
[EMAIL PROTECTED]


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




Re: [PHP] problems with include()

2001-09-13 Thread ReDucTor

are you using a .cfg extension?!?

you are going to need to add the path to php at the top if you are :D

- Original Message -
From: LRW [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, September 14, 2001 1:31 AM
Subject: [PHP] problems with include()


 I got a plain test to work...made a test.php that included the following:
 htmlheadtitlePHP Test/title/head
 body
 ?php echo Hello Worldp;?
 br
 ?include(texttest.txt);?
 br
 /body/html

 (texttest.txt just has some randome words in it.)

 But when I try to make a page with tables, and have it place the text in a
 cell, I get the following error:
 CGI Error
 The specified CGI application misbehaved by not returning a complete set
of
 HTTP headers. The headers it did return are:
 Followed by nothing.

 The code is:
 htmlheadtitleNew Page 1/title/head
 body
 h1Test/h1
 div align=left
   table border=2 cellspacing=1 width=100%
 tr
   td width=33%Boo/td
   td width=33%nbsp;/td
   td width=34%nbsp;/td
 /tr
 tr
   td width=33%nbsp;/td
   td width=33%
   ?php
   include(texttest.txt);
   ?/td
   td width=34%nbsp;/td
 /tr
 tr
   td width=33%nbsp;/td
   td width=33%nbsp;/td
   td width=34%
 p align=rightYa/td
 /tr
   /table
 /div
 /body
 /html

 Pretty simple and straightforward I would think. I named it tabtest.php.

 Any ideas why it'll work in the 1st but not the 2nd example?

 Thanks for all your help! =)

 Liam



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



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




Re: [PHP] double values in array

2001-09-13 Thread Tom Beidler

MYSQL_ASSOC did the trick.

Thanks

 From: Andrew Perevodchik [EMAIL PROTECTED]
 Reply-To: Andrew Perevodchik [EMAIL PROTECTED]
 Date: Thu, 13 Sep 2001 08:10:52 +0300
 To: Tom Beidler [EMAIL PROTECTED]
 Cc: php list [EMAIL PROTECTED]
 Subject: Re: [PHP] double values in array
 
 Hello! You wrote:
 
 TB What am I doing wrong?
 
 You should use this line:
 $y = mysql_fetch_array ($getrec_result, MYSQL_ASSOC);
 
 -- 
 Andrew Perevodchik
 [EMAIL PROTECTED]
 
 


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




[PHP] Re: problems with include()

2001-09-13 Thread LRW

:::hangs head in utter shame:::
Because I'm a complete idiot and saved the bleeding file to a local
directory instead of under the web server's.
I shall now open my shirt for the flogging. =/

Liam


Lrw wrote in message [EMAIL PROTECTED]...
I got a plain test to work...made a test.php that included the following:
htmlheadtitlePHP Test/title/head
body
?php echo Hello Worldp;?
br
?include(texttest.txt);?
br
/body/html

(texttest.txt just has some randome words in it.)

But when I try to make a page with tables, and have it place the text in a
cell, I get the following error:
CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers. The headers it did return are:
Followed by nothing.

The code is:
htmlheadtitleNew Page 1/title/head
body
h1Test/h1
div align=left
  table border=2 cellspacing=1 width=100%
tr
  td width=33%Boo/td
  td width=33%nbsp;/td
  td width=34%nbsp;/td
/tr
tr
  td width=33%nbsp;/td
  td width=33%
  ?php
  include(texttest.txt);
  ?/td
  td width=34%nbsp;/td
/tr
tr
  td width=33%nbsp;/td
  td width=33%nbsp;/td
  td width=34%
p align=rightYa/td
/tr
  /table
/div
/body
/html

Pretty simple and straightforward I would think. I named it tabtest.php.

Any ideas why it'll work in the 1st but not the 2nd example?

Thanks for all your help! =)

Liam





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




RE: [PHP] minus in [] groups in ereg

2001-09-13 Thread Johnson, Kirk

Feature. By placing a dash next to the bracket, there is no confusion that
the dash is being used to specify a range.

Kirk

 -Original Message-
 From: Andrew Perevodchik [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, September 13, 2001 9:32 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] minus in [] groups in ereg
 
 
 Is this a bug or feature? The only way to include
 a minus characher in [] groups in regex is to put
 \- right gefore ]
 
 [[A-Za-z0-9\_\-\=\%\.]] won't work with - as it is supposed to
 [[A-Za-z0-9\_\=\%\.\-]] is ok
 
 Uh?

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




[PHP] Re: Graphs...

2001-09-13 Thread Philip Hallstrom

http://www.aditus.nu/jpgraph/
http://vagrant.sourceforge.net/

haven't used either of them though... but they sure look nice.

On Fri, 10 Aug 2001, Nic Skitt wrote:

 Anybody got any tuts/examples of a working graph with PHP?

 Cheers

 Nic



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



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




Re: [PHP] Email checking

2001-09-13 Thread David Otton

On Thu, 13 Sep 2001 11:28:01 -0700, you wrote:

like to be able to check to see that: the email is in the correct format and
the domain actually exists. Can anyone lend a hand?

[putting the try it this way bit first]

The only way to validate an email address is to try to send email to
it.

If you are doing anything where users add themselves to a mailing
list, then best practice is to use a double-opt-in. (this is what you
had to do when signing up to the PHP list).

a) user requests that their email address is signed up
b) a email with a unique subject line is sent to the address
c) when the email is replied to, the account goes live

This way, nobody can be added to the database maliciously, and you are
guaranteed to have a working email address.

However...

if (!ereg(([[:alnum:]\.\-]+)(\@[[:alnum:]\.\-]+\.+), $email)) {
$result = 'Not a valid email address';
}

checks that an email address parses ok.

list(,$domain) = split('@', $email);

should put the domain component in $domain. Now, you have to check
that an MX record exists for that domain. Here's a script that will
give you some idea of what you will be receiving:

http://www.declude.com/tools/lookup.php

If you want to be really paranoid, you can then connect to the host(s)
in the MX record on port 25 and check they have SMTP servers running.

Even when you've done all this:

1) The user portion of the address may be incorrect (a few SMTP
servers offer VRFY though).

2) The MX record may be wrong, and the SMTP server might refuse mail
for that domain

djo


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




[PHP] Beginner's books?

2001-09-13 Thread LRW

OK, here's a question that should just make me look like a newbie and not an
idiot:

Anyone have any recommendations of good books for PHP beginners?
Something that gives the basics in clear detail and as few errors in the
examples as possible? =)

I've found bad errors in Sam's Teach Yourself ASP for example.

Thanks!
Liam



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




RE: [PHP] Beginner's books?

2001-09-13 Thread Brandon Orther

PHP Fast  Easy :  http://www.thickbook.com/books/index.phtml

-Original Message-
From: LRW [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, September 13, 2001 8:54 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Beginner's books?

OK, here's a question that should just make me look like a newbie and
not an
idiot:

Anyone have any recommendations of good books for PHP beginners?
Something that gives the basics in clear detail and as few errors in the
examples as possible? =)

I've found bad errors in Sam's Teach Yourself ASP for example.

Thanks!
Liam



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


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




Re: [PHP] File Uploads

2001-09-13 Thread Christopher CM Allen

Thanks Much Martin!


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


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




Re: [PHP] I am making a mailing list but....

2001-09-13 Thread Kyle Smith

I really need help on this one, so someone please!


-lk6-
http://www.StupeedStudios.f2s.com
Home of the burning lego man!

ICQ: 115852509
MSN: [EMAIL PROTECTED]
AIM: legokiller666


- Original Message -
From: Kyle Smith [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, September 12, 2001 8:53 PM
Subject: [PHP] I am making a mailing list but


. how do i make php add something to a text document on the smae line
cause i need the text document to look like this

[EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED];

so well, how do i get it to add on to line 1 and would i need it to make the
; go on the last line cause php cat delete things in txt documents?


-lk6-
http://www.StupeedStudios.f2s.com
Home of the burning lego man!

ICQ: 115852509
MSN: [EMAIL PROTECTED]
AIM: legokiller666




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




[PHP] threaded forum to display replies

2001-09-13 Thread hassan xaaji


Hi

I have been coding a threaded forum. A simple one. I
have this problem:

I cannot show all the replies in a threaded way. I
tried a recursive method which takes the messageid and
I do like 
$messageID = $p_id +1;
showMessages($messageID);

This only works if the messageids are 1 2 3 4 5 6. but
if two consecutive messages have messages ids like 13
and 15 or 14 and 20 for example, this does not work.
Please help me here.

Thanks in advance

hxaaji



Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie

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




RE: [PHP] I am making a mailing list but....

2001-09-13 Thread Michael Geier, CDM Systems Admin

It would help if you were a little more descriptive about this...

Are you trying to do this in the To: field, the Cc: or Bcc: fields, actually
in the body of a message, in a flat file, in a DB...

flat file:
$fp = fopen(filename,w);
//emails in array
while ($tmp = array_shift($array)) { fputs($fp,$tmp; ); }
fclose($fp);


-Original Message-
From: Kyle Smith [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 13, 2001 7:19 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] I am making a mailing list but


I really need help on this one, so someone please!


-lk6-
http://www.StupeedStudios.f2s.com
Home of the burning lego man!

ICQ: 115852509
MSN: [EMAIL PROTECTED]
AIM: legokiller666


- Original Message -
From: Kyle Smith [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, September 12, 2001 8:53 PM
Subject: [PHP] I am making a mailing list but


. how do i make php add something to a text document on the smae line
cause i need the text document to look like this

[EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED];

so well, how do i get it to add on to line 1 and would i need it to make the
; go on the last line cause php cat delete things in txt documents?


-lk6-
http://www.StupeedStudios.f2s.com
Home of the burning lego man!

ICQ: 115852509
MSN: [EMAIL PROTECTED]
AIM: legokiller666




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


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




Re: [PHP] Email checking

2001-09-13 Thread rm

Have you tried:

http://zend.com/codex.php?CID=11


--- Max Mouse [EMAIL PROTECTED] wrote:
 I've been looking to check the validity of an email
 address when it's
 entered by a person on a from. So far, I have found
 many different versions


__
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/

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




Re[2]: [PHP] minus in [] groups in ereg

2001-09-13 Thread Andrew Perevodchik

Hello! You wrote:

JK Feature. By placing a dash next to the
JK bracket, there is no confusion that the dash
JK is being used to specify a range.

Doesn't slash before dash mean that???

-- 
Andrew Perevodchik
[EMAIL PROTECTED]


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




[PHP] Re: Beginner's books?

2001-09-13 Thread Jonathan Chum

Core PHP Programming by Leon Atkins is an excellent book IMHO. Each function
comes with a clear cut example how to use it. I have the first edition and
right now, I'm considering to purchase the second edition since it covers
PHP 4. That was my first PHP book when I started PHP.

Lrw [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 OK, here's a question that should just make me look like a newbie and not
an
 idiot:

 Anyone have any recommendations of good books for PHP beginners?
 Something that gives the basics in clear detail and as few errors in the
 examples as possible? =)

 I've found bad errors in Sam's Teach Yourself ASP for example.

 Thanks!
 Liam





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




RE: Re[2]: [PHP] minus in [] groups in ereg

2001-09-13 Thread Johnson, Kirk

 JK Feature. By placing a dash next to the
 JK bracket, there is no confusion that the dash
 JK is being used to specify a range.
 
 Doesn't slash before dash mean that???

Could be, I don't know. I always put a dash next to the bracket, instead of
escaping it with a backslash. As is often the case, there is more than one
way to do it.

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




Re: [PHP] limiting rows and pages like google

2001-09-13 Thread Julian Wood


It's not too hard to do the next/previous through all your results, as 
has been shown by several people. What is a little trickier, at least 
when using mysql and trying to take advantage of the limit clause, is 
how to display how many results you have (ie 1 to 10 of 107 results). If 
you use the limit, you can't get the total number of rows, without doing 
a second search sans limit. It's also harder to do the next link, 
because you don't necessarily know if there are any more rows (imagine 
you are displaying 10 rows at a time, you are on page 3 and there are 30 
total rows). Conversely, if you do a single query without the limit, 
then you're doing a slower search (limiting a search is way faster), and 
I'm not sure of the implications of the full result set residing 
serverside - maybe higher memory requirements. So what do people do to 
take advantage of limit? Two queries or a single query? Any other 
solutions? Any more insights on how limit works?

Julian

On Wednesday, September 12, 2001, at 10:16 PM, Adrian D'Costa wrote:


 Hi,

 I am trying to find out the the best way to do the following:

 I have a script that select records from a table.  The problem is that I
 need to limit the rows to 20. I know that I can use limit 20.  But 
 what I
 want to do is give the view a link to the next 20 till all the records 
 are
 shown.  What I don't know is how to maintain the search query and I want
 to use the same script.

 The logic would be to check if the script is called the first time, then
 the sql statement would be select travel.*, city.city from travel, city
 where travel.cityid=city.id limit 0,20.
 The second time or based on what has been selected on the page (1-20,
 21-40, etc) add that to the sql statement.  My question is how?

 Can someone guide me or give me some example.

 TIA

 Adrian


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


--
Julian Wood

Programmer/Analyst
University of Calgary

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




[PHP] Array Question

2001-09-13 Thread dhardison

Hi,
I've got an array of items that I've sorted in descending order. I'd
like to select the first ten items only  from the array to place in a graph
that's generated later in the script.  Here's a sample array I'm trying to
work with.

 Array
(
[209.181.49.x] = 2
[64.225.143.x] = 2
[63.174.69.x] = 1
[207.217.120.x] = 1
[164.109.19.x] = 1
[205.197.83.x] = 1
[24.155.23.x] = 1
[24.237.4.x] = 1
[161.58.135.x] = 1
[216.33.156.x] = 1
[64.14.48.x] = 1
[64.38.239.x] = 1
[203.155.4.x] = 1
[204.176.182.x] = 1
[64.12.136.x] = 1
[208.7.216.x] = 1
[64.70.22.x] = 1
[63.225.237.x] = 1
[205.197.83.x] = 1
[209.67.135.x] = 1
[64.14.48.x] = 1
[205.197.83.x] = 1
[206.67.234.x] = 1
)

How could I grab the first ten pairs and store them for use later in the
script?

Thanks,
dhardison


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




Re: [PHP] Email checking

2001-09-13 Thread Alexander Skwar

So sprach »Max Mouse« am 2001-09-13 um 11:28:01 -0700 :
 the domain actually exists. Can anyone lend a hand?

My try:

 function CheckEmail($adr){
   // Parameter:
   // $adr  - Email Adress
   // Rückgabewerte:
   // TRUE  - everything fine
   // Else, returns array:
   // Array(code, part)
   // Code s.u.; part: Part which caused error
   // -1- no @ in adr
   // -2- More than 1 @ (alas theoretically correct...)
   // -3- Error in Local-Part 
   // -4- Error in Domainname
   // -5- Domain not existent
   // -6- No MX for Domain

   // Regexpe
   $re = array(
 // - Local-Part
 'lp'  = '[a-z_\d][-_.a-z\d]{0,}',
 // - Domain
 'dom' = '(?:[a-z\d]{1,}(?:[-a-z\d]{0,}?){0,}?\.){0,}[a-z]{2,3}\.{0,1}'
   );

   foreach ($re as $typ = $wert){
 $re[$typ] = '÷^' . $wert . '$÷i';
   }

   if (('' == $adr) ||
   (FALSE === ($parts = split('@', $adr)))
  ){
 // Nothing to do
 return array('code' = -1, 'part' = $adr);
   }
   if (2  ($part_anzahl = count($parts))){
 // Less than 1 @ (also 0)
 return array('code' = -2, 'part' = $adr);
   }
   if (2  $part_anzahl){
 // Too many @'s!
 return array('code' = -3, 'part' = $adr);
   }
   if (! preg_match($re['lp'], $parts[0])){
 // Local-Part error!
 return array('code' = -4, 'part' = $parts[0]);
   }
   if (! preg_match($re['dom'], $parts[1])){
 // Domain looks bogus!
 return array('code' = -5, 'part' = $parts[1]);
   }
   if (! checkdnsrr($parts[1], 'ANY')){
 // Domain not existant
 return array('code' = -6, 'part' = $parts[1]);
   }
   if (! checkdnsrr($parts[1], 'MX')){
 // No MX for domain
 return array('code' = -7, 'part' = $parts[1]);
   }

   // When we get here, everything is fine!
   return TRUE;
 }

Alexander Skwar
-- 
How to quote:   http://learn.to/quote (german) http://quote.6x.to (english)
Homepage:   http://www.digitalprojects.com   |   http://www.iso-top.de
   iso-top.de - Die günstige Art an Linux Distributionen zu kommen
Uptime: 12 hours 58 minutes

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