php-general Digest 12 Dec 2004 23:04:24 -0000 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]


----------------------------------------------------------------------
--- Begin Message ---
--- 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 ---
--- Begin Message ---
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 before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Any stone in your boot always migrates against the pressure gradient to
exactly the point of most pressure.
es a  -- Milt Barber
*/

--- End Message ---
--- Begin Message ---
--- 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

--- End Message ---
--- Begin Message ---
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 '$Ind<br>', "$Ind<br>", $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.
*/

--- End Message ---
--- Begin Message ---
--- Jason Wong <[EMAIL PROTECTED]> wrote:

> 
> If in doubt, print it out (TM)
> 
>   echo '$Ind<br>', "$Ind<br>", $Ind;
> 
$Ind
'1','2','3','4'
'1','2','3','4'

Funny, they are both the same.

Stuart

--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
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?

--- End Message ---
--- Begin Message ---
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
*/

--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
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!!
*/

--- End Message ---
--- Begin Message ---
>> 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.

--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
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 +0000] "GET / HTTP/1.1" 200 1494
127.0.0.1 - - [12/Dec/2004:13:23:20 +0000] "GET /apache_pb.gif HTTP/1.1"
304 -
127.0.0.1 - - [12/Dec/2004:13:23:32 +0000] "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>
<title>Our 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 '<p>Unable 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('<p>Unable to locate the joke ' .
'database at this time.</p>');
}
?>
<p>Here 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('<p>Error 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>
> > <title>Our 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 '<p>Unable 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('<p>Unable 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
>

--- End Message ---
--- Begin Message ---
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.
*/

--- End Message ---
--- Begin Message ---
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

Attachment: search-test.php
Description: application/php


--- End Message ---
--- Begin Message ---
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 ?

--- End Message ---
--- Begin Message ---
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 ? 

--- End Message ---
--- Begin Message ---
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
>
>
>

--- End Message ---
--- Begin Message --- 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
--- End Message ---
--- Begin Message ---
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]

--- End Message ---
--- Begin Message --- 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
=======================

--- End Message ---
--- Begin Message ---
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
--- End Message ---
--- Begin Message ---
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 

--- End Message ---
--- Begin Message --- ----- 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
--- End Message ---
--- Begin Message ---
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
>
>
>

--- End Message ---
--- Begin Message --- 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/register&r=6584
--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message --- 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
=======================

--- End Message ---

Reply via email to