Re: [PHP-DB] MySQL REGEXP functionality... any way to make this easier?

2002-10-14 Thread Ignatius Reilly

If you want to generalize the process to a n-set, a recursion method is
clearly required.

XSLT looks the best candidate to me to do this. I will tackle it when I find
some time.

Cheers
Ignatius

- Original Message -
From: Xepherys [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, October 10, 2002 8:26 AM
Subject: [PHP-DB] MySQL REGEXP functionality... any way to make this easier?


 Right now, a sample query I might have would be...

 SELECT * FROM ospd WHERE word REGEXP '^([a]?[p]?[e]?)$|^[p]?[a]?[e]?$|^[a
 ]?[e]?[p]?$|^[p]?[e]?[a]?$|^[e]?[p]?[a]?$|^[e]?[a]?[p]?$';


 where basically I need to query every combination of a, p and e.  This is
a
 pain, but for only three letter is not so bad.  As you can see, this could
 become unruly with larger numbers of letters.  Each instance of a letter
can
 only occur once.  However, a letter may be duplicated and used once for
each
 instance.  Hence the statement steps through... it could also be something
 like...

 SELECT * FROM ospd WHERE word REGEXP
 '^[a]?[a]?[e]?$|^[a]?[e]?[a]?$||^[e]?[a]?[a]?$';

 more easily written because one letter is used twice and can occure once
for
 each instance.  Please let me know if you have any ideas.


 Jesse
 [EMAIL PROTECTED]


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




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




[PHP-DB] Accessing data from next row? (mysql)

2002-10-14 Thread Leif K-Brooks

Using mysql, how do I access the data of the next row using code
something like this:
$result = mysql_query(select column from table where whatever='whatever');
while($array = mysql_fetch_array($result)){
//Whatever
}

-- 
The above message is encrypted with double rot13 encoding.  Any 
unauthorized attempt to decrypt it will be prosecuted to the full extent 
of the law.




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




RE: [PHP-DB] Accessing data from next row? (mysql)

2002-10-14 Thread John W. Holmes

 Using mysql, how do I access the data of the next row using code
 something like this:
 $result = mysql_query(select column from table where
 whatever='whatever');
 while($array = mysql_fetch_array($result)){
 //Whatever
 }

Each iteration of the while loop will fetch a row for you and it's
contents will be in the $array[] array. Try echo $array['column'];
inside of your while to see what I'm talking about.

---John Holmes...



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




RE: [PHP-DB] Accessing data from next row? (mysql)

2002-10-14 Thread Snijders, Mark

if you want to access stuff from row 3 while being in row 2.. you first have
to put it all into an array.. and then you coul do that.. but i can't comup
with something where you need something like that.. a strange idea...?

-Original Message-
From: Leif K-Brooks [mailto:[EMAIL PROTECTED]]
Sent: maandag 14 oktober 2002 9:47
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Accessing data from next row? (mysql)


I know that, but what if I need to access data from the next row?  If I 
have 3 rows, is there a way to access something from row 3 while the 
loop is in row 2, but still have the loop go to row 3 when it's done 
with row 2?

John W. Holmes wrote:

Using mysql, how do I access the data of the next row using code
something like this:
$result = mysql_query(select column from table where
whatever='whatever');
while($array = mysql_fetch_array($result)){
//Whatever
}



Each iteration of the while loop will fetch a row for you and it's
contents will be in the $array[] array. Try echo $array['column'];
inside of your while to see what I'm talking about.

---John Holmes...



  


-- 
The above message is encrypted with double rot13 encoding.  Any
unauthorized attempt to decrypt it will be prosecuted to the full extent
of the law.




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




RE: [PHP-DB] Accessing data from next row? (mysql)

2002-10-14 Thread John W. Holmes

No. Try putting everything into an array and then working with that
array afterwards.

While($row = mysql_fetch_array($result))
{ $a[] = $row['column']; }

Then work with $a, which will have all the values.

---John Holmes...

 -Original Message-
 From: Leif K-Brooks [mailto:[EMAIL PROTECTED]]
 Sent: Monday, October 14, 2002 3:47 AM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Accessing data from next row? (mysql)
 
 I know that, but what if I need to access data from the next row?  If
I
 have 3 rows, is there a way to access something from row 3 while the
 loop is in row 2, but still have the loop go to row 3 when it's done
 with row 2?
 
 John W. Holmes wrote:
 
 Using mysql, how do I access the data of the next row using code
 something like this:
 $result = mysql_query(select column from table where
 whatever='whatever');
 while($array = mysql_fetch_array($result)){
 //Whatever
 }
 
 
 
 Each iteration of the while loop will fetch a row for you and it's
 contents will be in the $array[] array. Try echo $array['column'];
 inside of your while to see what I'm talking about.
 
 ---John Holmes...
 
 
 
 
 
 
 --
 The above message is encrypted with double rot13 encoding.  Any
 unauthorized attempt to decrypt it will be prosecuted to the full
extent
 of the law.
 




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




[PHP-DB] Re: Accessing data from next row? (mysql)

2002-10-14 Thread Adam Royle

Create an array and go through the array as needed.

Here is some code from one of my db functions:

$DB_RESULT = mysql_query($sql) or die(Error executing query:  . 
mysql_error());

// create an empty array to fill with data
$arrData = array();

$rowCount = 0;
while ($r = mysql_fetch_array($DB_RESULT, MYSQL_ASSOC)){
foreach ($r as $key = $value){
$arrData[$rowCount][$key] = $value;
}
$rowCount++;
}

then simply instead of your code:
while($array = mysql_fetch_array($result)){

use this:
for ($i=0;$icount($arrData);$i++){
$arrThisRow = $arrData[$i];
$arrNextRow = $arrData[$i+1];
}

obviously, if you are trying to access a variable which index does not 
exist, you will need to implement some sort of error checking, etc

adam


 Using mysql, how do I access the data of the next row using code
 something like this:
 $result = mysql_query(select column from table where 
 whatever='whatever');
 while($array = mysql_fetch_array($result)){
 //Whatever
 }


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




RE: [PHP-DB] Accessing data from next row? (mysql)

2002-10-14 Thread olinux

I just did something similar where I had a left join
that returns several rows for each record. So to make
sure that each record is outputted once and contains
the correct 'categories' at the end of the while i
store the current $id as $prev_id. This way I can
check to see if we're working on the same listing
($id==$prev_id) and just adding a category or if it is
a new listing ($id!=$prev_id).


table listings contains company info
table categories contains the categories that they may
beloing to 
table l_categories ties the two together

QUERY:
SELECT * FROM listings l
LEFT JOIN l_categories lc ON l.l_id = lc.l_id
LEFT JOIN categories c ON lc.cat_id = c.cat_id
WHERE l.b_id = '.$_SESSION[b_id].'
ORDER BY l.l_id

$prev_id = '';
while ($row = mysql_fetch_array($result))
{
if ($row[l_id] == $prev_id)
{
$listing .= '- '.$row[category].'br';
}
elseif ($row[l_id] != $prev_id)
{
if ($prev_id != '')
{
// not first listing
$content .= $listing.'/td/tr
trtd[a
href=edit.php?l_id='.$prev_id.'Modify/a]
/td/tr
trtdnbsp;/td/tr';
$listing = '';
}

$listing .= 'trtd bgcolor=#EE
strong'.$row[l_name].'/strong
/td/tr
trtd
'.$row[l_address].'br
'.$row[l_city].', '.$row[l_state].'
'.$row[l_zip].'br
strongPhone:/strong
'.format_phone($row[l_phone]).'br
strongToll-Free:/strong
'.format_phone($row[l_tollfree]).'br
strongFax:/strong
'.format_phone($row[l_fax]).'br
strongEmail:/strong '.$row[l_email].'br
strongDescription:/strong
'.$row[l_description].'br
strongCategories:/strongbr -
'.$row[category].'br';
}

Then after the while loop I do this to finish off the
list and provide the edit link

$content .= $listing.'/td/tr
trtd[a
href=edit.php?l_id='.$prev_id.'Modify/a]
/td/tr
trtdnbsp;/td/tr';
$listing = '';

olinux


--- Snijders, Mark [EMAIL PROTECTED]
wrote:
 if you want to access stuff from row 3 while being
 in row 2.. you first have
 to put it all into an array.. and then you coul do
 that.. but i can't comup
 with something where you need something like that..
 a strange idea...?
 
 -Original Message-
 From: Leif K-Brooks
 [mailto:[EMAIL PROTECTED]]
 Sent: maandag 14 oktober 2002 9:47
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Accessing data from next row?
 (mysql)
 
 
 I know that, but what if I need to access data from
 the next row?  If I 
 have 3 rows, is there a way to access something from
 row 3 while the 
 loop is in row 2, but still have the loop go to row
 3 when it's done 
 with row 2?
 
 John W. Holmes wrote:
 
 Using mysql, how do I access the data of the next
 row using code
 something like this:
 $result = mysql_query(select column from table
 where
 whatever='whatever');
 while($array = mysql_fetch_array($result)){
 //Whatever
 }
 
 
 
 Each iteration of the while loop will fetch a row
 for you and it's
 contents will be in the $array[] array. Try echo
 $array['column'];
 inside of your while to see what I'm talking about.
 
 ---John Holmes...
 
 
 
   
 
 
 -- 
 The above message is encrypted with double rot13
 encoding.  Any
 unauthorized attempt to decrypt it will be
 prosecuted to the full extent
 of the law.
 
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


__
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos  More
http://faith.yahoo.com

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




[PHP-DB] mssql select db problem

2002-10-14 Thread Kadir Leblebici

Hi friends
I have big problem
I connect to mssql server
I connected succesful
but i select_db
samples code is here

$hostname = 192.168.100.4;
$username = sa;
$password = ;
$dbName =WIN-PAK 2;

MSSQL_CONNECT($hostname,$username,$password) or DIE(DATABASE FAILED TO 
RESPOND.);
mssql_select_db($dbName) or DIE(DATABASE BULUNAMADI);

message

Warning: MS SQL message: Line 1: Incorrect syntax near '-'. (severity 15) 
in C:\apache\htdocs\ornek\mssql.php on line 9

Warning: MS SQL: Unable to select database: WIN-PAK 2 in 
C:\apache\htdocs\ornek\mssql.php on line 9
DATABASE BULUNAMADI

where is the problem

Thanks


[PHP-DB] Re: Accessing data from next row? (mysql)

2002-10-14 Thread Adam Royle

Also, if you're not sure how to get the values from $arrThisRow / 
$arrNextRow:

echo $arrThisRow['columnName'];

or $arrData[$i]['columnName'] if you want to access it manually without 
the other two arrays

adam

On Monday, October 14, 2002, at 06:05  PM, Adam Royle wrote:

 Create an array and go through the array as needed.

 Here is some code from one of my db functions:

   $DB_RESULT = mysql_query($sql) or die(Error executing query:  . 
 mysql_error());

   // create an empty array to fill with data
   $arrData = array();

   $rowCount = 0;
   while ($r = mysql_fetch_array($DB_RESULT, MYSQL_ASSOC)){
   foreach ($r as $key = $value){
   $arrData[$rowCount][$key] = $value;
   }
   $rowCount++;
   }

 then simply instead of your code:
 while($array = mysql_fetch_array($result)){

 use this:
 for ($i=0;$icount($arrData);$i++){
   $arrThisRow = $arrData[$i];
   $arrNextRow = $arrData[$i+1];
 }

 obviously, if you are trying to access a variable which index does not 
 exist, you will need to implement some sort of error checking, etc

 adam


 Using mysql, how do I access the data of the next row using code
 something like this:
 $result = mysql_query(select column from table where 
 whatever='whatever');
 while($array = mysql_fetch_array($result)){
 //Whatever
 }



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




Re: [PHP-DB] Problem with MySQL 4.0.4 beta

2002-10-14 Thread Jason Wong

On Sunday 13 October 2002 20:41, Rosen wrote:
 Hi,
 I just installed MySQL server on WIndows 98 and when server starts the
 window with mysqld-opt opens and stop responding. And server didn't
 start. Any ideas for this?

Try asking on the mysql lists?

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


/*
HOST SYSTEM NOT RESPONDING, PROBABLY DOWN. DO YOU WANT TO WAIT? (Y/N)
*/


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




[PHP-DB] First record of array not being echoed

2002-10-14 Thread Rankin, Randy

Good morning all.

I am attempting to create a table in which there is a title cell populated
with a training wave number and then I would like to echo all members of
each training wave below the title cell (See example below for
clarification). All seems to be working with one exception. The first record
of each array is not being echoed. If I run the query in MySQL, all rows are
returned, so it must just be something I am not seeing in the code (which is
posted below). Thanks in advance for any help.

Randy

--  START EXAMPLE ---


Training Wave: I-02   
 
Brumley, Kennith 
Dillard, Lori 
Hamilton, Don 
Larsen, Gerry 
Robinson, Bobby 
Sarabi, Ray 
Shaddix, Kirby 
Springer, Leon 
 
Training Wave: II-02   
 
Boles, Scooby 
Deloney, Jerald 
Russell, Roger 
Smith, Martha 
Stockman, Joe 
Williams, Ed 

ETC, ETC, ...

--  END EXAMPLE --- 

  BEGIN CODE SNIPET -
?
$sql = SELECT u.last_name, u.first_name, w.wave_id, w.wave_num
FROM USERS u, WAVES w
WHERE w.wave_id = u.wave_id
AND u.plant_id = '$plant_id'
ORDER BY w.wave_id ASC, u.last_name ASC;

$result = db_query ( $sql );

for ( $i = 0; $i  db_num_rows ( $result ); $i++ )
{
$record = db_fetch_object ( $result );  

if ( $record-wave_num != $prior_wave )
{
$prior_wave = $record-wave_num;

?

table width=375 cellpadding=0 cellspacing=0
border=0 
tr
td colspan=2 height=10?php
echo FILLER; ?/td
/tr
tr height=20 bgcolor=? echo $color2; ?
tdb
class=bGraybnbsp;Training Wave: ? echo $prior_wave; ?/b/td
td align=rightnbsp;/td
/tr
tr
td colspan=2 height=10?php
echo FILLER; ?/td
 /tr
/table  

?
}
else
{
?

table width=575 cellpadding=0 cellspacing=0
border=0 
tr
tdnbsp; ? echo
$record-last_name . ,  . $record-first_name; ?/td
/tr
/table
?
}

   }
}
}
?

-  END CODE SNIPET
-



Re: [PHP-DB] First record of array not being echoed

2002-10-14 Thread Marco Tabini

It seems to me that the first time you go through the loop, if
$record-wave_num is != $prior_wave then you print the wave number but
not the person's name--but you already have a record there with a
person's name!

Try taking out the else statement--if you follow the code from there you
should be able to fix it up.

Of course, I'm also doing this by just looking at your code, so I may be
wrong (the odds are not in my favor) :-)

On Mon, 2002-10-14 at 07:58, Rankin, Randy wrote:
 Good morning all.
 
 I am attempting to create a table in which there is a title cell populated
 with a training wave number and then I would like to echo all members of
 each training wave below the title cell (See example below for
 clarification). All seems to be working with one exception. The first record
 of each array is not being echoed. If I run the query in MySQL, all rows are
 returned, so it must just be something I am not seeing in the code (which is
 posted below). Thanks in advance for any help.
 
 Randy
 
 --  START EXAMPLE ---
 
   
   Training Wave: I-02   
  
   Brumley, Kennith 
   Dillard, Lori 
   Hamilton, Don 
   Larsen, Gerry 
   Robinson, Bobby 
   Sarabi, Ray 
   Shaddix, Kirby 
   Springer, Leon 
  
   Training Wave: II-02   
  
   Boles, Scooby 
   Deloney, Jerald 
   Russell, Roger 
   Smith, Martha 
   Stockman, Joe 
   Williams, Ed 
 
   ETC, ETC, ...
 
 --  END EXAMPLE ---   
 
   BEGIN CODE SNIPET -
 ?
 $sql = SELECT u.last_name, u.first_name, w.wave_id, w.wave_num
   FROM USERS u, WAVES w
   WHERE w.wave_id = u.wave_id
   AND u.plant_id = '$plant_id'
   ORDER BY w.wave_id ASC, u.last_name ASC;
 
 $result = db_query ( $sql );
 
 for ( $i = 0; $i  db_num_rows ( $result ); $i++ )
   {
   $record = db_fetch_object ( $result );  
   
   if ( $record-wave_num != $prior_wave )
   {
   $prior_wave = $record-wave_num;
   
   ?
   
   table width=375 cellpadding=0 cellspacing=0
 border=0 
   tr
   td colspan=2 height=10?php
 echo FILLER; ?/td
   /tr
   tr height=20 bgcolor=? echo $color2; ?
   tdb
 class=bGraybnbsp;Training Wave: ? echo $prior_wave; ?/b/td
   td align=rightnbsp;/td
   /tr
   tr
   td colspan=2 height=10?php
 echo FILLER; ?/td
/tr
   /table  
   
   ?
   }
   else
   {
   ?
   
   table width=575 cellpadding=0 cellspacing=0
 border=0 
   tr
   tdnbsp; ? echo
 $record-last_name . ,  . $record-first_name; ?/td
   /tr
   /table
 ?
   }
 
}  
 }
 }
 ?
 
 -  END CODE SNIPET
 -



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




RE: [PHP-DB] First record of array not being echoed

2002-10-14 Thread Rankin, Randy

Thanks Marco!

It's working now. Based on your suggestion, here is waht I came up with.
It's working now.

Randy


  SNIP 

table width=375 cellpadding=0 cellspacing=0 border=0 
tr
td colspan=2 height=10?php echo FILLER; ?/td
/tr
tr height=20 bgcolor=? echo $color2; ?
tdb class=bGraybnbsp;Training Wave: ? echo $prior_wave;
?/b/td
td align=rightnbsp;/td
/tr
tr
td colspan=2 height=10?php echo FILLER; ?/td
/tr

--  ADDED THIS HERE ---
tr
tdnbsp; ? echo $record-last_name . ,  . $record-first_name;
?/td
/tr
---  END ADDED CODE 
 /table  

?
}
else
{
?

table width=575 cellpadding=0 cellspacing=0 border=0
tr
tdnbsp; ? echo $record-last_name . ,  .
$record-first_name; ?/td
/tr
/table
--  END SNIP 

  -Original Message-
 From: Marco Tabini [EMAIL PROTECTED]  
 Sent: Monday, October 14, 2002 7:17 AM
 To:   Rankin, Randy
 Cc:   [EMAIL PROTECTED]
 Subject:  Re: [PHP-DB] First record of array not being echoed
 
 It seems to me that the first time you go through the loop, if
 $record-wave_num is != $prior_wave then you print the wave number but
 not the person's name--but you already have a record there with a
 person's name!
 
 Try taking out the else statement--if you follow the code from there you
 should be able to fix it up.
 
 Of course, I'm also doing this by just looking at your code, so I may be
 wrong (the odds are not in my favor) :-)
 
 On Mon, 2002-10-14 at 07:58, Rankin, Randy wrote:
  Good morning all.
 
  I am attempting to create a table in which there is a title cell
 populated
  with a training wave number and then I would like to echo all members of
  each training wave below the title cell (See example below for
  clarification). All seems to be working with one exception. The first
 record
  of each array is not being echoed. If I run the query in MySQL, all rows
 are
  returned, so it must just be something I am not seeing in the code
 (which is
  posted below). Thanks in advance for any help.
 
  Randy
 
  --  START EXAMPLE ---
 
 
  Training Wave: I-02
 
  Brumley, Kennith
  Dillard, Lori
  Hamilton, Don
  Larsen, Gerry
  Robinson, Bobby
  Sarabi, Ray
  Shaddix, Kirby
  Springer, Leon
 
  Training Wave: II-02
 
  Boles, Scooby
  Deloney, Jerald
  Russell, Roger
  Smith, Martha
  Stockman, Joe
  Williams, Ed
 
  ETC, ETC, ...
 
  --  END EXAMPLE ---
 
    BEGIN CODE SNIPET
 -
  ?
  $sql = SELECT u.last_name, u.first_name, w.wave_id, w.wave_num
  FROM USERS u, WAVES w
  WHERE w.wave_id = u.wave_id
  AND u.plant_id = '$plant_id'
  ORDER BY w.wave_id ASC, u.last_name ASC;
 
  $result = db_query ( $sql );
 
  for ( $i = 0; $i  db_num_rows ( $result ); $i++ )
  {
  $record = db_fetch_object ( $result );
 
  if ( $record-wave_num != $prior_wave )
  {
  $prior_wave = $record-wave_num;
 
  ?
 
  table width=375 cellpadding=0 cellspacing=0
  border=0
  tr
  td colspan=2 height=10?php
  echo FILLER; ?/td
  /tr
  tr height=20 bgcolor=? echo $color2; ?
  tdb
  class=bGraybnbsp;Training Wave: ? echo $prior_wave; ?/b/td
  td align=rightnbsp;/td
  /tr
  tr
  td colspan=2 height=10?php
  echo FILLER; ?/td
   /tr
  /table
 
  ?
  }
  else
  {
  ?
 
  table width=575 cellpadding=0 cellspacing=0
  border=0
  tr
  tdnbsp; ? echo
  $record-last_name . ,  . $record-first_name; ?/td
  /tr
  /table
  ?
  }
 
 }
  }
  }
  ?
 
  -  END CODE SNIPET
  -
 
 



[PHP-DB] .htaccess and db authentication

2002-10-14 Thread Adam Royle

I was wondering about people's thoughts on file security through php 
using database authentication.

Take the following example:

I have a folder (in webroot) called /videos/ which contains a heap of 
files like so:

video_1_14-06-2002.mpg
video_2_15-06-2002.mpg
video_3_16-06-2002.mpg
video_4_17-06-2002.mpg

Now, in a database I have table with a heap of users, with some sort of 
security identifier which allows them to access only the files they are 
given access to. Now, doing this in PHP is no problem, but I want to be 
able to stop them from 'predicting' what the next filename would be and 
just typing that in.

I thought about using .htaccess, where if they try to access one of the 
files, it sends it off to a php page which authenticates and displays a 
list of files they are allowed to view, although I would like it if 
they had the opportunity to type in the url of the file if they are 
actually authorized to do so.

I would prefer not to keep a file listing of allowed usernames and 
passwords using .htaccess, as this information could potentially be 
updated frequently with a large amount of users (or would this not be a 
problem).

Has anyone implemented this type of system before? are there any good 
resources people know of for this type of thing?

Thanks,
Adam.


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




Re: [PHP-DB] .htaccess and db authentication

2002-10-14 Thread Marco Tabini

How about using PHP as a pipe to funnel the MPG files through:

?
// Place your security logic here and exit if
// auth is not successful

// $filename is the path of the file
// to server

header (Content Type:video/mpeg);
readfile ($filename);
?

This way you can place your MPG files completely outside the server root
and your users will have to go through your scripts in order to even get
to them. Even better, they won't be able to bookmark them because even
if they do they'll still have to go through your script (you could even
add a random token to the URL so that they can't bookmark the files at
all.).


Marco

On Mon, 2002-10-14 at 08:58, Adam Royle wrote:
 I was wondering about people's thoughts on file security through php 
 using database authentication.
 
 Take the following example:
 
 I have a folder (in webroot) called /videos/ which contains a heap of 
 files like so:
 
 video_1_14-06-2002.mpg
 video_2_15-06-2002.mpg
 video_3_16-06-2002.mpg
 video_4_17-06-2002.mpg
 
 Now, in a database I have table with a heap of users, with some sort of 
 security identifier which allows them to access only the files they are 
 given access to. Now, doing this in PHP is no problem, but I want to be 
 able to stop them from 'predicting' what the next filename would be and 
 just typing that in.
 
 I thought about using .htaccess, where if they try to access one of the 
 files, it sends it off to a php page which authenticates and displays a 
 list of files they are allowed to view, although I would like it if 
 they had the opportunity to type in the url of the file if they are 
 actually authorized to do so.
 
 I would prefer not to keep a file listing of allowed usernames and 
 passwords using .htaccess, as this information could potentially be 
 updated frequently with a large amount of users (or would this not be a 
 problem).
 
 Has anyone implemented this type of system before? are there any good 
 resources people know of for this type of thing?
 
 Thanks,
 Adam.
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 



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




[PHP-DB] upload script filename checking

2002-10-14 Thread Michael Knauf/Niles


Ok, so I've got a simple upload script... User uses form to select a file,
the file is then uploaded to a dir on the web server, and a link is
provided for the user to view the file.

Of course when the user uploads my pic.jpg the resulting link is broken
(because of the space)... so I want to replace any occurrence of   with 
_

Now I'm sure there are other nastys to worry about but I'm new to this any
suggestions on an easy way to make sure the file names are good?

Michael



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




Re: [PHP-DB] upload script filename checking

2002-10-14 Thread Bas Jobsen

Op maandag 14 oktober 2002 15:41, schreef Michael Knauf/Niles:
 (because of the space)... so I want to replace any occurrence of   with 
 _
$filename=str_replace(' ','_',$filename);

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




[PHP-DB] Fatal error: Call to undefined function: mysql_connect() ......

2002-10-14 Thread Vyas, Bhavin

I get the following error:
Fatal error: Call to undefined function: mysql_connect() 

on php 4.1.2.

It *has* been compiled with-mysql...here is a snippet from phpinfo()

'--with-kerberos=/usr/kerberos' '--with-ldap=shared'
'--with-mysql=shared,/usr' 


Any ideas why I am getting the error?

Thanks,
Bhavin Vyas.

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




Re: [PHP-DB] Fatal error: Call to undefined function: mysql_connect() ......

2002-10-14 Thread Jeffrey_N_Dyke


does the mysql section show up in phpinfo() ?  is [shared] allowed in that
configure argument?


|-|
| Jeff | KeaneIT - Presidents Landing |
| | Suite: 200|
|   Outside: 617 -517-1772 | E-mail:  |
| [EMAIL PROTECTED]|
|   [ Mailing: 10 Presidents Landing  |
|   Medford, MA 02155 USA ]   |
|-|





   
   
  Vyas, Bhavin   
   
  Bhavin.Vyas@247ReaTo:   '[EMAIL PROTECTED]' 
[EMAIL PROTECTED]
  lMedia.comcc:   
   
 Subject:  [PHP-DB] Fatal error: Call 
to undefined function: mysql_connect() ..   
  10/14/2002 10:57 AM  
   
   
   
   
   




I get the following error:
Fatal error: Call to undefined function: mysql_connect()

on php 4.1.2.

It *has* been compiled with-mysql...here is a snippet from phpinfo()

'--with-kerberos=/usr/kerberos' '--with-ldap=shared'
'--with-mysql=shared,/usr'


Any ideas why I am getting the error?

Thanks,
Bhavin Vyas.

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





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




RE: [PHP-DB] Fatal error: Call to undefined function: mysql_connect() ......

2002-10-14 Thread Vyas, Bhavin

The only other place it shows up is in the dbx section
DBX
dbx support enabled
dbx version 1.0.0
supported databases MySQLbr /ODBCbr /PostgreSQLbr /Microsoft SQL
Serverbr /FrontBase

There isn't a 'mysql' section.
I am not sure if [shared] is allowed, it should be considering that the
version is 4.1.2 and this install was default RH7.3.
Is there a way to check and make sure?

Thanks,
Bhavin.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 14, 2002 11:04 AM
To: Vyas, Bhavin
Cc: '[EMAIL PROTECTED]'
Subject: Re: [PHP-DB] Fatal error: Call to undefined function:
mysql_connect() ..



does the mysql section show up in phpinfo() ?  is [shared] allowed in that
configure argument?


|-|
| Jeff | KeaneIT - Presidents Landing |
| | Suite: 200|
|   Outside: 617 -517-1772 | E-mail:  |
| [EMAIL PROTECTED]|
|   [ Mailing: 10 Presidents Landing  |
|   Medford, MA 02155 USA ]   |
|-|





 

  Vyas, Bhavin

  Bhavin.Vyas@247ReaTo:
'[EMAIL PROTECTED]' [EMAIL PROTECTED]

  lMedia.comcc:

 Subject:  [PHP-DB] Fatal
error: Call to undefined function: mysql_connect() ..   
  10/14/2002 10:57 AM

 

 





I get the following error:
Fatal error: Call to undefined function: mysql_connect()

on php 4.1.2.

It *has* been compiled with-mysql...here is a snippet from phpinfo()

'--with-kerberos=/usr/kerberos' '--with-ldap=shared'
'--with-mysql=shared,/usr'


Any ideas why I am getting the error?

Thanks,
Bhavin Vyas.

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





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

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




RE: [PHP-DB] (reverse) matching like LIKE?

2002-10-14 Thread John W. Holmes

 When if have the keyword 'msq' i can match the field 'mysqldata'
 SELECT * FROM table WHERE field LIKE $keyword%
 But how do i get a match when the keyword is 'mysqldatabase' and the
field
 'mysql'? (TRUE cause keyword contains 'mysql').
 

That'll never work unless you know where to divide up the keyword into
separate words. The way you want it, why not return everything with an
a in it, since the keyword contains 'a'??

---John Holmes...



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




RE: [PHP-DB] .htaccess and db authentication

2002-10-14 Thread John W. Holmes

Store the files outside of your web root or in an .htaccess protected
directory. You don't have to control an .htaccess password list, just
let PHP handle the sending of the file. 

Validate your user and whether they should be looking at the file they
requested, then use header() to send the appropriate header for the file
and use readfile() to send the data.

---John Holmes...

 -Original Message-
 From: Adam Royle [mailto:[EMAIL PROTECTED]]
 Sent: Monday, October 14, 2002 8:59 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] .htaccess and db authentication
 
 I was wondering about people's thoughts on file security through php
 using database authentication.
 
 Take the following example:
 
 I have a folder (in webroot) called /videos/ which contains a heap of
 files like so:
 
 video_1_14-06-2002.mpg
 video_2_15-06-2002.mpg
 video_3_16-06-2002.mpg
 video_4_17-06-2002.mpg
 
 Now, in a database I have table with a heap of users, with some sort
of
 security identifier which allows them to access only the files they
are
 given access to. Now, doing this in PHP is no problem, but I want to
be
 able to stop them from 'predicting' what the next filename would be
and
 just typing that in.
 
 I thought about using .htaccess, where if they try to access one of
the
 files, it sends it off to a php page which authenticates and displays
a
 list of files they are allowed to view, although I would like it if
 they had the opportunity to type in the url of the file if they are
 actually authorized to do so.
 
 I would prefer not to keep a file listing of allowed usernames and
 passwords using .htaccess, as this information could potentially be
 updated frequently with a large amount of users (or would this not be
a
 problem).
 
 Has anyone implemented this type of system before? are there any good
 resources people know of for this type of thing?
 
 Thanks,
 Adam.
 
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




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




RE: [PHP-DB] Fatal error: Call to undefined function: mysql_conne ct() ......

2002-10-14 Thread Jeffrey_N_Dyke


I think this is how it works.if you're using dbx then you need to
connect using dbx_connect and not mysql_connect
and i don't think that [shared] is a valid argument.

I only connect to mysql and M$Sql  so i have configured to connect to those
specifiacally.

I would reconfigure using -with-mysql=/path/to/mysql

but, i am on Solaris8, so you may want to get other advice from someone
running RH

hth
jd



   
   
Vyas, Bhavin 
   
Bhavin.Vyas@247Real   To: '[EMAIL PROTECTED]' 
[EMAIL PROTECTED]
Media.com cc: '[EMAIL PROTECTED]' 
[EMAIL PROTECTED]
   Subject: RE: [PHP-DB] Fatal error: 
Call to undefined function: 
10/14/2002 11:14 AM mysql_conne ct() ..
   
   
   
   
   




The only other place it shows up is in the dbx section
   DBX
dbx support enabled
dbx version 1.0.0
supported databases MySQLbr /ODBCbr /PostgreSQLbr /Microsoft SQL
Serverbr /FrontBase

There isn't a 'mysql' section.
I am not sure if [shared] is allowed, it should be considering that the
version is 4.1.2 and this install was default RH7.3.
Is there a way to check and make sure?

Thanks,
Bhavin.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 14, 2002 11:04 AM
To: Vyas, Bhavin
Cc: '[EMAIL PROTECTED]'
Subject: Re: [PHP-DB] Fatal error: Call to undefined function:
mysql_connect() ..



does the mysql section show up in phpinfo() ?  is [shared] allowed in that
configure argument?


|-|
| Jeff | KeaneIT - Presidents Landing |
| | Suite: 200|
|   Outside: 617 -517-1772 | E-mail:  |
| [EMAIL PROTECTED]|
|   [ Mailing: 10 Presidents Landing  |
|   Medford, MA 02155 USA ]   |
|-|







   Vyas, Bhavin

   Bhavin.Vyas@247ReaTo:
'[EMAIL PROTECTED]' [EMAIL PROTECTED]

   lMedia.comcc:

 Subject:  [PHP-DB] Fatal
error: Call to undefined function: mysql_connect() ..
   10/14/2002 10:57 AM









I get the following error:
Fatal error: Call to undefined function: mysql_connect()

on php 4.1.2.

It *has* been compiled with-mysql...here is a snippet from phpinfo()

'--with-kerberos=/usr/kerberos' '--with-ldap=shared'
'--with-mysql=shared,/usr'


Any ideas why I am getting the error?

Thanks,
Bhavin Vyas.

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





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

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





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




RE: [PHP-DB] mssql select db problem

2002-10-14 Thread Jeffrey_N_Dyke


i'd get rid of the space as well, or use brackets around the db name to
account for the space.



   
   
John W. Holmes   
   
holmes072000@ch   To: 'Kadir Leblebici' 
[EMAIL PROTECTED], [EMAIL PROTECTED]  
arter.net cc: 
   
   Subject: RE: [PHP-DB] mssql select db 
problem  
10/14/2002 11:30   
   
AM 
   
Please respond 
   
to holmes072000
   
   
   
   
   




Rename your database. Either PHP or MSSQL doesn't like the '-' in the
name.

---John Holmes...

 -Original Message-
 From: Kadir Leblebici [mailto:[EMAIL PROTECTED]]
 Sent: Monday, October 14, 2002 4:36 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] mssql select db problem

 Hi friends
 I have big problem
 I connect to mssql server
 I connected succesful
 but i select_db
 samples code is here

 $hostname = 192.168.100.4;
 $username = sa;
 $password = ;
 $dbName =WIN-PAK 2;

 MSSQL_CONNECT($hostname,$username,$password) or DIE(DATABASE FAILED
TO
 RESPOND.);
 mssql_select_db($dbName) or DIE(DATABASE BULUNAMADI);

 message

 Warning: MS SQL message: Line 1: Incorrect syntax near '-'. (severity
15)
 in C:\apache\htdocs\ornek\mssql.php on line 9

 Warning: MS SQL: Unable to select database: WIN-PAK 2 in
 C:\apache\htdocs\ornek\mssql.php on line 9
 DATABASE BULUNAMADI

 where is the problem

 Thanks



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





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




RE: [PHP-DB] mssql select db problem

2002-10-14 Thread Jeffrey_N_Dyke

sorry i mis spoke, the brackets will help you in queries with tables and
columns that have spaces, not in the connect with actual dbs(at least i
don't think so).

- Forwarded by Jeffrey N Dyke/CORP/Keane on 10/14/2002 11:40 AM -
   
 
Jeffrey N Dyke 
 
 To: [EMAIL PROTECTED]
 
10/14/2002   cc: 'Kadir Leblebici' 
[EMAIL PROTECTED], [EMAIL PROTECTED]
11:32 AM Subject: RE: [PHP-DB] mssql select db 
problem(Document link: Jeff  
 Dyke) 
 
   
 



i'd get rid of the space as well, or use brackets around the db name to
account for the space.



   
   
John W. Holmes   
   
holmes072000@ch   To: 'Kadir Leblebici' 
[EMAIL PROTECTED], [EMAIL PROTECTED]  
arter.net cc: 
   
   Subject: RE: [PHP-DB] mssql select db 
problem  
10/14/2002 11:30   
   
AM 
   
Please respond 
   
to holmes072000
   
   
   
   
   




Rename your database. Either PHP or MSSQL doesn't like the '-' in the
name.

---John Holmes...

 -Original Message-
 From: Kadir Leblebici [mailto:[EMAIL PROTECTED]]
 Sent: Monday, October 14, 2002 4:36 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] mssql select db problem

 Hi friends
 I have big problem
 I connect to mssql server
 I connected succesful
 but i select_db
 samples code is here

 $hostname = 192.168.100.4;
 $username = sa;
 $password = ;
 $dbName =WIN-PAK 2;

 MSSQL_CONNECT($hostname,$username,$password) or DIE(DATABASE FAILED
TO
 RESPOND.);
 mssql_select_db($dbName) or DIE(DATABASE BULUNAMADI);

 message

 Warning: MS SQL message: Line 1: Incorrect syntax near '-'. (severity
15)
 in C:\apache\htdocs\ornek\mssql.php on line 9

 Warning: MS SQL: Unable to select database: WIN-PAK 2 in
 C:\apache\htdocs\ornek\mssql.php on line 9
 DATABASE BULUNAMADI

 where is the problem

 Thanks



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






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




RE: [PHP-DB] Fatal error: Call to undefined function: mysql_conne ct() ......

2002-10-14 Thread Jeffrey_N_Dyke


what are you passing for module(the first argument for dbx_connect)  it
should be DBX_MYSQL, or  mysql, if that fails, recompile without the shared
argument, and i bet that would work



   
   
Vyas, Bhavin 
   
Bhavin.Vyas@247Real   To: '[EMAIL PROTECTED]' 
[EMAIL PROTECTED], Vyas,
Media.com  Bhavin [EMAIL PROTECTED] 
   
   cc: '[EMAIL PROTECTED]' 
[EMAIL PROTECTED]
10/14/2002 11:43 AMSubject: RE: [PHP-DB] Fatal error: 
Call to undefined function: 
mysql_conne  ct() ..   
   
   
   




Thanks for the info. Now, I am getting the following error:

Warning: dbx: module '1' not loaded or not supported.

If any one has any ideas

Thanks,
Bhavin.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 14, 2002 11:29 AM
To: Vyas, Bhavin
Cc: '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] Fatal error: Call to undefined function:
mysql_conne ct() ..



I think this is how it works.if you're using dbx then you need to
connect using dbx_connect and not mysql_connect
and i don't think that [shared] is a valid argument.

I only connect to mysql and M$Sql  so i have configured to connect to those
specifiacally.

I would reconfigure using -with-mysql=/path/to/mysql

but, i am on Solaris8, so you may want to get other advice from someone
running RH

hth
jd





 Vyas, Bhavin

 Bhavin.Vyas@247Real   To:
'[EMAIL PROTECTED]' [EMAIL PROTECTED]
 Media.com cc:
'[EMAIL PROTECTED]' [EMAIL PROTECTED]
Subject: RE: [PHP-DB]
Fatal error: Call to undefined function:
 10/14/2002 11:14 AM mysql_conne ct() ..









The only other place it shows up is in the dbx section
   DBX
dbx support enabled
dbx version 1.0.0
supported databases MySQLbr /ODBCbr /PostgreSQLbr /Microsoft SQL
Serverbr /FrontBase

There isn't a 'mysql' section.
I am not sure if [shared] is allowed, it should be considering that the
version is 4.1.2 and this install was default RH7.3.
Is there a way to check and make sure?

Thanks,
Bhavin.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 14, 2002 11:04 AM
To: Vyas, Bhavin
Cc: '[EMAIL PROTECTED]'
Subject: Re: [PHP-DB] Fatal error: Call to undefined function:
mysql_connect() ..



does the mysql section show up in phpinfo() ?  is [shared] allowed in that
configure argument?


|-|
| Jeff | KeaneIT - Presidents Landing |
| | Suite: 200|
|   Outside: 617 -517-1772 | E-mail:  |
| [EMAIL PROTECTED]|
|   [ Mailing: 10 Presidents Landing  |
|   Medford, MA 02155 USA ]   |
|-|







Vyas, Bhavin

Bhavin.Vyas@247ReaTo:
'[EMAIL PROTECTED]' [EMAIL PROTECTED]

lMedia.comcc:

   Subject:  [PHP-DB] Fatal
error: Call to undefined function: mysql_connect() ..
10/14/2002 10:57 AM









I get the following error:
Fatal error: Call to undefined function: mysql_connect()

on php 4.1.2.

It *has* been compiled with-mysql...here is a snippet from phpinfo()

'--with-kerberos=/usr/kerberos' '--with-ldap=shared'
'--with-mysql=shared,/usr'


Any ideas why I am getting the error?

Thanks,
Bhavin Vyas.

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





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

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







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




RE: [PHP-DB] Fatal error: Call to undefined function: mysql_connect() ......

2002-10-14 Thread Vyas, Bhavin

I am using mysq. I tried to re-install using rpm, but didn't work. Will
need to recompile. However, now, I am getting Mysql not loaded. My feeling
is that there must be a simple way to load this module, just don't know how
:-(
If anyone does, please let me know, else I will recompile.

Thanks for all your help!!!

Bhavin.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 14, 2002 11:46 AM
To: Vyas, Bhavin
Cc: '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] Fatal error: Call to undefined function:
mysql_conne ct() ..



what are you passing for module(the first argument for dbx_connect)  it
should be DBX_MYSQL, or  mysql, if that fails, recompile without the shared
argument, and i bet that would work



 

Vyas, Bhavin

Bhavin.Vyas@247Real   To:
'[EMAIL PROTECTED]' [EMAIL PROTECTED], Vyas,
Media.com  Bhavin
[EMAIL PROTECTED]
   cc:
'[EMAIL PROTECTED]' [EMAIL PROTECTED]
10/14/2002 11:43 AMSubject: RE: [PHP-DB]
Fatal error: Call to undefined function: 
mysql_conne  ct() ..

 





Thanks for the info. Now, I am getting the following error:

Warning: dbx: module '1' not loaded or not supported.

If any one has any ideas

Thanks,
Bhavin.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 14, 2002 11:29 AM
To: Vyas, Bhavin
Cc: '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] Fatal error: Call to undefined function:
mysql_conne ct() ..



I think this is how it works.if you're using dbx then you need to
connect using dbx_connect and not mysql_connect
and i don't think that [shared] is a valid argument.

I only connect to mysql and M$Sql  so i have configured to connect to those
specifiacally.

I would reconfigure using -with-mysql=/path/to/mysql

but, i am on Solaris8, so you may want to get other advice from someone
running RH

hth
jd





 Vyas, Bhavin

 Bhavin.Vyas@247Real   To:
'[EMAIL PROTECTED]' [EMAIL PROTECTED]
 Media.com cc:
'[EMAIL PROTECTED]' [EMAIL PROTECTED]
Subject: RE: [PHP-DB]
Fatal error: Call to undefined function:
 10/14/2002 11:14 AM mysql_conne ct() ..









The only other place it shows up is in the dbx section
   DBX
dbx support enabled
dbx version 1.0.0
supported databases MySQLbr /ODBCbr /PostgreSQLbr /Microsoft SQL
Serverbr /FrontBase

There isn't a 'mysql' section.
I am not sure if [shared] is allowed, it should be considering that the
version is 4.1.2 and this install was default RH7.3.
Is there a way to check and make sure?

Thanks,
Bhavin.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 14, 2002 11:04 AM
To: Vyas, Bhavin
Cc: '[EMAIL PROTECTED]'
Subject: Re: [PHP-DB] Fatal error: Call to undefined function:
mysql_connect() ..



does the mysql section show up in phpinfo() ?  is [shared] allowed in that
configure argument?


|-|
| Jeff | KeaneIT - Presidents Landing |
| | Suite: 200|
|   Outside: 617 -517-1772 | E-mail:  |
| [EMAIL PROTECTED]|
|   [ Mailing: 10 Presidents Landing  |
|   Medford, MA 02155 USA ]   |
|-|







Vyas, Bhavin

Bhavin.Vyas@247ReaTo:
'[EMAIL PROTECTED]' [EMAIL PROTECTED]

lMedia.comcc:

   Subject:  [PHP-DB] Fatal
error: Call to undefined function: mysql_connect() ..
10/14/2002 10:57 AM









I get the following error:
Fatal error: Call to undefined function: mysql_connect()

on php 4.1.2.

It *has* been compiled with-mysql...here is a snippet from phpinfo()

'--with-kerberos=/usr/kerberos' '--with-ldap=shared'
'--with-mysql=shared,/usr'


Any ideas why I am getting the error?

Thanks,
Bhavin Vyas.

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





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

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






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




[PHP-DB] more upload script filename checking

2002-10-14 Thread Michael Knauf/Niles


Ok, next question:

Here's my upload script:

?
  if ($upfile1==none)
  {
echo no file selected for upload please go back and select a
file.;
exit;
  }

  if ($upfile1_size==0)
  {
echo No data was transferred, your file may be too large or
may not exist;
exit;
  }
  $upfile1_name=str_replace(' ','_',$upfile1_name);
  if (file_exists(/var/www/html/files/$upfile1_name))
  {
  echo Font color=redfile $upfile1_name already
exists/fontpNote: Your file may have been renamed if it contained
spaces, this is so that links to the file will work correctly./PP If
you want to replace an existing file, Talk to Michael Knauf.;
  exit;
  }

  if (!is_uploaded_file($upfile1))
  {
echo file may contain upload attack, this is not allowed;
exit;
  }

  $okfile1=/var/www/html/files/.$upfile1_name;

  if ( !copy($upfile1, $okfile1))
  {
echo Could not move file;
exit;
  }

  echo File uploaded successfullyBRBR;
  $fp = fopen($okfile1, r);
  $contents = fread ($fp, filesize ($okfile1));
  fclose($fp);

  $fp = fopen($okfile1, w);
  fwrite($fp, $contents);
  fclose($fp);

  echo HR;

  echo you can link to your file at: A
HREF=http://red.niles.net/files/$upfile1_namehttp://red.niles.net/files/$upfile1_name/A;
?

That all works fine, and accepts a file from a simple html form file
element: input type=file name=upfile1

So I think, my, wouldn't it be nice if they could upload 3 or 4 files at
once?

Problem 1, I'm not sure how to structure that, obviously a loop of some
sort, but what makes me cry for help, is that I simply duplicated my html
input input type=file name=upfile2 and called it upfile2, and
duplicated my php code and changed each second instance of upfile1 to
upfile2 which worked fine, too till I trigger any of the error conditions
in the first iteration... then the exit function happens and the second
file is ignored (because i've exited out of the script, I know) the
question is how I exit out of the first iteration but not the second...

Michael



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




Re: [PHP-DB] more upload script filename checking

2002-10-14 Thread Marco Tabini

Well, you can use the break statement to exit a loop or code block, but
wouldn't you rather want to create a single loop that can handle any
number of files?


 On Mon, 2002-10-14 at 13:54, Michael Knauf/Niles wrote:
 
 Ok, next question:
 
 Here's my upload script:
 
 ?
   if ($upfile1==none)
   {
 echo no file selected for upload please go back and select a
 file.;
 exit;
   }
 
   if ($upfile1_size==0)
   {
 echo No data was transferred, your file may be too large or
 may not exist;
 exit;
   }
   $upfile1_name=str_replace(' ','_',$upfile1_name);
   if (file_exists(/var/www/html/files/$upfile1_name))
   {
   echo Font color=redfile $upfile1_name already
 exists/fontpNote: Your file may have been renamed if it contained
 spaces, this is so that links to the file will work correctly./PP If
 you want to replace an existing file, Talk to Michael Knauf.;
   exit;
   }
 
   if (!is_uploaded_file($upfile1))
   {
 echo file may contain upload attack, this is not allowed;
 exit;
   }
 
   $okfile1=/var/www/html/files/.$upfile1_name;
 
   if ( !copy($upfile1, $okfile1))
   {
 echo Could not move file;
 exit;
   }
 
   echo File uploaded successfullyBRBR;
   $fp = fopen($okfile1, r);
   $contents = fread ($fp, filesize ($okfile1));
   fclose($fp);
 
   $fp = fopen($okfile1, w);
   fwrite($fp, $contents);
   fclose($fp);
 
   echo HR;
 
   echo you can link to your file at: A
 
HREF=http://red.niles.net/files/$upfile1_namehttp://red.niles.net/files/$upfile1_name/A;
 ?
 
 That all works fine, and accepts a file from a simple html form file
 element: input type=file name=upfile1
 
 So I think, my, wouldn't it be nice if they could upload 3 or 4 files at
 once?
 
 Problem 1, I'm not sure how to structure that, obviously a loop of some
 sort, but what makes me cry for help, is that I simply duplicated my html
 input input type=file name=upfile2 and called it upfile2, and
 duplicated my php code and changed each second instance of upfile1 to
 upfile2 which worked fine, too till I trigger any of the error conditions
 in the first iteration... then the exit function happens and the second
 file is ignored (because i've exited out of the script, I know) the
 question is how I exit out of the first iteration but not the second...
 
 Michael
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 



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




Re: [PHP-DB] Birthdays!

2002-10-14 Thread Marco Tabini

How about 

select * from table where birthday between now() and date_add(now(),
interval 15 day);

Assuming, of course, you're using MySQL.

Cheers,


Marco

On Mon, 2002-10-14 at 16:20, Steve Vernon wrote:
 Hiya,
 Just wondering what is the best way to do this please.
 
 I have various birthdays stored as dates including birth years. 
 
 Just wondering is there a function, or an easy way to work out the birthdays in 
the next two weeks say. Just be nice on my website to remind me of birthdays.Suppose 
its simple to work out manually, but then have to mess around with days a month etc.
 
 Thanks,
 
 Steve
 XX



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




Re: [PHP-DB] Birthdays!

2002-10-14 Thread Steve Vernon

Yeh but that does not take into account years does it? My table has there
birth year, wont that mess it up and not work? I assume I need to do a
function only on the months and days??

Thanks!

Steve
XX


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




Re: [PHP-DB] Fatal error: Call to undefined function: mysql_conne ct() ......

2002-10-14 Thread Michael Mauch

Bhavin Vyas [EMAIL PROTECTED] wrote:

 I am using mysq. I tried to re-install using rpm, but didn't work. Will
 need to recompile. However, now, I am getting Mysql not loaded. My feeling
 is that there must be a simple way to load this module, just don't know how
 :-(

You have to use

extension=mysql.so

in your php.ini, and make sure that the extension_dir is set to the
right directory (try locate mysql.so to find it). Stop and restart
Apache, then your mysql module should be available.

Regards...
Michael

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




Re: [PHP-DB] Birthdays!

2002-10-14 Thread David Robley

In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] says...
 How about 
 
 select * from table where birthday between now() and date_add(now(),
 interval 15 day);
 
 Assuming, of course, you're using MySQL.
 
 Cheers,
 
 
 Marco
 
 On Mon, 2002-10-14 at 16:20, Steve Vernon wrote:
  Hiya,
  Just wondering what is the best way to do this please.
  
  I have various birthdays stored as dates including birth years. 
  
  Just wondering is there a function, or an easy way to work out the birthdays 
in the next two weeks say. Just be nice on my website to remind me of 
birthdays.Suppose its simple to work out manually, but then have to mess around with 
days a month etc.
  
  Thanks,
  
  Steve
  XX

Break that down a bit further by searching on DAYOFYEAR(birthday) assuming 
that birthday is in/converted to the right format for DAYOFYEAR

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




RE: [PHP-DB] Birthdays!

2002-10-14 Thread John W. Holmes

There has to be a better way than this, but this is what I came up with
before dinner...

$dayofyear = date(z);
$daysinyear = (date(L))?366:365;

$numover = ($dayofyear + 14) - $daysinyear

if($numover  0)
{ 
$sql = DAYOFYEAR(dob)  $numover AND ; 
$twoweeks = $daysinyear;
}
else
{ $twoweeks = $dayofyear + 14; }

$sql .= DAYOFYEAR(dob) BETWEEN $dayofyear AND $twoweeks;

$result = mysql_query(SELECT * FROM yourtable WHERE $sql);

---John Holmes...

 -Original Message-
 From: Steve Vernon [mailto:[EMAIL PROTECTED]]
 Sent: Monday, October 14, 2002 4:20 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Birthdays!
 
 Hiya,
 Just wondering what is the best way to do this please.
 
 I have various birthdays stored as dates including birth years.
 
 Just wondering is there a function, or an easy way to work out the
 birthdays in the next two weeks say. Just be nice on my website to
remind
 me of birthdays.Suppose its simple to work out manually, but then have
to
 mess around with days a month etc.
 
 Thanks,
 
 Steve
 XX



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




[PHP-DB] MIME encoding and simplified chinese....help!

2002-10-14 Thread Nigel Dunn

I have a PHP MIME class that works supurblymy big question is...

Is there a way to convert the subject line to simplified chinese. The 
body of the email is fine but I havent been able to get the subject line 
to display chinese.

Any hints, tips or advice would be great.

Regards,
Nigel Dunn


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




Re: [PHP-DB] Birthdays!

2002-10-14 Thread Michael Mauch

John W. Holmes [EMAIL PROTECTED] wrote:
 There has to be a better way than this, but this is what I came up with
 before dinner...
 
 $dayofyear = date(z);
 $daysinyear = (date(L))?366:365;
 
 $numover = ($dayofyear + 14) - $daysinyear
 
 if($numover  0)
 { 
$sql = DAYOFYEAR(dob)  $numover AND ; 
$twoweeks = $daysinyear;
 }
 else
 { $twoweeks = $dayofyear + 14; }
 
 $sql .= DAYOFYEAR(dob) BETWEEN $dayofyear AND $twoweeks;
 
 $result = mysql_query(SELECT * FROM yourtable WHERE $sql);

I think the DAYOFYEAR approach has a little problem with leap years
(when the current year is a not leap year and the birthday year was a
leap year or vice versa).

See:

mysql select dayofyear('2002-10-15');
+-+
| dayofyear('2002-10-15') |
+-+
| 288 |
+-+
1 row in set (0.00 sec)


mysql select dayofyear('1976-10-15');
+-+
| dayofyear('1976-10-15') |
+-+
| 289 |
+-+
1 row in set (0.00 sec)

And another problem:

# php -r 'echo date(z),\n;'
287

So I'd replace the year of the birthdays with the current year
and then see which birthdays fit:

select * from yourtable 
where 
  concat(year(curdate()),'-',month(dob),'-',dayofmonth(dob))
  between curdate() and adddate(curdate(),interval 14 day);

But obviously, this has a little problem around New Year's Eve. E.g. if
somebody's birthday is on January, 3rd, the SQL expression above will
only see that on January, 1st. On December 31st, it will use the current
year for the birthday's year, and then the between-expression won't
match. So just use another expression with year(curdate())+1:

select * from yourtable
where 
  concat(year(curdate()),'-',month(dob),'-',dayofmonth(dob))
  between curdate() and adddate(curdate(),interval 14 day)
or
  concat(year(curdate())+1,'-',month(dob),'-',dayofmonth(dob))
  between curdate() and adddate(curdate(),interval 14 day);

Maybe there's still something missing, but I'd try that.

Regards...
Michael

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




[PHP-DB] Preserving the string

2002-10-14 Thread Michael Conway

I have a problem using barcodes.  They are variable in length (up to 13
integers).  I had to add them to the tables a strings (varchar(13)) to
preserve the leading zeros that are not uncommon.  The problem comes
with inserting these barcodes into other tables (passing them using
href).  When using a shopping cart application and inserting the barcode
from the product table into the items table (to store the user's
shopping cart contents), the leading zeros are lost.  Needless to say
that using the original tables with the true barcodes to verify the
contents of the user's cart for purchases and pricing subsequently
fails.  Is there a way to ensure the string is preserved in its entirety
when added to a new table using scripts?  

 

Michael Conway

[EMAIL PROTECTED]

(703) 968-8875

 




[PHP-DB] Re: MIME encoding and simplified chinese....help!

2002-10-14 Thread Manuel Lemos

Hello,

On 10/14/2002 09:34 PM, Nigel Dunn wrote:
 I have a PHP MIME class that works supurblymy big question is...
 
 Is there a way to convert the subject line to simplified chinese. The 
 body of the email is fine but I havent been able to get the subject line 
 to display chinese.

I don't know what class are you using, but if it is this class, all you 
need to do is to specify the chinese encoding that you want to use in 
the optional charset argument of the SetHeader function.


-- 

Regards,
Manuel Lemos


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




[PHP-DB] Re: MIME encoding and simplified chinese....help!

2002-10-14 Thread Manuel Lemos

Hello,

 On 10/14/2002 09:34 PM, Nigel Dunn wrote:
 
 I have a PHP MIME class that works supurblymy big question is...

 Is there a way to convert the subject line to simplified chinese. The 
 body of the email is fine but I havent been able to get the subject 
 line to display chinese.
 
 
 I don't know what class are you using, but if it is this class, all you 
 need to do is to specify the chinese encoding that you want to use in 
 the optional charset argument of the SetHeader function.

I meant this class:

http://www.phpclasses.org/mimemessage

-- 

Regards,
Manuel Lemos


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




[PHP-DB] Obsession for Oil

2002-10-14 Thread CK Raju

Reports of US annexing Iraq  appears to be highly disturbing. The oil 
reserves of Iraq appear to be the prime motive behind the US  ambition of 
ruling that country (without realising that even those reserves  are 
limited).  Perhaps it would be more good if US could concentrate on research 
to have hydrogen as fuel substitute instead of indulging in another 
arms-flexing exercise. The world is aware on who are the biggest consumers of 
oil and who contributes more to the global warming (considering the fact that 
even completely burnt hydrocarbons would produce carbon-dioxide). The world 
is also aware about the capability of  the promoters of 'free markets' to 
influence US Government and international organisations to get results in 
their favour.  These vocalists  of free markets have acquired immense 
capability to remain calm, even if  humanity is threatened, to such an extent 
that it can be compared to  any rogue organisation. The world is also aware 
on who contributed to the  loss of 5% of the ozone layer, creating a hole 
(that is gradually drifting  to the nearest pole as a result of the 
centrifugal action caused by the  rotation of the earth). The world is also 
aware about who is testing  armaments (on live targets under the name of  
carpet bombing) to flush out  mines. US should now sit and learn why some  
organisations attacked ruthless 'trading centres' and brainless 'arms 
headquarters' and what should  be done to avoid such reprisals in future.  
Perhaps this would give it enough courage to live in dignity and to let 
others live too.

CK Raju

PS : Sorry to post it here, but unilateral actions such as these have a high 
say in our career and would definitely make a change in the way we live and 
think now.

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




RE: [PHP-DB] Obsession for Oil

2002-10-14 Thread Gavin Nouwens

CK,

This isn't really the forum for this is it?

| -Original Message-
| From: CK Raju [mailto:[EMAIL PROTECTED]]
| Sent: Tuesday, 15 October 2002 2:30 PM
| To: [EMAIL PROTECTED]
| Subject: [PHP-DB] Obsession for Oil
|
|
| Reports of US annexing Iraq  appears to be highly disturbing. The oil
| reserves of Iraq appear to be the prime motive behind the US  ambition of
| ruling that country (without realising that even those reserves  are
| limited).  Perhaps it would be more good if US could concentrate
| on research
| to have hydrogen as fuel substitute instead of indulging in another
| arms-flexing exercise. The world is aware on who are the biggest
| consumers of
| oil and who contributes more to the global warming (considering
| the fact that
| even completely burnt hydrocarbons would produce carbon-dioxide).
| The world
| is also aware about the capability of  the promoters of 'free markets' to
| influence US Government and international organisations to get results in
| their favour.  These vocalists  of free markets have acquired immense
| capability to remain calm, even if  humanity is threatened, to
| such an extent
| that it can be compared to  any rogue organisation. The world is
| also aware
| on who contributed to the  loss of 5% of the ozone layer, creating a hole
| (that is gradually drifting  to the nearest pole as a result of the
| centrifugal action caused by the  rotation of the earth). The
| world is also
| aware about who is testing  armaments (on live targets under the name of
| carpet bombing) to flush out  mines. US should now sit and learn
| why some
| organisations attacked ruthless 'trading centres' and brainless 'arms
| headquarters' and what should  be done to avoid such reprisals in
| future.
| Perhaps this would give it enough courage to live in dignity and to let
| others live too.
|
| CK Raju
|
| PS : Sorry to post it here, but unilateral actions such as these
| have a high
| say in our career and would definitely make a change in the way
| we live and
| think now.
|
| --
| PHP Database Mailing List (http://www.php.net/)
| To unsubscribe, visit: http://www.php.net/unsub.php
|


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




Re: [PHP-DB] Obsession for Oil

2002-10-14 Thread CK Raju

 This isn't really the forum for this is it?
That was a response in my capacity as a human being, and we have seen similar 
postings last year post WTC incidents. I believe, perhaps very foolishly, 
that pre-emption is better than cure, and that someone influential hooked to 
this list might give a different advice to someone connected with this 
'development'. We are all here in this planet, and we don't receive any 
threats from extra-terrestrial beings. Why then do some of us get prepared to 
act this way ? Let us come out of that scare of talking politics while doing 
serious programming. They are all intertwined in daily life. 

Once again apologies for posting it here with promise of 'no more' (even as 
response).
CK Raju

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