php-general Digest 1 Dec 2010 01:49:16 -0000 Issue 7063

Topics (messages 309766 through 309781):

Re: EE1 plugin code/htmlentities() question
        309766 by: Richard Quadling
        309769 by: Micky Hulse

Re: Spoofing user_agent
        309767 by: Ron Piggott

Little Assistance...
        309768 by: Don Wieland

PHP shows nothing
        309770 by: Mohammad Taghi Khalifeh
        309771 by: Bob McConnell
        309772 by: Steve Staples
        309773 by: Mohammad Taghi Khalifeh
        309774 by: tedd
        309775 by: Mohammad Taghi Khalifeh
        309776 by: Bob McConnell
        309777 by: Mohammad Taghi Khalifeh
        309778 by: Marc Guay
        309779 by: Mohammad Taghi Khalifeh
        309780 by: Daniel P. Brown

Re: LDAP, Active Directory, and permissions
        309781 by: Tommy Pham

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
On 29 November 2010 19:24, Micky Hulse <mickyhulse.li...@gmail.com> wrote:
> Hello,
>
> I was looking at this ExpressionEngine plugin:
>
> <http://expressionengine.com/downloads/details/xml_encode/>
> Description: This plugin converts reserved XML characters to entities.
>  It is used in the RSS templates.
>
> ... Curious about this code:
>
> trim(str_replace(array('&#47;', '&nbsp;'), array("/", '&#160;'), $str));
>
> The plugin author used the above bit of code in the return statement.
>
> Just curious if their is any particular reason why one would want to
> replace &#47; and &nbsp; with / and &#160 respectively?
>
> For example, I am writing a similar plugin which utilizes
> htmlentities()... I guess I am just wondering if I should apply the
> same code as above to my entity-converted string?
>
> Thoughts?
>
> Thanks!
> Micky

I'm guessing that &nbsp; is only valid in HTML.

Not sure why / would be encoded as it isn't anything too special
outside of the closing tag.


-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

--- End Message ---
--- Begin Message ---
Hi Richard! Thanks for the reply, I really appreciate the help. :)

On Tue, Nov 30, 2010 at 5:49 AM, Richard Quadling <rquadl...@gmail.com> wrote:
> I'm guessing that &nbsp; is only valid in HTML.

 I see.

Ah, it looks like I need to be Googling for "htmlentities and xml".

Thanks for tip!

> Not sure why / would be encoded as it isn't anything too special
> outside of the closing tag.

Hrmm, yah. That must be an EE-specific thing... IIRC, in EE1, the
slashes needed to be converted from entities to a "/" when coming out
of the DB?

Ah, here we go:

[[

The SLASH constant has been removed from the template parser, and
forward slashes are no longer converted to entities.

]]

- 
<http://expressionengine.com/user_guide//development/conversion/syntax.html#general>

Thanks again Richard! Much appreciated!

Cheers,
Micky

--- End Message ---
--- Begin Message ---
The following solution works:

I set my user-agent to:
VerseOfTheDaySitemapRobot/1.0 (http://www.TheVerseOfTheDay.info)

By doing:
ini_set('user_agent', "VerseOfTheDaySitemapRobot/1.0 
(http://www.TheVerseOfTheDay.info)");

When ran by a cron job this causes AWSTATS to treat the hits as:
Unknown robot (identified by 'robot')    9704+18    284.82 MB    30 Nov 2010 - 
07:12

The part which tricked me is that if I run the site map generator PHP script 
using a user interface the hits on the site are credited to the Firefox (the 
browser I use) user-agent string.  The following article discusses how to 
change browser user agents:
http://www.walkernews.net/2007/07/05/how-to-change-user-agent-string/ 

Ron

The Verse of the Day
“Encouragement from God’s Word”
http://www.TheVerseOfTheDay.info

--- End Message ---
--- Begin Message ---
Hi all,

I am needing to find someone with extensive mySQL chops to assist me in building a few mySQL queries to run from PHP. Compensation, of course...

Probably an hour or so of effort for qualified. Please contact me PRIVATELY if interested.

Don

--- End Message ---
--- Begin Message ---
Hi there,
I have a package written in pure PHP, some .php files that refer to others
via require_once(''),
but when I try to see package's contents via a browser, the pacakge just
shows nothing: a blank page.
I've activated all log levels, and it seems that php doesn't encounter any
problem.
I'm using PHP 5.3.3 and apache httpd 2.2.
FYI, I'm new to PHP and this mailing list :)
I would appreciate if someone could help me.


Best
Mohammad

--- End Message ---
--- Begin Message ---
From: Mohammad Taghi Khalifeh

> Hi there,
> I have a package written in pure PHP, some .php files that refer to
others
> via require_once(''),
> but when I try to see package's contents via a browser, the pacakge
just
> shows nothing: a blank page.
> I've activated all log levels, and it seems that php doesn't encounter
any
> problem.
> I'm using PHP 5.3.3 and apache httpd 2.2.
> FYI, I'm new to PHP and this mailing list :)
> I would appreciate if someone could help me.

One of the irregularities about require_once is that if there is a
syntax error anywhere in the chain, the interpreter simply exits without
emitting anything. If you have display errors turned off, you get
nothing at all. There may be clues in the Apache error log, but don't
depend on it. To debug, enable errors temporarily, or print some bread
crumbs at the start of each file. That should at least help identify how
far you get before it fails.

Bob McConnell

--- End Message ---
--- Begin Message ---
On Tue, 2010-11-30 at 22:26 +0330, Mohammad Taghi Khalifeh wrote:
> Hi there,
> I have a package written in pure PHP, some .php files that refer to others
> via require_once(''),
> but when I try to see package's contents via a browser, the pacakge just
> shows nothing: a blank page.
> I've activated all log levels, and it seems that php doesn't encounter any
> problem.
> I'm using PHP 5.3.3 and apache httpd 2.2.
> FYI, I'm new to PHP and this mailing list :)
> I would appreciate if someone could help me.
> 
> 
> Best
> Mohammad


Pacakges, as in the classes?   if you're trying to view a class file,
then yes, you won't (err... usually shouldn't) see anything.  If you
were to go to the main page that actually builds the pages, utilizes the
classes and stuff, then you should see something.

There is also another potential issue.  There was a godaddy server that
i used to use, i switched over a site to their servers, and all of a
sudden, the site didn't show up.   The issue was that there were either
trailing spaces after the ?>, or there was no closing ?> for the php
file.  

Make sure that the page you're trying to pull up has some kind of echo,
or at least output of any type... if that fails, then you can try
adding:
error_reporting(E_ALL);
to the top of the page you're trying to view, to see if there are any
errors it is generating.

just some things to think/check...

good luck, and Welcome to PHP!!!

Steve


--- End Message ---
--- Begin Message ---
On Tue, Nov 30, 2010 at 10:38 PM, Bob McConnell <r...@cbord.com> wrote:

> From: Mohammad Taghi Khalifeh
>
> > Hi there,
> > I have a package written in pure PHP, some .php files that refer to
> others
> > via require_once(''),
> > but when I try to see package's contents via a browser, the pacakge
> just
> > shows nothing: a blank page.
> > I've activated all log levels, and it seems that php doesn't encounter
> any
> > problem.
> > I'm using PHP 5.3.3 and apache httpd 2.2.
> > FYI, I'm new to PHP and this mailing list :)
> > I would appreciate if someone could help me.
>
> One of the irregularities about require_once is that if there is a
> syntax error anywhere in the chain, the interpreter simply exits without
> emitting anything. If you have display errors turned off, you get
> nothing at all. There may be clues in the Apache error log, but don't
> depend on it. To debug, enable errors temporarily, or print some bread
> crumbs at the start of each file. That should at least help identify how
> far you get before it fails.
>
the files are so many,  so I think tracking problem by printing some bread
crumbs at the start of each file is not easy,
something that might help is that I've turned on magic_quotes_gpc because of
the package developer's suggestion.
but I got this warning in both php log:
"PHP Warning:  Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and
greater in Unknown on line 0"
is this warning mean that 'magic_quotes_gpc' will not work properly? so
whats the alternative?

Bob McConnell
>

--- End Message ---
--- Begin Message ---
At 10:26 PM +0330 11/30/10, Mohammad Taghi Khalifeh wrote:
Hi there,
I have a package written in pure PHP, some .php files that refer to others
via require_once(''),
but when I try to see package's contents via a browser, the pacakge just
shows nothing: a blank page.
I've activated all log levels, and it seems that php doesn't encounter any
problem.
I'm using PHP 5.3.3 and apache httpd 2.2.
FYI, I'm new to PHP and this mailing list :)
I would appreciate if someone could help me.


Best
Mohammad

Mohammad;

Do the included files run OK?

If there are any errors in them, you may get a blank page.

To trouble shoot this, I typically place an:

 echo('aaa');

in the first include. That way, if I see 'aaa' at the top of the web page, then I know the include has loaded properly.

Cheers,

tedd

--
-------
http://sperling.com/

--- End Message ---
--- Begin Message ---
On Tue, Nov 30, 2010 at 10:39 PM, Steve Staples <sstap...@mnsi.net> wrote:

> On Tue, 2010-11-30 at 22:26 +0330, Mohammad Taghi Khalifeh wrote:
> > Hi there,
> > I have a package written in pure PHP, some .php files that refer to
> others
> > via require_once(''),
> > but when I try to see package's contents via a browser, the pacakge just
> > shows nothing: a blank page.
> > I've activated all log levels, and it seems that php doesn't encounter
> any
> > problem.
> > I'm using PHP 5.3.3 and apache httpd 2.2.
> > FYI, I'm new to PHP and this mailing list :)
> > I would appreciate if someone could help me.
> >
> >
> > Best
> > Mohammad
>
>
> Pacakges, as in the classes?   if you're trying to view a class file,
> then yes, you won't (err... usually shouldn't) see anything.  If you
> were to go to the main page that actually builds the pages, utilizes the
> classes and stuff, then you should see something.
>
By saying Packages, I just meant  a bunch of files. there is no classes.


> There is also another potential issue.  There was a godaddy server that
> i used to use, i switched over a site to their servers, and all of a
> sudden, the site didn't show up.   The issue was that there were either
> trailing spaces after the ?>, or there was no closing ?> for the php
> file.
>
> Make sure that the page you're trying to pull up has some kind of echo,
> or at least output of any type... if that fails, then you can try
> adding:
> error_reporting(E_ALL);
> to the top of the page you're trying to view, to see if there are any
> errors it is generating.
>
> just some things to think/check...
>
> good luck, and Welcome to PHP!!!
>
> Steve
>
Thank you  very much for your "things" Steve, I'll check them all.

Mohammad



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

--- End Message ---
--- Begin Message ---
From: Mohammad Taghi Khalifeh

> On Tue, Nov 30, 2010 at 10:38 PM, Bob McConnell <r...@cbord.com> wrote:
>> From: Mohammad Taghi Khalifeh
>>> Hi there,
>>> I have a package written in pure PHP, some .php files that refer to
>>others
>>> via require_once(''),
>>> but when I try to see package's contents via a browser, the pacakge
>>just
>>> shows nothing: a blank page.
>>> I've activated all log levels, and it seems that php doesn't
encounter
>>any
>>> problem.
>>> I'm using PHP 5.3.3 and apache httpd 2.2.
>>> FYI, I'm new to PHP and this mailing list :)
>>> I would appreciate if someone could help me.
>>
>> One of the irregularities about require_once is that if there is a
>> syntax error anywhere in the chain, the interpreter simply exits
without
>> emitting anything. If you have display errors turned off, you get
>> nothing at all. There may be clues in the Apache error log, but don't
>> depend on it. To debug, enable errors temporarily, or print some
bread
>> crumbs at the start of each file. That should at least help identify
how
>> far you get before it fails.
> 
> the files are so many,  so I think tracking problem by printing some
> bread crumbs at the start of each file is not easy,
> something that might help is that I've turned on magic_quotes_gpc
because
> of the package developer's suggestion.
> but I got this warning in both php log:
> 
> "PHP Warning:  Directive 'magic_quotes_gpc' is deprecated in PHP 5.3
and
> greater in Unknown on line 0" 
> is this warning mean that 'magic_quotes_gpc' will not work properly?
so
> whats the alternative?

No, As long as it is just a warning it still works correctly, The
message simply points out that magic quotes was a terrible idea and they
are finally going to remove it from the language. You should never have
to use it.

You will probably have to selectively add breadcrumbs to isolate which
file or files are causing your problem. Even if you put them in every
fourth file, you at least get some idea where to start digging.

Bob McConnell

--- End Message ---
--- Begin Message ---
Bob and tedd

On Tue, Nov 30, 2010 at 11:20 PM, Bob McConnell <r...@cbord.com> wrote:

> From: Mohammad Taghi Khalifeh
>
> > On Tue, Nov 30, 2010 at 10:38 PM, Bob McConnell <r...@cbord.com> wrote:
> >> From: Mohammad Taghi Khalifeh
> >>> Hi there,
> >>> I have a package written in pure PHP, some .php files that refer to
> >>others
> >>> via require_once(''),
> >>> but when I try to see package's contents via a browser, the pacakge
> >>just
> >>> shows nothing: a blank page.
> >>> I've activated all log levels, and it seems that php doesn't
> encounter
> >>any
> >>> problem.
> >>> I'm using PHP 5.3.3 and apache httpd 2.2.
> >>> FYI, I'm new to PHP and this mailing list :)
> >>> I would appreciate if someone could help me.
> >>
> >> One of the irregularities about require_once is that if there is a
> >> syntax error anywhere in the chain, the interpreter simply exits
> without
> >> emitting anything. If you have display errors turned off, you get
> >> nothing at all. There may be clues in the Apache error log, but don't
> >> depend on it. To debug, enable errors temporarily, or print some
> bread
> >> crumbs at the start of each file. That should at least help identify
> how
> >> far you get before it fails.
> >
> > the files are so many,  so I think tracking problem by printing some
> > bread crumbs at the start of each file is not easy,
> > something that might help is that I've turned on magic_quotes_gpc
> because
> > of the package developer's suggestion.
> > but I got this warning in both php log:
> >
> > "PHP Warning:  Directive 'magic_quotes_gpc' is deprecated in PHP 5.3
> and
> > greater in Unknown on line 0"
> > is this warning mean that 'magic_quotes_gpc' will not work properly?
> so
> > whats the alternative?
>
> No, As long as it is just a warning it still works correctly, The
> message simply points out that magic quotes was a terrible idea and they
> are finally going to remove it from the language. You should never have
> to use it.
>
> You will probably have to selectively add breadcrumbs to isolate which
> file or files are causing your problem. Even if you put them in every
> fourth file, you at least get some idea where to start digging.
>
> Bob McConnell
>

As you recommended, by adding breadcrumbs, I found the hotspot: pg_connect()
Actually, somewhere php tryes to connect to postgresql via pg_connect().
The strange thing about it is that program dies in it without any echo.
providing connection information as $connection_string, the below block ends
the program:

        if(!$db = @pg_connect($connection_string)) {
                return FALSE;
        }
        return $db;

how can I find the problem and fix it?

--- End Message ---
--- Begin Message ---
>        if(!$db = @pg_connect($connection_string)) {
>                return FALSE;
>        }
>        return $db;
>
> how can I find the problem and fix it?


The @ symbol is telling it to ignore errors.  Remove it and you'll see
them if that's where the problem is.

http://php.net/manual/en/language.operators.errorcontrol.php

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

On Wed, Dec 1, 2010 at 1:02 AM, Marc Guay <marc.g...@gmail.com> wrote:

> >        if(!$db = @pg_connect($connection_string)) {
> >                return FALSE;
> >        }
> >        return $db;
> >
> > how can I find the problem and fix it?
>
>
> The @ symbol is telling it to ignore errors.  Remove it and you'll see
> them if that's where the problem is.
>
> http://php.net/manual/en/language.operators.errorcontrol.php
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> Thanks for advise (I didn't know that). but removing @ did not change
anything.
it seems that the problem is in pg_connect().

--- End Message ---
--- Begin Message ---
On Tue, Nov 30, 2010 at 16:51, Mohammad Taghi Khalifeh
<khalifeh...@gmail.com> wrote:
> it seems that the problem is in pg_connect().

    Do you have PostgreSQL support compiled into PHP?

    Command line:
        php -i | egrep -i 'postgres|pgsql'

    Web:
        <?php phpinfo(); /* Check in a browser for 'pgsql' or 'postgres' */ ?>

-- 
</Daniel P. Brown>
Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: ckn...@savage.za.org [mailto:ckn...@savage.za.org] On Behalf Of
> Chris Knipe
> Sent: Tuesday, November 30, 2010 4:47 AM
> To: php-gene...@lists.php.net
> Subject: [PHP] LDAP, Active Directory, and permissions
> 
> Hi,
> 
> I've found various sources and are successfully manipulating Active
> Directory from PHP on our Domain Controller - frankly, things works much
> better than I expected :)
> 
> I have now reached the point where I need to set permissions on objects in
> Active Directory, i.e. to restrict read permissions to certain OUs and
objects
> within the directory (mainly related to Exchange stuff).
> 
> Is there anything in PHP which can be used to set permissions on AD
> objects?  I haven't found any reference to doing this anywhere, so I
thought
> I'd give it a chance here... If not, then I suppose I'll have to code some
..NET
> application to act as a gateway between the PHP interface and Active
> Directory, but naturally I would like to do as much as possible from
within
> PHP itself.
> 
> Many thanks,
> 
> 
> --
> 
> Regards,
> Chris Knipe

Chris,

1) Shouldn't the OU security permissions be set within the AD itself?
2) If the above is done, then the user account that's being authenticated
shouldn't be able to access privileged information.

Just curious, are you using phpldapadmin?

Regards,
Tommy


--- End Message ---

Reply via email to