php-general Digest 12 Dec 2004 11:01:50 -0000 Issue 3165

2004-12-12 Thread php-general-digest-help

php-general Digest 12 Dec 2004 11:01:50 - Issue 3165

Topics (messages 204074 through 204092):

FTP_PUT 0kb problem
204074 by: jpb
204076 by: Marek Kilimajer

php variables in a backtick command
204075 by: Jonathan Duncan
204077 by: Jonathan Duncan
204079 by: Sebastian
204084 by: Rory Browne
204087 by: Jonathan Duncan
204088 by: Jonathan Duncan

Re: Data Access Object (DAO) with PHP
204078 by: Manuel Lemos

Re: PHP via DIAL-UP?
204080 by: Rory Browne

Forms Question: Options
204081 by: Steve Marquez
204082 by: Matthew Weier O'Phinney

Re: Joining same table twice
204083 by: Marek Kilimajer

Re: MySQL Connection problem
204085 by: Peter Lauri

dynamic include() in while loop
204086 by: Sebastian

Re: Sorry forgot to include the code for my last message - Mike Francis
204089 by: David Robley

Header location open into a new window?
204090 by: Justin Wilkins

Re: Question: Repopulating form parameters
204091 by: Stuart Felenstein
204092 by: Jason Wong

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--
---BeginMessage---

I am using the FTP_PUT command in conjunction with a form:

form action=upload.php method=post enctype=multipart/form-data
input type=file name=imagefile
input type=submit value=Submit

upload.php:
Everything seems to work except the put statement.
$upload = ftp_put($conn_id, $destination_file, $_POST[imagefile],
FTP_BINARY);

I am connecting to the server and it is replacing the old image file with a
0 kb file.

Permissions are RWX across the board. Any ideas?

Thanks - Jeff
---End Message---
---BeginMessage---
jpb wrote:
I am using the FTP_PUT command in conjunction with a form:
form action=upload.php method=post enctype=multipart/form-data
input type=file name=imagefile
input type=submit value=Submit
upload.php:
Everything seems to work except the put statement.
$upload = ftp_put($conn_id, $destination_file, $_POST[imagefile],
FTP_BINARY);
I am connecting to the server and it is replacing the old image file with a
0 kb file.
Permissions are RWX across the board. Any ideas?
Read http://www.php.net/manual/en/features.file-upload.php
information about uploaded file(s) is in $_FILES array and 
$_FILES['imagefile'] is an array
---End Message---
---BeginMessage---
I am trying to run a shell command with backticks.  However, I get a parse 
error.  Is it because I have an array variable in there?

$result = `adduser -l=$dist_id -p=$user['password'] --f=$user['name_first'] 
$user['name_last']`;

Do I need to assign the value to a regular variable before I put it in 
there?  Like this?

$pword=$user['password']
$fname =$user['name_first']
$lname =$user['name_last']
$result = `adduser -l=$dist_id -p=$pword --f=$fname $lname`;

Thanks,
Jonathan 
---End Message---
---BeginMessage---
So I tried it that way and it worked, that is annoying though, having to add 
extra lines to the code and assign the contents of one variable to another. 
Any way around this?

Jonathan


Jonathan Duncan [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
I am trying to run a shell command with backticks.  However, I get a parse 
error.  Is it because I have an array variable in there?

 $result = 
 `adduser -l=$dist_id -p=$user['password'] --f=$user['name_first'] 
 $user['name_last']`;

 Do I need to assign the value to a regular variable before I put it in 
 there?  Like this?

 $pword=$user['password']
 $fname =$user['name_first']
 $lname =$user['name_last']
 $result = `adduser -l=$dist_id -p=$pword --f=$fname $lname`;

 Thanks,
 Jonathan 
---End Message---
---BeginMessage---
well $user['password'] has no double quotes around it.

- Original Message - 
From: Jonathan Duncan [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, December 11, 2004 8:09 PM
Subject: [PHP] php variables in a backtick command


 I am trying to run a shell command with backticks.  However, I get a parse
 error.  Is it because I have an array variable in there?

 $result =
`adduser -l=$dist_id -p=$user['password'] --f=$user['name_first']
 $user['name_last']`;

 Do I need to assign the value to a regular variable before I put it in
 there?  Like this?

 $pword=$user['password']
 $fname =$user['name_first']
 $lname =$user['name_last']
 $result = `adduser -l=$dist_id -p=$pword --f=$fname $lname`;

 Thanks,
 Jonathan

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



---End Message---
---BeginMessage---
I'm not sure about variable expansion with backticks(I don't use
backticks, if necessary I use shell_exec() instead). I'm just after
installing a fresh SuSE 9.1, and php is giving me a segfault at the

php-general Digest 12 Dec 2004 23:04:24 -0000 Issue 3166

2004-12-12 Thread php-general-digest-help

php-general Digest 12 Dec 2004 23:04:24 - Issue 3166

Topics (messages 204093 through 204121):

Re: Question: Repopulating form parameters
204093 by: Stuart Felenstein
204094 by: Jason Wong
204095 by: Stuart Felenstein
204096 by: Jason Wong
204104 by: Stuart Felenstein

Infinity and nested categories
204097 by: Bruno B B Magalhães

sharing info between websites with XML?
204098 by: p80
204103 by: Jason Wong
204105 by: p80
204112 by: Jason Wong
204113 by: p80
204115 by: p80

Re: Sorry forgot to include the code for my last message - Mike Francis
204099 by: Mike Francis
204102 by: Jason Wong

LDAP and referrals
204100 by: List User

empty() problem
204101 by: Ahmed Abdel-Aliem
204106 by: Matt Palermo
204107 by: Sebastian
204108 by: John Holmes
204111 by: Craig Slusher
204121 by: adwin wijaya

Command Line
204109 by: Travis Conway
204114 by: - Edwin -
204116 by: Travis Conway

Re: dynamic include() in while loop
204110 by: Sebastian

Re: Close all open tags in HTML text
204117 by: Daniel Schierbeck

Re: Configuring PHP 5.0.2 on OpenBSD 3.6: png.h not found
204118 by: Raymond C. Rodgers

PHP's PS(*) function
204119 by: Colin

Re: Data Access Object (DAO) with PHP
204120 by: adwin wijaya

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--
---BeginMessage---

--- Jason Wong [EMAIL PROTECTED] wrote:

 On Sunday 12 December 2004 18:15, Stuart Felenstein
 wrote:
 
  Still stuck on this one.  I know I'm doing
 something
  wrong and wouldn't mind some correction:
 
 Did you mockup some test HTML in a wysisyg editor as
 suggested?

Yep like this :

select name=select size=10 multiple
option value=1 ?php if (!(strcmp(1,
None))) {echo SELECTED;} ?Black/option
option selected value=2 ?php if
(!(strcmp(2, None))) {echo SELECTED;}
?Blue/option
option value=3 ?php if (!(strcmp(3,
None))) {echo SELECTED;} ?Red/option
option value=4 ?php if (!(strcmp(4,
None))) {echo SELECTED;} ?Orange/option
option value=5 ?php if (!(strcmp(5,
None))) {echo SELECTED;} ?Purple/option
option selected value=6 ?php if
(!(strcmp(6, None))) {echo SELECTED;}
?Brown/option
  /select

Problem is arrays are hanging me up.

 Did you compare the mockup HTML with that produced
 by your code above?

//mockup 
option value=?php echo
$row_rsInd['CareerIDs']??php if
(!(strcmp($row_rsInd['CareerIDs'], 2))) {echo
SELECTED;} ??php echo
$row_rsInd['CareerCategories']?/option


//Attempt, problems with parsing errors:

select name=Ind[] size=8 multiple=multiple
id=Ind[] 
?php
while($row = mysql_fetch_array($inds, MYSQL_BOTH)) {
echo 'option value='.$row['CareerIDs'].'';
if (!(strcmp($row_rsInd['CareerIDs'], '$Ind')));
{echo SELECTED;}
.$row['CareerCategories'].'/option';
}


Close but no cigar.  Since $Ind is already imploded my
thinking is it need not be incremented in the echo
statement ?

Stuart
---End Message---
---BeginMessage---
On Sunday 12 December 2004 19:32, Stuart Felenstein wrote:

  Did you mockup some test HTML in a wysisyg editor as
  suggested?

 Yep like this :

 select name=select size=10 multiple
 option value=1 ?php if (!(strcmp(1,
 None))) {echo SELECTED;} ?Black/option

Um, your HTML wysiwyg editor can insert PHP code for you? The object of the 
exercise is to see what properly constructed HTML for displaying multiselect 
dropdown boxes with pre-selected values look like so you can try and 
reproduce it using PHP. If the above code does that then fine (I don't care 
to check).

 //Attempt, problems with parsing errors:

 select name=Ind[] size=8 multiple=multiple
 id=Ind[] 
 ?php
 while($row = mysql_fetch_array($inds, MYSQL_BOTH)) {
 echo 'option value='.$row['CareerIDs'].'';
 if (!(strcmp($row_rsInd['CareerIDs'], '$Ind')));

Why do you always get your IF clauses wrong (look at back at your previous 
posts). There should not be a semi-colon there. Read manual  Language 
Reference (thoroughly, until you can recite it back to front (or 
alternatively learn to refer to it when you get syntax (parsing) errors 
instead of asking the list)).

 Close but no cigar.  Since $Ind is already imploded my
 thinking is it need not be incremented in the echo
 statement ?

You tell me, print_r() and var_dump() it before you use it and decide whether 
it is correct.

One final thing: '$Ind' is not the same as $Ind.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives 

Re: [PHP] Question: Repopulating form parameters

2004-12-12 Thread Jason Wong
On Sunday 12 December 2004 18:15, Stuart Felenstein wrote:

 Still stuck on this one.  I know I'm doing something
 wrong and wouldn't mind some correction:

Did you mockup some test HTML in a wysisyg editor as suggested?

 Code now:

 if (count($Ind)  0 AND is_array($Ind)) {
 $Ind = '.implode(',', $Ind).';

 select name=Ind[] size=8 multiple=multiple
 id=Ind[] 
 ?php
 $selected = $_GET['Ind'];
 while($row = mysql_fetch_array($inds, MYSQL_BOTH)) {
 if ($selected==$row['CareerIDs']) echo ' selected';
 echo 'option
 value='.$row['CareerIDs'].''.$row['CareerCategories'].'/option';

}
 ?

Did you compare the mockup HTML with that produced by your code above?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Polymer physicists are into chains.
Ö
*/

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



Re: [PHP] Question: Repopulating form parameters

2004-12-12 Thread Stuart Felenstein

--- Jason Wong [EMAIL PROTECTED] wrote:

  Close but no cigar.  Since $Ind is already
 imploded my
  thinking is it need not be incremented in the echo
  statement ?
 
 You tell me, print_r() and var_dump() it before you
 use it and decide whether 
 it is correct.
 
 One final thing: '$Ind' is not the same as $Ind.
 


If I choose 1, 2 , 3 then

print_r($Ind); returns
'1','2','3'
This looks okay.

I'm passed the parsing errors. Semi colon was me
trying to stop parsing errors.  

?php
while($row = mysql_fetch_array($inds, MYSQL_BOTH)) {
echo 'option value='.$row['CareerIDs'].'';
if (!(strcmp($row_rsInd['CareerIDs'], $Ind)))
{echo SELECTED;}
echo $row['CareerCategories'].'/option';

I could not find a difference with '$Ind', or $Ind,
except I would think '$Ind' is correct, since  
would be a literal string.

Any more hints ? :)

Stuart

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



Re: [PHP] Question: Repopulating form parameters

2004-12-12 Thread Stuart Felenstein

--- Jason Wong [EMAIL PROTECTED] wrote:

  I'm pretty sure I need to loop through the $_Get
 of
  the array.   Not sure , and haven't found anything
  that shows this.
 
 Yes, you need to reference $_GET to see whether an
 option was selected and 
 change the echo above accordingly.
 

Still stuck on this one.  I know I'm doing something
wrong and wouldn't mind some correction:

Code now:

if (count($Ind)  0 AND is_array($Ind)) {
$Ind = '.implode(',', $Ind).';

select name=Ind[] size=8 multiple=multiple
id=Ind[] 
?php
$selected = $_GET['Ind'];
while($row = mysql_fetch_array($inds, MYSQL_BOTH)) {
if ($selected==$row['CareerIDs']) echo ' selected';
echo 'option
value='.$row['CareerIDs'].''.$row['CareerCategories'].'/option';

}
?

Stuart

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



Re: [PHP] Question: Repopulating form parameters

2004-12-12 Thread Stuart Felenstein

--- Jason Wong [EMAIL PROTECTED] wrote:

 On Sunday 12 December 2004 18:15, Stuart Felenstein
 wrote:
 
  Still stuck on this one.  I know I'm doing
 something
  wrong and wouldn't mind some correction:
 
 Did you mockup some test HTML in a wysisyg editor as
 suggested?

Yep like this :

select name=select size=10 multiple
option value=1 ?php if (!(strcmp(1,
None))) {echo SELECTED;} ?Black/option
option selected value=2 ?php if
(!(strcmp(2, None))) {echo SELECTED;}
?Blue/option
option value=3 ?php if (!(strcmp(3,
None))) {echo SELECTED;} ?Red/option
option value=4 ?php if (!(strcmp(4,
None))) {echo SELECTED;} ?Orange/option
option value=5 ?php if (!(strcmp(5,
None))) {echo SELECTED;} ?Purple/option
option selected value=6 ?php if
(!(strcmp(6, None))) {echo SELECTED;}
?Brown/option
  /select

Problem is arrays are hanging me up.

 Did you compare the mockup HTML with that produced
 by your code above?

//mockup 
option value=?php echo
$row_rsInd['CareerIDs']??php if
(!(strcmp($row_rsInd['CareerIDs'], 2))) {echo
SELECTED;} ??php echo
$row_rsInd['CareerCategories']?/option


//Attempt, problems with parsing errors:

select name=Ind[] size=8 multiple=multiple
id=Ind[] 
?php
while($row = mysql_fetch_array($inds, MYSQL_BOTH)) {
echo 'option value='.$row['CareerIDs'].'';
if (!(strcmp($row_rsInd['CareerIDs'], '$Ind')));
{echo SELECTED;}
.$row['CareerCategories'].'/option';
}


Close but no cigar.  Since $Ind is already imploded my
thinking is it need not be incremented in the echo
statement ?

Stuart

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



Re: [PHP] Question: Repopulating form parameters

2004-12-12 Thread Jason Wong
On Sunday 12 December 2004 20:18, Stuart Felenstein wrote:

 If I choose 1, 2 , 3 then

 print_r($Ind); returns
 '1','2','3'
 This looks okay.

You *should* know what it should look like so I'll take your word for it.

 I could not find a difference with '$Ind', or $Ind,
 except I would think '$Ind' is correct, since  
 would be a literal string.

Don't think, (to be more accurate, do *think*, but don't *speculate*).

If in doubt, print it out (TM)

  echo '$Indbr', $Indbr, $Ind;

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Murphy's Law is recursive.  Washing your car to make it rain doesn't work.
*/

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



[PHP] Infinity and nested categories

2004-12-12 Thread Bruno B B Magalhães
Hi again everybody,
well, I've asked it before, but I couldn't work on this at all.
As some knows I have a system witch has a category system. The generic  
part of the site is handled by a generic module called contents...  
generic like products, services, company, etc. Where the content layout  
and structure is quite the same.

Well suppose that I have this:
http://www.the_company.com/site/products/product_one/requirements/ 
requirements.html

Where:
site/	 the controller
products/  - alias module for content module
product_one/   - top category
requirements/- nested category
-- as many nested categories as needed
requirements.html - article is called searching using it without  
the .html, witch is used to know that it is an article and not a  
category. ('WHERE article_path='requirements' AND category_id='022')

My problem is that how can I handle those categories! and  
build a three of it.

I am using PHP5 and MySQL 4.1
Regards,
Bruno B B Magalhaes
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] sharing info between websites with XML?

2004-12-12 Thread p80
I have several website that use mysql as a database and I would like them to 
access each other DB. The problem is that I can't connect to each other mysql 
DB so I'm looking for a way to do so. I'm thinking of droping the mysql 
database in xml files that could be parse using php xml parser but I'm not 
sure if this is the best way to do it (sharing db's content). If it's the 
best way to do it tips would be welcome :) and if it's not the best way to do 
it could u please tell me what's the right way?

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



Re: [PHP] Re: Sorry forgot to include the code for my last message - Mike Francis

2004-12-12 Thread Mike Francis
Hi David,
Thanks for your help. I've taken out the @ character, and added the
error-trapping code to my file.

The results:
When I run the file, nothing untoward is reported, and I end up with a blank
screen in IE / Moxilla Firebird / Opera. There are no errors reported.
In the Apache error log, there are no error or movement messages reported
for this operation.
In the Apache Access Log the following is reported:
127.0.0.1 - - [12/Dec/2004:13:23:19 +] GET / HTTP/1.1 200 1494
127.0.0.1 - - [12/Dec/2004:13:23:20 +] GET /apache_pb.gif HTTP/1.1
304 -
127.0.0.1 - - [12/Dec/2004:13:23:32 +] GET /mysqlconnectcomplete.php
HTTP/1.1 200 -
I have the usual permissions on the database server which is accessible via
the command prompt with no problem.
I have the MyODBC driver installed and configured just in case PHP is
looking for it for some strange reason.
I've pasted the code below this message:

Used Code:-
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
html xmlns=http://www.w3.org/1999/xhtml;
head
titleOur List of Jokes/title
meta http-equiv=content-type
content=text/html; charset=iso-8859-1 /
/head
body
?php
// Connect to the database server
$dbcnx = mysql_connect('localhost', 'root', 'MyPassWord');
if (!$dbcnx) {
echo 'pUnable to connect to the ' .
'database server at this time./p' );
echo mysql_error();
exit();
}
// Select the jokes database
if ([EMAIL PROTECTED]('ijdb')) {
 echo mysql_error();
exit('pUnable to locate the joke ' .
'database at this time./p');
}
?
pHere are all the jokes in our database:/p
blockquote
?php
// Request the text of all the jokes
$result = mysql_query('SELECT joketext FROM joke');
if (!$result) {
exit('pError performing query: ' . mysql_error() . '/p');
}
// Display the text of each joke in a paragraph
while ($row = mysql_fetch_array($result)) {
echo 'p' . $row['joketext'] . '/p';
}
?
/blockquote
/body
/html

- Original Message - 
From: David Robley [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, December 12, 2004 5:25 AM
Subject: [PHP] Re: Sorry forgot to include the code for my last message -
Mike Francis


 On Sun, 12 Dec 2004 07:03, Mike Francis wrote:

  !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
  http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
  html xmlns=http://www.w3.org/1999/xhtml;
  head
  titleOur List of Jokes/title
  meta http-equiv=content-type
  content=text/html; charset=iso-8859-1 /
  /head
  body
  ?php
  // Connect to the database server
  $dbcnx = @mysql_connect('localhost', 'root', 'MyPassword');
  if (!$dbcnx) {
  echo 'pUnable to connect to the ' .
  'database server at this time./p' );

 Note that using the @ in front of the connect suppresses any error
messsages
 that may be returned from the connect; I would get rid of that. Then add
 here:

 echo mysql_error();
  exit();
  }
  // Select the jokes database
  if ([EMAIL PROTECTED]('ijdb')) {

 And use mysql_error() here too.
  exit('pUnable to locate the joke ' .
  'database at this time./p');
  }
  ?

 mysql_error() will return a useful error message.

 -- 
 David Robley

 Backups? We doan *NEED* no steenking baX%^~,VbKx NO CARRIER

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


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



[PHP] empty() problem

2004-12-12 Thread Ahmed Abdel-Aliem
Hi Group Members
i have a problem with function empty() 
i use it to check if user entered the form fields and store it in array

for example : 

if (empty($Game_rating))
$errors[] = You didn't enter the Online Status for the Game.;

the problem when the user enters 0 in the form field
the empty function returns the error.

can i  use another function that doesn't return false when the 0 is passes ?

any help plz ?

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



Re: [PHP] Re: Sorry forgot to include the code for my last message - Mike Francis

2004-12-12 Thread Jason Wong
On Sunday 12 December 2004 21:40, Mike Francis wrote:

Please do not top post.

 Hi David,
 Thanks for your help. I've taken out the @ character, and added the
 error-trapping code to my file.

 The results:
 When I run the file, nothing untoward is reported, and I end up with a
 blank screen in IE / Moxilla Firebird / Opera. There are no errors
 reported. In the Apache error log, there are no error or movement messages
 reported for this operation.
 In the Apache Access Log the following is reported:

You should be looking in the PHP error log, the location of which is defined 
in php.ini.

Alternatively put the following at the beginning of all your development code:

error_reporting(E_ALL);
ini_set('display_errors', TRUE);

That will display errors as they occur (as well as log them to file if php.ini 
was configured to do so).

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
To one large turkey add one gallon of vermouth and a demijohn of Angostura
bitters.  Shake.
  -- F. Scott Fitzgerald, recipe for turkey cocktail.
*/

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



Re: [PHP] sharing info between websites with XML?

2004-12-12 Thread Jason Wong
On Sunday 12 December 2004 21:35, p80 wrote:
 I have several website that use mysql as a database and I would like them
 to access each other DB. The problem is that I can't connect to each other
 mysql DB so I'm looking for a way to do so. I'm thinking of droping the
 mysql database in xml files that could be parse using php xml parser but
 I'm not sure if this is the best way to do it (sharing db's content). If
 it's the best way to do it tips would be welcome :) and if it's not the
 best way to do it could u please tell me what's the right way?

You're asking a very general question here. How you would approach this 
depends very much on what exactly it is that you're wanting to do. Perhaps if 
you could be more specific -- eg do you want to only make available specific 
pre-defined bits of data to client websites, does the client website have any 
need to change the data, does the data have to be encrypted whilst in 
transit, are all the websites under your control (more specifically can they 
be trusted), etc. 

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
A possum must be himself, and being himself he is honest.
  -- Walt Kelly
*/

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



Re: [PHP] empty() problem

2004-12-12 Thread Sebastian
trim it then use an operator..eg

if(trim($Game_rating) == '')
{
  // error ..
}

- Original Message - 
From: Ahmed Abdel-Aliem [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, December 12, 2004 8:58 AM
Subject: [PHP] empty() problem


 Hi Group Members
 i have a problem with function empty()
 i use it to check if user entered the form fields and store it in array

 for example :

 if (empty($Game_rating))
 $errors[] = You didn't enter the Online Status for the Game.;

 the problem when the user enters 0 in the form field
 the empty function returns the error.

 can i  use another function that doesn't return false when the 0 is passes
?

 any help plz ?

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




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



[PHP] Re: empty() problem

2004-12-12 Thread Matt Palermo
How about:

if($Game_Rating == )
$errors[] = You didn't enter the Online Status for the Game.;

This should work for you.

-Matt


Ahmed Abdel-Aliem [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hi Group Members
 i have a problem with function empty()
 i use it to check if user entered the form fields and store it in array

 for example :

 if (empty($Game_rating))
 $errors[] = You didn't enter the Online Status for the Game.;

 the problem when the user enters 0 in the form field
 the empty function returns the error.

 can i  use another function that doesn't return false when the 0 is passes 
 ?

 any help plz ? 

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



Re: [PHP] empty() problem

2004-12-12 Thread John Holmes
Ahmed Abdel-Aliem wrote:
Hi Group Members
i have a problem with function empty() 
i use it to check if user entered the form fields and store it in array

for example : 

if (empty($Game_rating))
$errors[] = You didn't enter the Online Status for the Game.;
the problem when the user enters 0 in the form field
the empty function returns the error.
Is $Game_rating supposed to be an integer? If so, then make it one and 
check for = to zero.

if(!isset($_Game_rating) || (int)$Game_rating = 0)
{ $errors[] = You didn't enter the Online Status for the Game.; }
Now you _know_ $Game_rating is an integer above zero and is safe to 
display and/or put into a query.

Simply checking for
if($Game_rating == '')
will throw notices on some setups about an undefined variable (depending 
upon error_reporting level) and will allow text through when it's 
supposed to just be an integer.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] dynamic include() in while loop

2004-12-12 Thread Sebastian
disregard this topic.. i slept on it and found out how to do it.

- Original Message - 
From: Sebastian [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, December 11, 2004 11:06 PM
Subject: [PHP] dynamic include() in while loop


 this is a brain buster, at least for me.
 i have a while loop (results from mysql) which display news articles. i
want
 to include() a file if there hasn't been a news article posted today
 meaning after midnight 12am to 12pm midnight... but if there are articles
 the articles would be echo'd before the include and the rest of the
articles
 below the include..

 eg,

 Article (today)
 Article (today)
 include();
 More articles (not today)

 .. but if there are no Articles posted today it would show up as:

 include();
 Article
 Article

 i want to know if this is possible, if so, can anyone give me an example?
 the articles are dated in unix timestamp.
 cheers

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




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



Re: [PHP] empty() problem

2004-12-12 Thread Craig Slusher
I use this function which I find is very useful:

function isEmpty(  $var )
{
return isset($var)  strlen(trim($var)) == 0;
}


On Sun, 12 Dec 2004 10:12:34 -0500, John Holmes
[EMAIL PROTECTED] wrote:
 Ahmed Abdel-Aliem wrote:
 
 
  Hi Group Members
  i have a problem with function empty()
  i use it to check if user entered the form fields and store it in array
 
  for example :
 
  if (empty($Game_rating))
$errors[] = You didn't enter the Online Status for the Game.;
 
  the problem when the user enters 0 in the form field
  the empty function returns the error.
 
 Is $Game_rating supposed to be an integer? If so, then make it one and
 check for = to zero.
 
 if(!isset($_Game_rating) || (int)$Game_rating = 0)
 { $errors[] = You didn't enter the Online Status for the Game.; }
 
 Now you _know_ $Game_rating is an integer above zero and is safe to
 display and/or put into a query.
 
 Simply checking for
 
 if($Game_rating == '')
 
 will throw notices on some setups about an undefined variable (depending
 upon error_reporting level) and will allow text through when it's
 supposed to just be an integer.
 
 --
 
 ---John Holmes...
 
 Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
 
 php|architect: The Magazine for PHP Professionals  www.phparch.com
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
Craig Slusher
Web Programmer
[EMAIL PROTECTED]

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



Re: [PHP] sharing info between websites with XML?

2004-12-12 Thread Jason Wong
On Sunday 12 December 2004 22:33, p80 wrote:

  eg do you want to only make available
  specific pre-defined bits of data to client websites,

 yes this is how I'd like to proceed

OK, if there are only a limited number of these pre-defined bits of data 
then the easiest way is probably just output it as plain text (you don't say 
what kind of data you're sharing) in an easy to parse format (CSV, XML, 
whatever you're comfortable with).

 I'm not sure about this yet. I know XML is pretty unsecure when it's not
 encrypted as it's only text. does php provide functions to ecrypt XML while
 on transit or should I use other technics than XML?

If your webserver is SSL enabled you could just make the data available only 
via login on SSL. It's relatively easy to setup the clients to login 
automatically. PHP supports encryption if you install the necessary libraries 
and configure PHP accordingly (manual  Mcrypt Encryption Functions). However 
the client has to be configured similarly so that it can decode the stuff.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
GOOD-NIGHT, everybody ... Now I have to go administer FIRST-AID to my
pet LEISURE SUIT!!
*/

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



Re: [PHP] Command Line

2004-12-12 Thread - Edwin -
Hi,

On Sun, 12 Dec 2004 09:15:46 -0600
Travis Conway [EMAIL PROTECTED] wrote:

 How do you reference command line arguments in php?
 
 i.e., chkmd5.php file.md5
 
 I am wanting to reference file.md5. Since the output of md5sum is
 not in the RFC I am having to manually parse each md5 and detect
 whether it is in Win32, Linux, or BSD format.

I'm not sure what you meant by that (since an md5 checksum is an md5
checksum) but...

 And since php has good built in md5() support it helps out.

I think you're looking for argv:

http://www.php.net/manual/en/reserved.variables.php#reserved.variables.server

PS
Btw, it's php-geNeral and not php-geMeral ;)

-- 
- E - on SUSE 9.1 | blackbox 0.65 | copperwalls was here ;)
  Your eyes saw even the embryo of me, and in your book   
all its parts were down in writing. - Psalm 139:16 

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



Re: [PHP] sharing info between websites with XML?

2004-12-12 Thread p80
On Sunday 12 December 2004 05:15 pm, Jason Wong wrote:
 On Sunday 12 December 2004 22:33, p80 wrote:
   eg do you want to only make available
   specific pre-defined bits of data to client websites,
 
  yes this is how I'd like to proceed

 OK, if there are only a limited number of these pre-defined bits of data
 then the easiest way is probably just output it as plain text (you don't
 say what kind of data you're sharing) in an easy to parse format (CSV, XML,
 whatever you're comfortable with).
and in case i need it what if it's not pre-defined bits of data, how shoud 
it be handle?

thanx in advance

PAt

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



Re: [PHP] Command Line

2004-12-12 Thread Travis Conway
- Original Message - 
From: - Edwin - [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: Travis Conway [EMAIL PROTECTED]
Sent: Sunday, December 12, 2004 10:40 AM
Subject: Re: [PHP] Command Line


Hi,
On Sun, 12 Dec 2004 09:15:46 -0600
Travis Conway [EMAIL PROTECTED] wrote:
How do you reference command line arguments in php?
i.e., chkmd5.php file.md5
I am wanting to reference file.md5. Since the output of md5sum is
not in the RFC I am having to manually parse each md5 and detect
whether it is in Win32, Linux, or BSD format.
I'm not sure what you meant by that (since an md5 checksum is an md5
checksum) but...
What I mean is that a Win32 md5sum outputs like
hash *file
Linux:
file:hash
-or
hash:file
and BSD:
(file) hash
So if I run md5sum -c file.md5 and it was created on another platform, 
md5sum will not check md5.  The hash will be the same but not the file 
output format.  That is all.

And since php has good built in md5() support it helps out.
I think you're looking for argv:
http://www.php.net/manual/en/reserved.variables.php#reserved.variables.server
PS
Btw, it's php-geNeral and not php-geMeral ;)
It is much easier to just ask you guys though.
Trav 

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


Re: [PHP] Close all open tags in HTML text

2004-12-12 Thread Daniel Schierbeck
Matt Palermo wrote:
I realize that I can use the strip_tags function to remove HTML.  But I 
don't want to remove HTML tags.  I just want to make sure all open HTML tags 
are closed.  For example if they user submits HTML with a table tag and 
never closes it, then the rest of the page will look screwed up.  I still 
want to allow them to use HTML, but I want to close tags that were left open 
by them.  This way it allows them to use HTML and it won't screw up the rest 
of the page.

Thanks,
Matt

Richard Lynch [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

Matt Palermo wrote:
I would like to leave any HTML in there,
Do you *TRUST* the people typing the HTML to not attack your server, or
others, with cross-site scripting attacks?
If not, go re-read the manual about strip_tags, and pay particular
attention to the second, optional, argument.

but just make sure that ending
tags exist, so it doesn't screw up the rest of the page.  Strip tags 
would
just wipe out the HTML rather than allowing it and ending it safely.
Strip tags will allow you to wipe out *DANGEROUS* HTML which will make
your web server a source of problems not only to you, but to me as well.
Please use strip_tags to allow only the tags you *NEED* the users to be
able to use.
It will only take you seconds, and it will save you (and us) a lot of
grief in the long run.
--
Like Music?
http://l-i-e.com/artists.htm 
You still need to control it. This would certainly fuck up your page:
div style=position: absolute; width: 100%; height: 100%; top: 0; left: 
0; right: 0; bottom: 0; background-color: red;/div

--
Daniel Schierbeck
Help spread Firefox (www.getfirefox.com): 
http://www.spreadfirefox.com/?q=user/registerr=6584

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


[PHP] PHP's PS(*) function

2004-12-12 Thread Colin
Hi,

Can someone tell me how to create my own PS() in the source code

eg, i want to make PS(sidd) in the session.c but it complains when I compile

thanks

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



Re: [PHP] Re: Data Access Object (DAO) with PHP

2004-12-12 Thread adwin wijaya
Thank you for DAO class that you recommended to me.
I would like to read the Pear and Metalstorage documentation ( tried 
it) first before deciding which one I would like to use ;)

--
===
Best Regards
Adwin Wijaya
www.kuya-kuya.net
www.e-rhema.net
===
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: Re: [PHP] sharing info between websites with XML?

2004-12-12 Thread John Holmes
 From: p80 [EMAIL PROTECTED]
 
  I have several website that use mysql as a database and I would like them
 to access each other DB. The problem is that I can't connect to each other
 mysql
  DB so I'm looking for a way to do so.
 
 Why aren't you able to connect to the other databases?
 cause hosters forbid it.

Then get another host or somewhere else to host your databases. Not a PHP 
issue, though. 

---John Holmes...

UCCASS - PHP Survey System
http://www.bigredspark.com/survey.html

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



Re: [PHP] empty() problem

2004-12-12 Thread adwin wijaya
Ahmed Abdel-Aliem wrote:
Hi Group Members
i have a problem with function empty() 
i use it to check if user entered the form fields and store it in array

for example : 

if (empty($Game_rating))
$errors[] = You didn't enter the Online Status for the Game.;
the problem when the user enters 0 in the form field
the empty function returns the error.
can i  use another function that doesn't return false when the 0 is passes ?
any help plz ?

try to use isset() instead of empty.
empty() will be true if:
1. it contains 0
2. it is empty
3. or it contains white space.
but, for example if $x = '   ' ; .. isset() will return true instead of 
false. So try to trim($x) before doing isset.

cmmiw
--
===
Best Regards
Adwin Wijaya
www.kuya-kuya.net
www.e-rhema.net
===
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Classes and Functions

2004-12-12 Thread Rory Browne
your question is hard to answer. The difference between classes and
functions is like the difference between a toolbox, and a spanner. A
class is a container, that contains functions, and variables, or as
they are called in Object-Oriented-Speak(methods, and properties).

A method is a function that exists in a class, although in php they
are still declared as functions.

function do_something(){
  echo Im doing something this is a function;
}

class class_thing{
  function method_of_thing(){
 echo I am a method(function) that exists inside of class class_thing;
  } 
}


Hope this helps, but from what I'm reading, you really need to learn
some basics before you even think about classes. Worry about functions
for now. Read the PHP manual(you don't get better docs, than the php
ones). It explains things like that in a easy to use manner.

I also don't know of a better programming tutorial than the PHP manual.

Good luck
Rory


On Sat, 11 Dec 2004 10:23:12 -0800, Robby Russell [EMAIL PROTECTED] wrote:
 On Sat, 2004-12-11 at 13:03 -0500, R. Van Tassel wrote:
 
 
  Can someone give me a distinction between the two and when to use / not use
  them?
 
 
 
  I want to thank everyone who replied about myFor loop question. All the
  answers were VERY helpful! Thanks very much.
 
 You might want to pick up a book on programming to read up on this.
 
 In a nutshell, a function should do something specific. It's good to use
 functions when you do the same thing in different places in your code so
 that you don't need to copy/paste your code over and over.
 
 function foo()
 {
 $x = 1;
 $y = 2;
 return $x + $y;
 }
 
 $bar = foo();
 
 print $bar;
 -
 OUTPUT:
 3
 
 A class/object is a collection of functions and variables that are
 contained within their own scope. (vague description)
 
 class foobar
 {
   var $x = 10;
 
   var $y = NULL;
 
   function foobar($y)
   {
  $this-y = $y;
   }
 
   function add()
   {
 return $this-x + $this-y;
   }
 
   function subtract()
   {
 return $this-x - $this-y;
   }
 
 }
 
 $object = new foobar(4);
 
 print $object-add() . \n;
 print $object-subtract() . \n;
 
 # set y to a new number
 $object-y = 2;
 
 print $object-add() . \n;
 print $object-subtract() . \n;
 
 
 OUTPUT:
  14
  6
  12
  8
 
 As it sounds like you're still new to this, I would pick up a book or
 read some material online that will better show you when to use either
 and play around with them both.
 
 Have fun
 
 -Robby
 
 --
 /***
 * Robby Russell | Owner.Developer.Geek
 * PLANET ARGON  | www.planetargon.com
 * Portland, OR  | [EMAIL PROTECTED]
 * 503.351.4730  | blog.planetargon.com
 * PHP/PostgreSQL Hosting  Development
 *--- Now supporting PHP5 ---
 /
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



[PHP] PHP Apache Upload file Permission denied

2004-12-12 Thread Michael Leung
Hi all,
   I have faced the upload file permission denied for weeks. I can't
write a new file/create a directory. I did a test in PHP standalone
(Linux shell).  The operation is very normal.
But in web environment, I got this error message:

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to
move '/tmp/phpjsLZfC' to '/var/www/htm/test/icons.zip' in
/var/www/html/simple_upload.php on line 76.

I think this is a problem bewteen Apache and PHP. The safe mode of PHP
is off and test directory is changed to 777.

yours,
Michael

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



Re: [PHP] PHP Apache Upload file Permission denied

2004-12-12 Thread Andre Dubuc
Dear Michael,

I spent the better part of today trying to get a file upload script to work 
too. Same sort of problem: local linux works ok, but web - nope.

Looking at your error message, it might be the renaming of the temp file that 
is barfing.

if (($_FILES[pix][size]  0)($_FILES[pix][size]  75000)){

if ($_FILES[pix][type] == image/jpeg)
{
$pix_file = $_FILES[pix][name];
$pix_temp_file = $_FILES[pix][tmp_name];

$new_pix_file = -5.jpg;

if(is_uploaded_file($pix_temp_file)){
move_uploaded_file($pix_temp_file, pix/$new_pix_file);
}
}
}
else {

print brbrbrbrbigbPicture Upload 
Errorb/bigbrbrh5Filesize is greater than maximum 75k!brbr 
Please resize your picture to below 75k, and try again!/h5br;
}

This works for me -- might want to modify it and see if it clicks on yours. My 
pix directory is 777, uploaded files go in as apache:apache 755. (also, if 
you try to upload greater than limit set in apache, nothing will show up in 
'/var/www/htm/test/icons.zip'.
  ^

Btw, is that a typo: 'htm' or did you want 'html'??

Hth,
Andre

On Sunday 12 December 2004 07:46 pm, Michael Leung wrote:
 Hi all,
I have faced the upload file permission denied for weeks. I can't
 write a new file/create a directory. I did a test in PHP standalone
 (Linux shell).  The operation is very normal.
 But in web environment, I got this error message:

 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to
 move '/tmp/phpjsLZfC' to '/var/www/htm/test/icons.zip' in
 /var/www/html/simple_upload.php on line 76.

 I think this is a problem bewteen Apache and PHP. The safe mode of PHP
 is off and test directory is changed to 777.

 yours,
 Michael

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



Re: [PHP] PHP Apache Upload file Permission denied

2004-12-12 Thread Michael Leung
Hi Andre,
  thank you, I have hided my html path in the message. I have replace 
my real path with '/var/www/html/'.  the error message should be like
this.
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to
  move '/tmp/phpjsLZfC' to '/var/www/html/test/icons.zip' in
  /var/www/html/simple_upload.php on line 76.
Pervious error message , I have some typing mistakes in there.

Yes, this kind of script is working in my pervious old server. But
after I have upgraded the OS to Fedora 3 with PHP 5.0.2 and Apache 2.
The script does not work any more. I am thinking may be I need to
modify some configure in Apache 2 to allow the upload file function.

yours,
Michael

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



[PHP] Automaticly Play Sound when MySql Reach some Number

2004-12-12 Thread Sejati Opreker
How do I make automaticly PHP playing a sound (Ogg, or
MP3 format file) when MySql (in Table, or Coulom)
reach a number (for example 5)


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: [PHP] Question: Repopulating form parameters

2004-12-12 Thread David Robley
On Mon, 13 Dec 2004 00:56, Stuart Felenstein wrote:

 
 --- Jason Wong [EMAIL PROTECTED] wrote:
 
 
 If in doubt, print it out (TM)
 
   echo '$Indbr', $Indbr, $Ind;
 
 $Ind
 '1','2','3','4'
 '1','2','3','4'
 
 Funny, they are both the same.

I think you are missing the point Jason was trying to make, which is the
difference between '$Ind' and $Ind. If you look again, you will see that
those are handled differently.

http://www.php.net/manual/en/language.types.string.php will tell you more
about the difference in handling of single quoted and double quoted
strings.

-- 
David Robley

This isn't right. This isn't even wrong.

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



[PHP] Re: Infinity and nested categories

2004-12-12 Thread David Robley
On Sun, 12 Dec 2004 23:50, Bruno b b magalhães wrote:

 Hi again everybody,
 
 well, I've asked it before, but I couldn't work on this at all.
 
 As some knows I have a system witch has a category system. The generic
 part of the site is handled by a generic module called contents...
 generic like products, services, company, etc. Where the content layout
 and structure is quite the same.
 
 Well suppose that I have this:
 http://www.the_company.com/site/products/product_one/requirements/
 requirements.html
 
 Where:
 site/  the controller
 products/  - alias module for content module
 product_one/   - top category
 requirements/- nested category
  -- as many nested categories as needed
 requirements.html - article is called searching using it without
 the .html, witch is used to know that it is an article and not a
 category. ('WHERE article_path='requirements' AND category_id='022')
 
 My problem is that how can I handle those categories! and
 build a three of it.
 
 I am using PHP5 and MySQL 4.1

You may find this article on storing hierarchical data useful.

http://www.sitepoint.com/print/hierarchical-data-database

-- 
David Robley

On the other hand, you also have 5 fingers.

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



Re: [PHP] PHP Apache Upload file Permission denied

2004-12-12 Thread Travis Conway
Ha!
Sorry for that Fedora 3 is causing all kinds of havoc. I would stay away 
for a while.

Trav
- Original Message - 
From: Michael Leung [EMAIL PROTECTED]
To: Andre Dubuc [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Sunday, December 12, 2004 7:25 PM
Subject: Re: [PHP] PHP Apache Upload file Permission denied


Hi Andre,
 thank you, I have hided my html path in the message. I have replace
my real path with '/var/www/html/'.  the error message should be like
this.
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to
 move '/tmp/phpjsLZfC' to '/var/www/html/test/icons.zip' in
 /var/www/html/simple_upload.php on line 76.
Pervious error message , I have some typing mistakes in there.
Yes, this kind of script is working in my pervious old server. But
after I have upgraded the OS to Fedora 3 with PHP 5.0.2 and Apache 2.
The script does not work any more. I am thinking may be I need to
modify some configure in Apache 2 to allow the upload file function.
yours,
Michael
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php 
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP Apache Upload file Permission denied

2004-12-12 Thread Michael Leung
Hi all,
  I am more believing this is a kind of apache configure problem. If
that's Fedora 3 problem, I can't do this kind in command line.
Therefore, if I bypassed Apache, my problem is solved. Moreover, my
system is highly OOP , I can't fall back into PHP 4.


yours,
Michael

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



Re: [PHP] PHP Apache Upload file Permission denied

2004-12-12 Thread Raditha Dissanayake

Yes, this kind of script is working in my pervious old server. But
after I have upgraded the OS to Fedora 3 with PHP 5.0.2 and Apache 2.
 

Then as I mentioned in my previous mail SELinux is to blame. Uninstall 
it or disable it. (pass selinux=0 when you boot).

 


--
Raditha Dissanayake.
--
http://www.radinks.com/print/card-designer/ | Card Designer Applet
http://www.radinks.com/upload/  | Drag and Drop Upload 

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


Re: [PHP] PHP Apache Upload file Permission denied

2004-12-12 Thread Travis Conway
What user did you run your command line as?
Trav
- Original Message - 
From: Michael Leung [EMAIL PROTECTED]
To: Travis Conway [EMAIL PROTECTED]
Cc: Andre Dubuc [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Sunday, December 12, 2004 8:01 PM
Subject: Re: [PHP] PHP Apache Upload file Permission denied


Hi all,
 I am more believing this is a kind of apache configure problem. If
that's Fedora 3 problem, I can't do this kind in command line.
Therefore, if I bypassed Apache, my problem is solved. Moreover, my
system is highly OOP , I can't fall back into PHP 4.
yours,
Michael
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] still have the same problem

2004-12-12 Thread Mecnun
I have a form and a php file. I enter some values from the form and click to 
submit button. The values that I enter can't be seen on the output. I'm using 
Php php-4.0.5 and my register_global is set to Off.
 
HTML file:
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
html
head
title9.2/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
/head
body
form action=listing9.3.php method=POST
Name: br
input type = text name=user
br
Address:br
textarea name=address rows=5 cols=40/textarea
br
input type=submit value=Send  
/form
/body
/html
 
PHP File:
 
?php
print Welcome b $_POST[user] /b P\n\n;
print Your address is:P\n\n b $_POST[address] /b;
?
 
 
 
 
The output dont show the user value or address value. 
 
Thanks,

Selim


-
Do you Yahoo!?
 Send holiday email and support a worthy cause. Do good.

[PHP] LDAP and referrals

2004-12-12 Thread List User
Hello!

Currently I'm playing with LDAP referrals in a PHP application and
I've reached a point, where it's not clear if there's some kind of
misunderstanding on my side, or if there's a problem either in the
PHP functions or the OpenLDAP server here...

The attached mini script tries to access the local LDAP and searches
for objects containing the uid attribute. The LDAP tree contains two
referrals which point to an external server which definitively has additional
objects containing uid attributes. The plan is to get all objects that contain
the uid attribute - from all trees.

I'm trying to make use of the rebind feature. Since there's no propper
documentation on how to use this function, I've been trying several
methods till this moment (anonymous bind for testing), the external
servers get connected, but the search query doesn't seem to show
any ambitions to get executed.

Do I need to do everything manualy (get_first_reference, etc.) or am I
just blind? Any hints would be greately appreciated :-)

Component information:
PHP: 4.3.9 (Debian sarge)
OpenLDAP: 2.1.30 (Debian sarge)

I'm not sure if this should go to php-db instead - if so, sorry :-)

Greetings,
Cajus


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

Re: [PHP] Question: Repopulating form parameters

2004-12-12 Thread Stuart Felenstein

--- Jason Wong [EMAIL PROTECTED] wrote:

 
 If in doubt, print it out (TM)
 
   echo '$Indbr', $Indbr, $Ind;
 
$Ind
'1','2','3','4'
'1','2','3','4'

Funny, they are both the same.

Stuart

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


Re: [PHP] sharing info between websites with XML?

2004-12-12 Thread p80
On Sunday 12 December 2004 03:16 pm, Jason Wong wrote:
 On Sunday 12 December 2004 21:35, p80 wrote:
  I have several website that use mysql as a database and I would like them
  to access each other DB. The problem is that I can't connect to each
  other mysql DB so I'm looking for a way to do so. I'm thinking of droping
  the mysql database in xml files that could be parse using php xml parser
  but I'm not sure if this is the best way to do it (sharing db's content).
  If it's the best way to do it tips would be welcome :) and if it's not
  the best way to do it could u please tell me what's the right way?

 eg do you want to only make available
 specific pre-defined bits of data to client websites,
yes this is how I'd like to proceed
 does the client 
 website have any need to change the data
no it doesn't need to change it, only access it.

 does the data have to be 
 encrypted whilst in transit
I'm not sure about this yet. I know XML is pretty unsecure when it's not 
encrypted as it's only text. does php provide functions to ecrypt XML while 
on transit or should I use other technics than XML?

 are all the websites under your control (more 
 specifically can they be trusted), etc.
yes they can be trusted as they are partenairs but they are not all under my 
control

thanx in advance

Pat

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


[PHP] Command Line

2004-12-12 Thread Travis Conway
How do you reference command line arguments in php?
i.e., chkmd5.php file.md5
I am wanting to reference file.md5. Since the output of md5sum is not in the 
RFC I am having to manually parse each md5 and detect whether it is in 
Win32, Linux, or BSD format.  And since php has good built in md5() support 
it helps out.

Travis 

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


Re: [PHP] sharing info between websites with XML?

2004-12-12 Thread p80
 I have several website that use mysql as a database and I would like them
to access each other DB. The problem is that I can't connect to each other
mysql
 DB so I'm looking for a way to do so.

Why aren't you able to connect to the other databases?
cause hosters forbid it.

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


Re: [PHP] Configuring PHP 5.0.2 on OpenBSD 3.6: png.h not found

2004-12-12 Thread Raymond C. Rodgers
On Fri, 2004-12-10 at 13:23, Richard Lynch wrote:
 Where exactly is png.h in your directory system?
 If libpng is installed, it should be there.
 
 What are you using after the --with-png-dir=
 Whatever you are using, it must be a directory far enough *above* png.h to
 encompass not only '/include/*/png.h' but also '/lib/*/*png*.so/
 Many beginners mistakenly pass in the directory that contains 'png.h' --
 Alas, PHP *also* needs to find all the png library binary files (.so) in
 order to pull them in.
 So starting at png.h, work your way 'up' until you hit a directory that
 also has *png*.so down inside it somewhere (perhaps one or two levels
 deep) and pass *that* directory with --with-png-dir=

The problem was solved by making symlinks from the actual location of
the png headers (/usr/local/include/libpng) to a slightly higher
location (/usr/local/include). Previously attempting to point
--with-png-dir= to either /usr/local/ didn't work. I found the tip
about making symlinks to correct this issue by sheer luck.

Raymond

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


Re: [PHP] PHP Apache Upload file Permission denied

2004-12-12 Thread Raditha Dissanayake
Michael Leung wrote:
Hi all,
  I have faced the upload file permission denied for weeks. I can't
write a new file/create a directory. I did a test in PHP standalone
(Linux shell).  The operation is very normal.
But in web environment, I got this error message:
 

Something that just occurred to me?
do you have SELinux installed?
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to
move '/tmp/phpjsLZfC' to '/var/www/htm/test/icons.zip' in
/var/www/html/simple_upload.php on line 76.
I think this is a problem bewteen Apache and PHP. The safe mode of PHP
is off and test directory is changed to 777.
yours,
Michael
 


--
Raditha Dissanayake.
--
http://www.radinks.com/print/card-designer/ | Card Designer Applet
http://www.radinks.com/upload/  | Drag and Drop Upload 

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


: [PHP] empty() problem

2004-12-12 Thread yangshiqi
Maybe this can help you.

If (empty((string)$Game_rating))


--
: Ahmed Abdel-Aliem [mailto:[EMAIL PROTECTED] 
: 20041212 21:58
: [EMAIL PROTECTED]
: [PHP] empty() problem

Hi Group Members
i have a problem with function empty() 
i use it to check if user entered the form fields and store it in array

for example : 

if (empty($Game_rating))
$errors[] = You didn't enter the Online Status for the Game.;

the problem when the user enters 0 in the form field
the empty function returns the error.

can i  use another function that doesn't return false when the 0 is passes ?

any help plz ?

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

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


Re: [PHP] LDAP and referrals

2004-12-12 Thread List User
Whoops.  For some reason I've attached the wrong file. Here's the correct one.

Cajus
#!/usr/bin/php4 -q
?php

# T E S T - V A R I A B L E S ##
$server= localhost;
$filter= (uid=*);
$base  = dc=example,dc=net;


 F U N C T I O N S #
function get_additional_error($res)
{
$error= ;
ldap_get_option ($res, LDAP_OPT_ERROR_STRING, $error);
return ($error);
}

function get_error($res)
{
$error= ldap_error($res);
if ($error == 'Success'){
return success;
} else {
$adderror= get_additional_error($res);
if ($adderror != ){
$error= $error. (.get_additional_error($res).);
}
return $error;
}
}


function rebind($ldap, $referral)
{
$server= preg_replace('!^(ldap://[^/]+)/.*$!', '\\1', $referral);
if (!($ds= ldap_connect($server))){
echo reconnect failed - ;
return ($ldap);
}
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ds, LDAP_OPT_REFERRALS, 1);
ldap_set_rebind_proc($lds, rebind);
if (!ldap_bind($ds)){
echo rebind failed - ;
return ($ldap);
}
echo rebind to $server - ;
return ($ds);
}



# M A I N  #

echo Opening connection to $server - ;
$ds= @ldap_connect($server);

if ($ds) {
echo success\n;

echo Setting up link parameters - ;
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ds, LDAP_OPT_REFERRALS, 1);
echo get_error($ds).\n;

echo Setting rebind proc - ;
ldap_set_rebind_proc($ds, rebind);
echo get_error($ds).\n;

echo Binding - ;
if (!($r= @ldap_bind($ds))){
echo get_error($ds).\n\n;
exit (2);
}
echo success\n;
} else {
echo get_error($ds).\n\n;
exit (1);
}

echo Performing search with base '$base' and filter '$filter'\n;
echo * starting search - ;
$sr=   @ldap_search($ds, $base, $filter, array('uid', 'cn'), 0, 0, 0, 
LDAP_DEREF_ALWAYS);
echo get_error($ds).\n;
if (!$sr){
exit (3);
}

$info= ldap_get_entries($ds, $sr);
echo * getting entries - ;
echo get_error($ds).\n;
if (!$info){
exit (4);
}
for ($n= 0; $n=$info['count']; $n++){
if (!isset($info[$n]['uid'][0])){
continue;
}
echo   .$info[$n]['dn'].\n;
}


echo Closing connection...\n;
ldap_close($ds);
?

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