[PHP] formatting - generating tables with php

2001-09-23 Thread rico

I have an intermediate process that allows you to add table rows with input
fields; and while this works, for some reason, it is adding extra white
space before the table, even though the generated html does not show
additional 's or 's.

whats going on?

attached are the files in question.

TIA

--
-
Click here for Free Video!!
http://www.gohip.com/free_video/



begin 666 arrayprocr.php
M/&AT;6P^#0H\:&5A9#X-"CQT:71L93Y!2!0'0O8W-S(CX\(2TM#0I!('L@=&5X="UD96-O
MR!F;VYT+69A;6EL>3H@87)I86PL:&5L=F5T:6-A+'-A;G,M
MR!F;VYT+69A;6EL>3H@
M87)I86PL:&5L=F5T:6-A+'-A;G,M6YA;64I.PT*#0IF;W(H)&D],#LD:3PD
M8VYT.R1I*RLI>PT*"0T*"65C:&\@(CQT2!P;W!U;&%T;W(\+W1I=&QE
M/@T*/%-464Q%(%194$4](G1E>'0O8W-S(CX\(2TM#0I!('L@=&5X="UD96-O
MR!F;VYT+69A;6EL>3H@87)I86PL:&5L=F5T:6-A+'-A;G,M
MR!F;VYT+69A;6EL>3H@
M87)I86PL:&5L=F5T:6-A+'-A;G,M2!C;&EC:R \82!H5]D97!T:#TU.PT*)&%R5]D97!T:" K("1A9&1T;SL-"@D-"F9O7!E/7-U8FUI="!V86QU93TB<')O8V5S2!P;W!U;&%T;W(\+W1I=&QE
M/@T*/%-464Q%(%194$4](G1E>'0O8W-S(CX\(2TM#0I!('L@=&5X="UD96-O
MR!F;VYT+69A;6EL>3H@87)I86PL:&5L=F5T:6-A+'-A;G,M
MR!F;VYT+69A;6EL>3H@
M87)I86PL:&5L=F5T:6-A+'-A;G,Mhttp://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: formatting - generating tables with php

2001-09-23 Thread rico

never mind hehe

--
-
Click here for Free Video!!
http://www.gohip.com/free_video/

"Rico" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have an intermediate process that allows you to add table rows with
input
> fields; and while this works, for some reason, it is adding extra white
> space before the table, even though the generated html does not show
> additional 's or 's.
>
> whats going on?
>
> attached are the files in question.
>
> TIA
>
> --
> -
> Click here for Free Video!!
> http://www.gohip.com/free_video/
>
>
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: formatting - generating tables with php

2001-09-23 Thread rico

wait no, arraymaker.php displays the additional table rows correctly after
adding rows with addtoarray.php, but then once submitted, arrayprocr.php
displays new additional white space before beginning the table, yet w/ no
HTML 's or 's added.

so the question still stands.

--
-
Click here for Free Video!!
http://www.gohip.com/free_video/

"Rico" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> never mind hehe
>
> --
> -
> Click here for Free Video!!
> http://www.gohip.com/free_video/
>
> "Rico" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I have an intermediate process that allows you to add table rows with
> input
> > fields; and while this works, for some reason, it is adding extra white
> > space before the table, even though the generated html does not show
> > additional 's or 's.
> >
> > whats going on?
> >
> > attached are the files in question.
> >
> > TIA
> >
> > --
> > -
> > Click here for Free Video!!
> > http://www.gohip.com/free_video/
> >
> >
> >
> >
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] formatting in HTML from PHP scripts. Please help!

2001-09-23 Thread rico

Attached are the files in question.  They are used in order as such:
arraymaker.php -> add more keys:elements via addtoarray.php ->
arraymaker.php -> arrayprocr.php

the code works.

The problem is in the final formatting in arrayprocr.php.  I notice that
whenever a new  is added to the final table, it gets pushed further down
the page, almost as if a  has been added for each new ...but there
is not.

I've looked it over, it looks clean.  The resulting HTML in arrayprocr.php
is clean and devoid of any "extra 's or 's.

Why would this be happening?  anyone? please help.

TIA

rico

--
-
Click here for Free Video!!
http://www.gohip.com/free_video/




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: formatting in HTML from PHP scripts. Please help!

2001-09-23 Thread rico

oops, forgot to add the files in

--
-
Click here for Free Video!!
http://www.gohip.com/free_video/

"Rico" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Attached are the files in question.  They are used in order as such:
> arraymaker.php -> add more keys:elements via addtoarray.php ->
> arraymaker.php -> arrayprocr.php
>
> the code works.
>
> The problem is in the final formatting in arrayprocr.php.  I notice that
> whenever a new  is added to the final table, it gets pushed further
down
> the page, almost as if a  has been added for each new ...but there
> is not.
>
> I've looked it over, it looks clean.  The resulting HTML in arrayprocr.php
> is clean and devoid of any "extra 's or 's.
>
> Why would this be happening?  anyone? please help.
>
> TIA
>
> rico
>
> --
> -
> Click here for Free Video!!
> http://www.gohip.com/free_video/
>
>
>


begin 666 arrayprocr.php
M/&AT;6P^#0H\:&5A9#X-"CQT:71L93Y!2!0'0O8W-S(CX\(2TM#0I!('L@=&5X="UD96-O
MR!F;VYT+69A;6EL>3H@87)I86PL:&5L=F5T:6-A+'-A;G,M
MR!F;VYT+69A;6EL>3H@
M87)I86PL:&5L=F5T:6-A+'-A;G,M6YA;64I.PT*#0IF;W(H)&D],#LD:3PD
M8VYT.R1I*RLI>PT*"0T*"65C:&\@(CQT2!P;W!U;&%T;W(\+W1I=&QE
M/@T*/%-464Q%(%194$4](G1E>'0O8W-S(CX\(2TM#0I!('L@=&5X="UD96-O
MR!F;VYT+69A;6EL>3H@87)I86PL:&5L=F5T:6-A+'-A;G,M
MR!F;VYT+69A;6EL>3H@
M87)I86PL:&5L=F5T:6-A+'-A;G,M2!C;&EC:R \82!H5]D97!T:#TU.PT*)&%R5]D97!T:" K("1A9&1T;SL-"@D-"F9O7!E/7-U8FUI="!V86QU93TB<')O8V5S2!P;W!U;&%T;W(\+W1I=&QE
M/@T*/%-464Q%(%194$4](G1E>'0O8W-S(CX\(2TM#0I!('L@=&5X="UD96-O
MR!F;VYT+69A;6EL>3H@87)I86PL:&5L=F5T:6-A+'-A;G,M
MR!F;VYT+69A;6EL>3H@
M87)I86PL:&5L=F5T:6-A+'-A;G,Mhttp://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] formatting in HTML from PHP scripts. Please help!

2001-09-23 Thread rico

Ah, ok, didnt know about the faus pax re: attachments. Lo siento!

Anyway, Ill give that a try, thx.  ill post back yay or nay.

--
-
Click here for Free Video!!
http://www.gohip.com/free_video/

"Matt Greer" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Sunday 23 September 2001 17:01, rico wrote:
>
> > The problem is in the final formatting in arrayprocr.php.  I notice that
> > whenever a new  is added to the final table, it gets pushed further
> > down the page, almost as if a  has been added for each new
...but
> > there is not.
> >
> I cant look at your files as they always arrive as gibberish. How are you
> encoding them? Generally attachments on a mailing list is a faux pas
however.
>
> But extra space in tables can happen if you allow a carriage return or
white
> space between the  element and what it contains. So instead of:
>
> 
> data here
> 
>
> have
>
> data here
>
> this is especially true of images
>
> I have no idea if that's your problem, but its worth a shot.
>
> Matt



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] formatting in HTML from PHP scripts. Please help!

2001-09-23 Thread rico

nope, no go...still getting extra lines after taking out all instances of \n

--
-
Click here for Free Video!!
http://www.gohip.com/free_video/

"Rico" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Ah, ok, didnt know about the faus pax re: attachments. Lo siento!
>
> Anyway, Ill give that a try, thx.  ill post back yay or nay.
>
> --
> -
> Click here for Free Video!!
> http://www.gohip.com/free_video/
>
> "Matt Greer" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > On Sunday 23 September 2001 17:01, rico wrote:
> >
> > > The problem is in the final formatting in arrayprocr.php.  I notice
that
> > > whenever a new  is added to the final table, it gets pushed
further
> > > down the page, almost as if a  has been added for each new
> ...but
> > > there is not.
> > >
> > I cant look at your files as they always arrive as gibberish. How are
you
> > encoding them? Generally attachments on a mailing list is a faux pas
> however.
> >
> > But extra space in tables can happen if you allow a carriage return or
> white
> > space between the  element and what it contains. So instead of:
> >
> > 
> > data here
> > 
> >
> > have
> >
> > data here
> >
> > this is especially true of images
> >
> > I have no idea if that's your problem, but its worth a shot.
> >
> > Matt
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] formatting in HTML from PHP scripts. Please help!

2001-09-23 Thread rico

OMG, never mindim an idiot.

clear as day a  i had left in the middle of an echo statement after


doy!

--
-
Click here for Free Video!!
http://www.gohip.com/free_video/

"Matt Greer" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Sunday 23 September 2001 17:01, rico wrote:
>
> > The problem is in the final formatting in arrayprocr.php.  I notice that
> > whenever a new  is added to the final table, it gets pushed further
> > down the page, almost as if a  has been added for each new
...but
> > there is not.
> >
> I cant look at your files as they always arrive as gibberish. How are you
> encoding them? Generally attachments on a mailing list is a faux pas
however.
>
> But extra space in tables can happen if you allow a carriage return or
white
> space between the  element and what it contains. So instead of:
>
> 
> data here
> 
>
> have
>
> data here
>
> this is especially true of images
>
> I have no idea if that's your problem, but its worth a shot.
>
> Matt



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] File permitions

2001-09-23 Thread rico

im definitely not a guru, but perhaps this might help

http://www.php.net/manual/en/html/function.chmod.html
http://www.php.net/manual/en/html/function.chown.html

those are the doc pages on usage of similar process for setting permissions
(i believe)

GL

--
-
Click here for Free Video!!
http://www.gohip.com/free_video/

<[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Maybe I wasn't clear in my previous message:
> What I want to do is: when you fill the form, record it
> to a file without 666 permitions. I mean: I don't want
> to have the file "opened" to everybody. In Perl it was
> possible (because it uses directly "system" user, which
> is similar to "root"), I want to make it possible using
> PHP. E.G.: The PHP-script receives the form, makes an
> internal authentication and creates or writes the file
> with 600 permitions.
>
> Thank you,
>
> Manuel Silva
>
>
> Quoting Alexander Skwar <[EMAIL PROTECTED]>:
>
> > So sprach »[EMAIL PROTECTED]« am
> > 2001-09-23 um 19:08:20 +0100 :
> > > Is there any possibility to write to files as
> > "httpd"
> > > or "system" (which can write to files even
> > with "000"
> > > permitions)?
> >
> > With 000 permissions?  Is "system" an alias for
> > root?  If not, then it's
> > not possible.
> >
> > But normally the files should only need access
> > for the group running the
> > webserver process.  Here at home, it's
> > apache/apache.
> >
> > Alexander Skwar
> > --
> > How to quote: http://learn.to/quote (german)
> > http://quote.6x.to (english)
> > Homepage: http://www.digitalprojects.com   |
> > http://www.iso-top.de
> >iso-top.de - Die günstige Art an Linux
> > Distributionen zu kommen
> > Uptime: 8 hours 49 minutes
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> > To contact the list administrators, e-mail:
> > [EMAIL PROTECTED]
> >
> >
>
> -
> Visite http://www.lusoweb.pt



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] File permitions

2001-09-23 Thread rico

looks pretty straightforward with php's caveat to be careful to use octal...

chmod ("/somedir/somefile", 0755);  // octal; correct value of mode


--
-
Click here for Free Video!!
http://www.gohip.com/free_video/

<[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Maybe I wasn't clear in my previous message:
> What I want to do is: when you fill the form, record it
> to a file without 666 permitions. I mean: I don't want
> to have the file "opened" to everybody. In Perl it was
> possible (because it uses directly "system" user, which
> is similar to "root"), I want to make it possible using
> PHP. E.G.: The PHP-script receives the form, makes an
> internal authentication and creates or writes the file
> with 600 permitions.
>
> Thank you,
>
> Manuel Silva
>
>
> Quoting Alexander Skwar <[EMAIL PROTECTED]>:
>
> > So sprach »[EMAIL PROTECTED]« am
> > 2001-09-23 um 19:08:20 +0100 :
> > > Is there any possibility to write to files as
> > "httpd"
> > > or "system" (which can write to files even
> > with "000"
> > > permitions)?
> >
> > With 000 permissions?  Is "system" an alias for
> > root?  If not, then it's
> > not possible.
> >
> > But normally the files should only need access
> > for the group running the
> > webserver process.  Here at home, it's
> > apache/apache.
> >
> > Alexander Skwar
> > --
> > How to quote: http://learn.to/quote (german)
> > http://quote.6x.to (english)
> > Homepage: http://www.digitalprojects.com   |
> > http://www.iso-top.de
> >iso-top.de - Die günstige Art an Linux
> > Distributionen zu kommen
> > Uptime: 8 hours 49 minutes
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> > To contact the list administrators, e-mail:
> > [EMAIL PROTECTED]
> >
> >
>
> -
> Visite http://www.lusoweb.pt



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Memcached is driving me nuts

2008-11-24 Thread Rico Secada
Hi.

This post has also been posted on the Debian list.

I have two different Debian Etch machines running with the exact same
packages installed, when I use PHP memcached with compression (zlib) it
works at one machine but not the other. No errors are thrown. 

I need to know why it is only working on one machine and not the other.

I am talking about the MEMCACHE_COMPRESSED flag if anyone knows about
this.

I am using this small script to test with:

connect('localhost', 11211);

$version = $memcached->getVersion();
print ("Memcached version: ".$version."");

//  $memcached->flush();

$output = $memcached->get('var_key');

if (empty($output)) {

$memcached->set('var_key', 'Hello I am Memcached',
MEMCACHE_COMPRESSED, 3600);

print ("Memcached has just been set!");

} else {

print ("Memcached is already set with this value:
$output");

}
?>

If I disable the compression flag (using the 'false' value or zero
value) on the failing machine, all works correctly, but when I enable
it like in the above script it fails without error.

I have also tried running memcached with "-vv" options, and checked the
log, but no errors show up.

I am suspecting that zlib isn't working right on the failing machine,
but using phpinfo() it shows that zlib is enabled.

On both machines the following packages are installed:

ii  libcompress-zlib-perl   1.42-2  
ii libio-zlib-perl  1.04-1
ii zlib1g   1.2.3-13

ii  libapache2-mod-php5 5.2.0-8+etch13
ii php5 5.2.0-8+etch13
ii php5-common  5.2.0-8+etch13
ii php5-gd  5.2.0-8+etch13
ii  php5-imagick0.9.11+1-4.1
ii php5-memcache2.0.1-1.1
ii  php5-mysql  5.2.0-8
+etch13 
ii php5-pgsql   5.2.0-8+etch13

Any help in understanding what is going on would be greatly
appreciated.

Best regards.

Rico






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



Re: [PHP] Re: Memcached is driving me nuts

2008-11-24 Thread Rico Secada
On Mon, 24 Nov 2008 15:13:32 -0500
Al <[EMAIL PROTECTED]> wrote:

> Try debug_backtrace()

Thanks for your reply.

I get an empty array:

array(0) { } 
 
> Rico Secada wrote:
> > Hi.
> > 
> > This post has also been posted on the Debian list.
> > 
> > I have two different Debian Etch machines running with the exact
> > same packages installed, when I use PHP memcached with compression
> > (zlib) it works at one machine but not the other. No errors are
> > thrown. 
> > 
> > I need to know why it is only working on one machine and not the
> > other.
> > 
> > I am talking about the MEMCACHE_COMPRESSED flag if anyone knows
> > about this.
> > 
> > I am using this small script to test with:
> > 
> >  > error_reporting(E_ALL);
> > 
> > $memcached = new Memcache;
> > 
> > $memcached->connect('localhost', 11211);
> > 
> > $version = $memcached->getVersion();
> > print ("Memcached version: ".$version."");
> > 
> > //  $memcached->flush();
> > 
> > $output = $memcached->get('var_key');
> > 
> > if (empty($output)) {
> > 
> > $memcached->set('var_key', 'Hello I am Memcached',
> > MEMCACHE_COMPRESSED, 3600);
> > 
> > print ("Memcached has just been set!");
> > 
> > } else {
> > 
> > print ("Memcached is already set with this value:
> > $output");
> > 
> > }
> > ?>
> > 
> > If I disable the compression flag (using the 'false' value or zero
> > value) on the failing machine, all works correctly, but when I
> > enable it like in the above script it fails without error.
> > 
> > I have also tried running memcached with "-vv" options, and checked
> > the log, but no errors show up.
> > 
> > I am suspecting that zlib isn't working right on the failing
> > machine, but using phpinfo() it shows that zlib is enabled.
> > 
> > On both machines the following packages are installed:
> > 
> > ii  libcompress-zlib-perl   1.42-2  
> > ii libio-zlib-perl  1.04-1
> > ii zlib1g   1.2.3-13
> > 
> > ii  libapache2-mod-php5 5.2.0-8+etch13
> > ii php5 5.2.0-8+etch13
> > ii php5-common  5.2.0-8+etch13
> > ii php5-gd  5.2.0-8+etch13
> > ii  php5-imagick0.9.11+1-4.1
> > ii php5-memcache2.0.1-1.1
> > ii  php5-mysql  5.2.0-8
> > +etch13 
> > ii php5-pgsql   5.2.0-8+etch13
> > 
> > Any help in understanding what is going on would be greatly
> > appreciated.
> > 
> > Best regards.
> > 
> > Rico
> > 
> > 
> > 
> > 
> > 
> 
> -- 
> 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] Fixing the path

2009-09-11 Thread Rico Secada
Hi.

Some time ago I developed a small web application that a bunch of users
has installed.

I have always used the DOCUMENT_ROOT for my includes, but the other day
I installed the application in a subdirectory, and as you've guessed a
lot of the includes didn't work.

I have been reading up on the subject of absolute vs. relative paths
etc. And on the subject of defining your own document root.

I need the application to be as user friendly as possible, and I would
like to avoid having users enter path details in the configuration.

What is the best way to solve this problem?

Best regards.

Rico.

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



Re: [PHP] Fixing the path

2009-09-13 Thread Rico Secada
On Sat, 12 Sep 2009 00:43:50 -0400
Paul M Foster  wrote:

> (Or maybe I've completely misread what you're trying to do.)

Yes you did, but never mind :)
 
> Paul
> 
> -- 
> Paul M. Foster
> 
> -- 
> 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] I need some thoughts on code duplication and separation

2010-10-20 Thread Rico Secada
Hi.

I am working on a small system where I am both trying to avoid code
duplication and at the same time I am trying to keep the presentation
logic separated from the application logic.

I am using sessions and are avoiding "headers already sent" problem by
keeping the HTML out of the application.

For example, I would like to have a common header.php file, but it is
difficult to create this since one file needs to have some specific
Javascript located in the   tags, but the other files
doesn't need this.

Another file needs to have a specific "onload" call in the  tag,
while yet another file also needs to have an "onload" call, but with
different attributes.

I have been looking around in other systems to see what kinds of
solutions are being used - as inspiration.

I have been thinking about the following solutions:

1. Create only ONE header.php file that contains a lot of conditionals
depending on what file is including it - the output of HTML/Javascript
changes.

I believe this would turn into a very ugly hack. Difficult to maintain.

2. Create a HTML generating class with a set of methods that each
contains an adequate amount of parameters. Each method maintains its
own HTML tag. For example, docType($type) would generate the doctype
specification.

I believe this is a "cleaner" solution, but the problem with code
duplication isn't avoided.

Some of the presentation logic contains conditionals and the HTML
changes when the conditional changes, hence the header content changes,
but the , , and  doesn't necessarily change and
they would get duplicated a couple of times in some files.

3. Avoid the problem all together, use output buffering and completely
forget about separation between application and presentation.

I hope I make sense.

Any thoughts on these kinds of problems?

Best regards.


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



Re: [PHP] I need some thoughts on code duplication and separation

2010-10-24 Thread Rico Secada
On Thu, 21 Oct 2010 10:55:14 -0400
Paul M Foster  wrote:

> On Thu, Oct 21, 2010 at 04:05:50AM +0200, Rico Secada wrote:
> 
> > Hi.
> > 
> > I am working on a small system where I am both trying to avoid code
> > duplication and at the same time I am trying to keep the
> > presentation logic separated from the application logic.
> > 
> > I am using sessions and are avoiding "headers already sent" problem
> > by keeping the HTML out of the application.
> > 
> > For example, I would like to have a common header.php file, but it
> > is difficult to create this since one file needs to have some
> > specific Javascript located in the   tags, but the
> > other files doesn't need this.
> > 
> > Another file needs to have a specific "onload" call in the 
> > tag, while yet another file also needs to have an "onload" call,
> > but with different attributes.
> > 
> > I have been looking around in other systems to see what kinds of
> > solutions are being used - as inspiration.
> > 
> > I have been thinking about the following solutions:
> > 
> > 1. Create only ONE header.php file that contains a lot of
> > conditionals depending on what file is including it - the output of
> > HTML/Javascript changes.
> > 
> > I believe this would turn into a very ugly hack. Difficult to
> > maintain.
> 
> Not really. Here's what I do. I have a page controller which defines
> variables and such, and then calls the header.php file. The page
> controller will contain something like this:
> 
> $meta['jsfiles'] = 'onload.js';
> 
> The header.php will contain code like this:
> 
> 
> 
> 
> 
> The page controller can also contain a variety of other settings,
> like:
> 
> $meta['content'] = 'cust_add.php';
> 
> and the header.php will contain:
> 
> 
> 
> This directs the proper internal content for the header.php, which is
> really like a "template" file.
> 
> Also remember that at the bottom of the page controller, you do a like
> like this:
> 
> include 'header.php';
> 
> You can change this as you like for any given page controller.
> 
> Paul
> 
> -- 
> Paul M. Foster

Thanks Paul! It's a nice way to do it.

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



[PHP] Best practice for if (!$stmt->execute())

2010-10-24 Thread Rico Secada
Hi.

I have been doing like this:

if (!$stmt->execute()) {
return false;
} else {

... some code

return true;
OR
return $foo; // Some int, string, whatever.

}

I am thinking about changing the "return false" with a:

if (!$stmt->execute()) {
die(DB_ERROR);

This way making sure that every single db execute gets a valid check
and at the same time return some kind of valuable db error to the user
and end the script.

How do you deal with db execution checks?

Thanks in advance!

Best regards.

Rico.


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



Re: [PHP] Best practice for if (!$stmt->execute())

2010-10-25 Thread Rico Secada
On Mon, 25 Oct 2010 00:26:23 -0700
"Tommy Pham"  wrote:

> > -Original Message-
> > From: Rico Secada [mailto:coolz...@it.dk]
> > Sent: Sunday, October 24, 2010 9:06 PM
> > To: php-general@lists.php.net
> > Subject: [PHP] Best practice for if (!$stmt->execute())
> > 
> > Hi.
> > 
> > I have been doing like this:
> > 
> > if (!$stmt->execute()) {
> > return false;
> > } else {
> > 
> > ... some code
> > 
> > return true;
> > OR
> > return $foo; // Some int, string, whatever.
> > 
> > }
> > 
> > I am thinking about changing the "return false" with a:
> > 
> > if (!$stmt->execute()) {
> > die(DB_ERROR);
> > 
> > This way making sure that every single db execute gets a valid
> > check and
> at
> > the same time return some kind of valuable db error to the user and
> > end
> the
> > script.
> > 
> > How do you deal with db execution checks?
> > 
> > Thanks in advance!
> > 
> > Best regards.
> > 
> > Rico.
> > 
> 
> Rico,
> 
> Shouldn't you consider this as "what happens, while in production,
> should the script fails?", whether its DB related or not.  In that
> case, how would you want to handle the error?   Do you, or the system
> admin, want to be notified one way or another of the failure?  Do
> want to implement a backup in case that failure happens as an
> 'automatic recovery' mechanism?  As a system/network admin, I go by 3
> guidelines:
> 1) Prevent failure as much as I can (either system hardware, software
> applications, hacks/exploits/vulnerabilities, etc.).
> 2) In the event that 1 fails, what's the recovery process?  How fast
> can I recover from it?
> 3) If 2 fails, then there's something wrong with the whole process,
> which I need to expand my knowledge & skillset.
> 
> In my past experiences, I haven't yet got to stage 2 because there
> precautions you can take to detect when a failure is about to happen
> so that stage 2 will never happens.  What you need to consider is how
> important is this?  Is it mission critical?
> 
> Regards,
> Tommy

Thank you for some very important thoughts! Creating an extended error
handling function seems appropriate.

Regards,
Rico 

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



Re: [PHP] Best practice for if (!$stmt->execute())

2010-10-25 Thread Rico Secada
On Mon, 25 Oct 2010 22:56:37 -0400
Paul M Foster  wrote:

> Bear in mind, an "error" is *never* that a query returned no data or
> data the user might consider bad.

This is an important point. When is an "error" an actual error? When is
it something that *needs* to be logged and mailed?
 
> Paul
> 
> -- 
> Paul M. Foster
> 
> -- 
> 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] Documentation

2010-10-27 Thread Rico Secada
On Wed, 27 Oct 2010 10:52:58 +0200
Jordan Jovanov  wrote:

> Hello All,
> 
> I finished with coding and now I am on the part when need to write 
> documentation. But I don't know how to write correct documentation.
> Does have some rules or standard for writing documentation for PHP?
> Or maybe have some programs for writing documentations?

You should consider who is going to read the documentation. Are we
talking about end users and/or other coders?

Other coders benefit from code comments and as some suggests
phpDocumentor has some nice features if you want to automate some of it.

End users on the other hand need hand written documentation and in most
cases non-technical explanations.

> Best Regards,
> Jordan JOVANOV
> 
> -- 
> 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] Is it possible to install PHP on IIS?

2010-11-16 Thread Rico Secada
On Tue, 16 Nov 2010 12:16:25 +0530
Himani Aggarwal  wrote:

> Hi Folks, is it possible to install PHP on IIS? If yes, can someone
> please guide me on how to go about doing it? Thanks

Now, why would you wanna do something crazy like that?! :)
 

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



Re: [PHP] Wordpress Page: How to add pagination?

2010-11-22 Thread Rico Secada
On Mon, 22 Nov 2010 09:27:28 +0800 (SGT)
vince samoy  wrote:

Hi Vince.

This is not a Wordpress mailing list. This is the general users PHP
mailing list.

> Hi guys,
> 
> I was wondering if this is the right place that this question of mine
> might get an answer. I'm currently working on a website project and
> I'm trying to add a pagination on a "Wordpress Page" as I might call
> it.
> 
> I was able to make it work on the archive.php page. Please take note
> that this page is calling out 3 "Posts" on each page and that the
> pagination is working.
> 
> Link: http://lgrathletics.com/lgr/category/basketball
> 
> Code:
> 
> 
> 
> 
> 
> this is the archive
> 
> 
> 
> 
> 
>  $c = 1; //init counter
> $bpr = 3; //boxes per row
> 
> if(have_posts()) :
>     while(have_posts()) :
>         the_post();
> ?>
>             
>                  title=""> >   >>('grid-post-image'); ?>
>                 
>                 
>                     
>                 
>             
>  if($c == $bpr) :
> ?>
> 
>  $c = 0;
> endif;
> ?>
>      $c++;
>     endwhile;
> endif;
> ?>
> 
> 
> 
> 
> 
> 
> 
> Now, I'm trying to make this work on a template page. With 3 "Pages"
> instead of posts on each page. You'll notice that the pagination is
> not appearing.
> 
> Link: http://lgrathletics.com/lgr/basketball
> 
> Code:
> 
>  /*
> Template Name: Product Grid
> */
> ?>
> 
> 
> 
> 
> 
> this is the product grid
> 
> 
>  $parent_title = get_the_title($post->post_parent);
> echo $parent_title;
> ?>
>  
> 
>  
> $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;    
>     
> query_posts(array('showposts' => 3, 'post_parent' => 173, 'post_type'
> => 'page'));
> 
>     while (have_posts()) {
>         
>         the_post(); // vital
>         
>         $thumbPath = get_post_meta($post->ID, 'thumbnail', true);
>         
>         if ($thumbPath == "") {
>             $thumbPath = "/images/comingsoon.png";
>         
>         }
>         
>         ?>
>      
>      class="grid-product"> 
>     
>          class="grid-product"> alt="" />  
>                     $ID, 'price',
> true); ?> 
>     
>     
>     
>          
>     wp_reset_query(); // Restore global post data
>     
> }
> ?>
> 
>  activated ?>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  
> 
> 
> 
> 
> 
> 
> 
> I really don't what I'm currently missing or this is something that
> is impossible. Hope you guys can help me out.
> 
> Thanks in advance and good day!
> 
> Vince
> 
> 
> 
> 
>   

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



[PHP] No errors gets displayed, just a blank page

2010-12-07 Thread Rico Secada
Hi.

What can cause that no parse error gets displayed (blank page/no output
at all) even though error reporting is set to "-1"? 

I have run the script through php lint on the console and it comes up
with no errors.

I have run into this problem the last couple of days making debugging a
nightmare.

Anyone with experience in this behavior?

Thanks and best regards

Rico

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



[PHP] PDO Prepared Statements and stripslashes

2010-12-20 Thread Rico Secada
Hi.

In an article about SQL Injection by Chris Shiflett he mentions the
following in a comment: "The process of escaping should preserve data,
so it should never be necessary to reverse it. When I'm auditing an
application, things like stripslashes() alert me to design problems."

Now, I'm always using PHP PDO with prepared statements and as such data
with quotes gets slashed automatically by PDO when inserted into the
database.

When I need to pull out the data something might be slashed and I need
to use stripslashes() or some str_replace() to make sure that the
slashes are removed.

So what's the mistake here and what's the correct way to do it?

Kind regards

Rico

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



Re: [PHP] PDO Prepared Statements and stripslashes

2010-12-20 Thread Rico Secada
On Tue, 21 Dec 2010 00:32:19 -0500
Paul M Foster  wrote:

> On Tue, Dec 21, 2010 at 05:31:15AM +0100, Rico Secada wrote:
> 
> > Hi.
> > 
> > In an article about SQL Injection by Chris Shiflett he mentions the
> > following in a comment: "The process of escaping should preserve
> > data, so it should never be necessary to reverse it. When I'm
> > auditing an application, things like stripslashes() alert me to
> > design problems."
> > 
> > Now, I'm always using PHP PDO with prepared statements and as such
> > data with quotes gets slashed automatically by PDO when inserted
> > into the database.
> 
> Just out of idle curiosity, are you using MySQL? PDO shouldn't be
> backslashing quotes for PostgreSQL, as the PostgreSQL convention for
> values containing single quotes is to double the quotes, as: ''.

Currently I'm working with MySQL, but I have just tested PDO with
PostgreSQL 8.3 and in this case PDO backslashes PostgreSQL as well.
 
> > When I need to pull out the data something might be slashed and I
> > need to use stripslashes() or some str_replace() to make sure that
> > the slashes are removed.
> > 
> > So what's the mistake here and what's the correct way to do it?
> 
> I don't see a mistake. If the values come out of the database
> backslashed, then you need to remove them to work with the data. My
> only question would be whether you're sure the data is backslashed
> before PDO ever sees it. In which case, yes, you have a problem.

No, the data is not slashed before PDO sees them.

I didn't see a mistake either, but then what does Chris mean? Stripping
slashes from output from the DB alerts him to a design problem, and
I'm just wondering if there another way of doing things I just haven't
heard of then. 

> Paul
> 
> -- 
> Paul M. Foster
> 
> -- 
> 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] PDO Prepared Statements and stripslashes

2010-12-21 Thread Rico Secada
On Tue, 21 Dec 2010 10:32:21 -0500
Adam Richardson  wrote:

> 1. Turn off magic_quotes_gpc if on, as its use has been deprecated.
> 2. Use prepared statements.
> 3. Don't worry about stripping slashes ever again :)

Thank you for a very enlightening answer. I guess I misunderstood
the "PDO automatically quotes.." and the slashes part! :-) 
> Adam
> 
> -- 
> Nephtali:  A simple, flexible, fast, and security-focused PHP
> framework http://nephtaliproject.com
> 

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



[PHP] Code should be selv-maintaining!

2011-08-29 Thread Rico Secada
Dont get me wrong, I love programming! But what an absolute pain in the
ass it is when you re-use old code only to discover something "less well
made".

You all know about this right?

You go into your homemade library of code to re-use some piece that you
already are using 12 other places in production. Now, last time you
worked on the code you thought it was almost perfect. While working on
the code this time you find an undiscovered bug or some part of the
code that looks like you where on drugs when you made it.

Of course we develop experience and more skills all the time, and as a
good programmer we never stop doing that, but what a pain it is when
the above happens and you have to patch the code being used those 12
other places too, and each place maybe has a slightly different usage,
so minor changes affect other stuff. And this goes on while your head
is spinning around trying to stay focused on the very task at hand that
originated the need for a quick re-usage of old code in the first place.

Why the hell can't code be self-maintaining!? :))

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



Re: [PHP] Novice question

2011-10-30 Thread Rico Secada
On Sun, 30 Oct 2011 17:24:07 -
"John Allsopp"  wrote:

> Hi
> 
> I'm afraid I've fallen a little out of touch with PHP dev, so a stupid
> question for you.
> 
> I want to write a script that requests a URL and then reads that
> website .. I'm interested to map web structures. My web host is
> saying I'll need URL file access enabled but that it's a) a security
> risk and b) deprecated.
> 
> So .. what's the good / proper / acceptable / secure way of reading in
> URLs in PHP or .. isn't there one?

cURL is the best one in my experience, but you have to manage security
yourself. Meaning: Remember to escape/encode data.

http://php.net/manual/en/book.curl.php

> Cheers
> J
> 
> -- 
> 01723 376477
> 
> Cost-free marketing: http://www.flowmarketing.co.uk/
> 
> Affordable marketing guidance for small businesses:
> http://www.amilliontweaks.co.uk/
> 
> Effective marketing services for SMEs: coming soon at
> http://www.surgemarketing.co.uk
> 
> Professional Internet marketing consultancy:
> http://www.johnallsopp.co.uk
> 
> 
> -- 
> 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