php-general Digest 31 Mar 2003 07:40:57 -0000 Issue 1970

Topics (messages 141647 through 141680):

issue with connecting to DB
        141647 by: Jennifer Fountain
        141663 by: Joel Colombo

Re: accessing result-set with associative array
        141648 by: Leif K-Brooks

Re: Ereg question
        141649 by: John W. Holmes
        141650 by: Beauford
        141651 by: Beauford
        141652 by: Beauford
        141668 by: John W. Holmes
        141672 by: Jason Wong
        141674 by: Beauford
        141677 by: Jason Wong
        141678 by: Beauford
        141679 by: Peter Houchin

Re: Problems with post data
        141653 by: Frank
        141657 by: Haseeb Iqbal
        141660 by: Chris Shiflett
        141667 by: John W. Holmes

Test tables existance
        141654 by: Antti
        141656 by: Miles Thompson
        141658 by: Haseeb Iqbal
        141659 by: Don Read

PHP, ASP, IIS and MySQL
        141655 by: Jesper Blomström
        141666 by: John W. Holmes

Re: Sessions and iframes (or frames)?
        141661 by: Justin French

Parsing XML CDATA errors?
        141662 by: Toby Coleridge

Parsing CSS files
        141664 by: Liam Gibbs
        141665 by: John W. Holmes
        141669 by: Sebastian

GNU & Open Source
        141670 by: John Taylor-Johnston
        141671 by: Rasmus Lerdorf
        141673 by: Manuel Lemos

what could be wrong
        141675 by: Haseeb Iqbal
        141676 by: Haseeb Iqbal

Re: require/include from a different directory
        141680 by: Tim Burden

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 ---
Here is the code:
 
<?php
    $link = mysql_connect("xxx", "xxxxx", "xxxxx")
        or die("Could not connect: " . mysql_error());
    print ("Connected successfully");
    mysql_close($link);
?>
 
 
WhenI try to connect, I get the following error:
 
Warning: mysql_connect() [function.mysql-connect]: Access denied for user: '[EMAIL PROTECTED]' (Using password: YES) in /xxx/xxxx/xxxxx/xxxx/testdb.php on line 2
Could not connect: Access denied for user: [EMAIL PROTECTED]' (Using password: YES)
 
I know the userid and password work because I can connect to the db via phpmyadmin, etc.
version
mysql 3.23.52
php 3
 
 
I have google searched and archived searched but I cannot find anything on this error.  We recently changed the password.
 
Does anyone have any idea what is happening?
 
Thanks
 
 

--- End Message ---
--- Begin Message ---
did u change the password with 'phpmyadmin' ?
u did ? ok then restart mysql !!!!
the passwords load when mysql starts up... at least when u change it via 'phpmyadmin'
havent played much with command line password mods... may not need the restart.
i just pounded my head with the prob last week... running redhat with mysql PHP combo.
all worked after i restarted the mysql service from command line.

Joel Colombo


  "Jennifer Fountain" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
  Here is the code:

  <?php
      $link = mysql_connect("xxx", "xxxxx", "xxxxx")
          or die("Could not connect: " . mysql_error());
      print ("Connected successfully");
      mysql_close($link);
  ?>


  WhenI try to connect, I get the following error:

  Warning: mysql_connect() [function.mysql-connect]: Access denied for user: '[EMAIL 
PROTECTED]' (Using password: YES) in /xxx/xxxx/xxxxx/xxxx/testdb.php on line 2
  Could not connect: Access denied for user: [EMAIL PROTECTED]' (Using password: YES)

  I know the userid and password work because I can connect to the db via phpmyadmin, 
etc.
  version
  mysql 3.23.52
  php 3


  I have google searched and archived searched but I cannot find anything on this 
error.  We recently changed the password. 

  Does anyone have any idea what is happening?

  Thanks


--- End Message ---
--- Begin Message --- It doesn't include the table name. Use name, albumid, etc.

anders thoresson wrote:

Hi,

I've the query "SELECT albums.name, albums.albumid, accessrights.albumid, accessrights.userid FROM albums, accessrights WHERE accessrights.userid = '$id' AND albums.albumid = accessrights.albumid".

It works allright. Using the result in a html <SELECT>-tag this way works:

    while($row = mysql_fetch_array($result))     {
        echo("<OPTION VALUE=\"$row[1]\"> $row[0]");
    }

But if I tries the following line, the script fails:

echo("<OPTION VALUE=\"$row['albums.albumid']\"> $row['albums.name']");

with the notice: Undefined index: 'albums.albumid' in <b>c:\web\thoresson.net\include\user_functions.php</b> on line <b>24</b>

I've been trying to learn PHP for three months now, but tonight was the first time I sat down with my project for two week, so I'm sorry if I'm bothering you with something obvious that I've just forgotten. :)

But I need to know: What am I doing wrong?

Best regards.


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




--- End Message ---
--- Begin Message ---
> I am using ereg to validate the format of a date entry (mm/dd/yy), but
if
> the year ends in a 0, it is being stripped and as such produces an
error.
> So
> 1990 would be 199.  The dob is being inputted by a form....
> 
> Here is my code:
> 
> if (!ereg("^([0-9]{2})/([0-9]{2})/([0-9]{4})$", $formsave["dob"],
$parts))
> {
>  $error["dob"] = "*"; $message["dob"] = "Invalid date format!";
>  $dob = " \"$parts[3]-$parts[2]-$parts[1]\"";
> }

So is $formsave['dob'] being changed before you get to this code,
causing the check to fail? What else are you doing with
$formsave['dob']? Nothing here is going to cause it to drop a zero from
the end. 

Your code doesn't make much sense, though. If the ereg() fails, $parts
is not going to have any value, so why are you referencing $part[1],
$part[2], etc... ?

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



--- End Message ---
--- Begin Message ---
$parts has been removed as I found I didn't need it there, but the problem
still exists. This part of code however may be causing the problem, although
I thought trim only stripped white space.....?.  $formsave['dob']  is a
session variable.  I have also found now that leading 0's are also being
stripped.

foreach($HTTP_POST_VARS as $varname => $value)
      $formsave[$varname] = trim($value, 50);

If it's not there then the whole script fails.

B.

----- Original Message -----
From: "John W. Holmes" <[EMAIL PROTECTED]>
To: "'Beauford'" <[EMAIL PROTECTED]>; "'PHP General'"
<[EMAIL PROTECTED]>
Sent: Sunday, March 30, 2003 2:28 PM
Subject: RE: [PHP] Ereg question


> > I am using ereg to validate the format of a date entry (mm/dd/yy), but
> if
> > the year ends in a 0, it is being stripped and as such produces an
> error.
> > So
> > 1990 would be 199.  The dob is being inputted by a form....
> >
> > Here is my code:
> >
> > if (!ereg("^([0-9]{2})/([0-9]{2})/([0-9]{4})$", $formsave["dob"],
> $parts))
> > {
> >  $error["dob"] = "*"; $message["dob"] = "Invalid date format!";
> >  $dob = " \"$parts[3]-$parts[2]-$parts[1]\"";
> > }
>
> So is $formsave['dob'] being changed before you get to this code,
> causing the check to fail? What else are you doing with
> $formsave['dob']? Nothing here is going to cause it to drop a zero from
> the end.
>
> Your code doesn't make much sense, though. If the ereg() fails, $parts
> is not going to have any value, so why are you referencing $part[1],
> $part[2], etc... ?
>
> ---John W. Holmes...
>
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



--- End Message ---
--- Begin Message ---
This is what I get when I echo $formsave["dob"]  - 9/09/199.  It was
inputted as 09/09/1990.

B.

----- Original Message -----
From: "John W. Holmes" <[EMAIL PROTECTED]>
To: "'Beauford'" <[EMAIL PROTECTED]>; "'PHP General'"
<[EMAIL PROTECTED]>
Sent: Sunday, March 30, 2003 2:28 PM
Subject: RE: [PHP] Ereg question


> > I am using ereg to validate the format of a date entry (mm/dd/yy), but
> if
> > the year ends in a 0, it is being stripped and as such produces an
> error.
> > So
> > 1990 would be 199.  The dob is being inputted by a form....
> >
> > Here is my code:
> >
> > if (!ereg("^([0-9]{2})/([0-9]{2})/([0-9]{4})$", $formsave["dob"],
> $parts))
> > {
> >  $error["dob"] = "*"; $message["dob"] = "Invalid date format!";
> >  $dob = " \"$parts[3]-$parts[2]-$parts[1]\"";
> > }
>
> So is $formsave['dob'] being changed before you get to this code,
> causing the check to fail? What else are you doing with
> $formsave['dob']? Nothing here is going to cause it to drop a zero from
> the end.
>
> Your code doesn't make much sense, though. If the ereg() fails, $parts
> is not going to have any value, so why are you referencing $part[1],
> $part[2], etc... ?
>
> ---John W. Holmes...
>
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



--- End Message ---
--- Begin Message ---
Just some more information. It appears that the session variable
$formsave["dob"] is causing the problem. If I echo the input $_POST['dob']
it shows correctly, but when it's put into $formsave["dob"]  the leading and
ending 0's are being stripped.

B.

----- Original Message -----
From: "John W. Holmes" <[EMAIL PROTECTED]>
To: "'Beauford'" <[EMAIL PROTECTED]>; "'PHP General'"
<[EMAIL PROTECTED]>
Sent: Sunday, March 30, 2003 2:28 PM
Subject: RE: [PHP] Ereg question


> > I am using ereg to validate the format of a date entry (mm/dd/yy), but
> if
> > the year ends in a 0, it is being stripped and as such produces an
> error.
> > So
> > 1990 would be 199.  The dob is being inputted by a form....
> >
> > Here is my code:
> >
> > if (!ereg("^([0-9]{2})/([0-9]{2})/([0-9]{4})$", $formsave["dob"],
> $parts))
> > {
> >  $error["dob"] = "*"; $message["dob"] = "Invalid date format!";
> >  $dob = " \"$parts[3]-$parts[2]-$parts[1]\"";
> > }
>
> So is $formsave['dob'] being changed before you get to this code,
> causing the check to fail? What else are you doing with
> $formsave['dob']? Nothing here is going to cause it to drop a zero from
> the end.
>
> Your code doesn't make much sense, though. If the ereg() fails, $parts
> is not going to have any value, so why are you referencing $part[1],
> $part[2], etc... ?
>
> ---John W. Holmes...
>
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



--- End Message ---
--- Begin Message ---
> I thought trim only stripped white space.....?.  $formsave['dob']  is
a
> session variable.  I have also found now that leading 0's are also
being
> stripped.
> 
> foreach($HTTP_POST_VARS as $varname => $value)
>       $formsave[$varname] = trim($value, 50);
> 
> If it's not there then the whole script fails.

Why do you have the 50 there in the trim() function? That's what's
causing your problems. You're removing all fives and zeros from the
beginning and end of your string, along with any white space. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



--- End Message ---
--- Begin Message ---
On Monday 31 March 2003 04:15, Beauford wrote:
> Just some more information. It appears that the session variable
> $formsave["dob"] is causing the problem. If I echo the input $_POST['dob']
> it shows correctly, but when it's put into $formsave["dob"]  the leading
> and ending 0's are being stripped.

Having read the whole thread it seems that you're only disclosing information 
when it's been totured out of you :)

May I suggest that in order to save yourself and other people's time that you 
give FULL and ACCURATE information. 

For example, at the start of the thread you're pinning the blame on your ereg, 
then you're saying the session variable is the problem. Only after it has 
been pointed out to you that what you say you're doing cannot possibly have 
the effect that you say you're seeing, do you finally disclose that you're 
using trim() on the vital variables.

Put simply, if you had posted your full and unadulterated code right from the 
start then this thread should/would/could have been resolved in about 2 
posts. Saving time and frustration for everyone involved.

-- 
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
------------------------------------------
/*
Bit off more than my mind could chew,
Shower or suicide, what do I do?
                -- Julie Brown, "Will I Make it Through the Eighties?"
*/


--- End Message ---
--- Begin Message ---
I posted the information as I had it. I had no idea what the problem was and
posted the information I thought was FULL and ACCURATE - if this isn't good
enough - then maybe I'll look for another list where people are a little
more forgiving of new users. Remember, you were in my shoes once.

B.

----- Original Message -----
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, March 30, 2003 11:20 PM
Subject: Re: [PHP] Ereg question


> On Monday 31 March 2003 04:15, Beauford wrote:
> > Just some more information. It appears that the session variable
> > $formsave["dob"] is causing the problem. If I echo the input
$_POST['dob']
> > it shows correctly, but when it's put into $formsave["dob"]  the leading
> > and ending 0's are being stripped.
>
> Having read the whole thread it seems that you're only disclosing
information
> when it's been totured out of you :)
>
> May I suggest that in order to save yourself and other people's time that
you
> give FULL and ACCURATE information.
>
> For example, at the start of the thread you're pinning the blame on your
ereg,
> then you're saying the session variable is the problem. Only after it has
> been pointed out to you that what you say you're doing cannot possibly
have
> the effect that you say you're seeing, do you finally disclose that you're
> using trim() on the vital variables.
>
> Put simply, if you had posted your full and unadulterated code right from
the
> start then this thread should/would/could have been resolved in about 2
> posts. Saving time and frustration for everyone involved.
>
> --
> 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
> ------------------------------------------
> /*
> Bit off more than my mind could chew,
> Shower or suicide, what do I do?
> -- Julie Brown, "Will I Make it Through the Eighties?"
> */
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



--- End Message ---
--- Begin Message ---
On Monday 31 March 2003 13:58, Beauford wrote:

> I posted the information as I had it. I had no idea what the problem was
> and posted the information I thought was FULL and ACCURATE - 

Full and accurate if taken literally are absolute terms and are objective not 
subjective.

> if this isn't
> good enough - then maybe I'll look for another list where people are a
> little more forgiving of new users. Remember, you were in my shoes once.

Jeez, my suggestion was to make it easier for others to help you. If you 
insist you can always continue to post your question in installments (don't 
forget a teaser to whet people's appetite for the next episode). And yes, you 
can also look for another list if you want. These are all your choices.

-- 
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
------------------------------------------
/*
Things are not always what they seem.
                -- Phaedrus
*/


--- End Message ---
--- Begin Message ---
This likely won't get through, but if it does. Post a real address so these
conversations don't go through the list. I mean I'm already a burden to the
list as it is.

B.

----- Original Message -----
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 31, 2003 1:36 AM
Subject: Re: [PHP] Ereg question


> On Monday 31 March 2003 13:58, Beauford wrote:
>
> > I posted the information as I had it. I had no idea what the problem was
> > and posted the information I thought was FULL and ACCURATE -
>
> Full and accurate if taken literally are absolute terms and are objective
not
> subjective.
>
> > if this isn't
> > good enough - then maybe I'll look for another list where people are a
> > little more forgiving of new users. Remember, you were in my shoes once.
>
> Jeez, my suggestion was to make it easier for others to help you. If you
> insist you can always continue to post your question in installments
(don't
> forget a teaser to whet people's appetite for the next episode). And yes,
you
> can also look for another list if you want. These are all your choices.
>
> --
> 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
> ------------------------------------------
> /*
> Things are not always what they seem.
> -- Phaedrus
> */
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>




--- End Message ---
--- Begin Message --- Beauford, Jason,

Build a bridge and get over it already sheeesh


TYVMIA Peter



--- End Message ---
--- Begin Message ---
Does this bug also applies to passing variables in an URL.

I'v noticed  that when the directive register_globals is set to off as it is
recommended in the php.ini file no variables are passed on to other pages.
Switching it to on would be the simplest solution, but scripts like
phpMyAdmin do not seem to have these problems.

Any idea or suggestion.

Frank

"John W. Holmes" <[EMAIL PROTECTED]> schreef in bericht
news:[EMAIL PROTECTED]
> I bet the web server that works is not running Apache 2, is it? Either
> way, it's an Apache2 and PHP bug. It's in the bug tracker somewhere...
> Use Apache 1.3.27 or whatever the latest is...
>
> ---John W. Holmes...
>
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
>
> > -----Original Message-----
> > From: Mark Douglas [mailto:[EMAIL PROTECTED]
> > Sent: Saturday, March 29, 2003 7:57 AM
> > To: '[EMAIL PROTECTED]'
> > Subject: [PHP] Problems with post data
> >
> > I'm having problems with my post variables. Here's the page I use to
> > submit
> > data:
> >
> > <FORM ACTION="test2.php" METHOD=POST />
> >     <INPUT TYPE=text SIZE=50 MAXLENGTH=50 NAME="new_area"
> > />&nbsp;&nbsp;<INPUT TYPE=SUBMIT VALUE="Add New Skill Area" /><BR
> /><BR />
> > </FORM>
> >
> > Here's the test2.php page:
> >
> > <?php
> > print_r($_POST);
> > ?>
> >
> > This is all very simple, and works on one of my webservers. However,
> on
> > another webserver with a practically identical configuration, if I
> post
> > "testing" the result that I get is this:
> >
> > Array ( [new_area] => testingnew_area=testing )
> >
> > I've spent hours scouring my two configurations, changing options here
> and
> > there, and have had zero success in making the problem webserver work.
> >
> > The server is a dual processor RedHat 8 system running apache 2.0.43,
> and
> > php 4.3.1. You can see the phpinfo at
> > http://inexorable.sagelikefool.net/phpinfo.htm (yes htm, not php). Any
> and
> > all help is appreciated!
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>



--- End Message ---
--- Begin Message ---
hi,
i have seen some script using a unique method.they grab all the global
variables in a array and then unset the global variables.ofcourse they are
not handling file uploads.i think its a good idea if you are not uploading
files.

any suggestions are welcome

Haseeb

>I'v noticed  that when the directive register_globals is set >to off as it
is
>recommended in the php.ini file no variables are passed >on to other pages.
>Switching it to on would be the simplest solution, but >scripts like
>phpMyAdmin do not seem to have these problems.


--- End Message ---
--- Begin Message ---
Frank,

John's answer applies to Apache 2.44 as well. I'm not sure how you interpreted
his advice against using Apache 2 to mean that an upgrade would solve your
problem. He recommended using the latest Apache 1.3.x.

The likely reason you are having trouble with register_globals is that you need
to reference GET variables as $_GET['blah'] instead of $blah. The archives are
filled with helpful information on this, as this question is asked a few times
a day.

Hope that helps.

Chris

=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/

--- End Message ---
--- Begin Message ---
> Does this bug also applies to passing variables in an URL.
> 
> I'v noticed  that when the directive register_globals is set to off as
it
> is
> recommended in the php.ini file no variables are passed on to other
pages.
> Switching it to on would be the simplest solution, but scripts like
> phpMyAdmin do not seem to have these problems.

The variables are passed, you just have to reference them as
$_GET['variable'] or $_POST['variable'], which is also mentioned many
times in the manual.

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



--- End Message ---
--- Begin Message --- How do I test if a mysql table exists or not? Is there a function for this? I didn't find a good one.

-antti


--- End Message ---
--- Begin Message ---

Come on, check the mysql section of the PHP manual ... this took about 20 sec http://www.php.net/manual/en/function.mysql-list-tables.php

At 11:34 PM 3/30/2003 +0300, Antti wrote:
How do I test if a mysql table exists or not? Is there a function for this? I didn't find a good one.

-antti


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


--- End Message ---
--- Begin Message ---
use mysql_query("show tables"); get them in array and then scan the array

thats what i would do if there isn;t any function


Friendship is always a sweet responsibility, never an opportunity.
HaSeEb IqBaL.
0300-4258030
----- Original Message ----- 
From: "Antti" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 31, 2003 1:34 AM
Subject: [PHP] Test tables existance


> How do I test if a mysql table exists or not? Is there a function for 
> this? I didn't find a good one.
> 
> -antti
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
On 30-Mar-2003 Antti wrote:
> How do I test if a mysql table exists or not? Is there a function for 
> this? I didn't find a good one.
> 
> -antti

function tableexists($tbl) {
    $res = @mysql_query("SELECT 1 FROM $tbl LIMIT 1");
    return ($res ? true : false);
}

Regards,
-- 
Don Read                                       [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

--- End Message ---
--- Begin Message --- Hi!

I hope this is the right place to ask this kind of question, otherwise I apologize.

I would like some advice, this is the situation:

We´re using IIS today and unfortunate we will have to cope with this situation for a long time ahead.
There are plans for using Apache on Linux but not right now (not even Apache on Win).


A great deal of work has been done in coding ASP (towards an Access-DB) :(
Now we´re going to replace Access with either MySQL or possibly PostgreSQL.
Since we in the future would like to run Apache on Linux instead of IIS on Win, it would be great to code all new functions in PHP instead of ASP (and nicer code too).
I have done some experiments with PHP on IIS (towards MySQL) and it all seems to work just fine.


My questions for you:
1) Is there a penelty/drawback when coding PHP instead of ASP on IIS (towards MySQL)?
2) Do you see any problems in having both ASP-code and PHP-code on the same server (it seems to work fine for me)?
3) (on the edge of topic) Do you have any comments or thoughts concerning the choice of DB. MySQL appears to like Win more than Postgres, or?


Many thanks in advance!

Jesper


--- End Message ---
--- Begin Message ---
> My questions for you:
> 1) Is there a penelty/drawback when coding PHP instead of ASP on IIS
> (towards MySQL)?

No, not really. I'm sure ASP has some little tricks built in that you'd
have to recreate in PHP, but the two are basically the same, regardless
of the OS.

> 2) Do you see any problems in having both ASP-code and PHP-code on the
> same server (it seems to work fine for me)?

No.

> 3) (on the edge of topic) Do you have any comments or thoughts
> concerning the choice of DB. MySQL appears to like Win more than
> Postgres, or?

MySQL seems to be more cross platform and more popular, but PG has a
larger feature set. Depends totally upon the complexity of your project
which one you use.

---John Holmes...



--- End Message ---
--- Begin Message ---
My advice is to first get REALLY comfortable with sessions in a non-framed
environment... get a grip on logging in, logging out, showing different code
for logged in members, restricting a user from doing something more than
once, etc etc.

THEN try to get it happening in a framed environment.

As discussed by John, you will have to force a refresh for any frame to be
"aware" of a recently logged in user, and you will have to do a lot of
checking when receiving a form or request in each of these frames, to ensure
there is a user logged in, etc.


As per ANY session stuff between pages, you need to propogate the session id
either through the URL to each frame (or hope that trans-sid takes care of
it), or rely on the user having cookies enabled.

To point out the really obvious, <? session_start(); ?> needs to be called
on the top of the script for EACH FRAME.


Justin


on 31/03/03 5:41 AM, Tiago Simões ([EMAIL PROTECTED]) wrote:

> Hello.
> 
> 
> I built this site using using different iframes: one for a login, other for
> a forum, another for a voting poll, etc...
> 
> I was wondering what is the best way to ensure that you could only post a
> topic in the forum, or vote if you had already logged in.
> 
> I'm somewhat familiar with the $_session global variable, but only if the
> code happens in the same page. How can you check, from another frame, that
> user is logged?
> 
> Thanks in advance...
> Tiago Simões
> 
> 


--- End Message ---
--- Begin Message ---
I am trying to parse an XML file that looks like the following
snippet:

<latest_news>
        <item id="1">
                <date>12/03/03</date>
                <title>New benefits to members</title>
                <description>
                        <![CDATA[hello :)<BR>Hello ]]>
                </description>
        </item>
</latæst_news>

however it will not parse (doesnt display anything) when I put the
CDATA line on the same line as the description and put the close tag
on the same line as well then all works fine, this is ok in this
exmple but it is of little use when the CDATA contains many lines or
is complicated etc is there a way to solve this? I have attaced the
PHP code I am using below but can not see anything wrong with it ??

Many Thanks
Toby.
<?php
if( ! ($fp = fopen( "./news.xml" , "r" )) )
  die("Couldn't open xml file!");
$counter = 0;
$person_data = array();
$xml_current_tag_state = '';

function startElementHandler( $parser, $element_name, $element_attribs ) {
  global $counter;
  global $person_data;
  global $xml_current_tag_state;
  if( $element_name == "ITEM" ) {
    $person_data[$counter]["id"] = $element_attribs["ID"];
  } else {
    $xml_current_tag_state = $element_name;
  }
}

function endElementHandler( $parser, $element_name ) {
  global $counter;
  global $person_data;
  global $xml_current_tag_state;
  $xml_current_tag_state = '';
  
  if( $element_name == "ITEM" ) {
    $counter++;
  }
}

function characterDataHandler( $parser , $data ) {
  global $counter;
  global $person_data;
  global $xml_current_tag_state;
  if( $xml_current_tag_state == '' )
    return;
  if( $xml_current_tag_state == "DATE" ) {
    $person_data[$counter]["date"] = $data;
  }
  if( $xml_current_tag_state == "TITLE" ) {
    $person_data[$counter]["title"] = $data;
  }
  if( $xml_current_tag_state == "DESCRIPTION" ) {
    $person_data[$counter]["description"] = $data;
  }
}
if( !($xml_parser = xml_parser_create()) )
  die("Couldn't create XML parser!");

xml_set_element_handler($xml_parser, "startElementHandler", "endElementHandler");
xml_set_character_data_handler($xml_parser, "characterDataHandler");
while( $data = fread($fp, 4096) )
{
  if( !xml_parse($xml_parser, $data, feof($fp)) )
  {
    break; // get out of while loop if we're done with the file
  }
}
xml_parser_free($xml_parser);
?>

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML>
<HEAD>
  <TITLE>Parsing the Sample XML File</TITLE>
</HEAD>

<BODY BGCOLOR="#ffffff">

<?php
for( $i=0 ; $i < $counter ; ++$i ) {
  echo "Date:&nbsp;&nbsp;" . $person_data[$i]["date"] . "<BR>\n";
  echo "Title:&nbsp;&nbsp;" . $person_data[$i]["title"] . "<BR>\n";
  echo "Description:&nbsp;&nbsp;" . $person_data[$i]["description"] . "<BR>\n";
  echo "<BR>\n";
}

?>

</BODY>
</HTML>

--- End Message ---
--- Begin Message ---
Is there any way of making PHP parse files with a CSS extension?

--- End Message ---
--- Begin Message ---
> Is there any way of making PHP parse files with a CSS extension?

Yeah... the same way you made your web server parse files with a .php
extension. Just repeat the same procedure for a .css extension.

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



--- End Message ---
--- Begin Message ---
if you have cpanel you can add the extension from there.

cheers,
- Sebastian

----- Original Message ----- 
From: "Liam Gibbs" <[EMAIL PROTECTED]>


Is there any way of making PHP parse files with a CSS extension?



--- End Message ---
--- Begin Message ---
Where does PHP.net stand? Is it GNU or OpenSource or both?

What's the difference between www.GNU.org and
www.OpenSource.org?
I have been reading:
http://www.oreilly.com/catalog/opensources/book/intro.html but
don't get what DiBona, Ockman & Stone mean. OpenSource permits
folks like RedHat to distribute a paid CD, GNU doesn't?
OpenSource permits greating a module or plugin to work with a
Microsoft product and GNU doesn't?

J


--- End Message ---
--- Begin Message ---
This is a list for questions about PHP.  Look in the titlebar of your
browser when you go to www.php.net to see what the acronym stands for.
Beyond that, please take this stuff somewhere else.

-Rasmus

On Sun, 30 Mar 2003, John Taylor-Johnston wrote:

> Where does PHP.net stand? Is it GNU or OpenSource or both?
>
> What's the difference between www.GNU.org and
> www.OpenSource.org?
> I have been reading:
> http://www.oreilly.com/catalog/opensources/book/intro.html but
> don't get what DiBona, Ockman & Stone mean. OpenSource permits
> folks like RedHat to distribute a paid CD, GNU doesn't?
> OpenSource permits greating a module or plugin to work with a
> Microsoft product and GNU doesn't?
>
> J
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message --- Hello,

On 03/31/2003 01:05 AM, Rasmus Lerdorf wrote:
This is a list for questions about PHP.  Look in the titlebar of your
browser when you go to www.php.net to see what the acronym stands for.
Beyond that, please take this stuff somewhere else.

He was asking *where* PHP stands (regarding licenses), not *what* PHP stands for. Maybe PHP FAQ should have something about licenses.


--

Regards,
Manuel Lemos


On Sun, 30 Mar 2003, John Taylor-Johnston wrote:


Where does PHP.net stand? Is it GNU or OpenSource or both?

What's the difference between www.GNU.org and
www.OpenSource.org?
I have been reading:
http://www.oreilly.com/catalog/opensources/book/intro.html but
don't get what DiBona, Ockman & Stone mean. OpenSource permits
folks like RedHat to distribute a paid CD, GNU doesn't?
OpenSource permits greating a module or plugin to work with a
Microsoft product and GNU doesn't?


--- End Message ---
--- Begin Message ---
i am doing this
$arr=imap_sort($pIMAP,1,1);
and getting this error
Notice: (null)(): Error in IMAP command received by server. (errflg=2) in
Unknown on line 0

what could be wrong here
regards

Friendship is always a sweet responsibility, never an opportunity.
HaSeEb IqBaL.
0300-4258030

--- End Message ---
--- Begin Message ---
thanx everyone i got it
the problem was i was opening connection with OP_HALFOPEN


Friendship is always a sweet responsibility, never an opportunity.
HaSeEb IqBaL.
0300-4258030



----- Original Message ----- 
From: "Haseeb Iqbal" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 01, 2003 12:09 AM
Subject: [PHP] what could be wrong


> i am doing this
> $arr=imap_sort($pIMAP,1,1);
> and getting this error
> Notice: (null)(): Error in IMAP command received by server. (errflg=2) in
> Unknown on line 0
> 
> what could be wrong here
> regards
> 
> Friendship is always a sweet responsibility, never an opportunity.
> HaSeEb IqBaL.
> 0300-4258030
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
The call to include() must be relative to one of the directories listed in
open_basedir, regardless of which file the call is made from.

Usually the dir mentioned in open_basedir is the docroot, so in  your case
require "include/inc_file.php";

should work from any file, in any folder.

----- Original Message -----
From: "Greg Macek" <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 29, 2003 3:37 PM
Subject: Re: [PHP] require/include from a different directory


> It seems I have found my problem. It has to do with the files I'm trying
> to include. They also include other files and the directories it's
> trying to include files from aren't working. I've found a workaround for
> my situation for the time being. It's not pretty, but functional.
>
> On Sat, 2003-03-29 at 14:19, Greg Macek wrote:
> > Hi,
> >
> > I'm having a problem hopefully can be easily answered. I'm trying to
> > organize parts of my site into different directories so that they're all
> > not in the "main" folder so to speak; basically breaking out by what
> > part of the application it is. I also have an "include" folder for all
> > my main functions and such...
> >
> > /          (main directory)
> > /include   (global functions, includes)
> > /app_sect1
> > /app_sect2
> >
> > what I'm trying to do from /app_sect1 is include a file from the
> > "include" directory, but with little success. The line looks like this:
> >
> > require "../include/inc_file.php";
> >
> > But my page just doesn't work for me now.. any ideas what I'm missing?
> >
> > - Greg
> >
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--- End Message ---

Reply via email to