OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 30 Jan 2004 19:09:33 -0000 Issue 2561

php-general-digest-helplists.php.net
Date: Fri Jan 30 2004 - 13:09:33 CST


php-general Digest 30 Jan 2004 19:09:33 -0000 Issue 2561

Topics (messages 176306 through 176387):

Am I missing Something
        176306 by: Phillip S. Baker
        176317 by: Stuart
        176340 by: Marek Kilimajer

Re: session management
        176307 by: Nadim Attari
        176335 by: Jeff McKeon

Why are my style sheets all listed on one line?
        176308 by: Freedomware
        176309 by: David OBrien
        176311 by: Freedomware
        176312 by: Pavel Jartsev
        176315 by: Freedomware
        176319 by: Ford, Mike [LSS]
        176327 by: Freedomware
        176345 by: Chris W

Re: locking to domain
        176310 by: Pavel Jartsev
        176334 by: Ryan A

PHP timeout
        176313 by: Mario
        176318 by: Raditha Dissanayake
        176325 by: Mario
        176326 by: Raditha Dissanayake
        176328 by: Mario
        176329 by: Raditha Dissanayake
        176336 by: Mario

PHP Social Software
        176314 by: Ralph

OOP methodology
        176316 by: Chris Neale
        176320 by: Raditha Dissanayake
        176322 by: electroteque
        176324 by: electroteque
        176337 by: Roman Neuhauser
        176362 by: Justin Patrin

PHP Style Switchers - Recommendations?
        176321 by: Freedomware

Re: parsing variables inside a variable?
        176323 by: Ford, Mike [LSS]
        176331 by: jimbo
        176332 by: jimbo
        176348 by: Ford, Mike [LSS]
        176351 by: Justin Patrin
        176354 by: John W. Holmes

Re: OOP methodology{O|T} kinda'
        176330 by: Jay Blanchard
        176363 by: Justin Patrin
        176364 by: Jay Blanchard
        176365 by: Chris Boget
        176369 by: Kelly Hallman
        176376 by: Ajai Khattri

tourico
        176333 by: Diana Castillo
        176347 by: Lucian Cozma

Re: phpCollab on shared server?
        176338 by: Marc A. Garrett

Re: Size of Arrays
        176339 by: Gandolf
        176341 by: Stuart

Request for files
        176342 by: Marco Schuler

Transferring an initiated Session to a Browser !!
        176343 by: Admin - CpanelPlus
        176346 by: Matt Matijevich
        176356 by: John W. Holmes

Re: OT, Maybe: Question Re: Apache/Macintosh Platform
        176344 by: Roddie Grant

Document Management and publishing
        176349 by: Jon Shoberg
        176377 by: memoimyself.yahoo.com.br

diff between script_filename, path_translated
        176350 by: John Schulz
        176353 by: John W. Holmes
        176358 by: John Schulz

text&image
        176352 by: Maciek Hofstede
        176355 by: John W. Holmes
        176357 by: Ajai Khattri
        176359 by: Maciek Hofstede
        176360 by: Ajai Khattri
        176361 by: Raditha Dissanayake

Comparing multiple Mysql tables to find duplicates
        176366 by: Chris Bruce
        176367 by: Raditha Dissanayake
        176368 by: Chris Bruce
        176370 by: John W. Holmes
        176371 by: Mike Brum
        176372 by: John W. Holmes
        176373 by: Chris Bruce
        176374 by: Chris Bruce
        176375 by: Raditha Dissanayake

How do you guys do this?
        176378 by: Ryan A
        176379 by: Justin Patrin
        176380 by: Chris W. Parker

Re: Oracle + PHP
        176381 by: Michael Mauch

Logging on to a web based application
        176382 by: Shaun

The PHP Problem
        176383 by: Ash
        176384 by: Gabriel Guzman
        176385 by: Pushpinder Singh
        176386 by: John Nichel
        176387 by: memoimyself.yahoo.com.br

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


Greetings all,

I am running version 4.3.4 of PHP.
Fairly recently. I am trying to call a pretty basic programming tool.
Maybe I am just really tired, or something but I am not getting what is
going on.
Is there something I am missing.

I am pulling a SQL call on a date to get the month. I am using Date_format
and the %c to get the Month in numeric format.
The I plug it into a variable and my intention is to call it as the index
of an array.
Nothing prints.

When I turn on all notices I get a notice that it is an undefined index.
What the heck is going on??

Thanks

Phillip

attached mail follows:


Phillip S. Baker wrote:
> I am running version 4.3.4 of PHP.
> Fairly recently. I am trying to call a pretty basic programming tool.
> Maybe I am just really tired, or something but I am not getting what is
> going on.
> Is there something I am missing.
>
> I am pulling a SQL call on a date to get the month. I am using
> Date_format and the %c to get the Month in numeric format.
> The I plug it into a variable and my intention is to call it as the
> index of an array.
> Nothing prints.
>
> When I turn on all notices I get a notice that it is an undefined index.
> What the heck is going on??

Sorry, left my mind reading helmet at home today. How about sharing some
code.

--
Stuart

attached mail follows:


You have: select date_format('%c', date_column) ....
You need: select date_format('%c', date_column) AS date_column ....

Else the column name in the result is "date_format('%c', date_column)".

Phillip S. Baker wrote:

> Greetings all,
>
> I am running version 4.3.4 of PHP.
> Fairly recently. I am trying to call a pretty basic programming tool.
> Maybe I am just really tired, or something but I am not getting what is
> going on.
> Is there something I am missing.
>
> I am pulling a SQL call on a date to get the month. I am using
> Date_format and the %c to get the Month in numeric format.
> The I plug it into a variable and my intention is to call it as the
> index of an array.
> Nothing prints.
>
> When I turn on all notices I get a notice that it is an undefined index.
> What the heck is going on??
>
> Thanks
>
> Phillip
>

attached mail follows:


Handling Session with PHP 4
http://www.zend.com/zend/tut/session.php
(Feb 15, 2000)

Session Authentication
http://www.zend.com/zend/spotlight/sessionauth7may.php
(May 15, 2001)

Custom Session Handling
http://www.zend.com/zend/spotlight/code-gallery-wade8.php
(April 30, 2003)

=======================
Maintaining State On The Web - An overview
http://www.zend.com/zend/art/maintainingstate.php
(November 8, 2001)

Beginner's Guide to URL Rewriting
http://www.sitepoint.com/article/910
(October 22nd 2002)

 Forums de WRI -> URL Rewriting et .htaccess
http://www.webrankinfo.com/forums/forum_12.htm
(... in French)

attached mail follows:


Here's how I do it.....

User table in mysql

UserID, username, password, admin, read, write
1001, John, *#&(&(, 0, 1, 0
1002, betty, KD)&#(&S, 1, 1, 1

Create a login form.

Get their username and password,

Run a query to pull the record where username and password match

If the username is in the table and the password is correct then

$_SESSION['userid'] = UserID (pulled from db query)
$_SESSION['admin'] = admin
$_SESSION['read'] = read
$_SESSION['write'] = write

Then create a function to check permissions based on the session
variable.

For instance if a page has a form for editing information, before
loading the form check to see if the
Current $_SESSION['write'] variable is set to '1', if so load the form,
if not then don't.

May not be the best way of doing things but it works well for me.

Jeff McKeon
IT Manager
Telaurus Communications LLC
jmckeontelaurus.com
(973) 889-8990 ex 209

***The information contained in this communication is confidential. It
is intended only for the sole use of the recipient named above and may
be legally privileged. If the reader of this message is not the intended
recipient, you are hereby notified that any dissemination, distribution
or copying of this communication, or any of its contents or attachments,
is expressly prohibited. If you have received this communication in
error, please re-send it to the sender and delete the original message,
and any copy of it, from your computer system. Thank You.***

> -----Original Message-----
> From: ajay [mailto:abra9823mail.usyd.edu.au]
> Sent: Friday, January 30, 2004 12:56 AM
> To: php-generallists.php.net
> Subject: Re: [PHP] session management
>
>
> hi!
>
> well i do have a MySQL database. The scenario is this, i dont
> want to use cookies or do any URL rewriting. i'm looking for
> something that mirrors J2EE's Session object that contains
> information about the user, their security level(user/admin
> etc) and this information can then be verified before each
> request. There would ofcourse be an expiry on the object. Is
> there a prewritten framework/class to handle this?
>
> thanks
>
> regards
>
> --
> ajay
> ---------------
> Who Dares Wins
>
> -------------------------------------------------
> This mail sent through IMP: www-mail.usyd.edu.au
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


I'm still fairly new to PHP, so there may be a simple fix for my
relatively trivial complaint.

I'm using an included page as a head section. It works fine, except that
when preview a page and view the source, all the style sheets are
displayed on one looooong line, like this:

</script><link href="../../css/ref.css" rel="stylesheet"
type="text/css"><link href="../../css/na/a1.css" rel="stylesheet"
type="text/css" /><link href=".css" rel="stylesheet" type="text/css"
/><link href="../../css/nations.css" rel="alternate stylesheet"
type="text/css" title="Nations" />

It looks like they won't scroll across THIS page, so here's a more clear
example:

<stylesheet1><stylesheet2><stylesheet3><stylesheet4>

What I want is a normal style sheet display, like this:

<stylesheet1>
<stylesheet2>
<stylesheet3>
<stylesheet4>

Do you know what causes this and if there's a fix? I posted some code
from the head section and main page below.

Thanks!

* * * * * * * * * *

HEAD SECTION (included page; ../../includes/ref/head.php)

<?php
$todayDate = date("m-d-Y");
echo '<title>Freedomware &gt; ' . $myname . '</title>';
echo '<meta name="description" content="' . $myname . ' versus
Microsoft" />';
echo '<meta name="keywords" content="' . $myname . ' versus Microsoft" />';
echo '<meta name="mssmarttagspreventparsing" content="true" />';
echo '<meta http-equiv="content-Type" content="text/html;
charset=iso-8859-1" />';
echo '<meta name="author" content="David Blomstrom" />';
echo '<script src="' . $periods . 'js/swapclass.js"
type="text/javascript"></script>';
echo '<script language="JavaScript" src="' . $periods .
'js/sort.js"></script>';
echo '<script language="JavaScript" src="' . $periods .
'js/ss.js"></script>';
echo '<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
   window.open(theURL,winName,features);
}
//-->
</script>';
echo '<link href="' . $periods . 'css/ref.css" rel="stylesheet"
type="text/css">';
if($includea1 == TRUE){
     echo '<link href="' . $periods . 'css/' . $continentcode .
'/a1.css" rel="stylesheet" type="text/css" />';
}
echo '<link href="' . $mycss . '.css" rel="stylesheet" type="text/css" />';
echo '<link href="' . $periods . 'css/nations.css" rel="alternate
stylesheet" type="text/css" title="Nations" />';
echo '<link href="' . $periods . 'css/themes/peace.css" rel="alternate
stylesheet" type="text/css" title="Peace" />';
echo '<link href="' . $periods . 'css/themes/war.css" rel="alternate
stylesheet" type="text/css" title="War" />';
echo '<link href="' . $periods . 'css/themes/pat' . $countrycode .
'.css" rel="alternate stylesheet" type="text/css" title="Patriotism" />';
echo '<link href="' . $periods . 'css/themes/nationalism.css"
rel="alternate stylesheet" type="text/css" title="Nationalism" />';
echo '<link href="' . $periods . 'css/themes/corporate.css"
rel="alternate stylesheet" type="text/css" title="Corporate" />';
echo '<link href="' . $periods . 'css/themes/conspiracy.css"
rel="alternate stylesheet" type="text/css" title="Conspiracy" />';
echo '<link href="' . $periods . 'css/themes/media.css" rel="alternate
stylesheet" type="text/css" title="Media" />';
echo '<link href="' . $periods . 'css/themes/atlantic.css"
rel="alternate stylesheet" type="text/css" title="Atlantic" />';
echo '<link href="' . $periods . 'css/themes/indian.css" rel="alternate
stylesheet" type="text/css" title="Indian" />';
echo '<link rel="SHORTCUT ICON" href="../../../../us/aaa/favicon.ico" />';
?>

* * * * * * * * * *
MAIN PAGE

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<?php
$myname = 'Alaska';
$mynickname = 'Land of the Midnight Sun';
$mycode = 'ak';
$mywebring = '/world/na/us/ak/';
$myregion = 'north';
$mycountry = 'United States';
$mycontinent = 'North America';
$countrycode = 'us';
$continentcode = 'na';
$periods = '../../';
$tlperiods = '../';
$includea1 = TRUE;
include ("../../includes/ref/head.php");
?>
<link rel="stylesheet" type="text/css" media="screen" title="User
Defined Style" href="<?php echo
(!$sitestyle)?'aaa':$sitestyle ?>.css" />
<script language="JavaScript" src="../../../js/ss.js"></script>
<link href="../../../xss/nations.css" rel="stylesheet" type="text/css">
<link href="../../../css/nations.css" rel="alternate stylesheet"
type="text/css" title="Nations" />
</head>

attached mail follows:


At 03:16 AM 1/30/2004, Freedomware wrote:
>I'm still fairly new to PHP, so there may be a simple fix for my
>relatively trivial complaint.
>
>I'm using an included page as a head section. It works fine, except that
>when preview a page and view the source, all the style sheets are
>displayed on one looooong line, like this:
>
></script><link href="../../css/ref.css" rel="stylesheet"
>type="text/css"><link href="../../css/na/a1.css" rel="stylesheet"
>type="text/css" /><link href=".css" rel="stylesheet" type="text/css"
>/><link href="../../css/nations.css" rel="alternate stylesheet"
>type="text/css" title="Nations" />
>
>It looks like they won't scroll across THIS page, so here's a more clear
>example:
>
><stylesheet1><stylesheet2><stylesheet3><stylesheet4>

You need a \n at the end of each line inside the quote
like
echo "<stylesheet>\n";

\n is newline
-Dave

>What I want is a normal style sheet display, like this:
>
><stylesheet1>
><stylesheet2>
><stylesheet3>
><stylesheet4>
>
>Do you know what causes this and if there's a fix? I posted some code from
>the head section and main page below.
>
>Thanks!
>
>
>* * * * * * * * * *
>
>HEAD SECTION (included page; ../../includes/ref/head.php)
>
><?php
>$todayDate = date("m-d-Y");
>echo '<title>Freedomware &gt; ' . $myname . '</title>';
>echo '<meta name="description" content="' . $myname . ' versus Microsoft" />';
>echo '<meta name="keywords" content="' . $myname . ' versus Microsoft" />';
>echo '<meta name="mssmarttagspreventparsing" content="true" />';
>echo '<meta http-equiv="content-Type" content="text/html;
>charset=iso-8859-1" />';
>echo '<meta name="author" content="David Blomstrom" />';
>echo '<script src="' . $periods . 'js/swapclass.js"
>type="text/javascript"></script>';
>echo '<script language="JavaScript" src="' . $periods .
>'js/sort.js"></script>';
>echo '<script language="JavaScript" src="' . $periods . 'js/ss.js"></script>';
>echo '<script language="JavaScript" type="text/JavaScript">
><!--
>function MM_openBrWindow(theURL,winName,features) { //v2.0
> window.open(theURL,winName,features);
>}
>//-->
></script>';
>echo '<link href="' . $periods . 'css/ref.css" rel="stylesheet"
>type="text/css">';
>if($includea1 == TRUE){
> echo '<link href="' . $periods . 'css/' . $continentcode . '/a1.css"
> rel="stylesheet" type="text/css" />';
>}
>echo '<link href="' . $mycss . '.css" rel="stylesheet" type="text/css" />';
>echo '<link href="' . $periods . 'css/nations.css" rel="alternate
>stylesheet" type="text/css" title="Nations" />';
>echo '<link href="' . $periods . 'css/themes/peace.css" rel="alternate
>stylesheet" type="text/css" title="Peace" />';
>echo '<link href="' . $periods . 'css/themes/war.css" rel="alternate
>stylesheet" type="text/css" title="War" />';
>echo '<link href="' . $periods . 'css/themes/pat' . $countrycode . '.css"
>rel="alternate stylesheet" type="text/css" title="Patriotism" />';
>echo '<link href="' . $periods . 'css/themes/nationalism.css"
>rel="alternate stylesheet" type="text/css" title="Nationalism" />';
>echo '<link href="' . $periods . 'css/themes/corporate.css" rel="alternate
>stylesheet" type="text/css" title="Corporate" />';
>echo '<link href="' . $periods . 'css/themes/conspiracy.css"
>rel="alternate stylesheet" type="text/css" title="Conspiracy" />';
>echo '<link href="' . $periods . 'css/themes/media.css" rel="alternate
>stylesheet" type="text/css" title="Media" />';
>echo '<link href="' . $periods . 'css/themes/atlantic.css" rel="alternate
>stylesheet" type="text/css" title="Atlantic" />';
>echo '<link href="' . $periods . 'css/themes/indian.css" rel="alternate
>stylesheet" type="text/css" title="Indian" />';
>echo '<link rel="SHORTCUT ICON" href="../../../../us/aaa/favicon.ico" />';
>?>
>
>
>* * * * * * * * * *
>MAIN PAGE
>
><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
><?php $myname = 'Alaska'; $mynickname = 'Land of the Midnight Sun';
>$mycode = 'ak'; $mywebring = '/world/na/us/ak/'; $myregion = 'north';
>$mycountry = 'United States'; $mycontinent = 'North America'; $countrycode
>= 'us'; $continentcode = 'na'; $periods = '../../'; $tlperiods = '../';
>$includea1 = TRUE; include ("../../includes/ref/head.php"); ?> -- PHP
>General Mailing List (http://www.php.net/) To unsubscribe, visit:
>http://www.php.net/unsub.php

attached mail follows:


David Obrien wrote:

> You need a \n at the end of each line inside the quote
> like
> echo "<stylesheet>\n";
>
> \n is newline
> -Dave

Thanks for the tip. However, I must be doing something wrong. \n didn't
work, so I searched Google for PHP + "new line" and found a page that
said you have to use \r\n if you're working on a Windows platform. But
that doesn't seem to work, either. (If you do use a special new line for
a Windows computer, then publish your website to a Linux server, will
that cause problems?)

Do I need to modify the new line code because my echo statements are
enclosed in single quotes (' '), rather than double quotes (" ")?

I pasted my entire include page code below. Thanks!

<?php
$todayDate = date("m-d-Y");
echo '<title>Freedomware &gt; ' . $myname . '</title>';
echo '<meta name="description" content="' . $myname . ' versus
Microsoft" />';
echo '<meta name="keywords" content="' . $myname . ' versus Microsoft" />';
echo '<meta name="mssmarttagspreventparsing" content="true" />';
echo '<meta http-equiv="content-Type" content="text/html;
charset=iso-8859-1" />';
echo '<meta name="author" content="David Blomstrom" />';
echo '<script src="' . $periods . 'js/swapclass.js"
type="text/javascript"></script>';
echo '<script language="JavaScript" src="' . $periods .
'js/sort.js"></script>';
echo '<script language="JavaScript" src="' . $periods .
'js/ss.js"></script>';
echo '<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
   window.open(theURL,winName,features);
}
//-->
</script>';
echo '<link href="' . $periods . 'css/ref.css" rel="stylesheet"
type="text/css">';
if($includea1 == TRUE){
     echo '<link href="' . $periods . 'css/' . $continentcode .
'/a1.css" rel="stylesheet" type="text/css" />';
}
echo '<link href="' . $mycss . '.css" rel="stylesheet" type="text/css" />';
echo '<link href="' . $periods . 'css/nations.css" rel="alternate
stylesheet" type="text/css" title="Nations" />\r\n';
echo '<link href="' . $periods . 'css/themes/peace.css" rel="alternate
stylesheet" type="text/css" title="Peace" />\r\n';
echo '<link href="' . $periods . 'css/themes/war.css" rel="alternate
stylesheet" type="text/css" title="War" />\r\n';
echo '<link href="' . $periods . 'css/themes/pat' . $countrycode .
'.css" rel="alternate stylesheet" type="text/css" title="Patriotism"
/>\r\n';
echo '<link href="' . $periods . 'css/themes/nationalism.css"
rel="alternate stylesheet" type="text/css" title="Nationalism" />\r\n';
echo '<link href="' . $periods . 'css/themes/corporate.css"
rel="alternate stylesheet" type="text/css" title="Corporate" />\r\n';
echo '<link href="' . $periods . 'css/themes/conspiracy.css"
rel="alternate stylesheet" type="text/css" title="Conspiracy" />\r\n';
echo '<link href="' . $periods . 'css/themes/media.css" rel="alternate
stylesheet" type="text/css" title="Media" />\r\n';
echo '<link href="' . $periods . 'css/themes/education.css"
rel="alternate stylesheet" type="text/css" title="Education" />\r\n';
echo '<link href="' . $periods . 'css/themes/911.css" rel="alternate
stylesheet" type="text/css" title="911" />\r\n';
echo '<link href="' . $periods . 'css/themes/bush.css" rel="alternate
stylesheet" type="text/css" title="Bush" />';
echo '<link href="' . $periods . 'css/themes/campaign.css"
rel="alternate stylesheet" type="text/css" title="Campaign" />\r\n';
echo '<link href="' . $periods . 'css/themes/na.css" rel="alternate
stylesheet" type="text/css" title="NA" />\r\n';
echo '<link href="' . $periods . 'css/themes/sa.css" rel="alternate
stylesheet" type="text/css" title="SA" />\r\n';
echo '<link href="' . $periods . 'css/themes/europe.css" rel="alternate
stylesheet" type="text/css" title="Europe" />\r\n';
echo '<link href="' . $periods . 'css/themes/asia.css" rel="alternate
stylesheet" type="text/css" title="Asia" />\r\n';
echo '<link href="' . $periods . 'css/themes/mideast.css" rel="alternate
stylesheet" type="text/css" title="Mideast" />\r\n';
echo '<link href="' . $periods . 'css/themes/africa.css" rel="alternate
stylesheet" type="text/css" title="Africa" />\r\n';
echo '<link href="' . $periods . 'css/themes/aus.css" rel="alternate
stylesheet" type="text/css" title="Australia" />\r\n';
echo '<link href="' . $periods . 'css/themes/pacific.css" rel="alternate
stylesheet" type="text/css" title="Pacific" />\r\n';
echo '<link href="' . $periods . 'css/themes/atlantic.css"
rel="alternate stylesheet" type="text/css" title="Atlantic" />\r\n';
echo '<link href="' . $periods . 'css/themes/indian.css" rel="alternate
stylesheet" type="text/css" title="Indian" />\r\n';
echo '<link rel="SHORTCUT ICON" href="../../../../us/aaa/favicon.ico" />';
?>

attached mail follows:


Freedomware wrote:
> David Obrien wrote:
>
>> You need a \n at the end of each line inside the quote
>> like
>> echo "<stylesheet>\n";
>>
>> \n is newline
>> -Dave
>
> ...
>
> Do I need to modify the new line code because my echo statements are
> enclosed in single quotes (' '), rather than double quotes (" ")?
>

"newline"-character should be inside double quotes ("\n").

For example:

instead of:

echo '<link href="' . $periods . 'css/nations.css" rel="alternate
stylesheet" type="text/css" title="Nations" />\r\n';

use:

echo '<link href="' . $periods . 'css/nations.css" rel="alternate
stylesheet" type="text/css" title="Nations" />'."\n";

Hope that helps. :)

--
Pavel a.k.a. Papi

attached mail follows:


Got it. It took me a while to home in on the period.

Thanks for the tips!

Pavel Jartsev wrote:

> "newline"-character should be inside double quotes ("\n").
>
> For example:
>
> instead of:
>
> echo '<link href="' . $periods . 'css/nations.css" rel="alternate
> stylesheet" type="text/css" title="Nations" />\r\n';
>
> use:
>
> echo '<link href="' . $periods . 'css/nations.css" rel="alternate
> stylesheet" type="text/css" title="Nations" />'."\n";
>
>
>
> Hope that helps. :)
>

attached mail follows:


On 30 January 2004 08:55, Freedomware wrote:

> David Obrien wrote:
>
> > You need a \n at the end of each line inside the quote like
> > echo "<stylesheet>\n";
> >
> > \n is newline
> > -Dave

Another way you could go, as this is mostly HTML with some PHP values thrown
in, is to write it as such -- then all your newlines are present exactly as
they appear. This would look something like:

 <?php
 $todayDate = date("m-d-Y");
 ?>
 <title>Freedomware &gt; <?php echo $myname ?></title>
 <meta name="description" content="<?php echo $myname ?> versus
  Microsoft" />
 <meta name="keywords" content="<?php echo $myname ?> versus
  Microsoft" />
 <meta name="mssmarttagspreventparsing" content="true" />
 <meta http-equiv="content-Type"
  content="text/html; charset=iso-8859-1" />
 <meta name="author" content="David Blomstrom" />
 <script src="<?php echo $periods ?>js/swapclass.js"
  type="text/javascript"></script>
 <script language="JavaScript"
  src="<?php echo $periods ?>js/sort.js"></script>'
 <script language="JavaScript"
  src="<?php echo $periods ?>js/ss.js"></script>
 <script language="JavaScript" type="text/JavaScript">
 <!--
 function MM_openBrWindow(theURL,winName,features) { //v2.0
    window.open(theURL,winName,features);
 }
 //-->
 </script>
 <link href="<?php echo $periods ?>css/ref.css" rel="stylesheet"
  type="text/css">
 <?php
   if($includea1){ ?>
 <link href="<?php echo $periods ?>css/<?php echo $continentcode ?>/a1.css"
  rel="stylesheet" type="text/css" />
 <?php
   }
 ?>
 <link href="<?php echo $mycss ?>.css" rel="stylesheet"
  type="text/css" />
 echo '<link href="' . $periods .

etc. etc.

By the way, the test

  if($includea1 == TRUE)

should be written as just

  if($includea1)

It has exactly the same outcome, but is both more readable (if you've named
your variables suitably) and more efficient (since you've saved the
redundant comparison operation).

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.fordleedsmet.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

attached mail follows:


Wow, thanks for the tips. That makes life a lot simpler!

Mike Ford wrote:

> Another way you could go, as this is mostly HTML with some PHP values thrown
> in, is to write it as such -- then all your newlines are present exactly as
> they appear. This would look something like:
>
>
> By the way, the test
>
> if($includea1 == TRUE)
>
> should be written as just
>
> if($includea1)
>
> It has exactly the same outcome, but is both more readable (if you've named
> your variables suitably) and more efficient (since you've saved the
> redundant comparison operation).

attached mail follows:


Freedomware wrote:

> I'm still fairly new to PHP, so there may be a simple fix for my
> relatively trivial complaint.
>
> I'm using an included page as a head section. It works fine, except
> that when preview a page and view the source, all the style sheets are
> displayed on one looooong line, like this:
>

It sounds like you have figured out the problem, however I thought I
would share another method that I like to use in similar situations.

<?php
$todayDate = date("m-d-Y");
print<<<END
<title>Freedomware &gt; $myname </title>
<meta name="description" content=" $myname versus Microsoft" />
<meta name="keywords" content=" $myname versus Microsoft" />
<meta name="mssmarttagspreventparsing" content="true" />
<meta http-equiv="content-Type" content="text/html; charset=iso-8859-1" />
<meta name="author" content="David Blomstrom" />
<script src=" $periods js/swapclass.js" type="text/javascript"></script>
<script language="JavaScript" src=" $periods js/sort.js"></script>
<script language="JavaScript" src=" $periods js/ss.js"></script>
<script language="JavaScript" type="text/JavaScript">
END;
?>

there is one pit fall on this method that I run into sometimes. If your
code is indented like it should be that moves the "END;" away from the
beginning of the line and it won't work. So this wouldn't work,

while(for a while){
    if(this){
        do stuff;
        print<<<END
        bunch of stuff here
        END;
        do more stuff;
    }
    end of while
}
The "END;" must be the first text on the line, so it has to be like this,

while(for a while){
    if(this){
        do stuff;
        print<<<END
        bunch of stuff here
END;
        do more stuff;
    }
    end of while
}

Chris W

attached mail follows:


Ryan A wrote:
> Hey all,
> I have a rather simple need that I am sure a lot of you must have gone
> through,
> I need a bit of code so that the script can run only at "something.com"..I
> am generating
> a MD5 license "key" based on that...
>
> Problem that I am having is.. wont I need 2 "keys" to see if the domain is
> with a "www"
> (eg www.something.com) or is being run without the "www" (eg:
> http://something.com) ?
> I'm pretty sure it can be done with one key....but how?
>

Maybe i've misunderstood the question, but U can check variable
$_SERVER['HTTP_HOST'] and make decisions according to it.

Hope that helps. :)

--
Pavel a.k.a. Papi

attached mail follows:


Hey,

Sorry, when I posted this yesterday it was towards the end of my day and I
was not thinking straight, by the time I got up today I had it figured out
:-)

Thanks anyway to everyone who replied.

Cheers,
-Ryan

On 1/30/2004 7:38:27 AM, Justin French (justinindent.com.au) wrote:
> On Friday, January 30, 2004, at 02:13 PM, Ryan A wrote:
>
> > I have a rather simple need that I am sure a lot of you must have gone
> > through, I need a bit of code so that the script can run only at
> > "something.com"..I
> > am generating a MD5 license "key" based on that...
> >
> > Problem that I am having is.. wont I need 2 "keys" to see if the
> > domain is
> > with a "www" (eg www.something.com) or is being run without the "www"
> > (eg:
> > http://something.com) ?
> I'm pretty sure it can be done with one
> > key....but how?
>

attached mail follows:


Hi all

I have a winXP machine on a network running IIS (PHP and MySQL is installed)

I have recently moved from one machine to another and after setting up IIS
and the rest and try to run few PHP scripts they just run forever or
timeout. I believe the problem is with the security permission on ...
somewhere, since I've been doing the same setup in several machines and it
works fine (not in this network).

Now, the funny thing is that most simple php script run fast after playing
with the permissions but more complicating scripts or the phpMyAdmin just
timesout.

Does anyone know what the hell is going on?

Mario

attached mail follows:


Mario,

Please don't reply to a message when you want to ask a question compose
a new thread instead.

Anyway from what you have described it sounds like you have a firewall
that's blocking the mysql port. Somefirewalls just drop the packets
instead of denying the connection. That way the script just hangs an
eternit waiting for a packet that never arrives. Try stopping your
firewall completely .

Mario wrote:

>Hi all
>
>I have a winXP machine on a network running IIS (PHP and MySQL is installed)
>
>I have recently moved from one machine to another and after setting up IIS
>and the rest and try to run few PHP scripts they just run forever or
>timeout. I believe the problem is with the security permission on ...
>somewhere, since I've been doing the same setup in several machines and it
>works fine (not in this network).
>
>Now, the funny thing is that most simple php script run fast after playing
>with the permissions but more complicating scripts or the phpMyAdmin just
>timesout.
>
>Does anyone know what the hell is going on?
>
>Mario
>
>
>

--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.

attached mail follows:


thanks for the reply Raditha.

I don't have a firewall setup on this PC

Is there a chance it's a permissions problem?
And why do few simple scripts run fine though?

Thanks

Mario
----- Original Message -----
From: "Raditha Dissanayake" <jabberraditha.com>
To: "Mario" <developericop.gr>
Cc: <php-generallists.php.net>
Sent: Friday, January 30, 2004 12:14 PM
Subject: Re: [PHP] PHP timeout

> Mario,
>
> Please don't reply to a message when you want to ask a question compose
> a new thread instead.
>
> Anyway from what you have described it sounds like you have a firewall
> that's blocking the mysql port. Somefirewalls just drop the packets
> instead of denying the connection. That way the script just hangs an
> eternit waiting for a packet that never arrives. Try stopping your
> firewall completely .
>
>
>
>
> Mario wrote:
>
> >Hi all
> >
> >I have a winXP machine on a network running IIS (PHP and MySQL is
installed)
> >
> >I have recently moved from one machine to another and after setting up
IIS
> >and the rest and try to run few PHP scripts they just run forever or
> >timeout. I believe the problem is with the security permission on ...
> >somewhere, since I've been doing the same setup in several machines and
it
> >works fine (not in this network).
> >
> >Now, the funny thing is that most simple php script run fast after
playing
> >with the permissions but more complicating scripts or the phpMyAdmin just
> >timesout.
> >
> >Does anyone know what the hell is going on?
> >
> >Mario
> >
> >
> >
>
>
> --
> Raditha Dissanayake.
> ------------------------------------------------------------------------
> http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
> Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
> Graphical User Inteface. Just 150 KB | with progress bar.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


Well the situation you have described are the typical symptoms of a
firewall eating up packets. (Simple scripts running fine and those that
connect to networking timing out) How about installing both the php
engine and mysql on the same machine for testing?

Mario wrote:

>thanks for the reply Raditha.
>
>I don't have a firewall setup on this PC
>
>Is there a chance it's a permissions problem?
>And why do few simple scripts run fine though?
>
>Thanks
>
>Mario
>----- Original Message -----
>From: "Raditha Dissanayake" <jabberraditha.com>
>To: "Mario" <developericop.gr>
>
>

--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.

attached mail follows:


both php and mysql is on the same machine.

even running the following timesout:
<?php

if (!($mylink = mysql_pconnect("localhost","*****","******")))

print "<h3>Problem connecting to the database server</h3>\n";

exit();

}

mysql_select_db("xxxxxxx") or die ("<h3>Problem connecting to the
database</h3><br>Description:" . mysql_error());

?>

----- Original Message -----
From: "Raditha Dissanayake" <jabberraditha.com>
To: "Mario" <developericop.gr>
Cc: <php-generallists.php.net>
Sent: Friday, January 30, 2004 1:01 PM
Subject: Re: [PHP] PHP timeout

>
> Well the situation you have described are the typical symptoms of a
> firewall eating up packets. (Simple scripts running fine and those that
> connect to networking timing out) How about installing both the php
> engine and mysql on the same machine for testing?
>
>
> Mario wrote:
>
> >thanks for the reply Raditha.
> >
> >I don't have a firewall setup on this PC
> >
> >Is there a chance it's a permissions problem?
> >And why do few simple scripts run fine though?
> >
> >Thanks
> >
> >Mario
> >----- Original Message -----
> >From: "Raditha Dissanayake" <jabberraditha.com>
> >To: "Mario" <developericop.gr>
> >
> >
>
> --
> Raditha Dissanayake.
> ------------------------------------------------------------------------
> http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
> Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
> Graphical User Inteface. Just 150 KB | with progress bar.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


Hi,

Make sure the mysql service is started and make sure that there isn't
anything else competing for the same port (3306) beyond that i am afraid
i cannot help as i am not a windows expert.

Mario wrote:

>both php and mysql is on the same machine.
>
>even running the following timesout:
><?php
>
>if (!($mylink = mysql_pconnect("localhost","*****","******")))
>
>print "<h3>Problem connecting to the database server</h3>\n";
>
>exit();
>
>}
>
>mysql_select_db("xxxxxxx") or die ("<h3>Problem connecting to the
>database</h3><br>Description:" . mysql_error());
>
>?>
>
>
>
>
>
--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.

attached mail follows:


it looks like it has nothing to do with MySQL and just with php

I'm running a simple script like
$x=23;

echo $x;

and it displays the number 23 properly, but the page keeps loading like
there is something else to load too.

----- Original Message -----
From: "Raditha Dissanayake" <jabberraditha.com>
To: "Mario" <developericop.gr>; <php-generallists.php.net>
Sent: Friday, January 30, 2004 1:33 PM
Subject: Re: [PHP] PHP timeout

> Hi,
>
> Make sure the mysql service is started and make sure that there isn't
> anything else competing for the same port (3306) beyond that i am afraid
> i cannot help as i am not a windows expert.
>
>
> Mario wrote:
>
> >both php and mysql is on the same machine.
> >
> >even running the following timesout:
> ><?php
> >
> >if (!($mylink = mysql_pconnect("localhost","*****","******")))
> >
> >print "<h3>Problem connecting to the database server</h3>\n";
> >
> >exit();
> >
> >}
> >
> >mysql_select_db("xxxxxxx") or die ("<h3>Problem connecting to the
> >database</h3><br>Description:" . mysql_error());
> >
> >?>
> >
> >
> >
> >
> >
> --
> Raditha Dissanayake.
> ------------------------------------------------------------------------
> http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
> Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
> Graphical User Inteface. Just 150 KB | with progress bar.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


Anybody know of any PHP based Social Software projects?

attached mail follows:


This is a long one - I'm trying to get to grips with my understanding of
OOP.

I'm not sure that I understand object oriented programming as well as I
could to benefit from using it in PHP. Although I've used it to produce
working applications, of the few objects I've produced nearly all have
carried too much weight and functionality (one object for both HTML
generation and DB interaction etc) and several have been extensions of the
others.

I was hoping someone might be able to check my logic.

One of the main functions of the application I'm working on at the moment,
my first use of OOP in PHP, is to iterate through a hierarchy of retail
outlets and extract information from a database based on each location in
the hierarchy. A template SQL statement is parsed and parts are replaced
with information from the hierarchy. This query is then executed, and the
results are placed in a table within a static HTML file stored in a
directory structure which mirrors the structure of the retail outlet
hierarchy. I've done it this way because the traffic to the site is
expected to be high and the information changes infrequently, so static
pages will ensure good performance.

The way I've written the application isn't up to much IMO, using objects in
a primitive way akin to a PC newbie using the CD ROM drive as a coffee cup
holder - ie. does the job but it's not quite how it was intended to be
used.

I've got one big object (treeMapper) that does everything, which includes
(over and above the database functions, file input and output, HTML
generation and string formatting). It has two main methods. Process() and
taskMaster(). The first method iterates one unit through the hierarchy and
then calls taskMaster() which takes values Process() has changed in the
object and uses them to query the database and to format the results into
an HTML table and output to a file (as described above).

In the code for the class, taskmaster() is empty. When I want to use the
class, I create a new class which extends treeMapper and then overrides the
taskMaster function. In this way I get an object which I can reuse for any
report which needs to be made for every store. It works and it's fast, but
this method seems really WRONG!

I started developing this six months ago as a first project in OOP in PHP,
and am starting to see it's limitations - for instance, I need to use the
DB functions for other small tasks on the site, which involves
instantiating a new treeMapper (which is highly inefficient as I won't need
the other 20 methods.). I've also got some handy string manipulation
routines which can't be used without instantiating a treeMapper. So I want
to break it up into smaller chunks, smaller objects which can talk to each
other.

From what I've read, I think I should be using an iterator pattern to
design an object which JUST does the iteration, a database object which
JUST does queries from the database, another iterator object which JUST
does iteration through database results and another object which draws
graphs based on results from the database.

My question is (I know you've been waiting) how best to connect up these
objects, as I only really need one instance of each object for my
application. PHP 5 objects seem easier to deal with (none of this
incomprehensible & notation) and I want to know whether the following is a
good way of doing it and how other people might go about this.

class dbObj
{
var $results;
function dbObj()
        {//set up DB con}
function execQuery()
        {//ODBC query exec - results put in $this->results}
}

class iterator
{
var $currentPos
function iterator()
        {//loads data into iterator}
function reset()
        {//Resets pointer}
function next()
        {//steps forward one item, changes $this->currentPos to whatever.}
}

class HTMLGenerator
{
function HTMLGenerator($dbObj, $iterator)
        {
                $this->dbObj = $dbObj;
                $this->iterator = $iterator;
        }
function MakeHTML()
        {// as you'd expect.
        // refers to $dbObj and $iterator (objects passed by reference in
        // PHP 5)
        // $iterator->currentPos used to parse SQL query
        // eg. $dbObj->execQuery("select...");
        // eg. $dbObj->results used to make HTML;

        // }
function outputToFile()
        {//Saves to File}
}

The main application would then do this:

$q = new dbObj;
$x = new iterator;
$y = new HTMLGenerator($q, $x)

while ($x->next())
{
        $y->MakeHTML();
        $y->outputToFile();
}

Anyone got any thoughts about whether this is a good way to do it? I was
wondering whether instantiating objects should be done within other objects
that need them - if this can be done - but I would only do that in cases
where (for instance) an HTMLGenerator object is instantiated without any
parameters, in which case some logic could be added to do this.

Thanks!

Chris

attached mail follows:


Hi Chris,

Sounds to me like you are pretty much on the right track bearing in mind
that PHP is not the bes language to learn OOP. Even your taskmanager
sounds good, i wouldn't bother with reading up on design patterns just
yet. They are indeed very important and you should definitely study
them, however having spent an year or more doing OOP helps you
understand them better. (others will disagree).

Don't worry about classes become too big either if all the code belongs
in one class it can't be helped. If you look at a fairly large java
program you will find classes that range from 20-30 lines to 2000+ lines.

Chris Neale wrote:

>This is a long one - I'm trying to get to grips with my understanding of
>OOP.
>
>I'm not sure that I understand object oriented programming as well as I
>could to benefit from using it in PHP. Although I've used it to produce
>working applications, of the few objects I've produced nearly all have
>carried too much weight and functionality (one object for both HTML
>generation and DB interaction etc) and several have been extensions of the
>others.
>
>I was hoping someone might be able to check my logic.
>
>One of the main functions of the application I'm working on at the moment,
>my first use of OOP in PHP, is to iterate through a hierarchy of retail
>outlets and extract information from a database based on each location in
>the hierarchy. A template SQL statement is parsed and parts are replaced
>with information from the hierarchy. This query is then executed, and the
>results are placed in a table within a static HTML file stored in a
>directory structure which mirrors the structure of the retail outlet
>hierarchy. I've done it this way because the traffic to the site is
>expected to be high and the information changes infrequently, so static
>pages will ensure good performance.
>
>The way I've written the application isn't up to much IMO, using objects in
>a primitive way akin to a PC newbie using the CD ROM drive as a coffee cup
>holder - ie. does the job but it's not quite how it was intended to be
>used.
>
>I've got one big object (treeMapper) that does everything, which includes
>(over and above the database functions, file input and output, HTML
>generation and string formatting). It has two main methods. Process() and
>taskMaster(). The first method iterates one unit through the hierarchy and
>then calls taskMaster() which takes values Process() has changed in the
>object and uses them to query the database and to format the results into
>an HTML table and output to a file (as described above).
>
>

--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.

attached mail follows:


Here is my advice, check out the pear code, it will help you dearly get the
grips of how to setup classes. IMHO i feel pear is a standard, i use most of
the standard but i dont particularly write classes for pear but structure it
similar, but am thinking of porting my error code around pear. Classes are
purely packages which are reusable within projects, try not to get simple
functions with complete classes mixed up, it may not be needed to make a
class at all. Hope this helps.

-----Original Message-----
From: Chris Neale [mailto:chrisnealethemoon.co.uk]
Sent: Friday, January 30, 2004 8:42 PM
To: php-generallists.php.net
Subject: [PHP] OOP methodology

This is a long one - I'm trying to get to grips with my understanding of
OOP.

I'm not sure that I understand object oriented programming as well as I
could to benefit from using it in PHP. Although I've used it to produce
working applications, of the few objects I've produced nearly all have
carried too much weight and functionality (one object for both HTML
generation and DB interaction etc) and several have been extensions of the
others.

I was hoping someone might be able to check my logic.

One of the main functions of the application I'm working on at the moment,
my first use of OOP in PHP, is to iterate through a hierarchy of retail
outlets and extract information from a database based on each location in
the hierarchy. A template SQL statement is parsed and parts are replaced
with information from the hierarchy. This query is then executed, and the
results are placed in a table within a static HTML file stored in a
directory structure which mirrors the structure of the retail outlet
hierarchy. I've done it this way because the traffic to the site is
expected to be high and the information changes infrequently, so static
pages will ensure good performance.

The way I've written the application isn't up to much IMO, using objects in
a primitive way akin to a PC newbie using the CD ROM drive as a coffee cup
holder - ie. does the job but it's not quite how it was intended to be
used.

I've got one big object (treeMapper) that does everything, which includes
(over and above the database functions, file input and output, HTML
generation and string formatting). It has two main methods. Process() and
taskMaster(). The first method iterates one unit through the hierarchy and
then calls taskMaster() which takes values Process() has changed in the
object and uses them to query the database and to format the results into
an HTML table and output to a file (as described above).

In the code for the class, taskmaster() is empty. When I want to use the
class, I create a new class which extends treeMapper and then overrides the
taskMaster function. In this way I get an object which I can reuse for any
report which needs to be made for every store. It works and it's fast, but
this method seems really WRONG!

I started developing this six months ago as a first project in OOP in PHP,
and am starting to see it's limitations - for instance, I need to use the
DB functions for other small tasks on the site, which involves
instantiating a new treeMapper (which is highly inefficient as I won't need
the other 20 methods.). I've also got some handy string manipulation
routines which can't be used without instantiating a treeMapper. So I want
to break it up into smaller chunks, smaller objects which can talk to each
other.

>From what I've read, I think I should be using an iterator pattern to
design an object which JUST does the iteration, a database object which
JUST does queries from the database, another iterator object which JUST
does iteration through database results and another object which draws
graphs based on results from the database.

My question is (I know you've been waiting) how best to connect up these
objects, as I only really need one instance of each object for my
application. PHP 5 objects seem easier to deal with (none of this
incomprehensible & notation) and I want to know whether the following is a
good way of doing it and how other people might go about this.

class dbObj
{
var $results;
function dbObj()
        {//set up DB con}
function execQuery()
        {//ODBC query exec - results put in $this->results}
}

class iterator
{
var $currentPos
function iterator()
        {//loads data into iterator}
function reset()
        {//Resets pointer}
function next()
        {//steps forward one item, changes $this->currentPos to whatever.}
}

class HTMLGenerator
{
function HTMLGenerator($dbObj, $iterator)
        {
                $this->dbObj = $dbObj;
                $this->iterator = $iterator;
        }
function MakeHTML()
        {// as you'd expect.
        // refers to $dbObj and $iterator (objects passed by reference in
        // PHP 5)
        // $iterator->currentPos used to parse SQL query
        // eg. $dbObj->execQuery("select...");
        // eg. $dbObj->results used to make HTML;

        // }
function outputToFile()
        {//Saves to File}
}

The main application would then do this:

$q = new dbObj;
$x = new iterator;
$y = new HTMLGenerator($q, $x)

while ($x->next())
{
        $y->MakeHTML();
        $y->outputToFile();
}

Anyone got any thoughts about whether this is a good way to do it? I was
wondering whether instantiating objects should be done within other objects
that need them - if this can be done - but I would only do that in cases
where (for instance) an HTMLGenerator object is instantiated without any
parameters, in which case some logic could be added to do this.

Thanks!

Chris

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

attached mail follows:


Yes i think java would be the best to learn proper OO, i've nevr done it,
but coming the other way knowing php OO, java became more familiar to me,
i'm gonna do it this year. With PHP5 coming out that all may change
slightly.

May i ask though, what is the point of a destructor and is it really good to
add it in, does it work in php4 ?

-----Original Message-----
From: Raditha Dissanayake [mailto:jabberraditha.com]
Sent: Friday, January 30, 2004 9:19 PM
To: chrisnealethemoon.co.uk; php-generallists.php.net
Subject: Re: [PHP] OOP methodology

Hi Chris,

Sounds to me like you are pretty much on the right track bearing in mind
that PHP is not the bes language to learn OOP. Even your taskmanager
sounds good, i wouldn't bother with reading up on design patterns just
yet. They are indeed very important and you should definitely study
them, however having spent an year or more doing OOP helps you
understand them better. (others will disagree).

attached mail follows:


# chrisnealethemoon.co.uk / 2004-01-30 09:41:53 +0000:
> I'm trying to get to grips with my understanding of OOP.
 
    <snip />

    Looks like you might enjoy reading Design Patterns by Gamma et. al.
    (ISBN: 0201633612). It's not easy reading, but will quite likely
    open your eyes. I've had many forehead-slapping moments since I
    started studying it. It's somewhat C++-centric, but the patterns
    are usable in other languages as well (and PHP can be seen as a
    dumbed down version of C++).

--
FreeBSD 4.9-STABLE
2:21PM up 4 days, 23:06, 17 users, load averages: 0.13, 0.03, 0.01

attached mail follows:


Wow, that's a lot of stuff in one class. Personally, I've started using
the MVC (Model, View, Controller) architecture. Basically what it does
is seperates Data logic from Display logic and Control logic. Here's how
I've been using it.

Model: Holds and deals with all data for the program, such as database
connections / queries, session data, data consistency. I am currently
using classes which use PEAR DB_DataObject for DB connections, querying,
and data storage.

View: Deals with displaying of data from model. ONLY does displaying, no
processing. Very minimal logic only associated with outputting.
Currently, I am using Smarty entirely for the view. Little no no PHP
code, only Smarty. The View in this case is just a smarty template file.

Controller: Handles requests from the browser. Instantiates Model and
View, calls functions in Model to alter its state (updating from
$_REQUEST vars, for instance). Chooses a view and then tells the view to
display. For me, this is all home-grown PHP.

This architecture can be much more complicated in, say, a C++ program,
but the Server/Client pattern built into web programs makes it much more
simple. The reason that I use this particular architecture is that it
factors all of the pieces of your program very nicely. Later, if you do
things right, you can use a single screen from one program in another
with minimal editing.

Here's a few pages that discuss MVC:
http://ootips.org/mvc-pattern.html
http://st-www.cs.uiuc.edu/users/smarch/st-docs/mvc.html

attached mail follows:


I've been using JavaScript style switchers combined with "alternate
style sheets," allowing users to control the appearance of my web pages.

However, I recently read that you can make style switchers with PHP -
which are allegedly superior to JavaScript style sheets. Then I found a
PHP style switcher at
http://www.contrastsweb.com/switcher/v2/example.php that has an added
advantage; you can apparently choose several style sheets independently
of one another. For example, you can change the background color, then
change the font.

I'm working on some complex tables that I'd like to control with such a
multi-style switcher. Suppose I have five style sheets, named One, Two,
Thtee, Four and Five. I'd like to set it up so that a visitor can view
the page with any one of these style sheets, or with a combination
thereof, such as One, Three and Four or Four and Five.

At any rate, I couldn't get the PHP style switcher above to work. (See,
also, http://www.contrastsweb.com/switcher/v2/)

I just wondered if anyone on this list has worked with PHP style
switchers and can recommend other tutorials or different strategies.

Thanks.

attached mail follows:


On 29 January 2004 14:56, jimbo wrote:

> Hi,
>
> I have a query regarding variable parsing.
>
> I have some text in a MySQL database in which I have included some
> variable names. Eg (but w/o quotes): "thankyou $name for registering
> on our web site".
>
> I query and use mysql_fetch_array to get the data into an associative
> array. I then build a string and output it like this:
> echo "blah blah ".$row["thecolumn"]." blah blah";
>
> However, the output is simply: "blah blah thankyou $name for
> registering on our web site blah blah" - i.e. $name does not get
> parsed. I have tried wrapping $name with curly brackets in the
> database but that doesn't help and I have also tried using both
> addslashes and removeslashes on $row["thecolumn"] and I have also
> tried this: echo "blah blah $row['thecolumn'] blah blah" - again both
> with and without curly brackets.
>
> Nothing seems to work. Is what I am trying to do possible?

Yes, but you need to force PHP to re-evaluate the string you retrieve from
the database -- normally, PHP just uses values retrieved at runtime as-is
and doesn't do any special interpretation on them.

The function you need to do this is eval() (http://www.php.net/eval), and
one possible way of using it to achieve your desired result is (off the top
of my head, untested):

   eval('echo "blah {$row[\'thecolumn\']} blah";');

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.fordleedsmet.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

attached mail follows:


Thanks Justin I was aware of that method but wanted to avoid it if possible,
however another person explained to me that eval() can be used to force PHP
to evaluate (i.e. parse) the variables, just thought I'd let you know for
your future reference.

James

--
--------------------------------------------------------
www.jholt.co.uk : affordable business website solutions
www.htpshareware.com : software for the disorganized
--------------------------------------------------------

"You don't needs eyes to see, you need vision" - Maxi Jazz

"Justin Patrin" <papercranereversefold.com> wrote in message
news:20040130004933.60914.qmailpb1.pair.com...
> Jimbo wrote:
>
> >
> > I query and use mysql_fetch_array to get the data into an associative
array.
> > I then build a string and output it like this:
> > echo "blah blah ".$row["thecolumn"]." blah blah";
> >
>
> What you need to understand is that the string parsing for variables
> only happens when the string is actually in your script. When you
> dynamically create a string (or get it from a DB) it's just a string of
> characters in memory and is *not* parsed.
>
> To do something like this, you would have to use one of a few things.
> The first would be to use some kind of search and replace to replace
> those variables with what you really want.
>
> $text = str_replace('$name', $name, $text);
>
> That's fairly simple and could even be done for multiple variables.
>
> foreach(array('name', 'price') as $varName) {
> //yes, the $$ is correct
> $text = str_replace('$'.$varName, $$varName, $text);
> }
>
> You could also use a regular expression if you *really* wanted to, but
> what's above is easier.
>
> --
> paperCrane <Justin Patrin>

attached mail follows:


Great - thanks v. much Mike. I don't know why there was no mention of
eval() in the section of the manual on Variable Parsing.

James

--
--------------------------------------------------------
www.jholt.co.uk : affordable business website solutions
www.htpshareware.com : software for the disorganized
--------------------------------------------------------

"You don't needs eyes to see, you need vision" - Maxi Jazz

"Mike Ford" <M.Fordleedsmet.ac.uk> wrote in message
news:841D90E489448A4F804E1D1B95768BF7D46343lis-exchange3.lmu.ac.uk...
> On 29 January 2004 14:56, jimbo wrote:
>
> > Hi,
> >
> > I have a query regarding variable parsing.
> >
> > I have some text in a MySQL database in which I have included some
> > variable names. Eg (but w/o quotes): "thankyou $name for registering
> > on our web site".
> >
> > I query and use mysql_fetch_array to get the data into an associative
> > array. I then build a string and output it like this:
> > echo "blah blah ".$row["thecolumn"]." blah blah";
> >
> > However, the output is simply: "blah blah thankyou $name for
> > registering on our web site blah blah" - i.e. $name does not get
> > parsed. I have tried wrapping $name with curly brackets in the
> > database but that doesn't help and I have also tried using both
> > addslashes and removeslashes on $row["thecolumn"] and I have also
> > tried this: echo "blah blah $row['thecolumn'] blah blah" - again both
> > with and without curly brackets.
> >
> > Nothing seems to work. Is what I am trying to do possible?
>
> Yes, but you need to force PHP to re-evaluate the string you retrieve from
> the database -- normally, PHP just uses values retrieved at runtime as-is
> and doesn't do any special interpretation on them.
>
> The function you need to do this is eval() (http://www.php.net/eval), and
> one possible way of using it to achieve your desired result is (off the
top
> of my head, untested):
>
> eval('echo "blah {$row[\'thecolumn\']} blah";');
>
> Cheers!
>
> Mike
>
> ---------------------------------------------------------------------
> Mike Ford, Electronic Information Services Adviser,
> Learning Support Services, Learning & Information Services,
> JG125, James Graham Building, Leeds Metropolitan University,
> Beckett Park, LEEDS, LS6 3QS, United Kingdom
> Email: m.fordleedsmet.ac.uk
> Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

attached mail follows:


On 30 January 2004 12:35, jimbo wrote:

> Great - thanks v. much Mike. I don't know why there was no mention of
> eval() in the section of the manual on Variable Parsing.

Possibly because they didn't want to get into the security issues involved.
It sounds like you're ok there, as you only intend putting very controlled
values into the database.

The problem comes if you're potentially eval()-ing user-supplied values that
have been insufficiently validated. Just suppose, for example, that it was
possible for a user to somehow get a value such as 'system("rm
/etc/passwds")' inserted into the database in a field that you then
eval()...

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.fordleedsmet.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

attached mail follows:


Jimbo wrote:

> Thanks Justin I was aware of that method but wanted to avoid it if possible,
> however another person explained to me that eval() can be used to force PHP
> to evaluate (i.e. parse) the variables, just thought I'd let you know for
> your future reference.
>
> James
>
> --
> --------------------------------------------------------
> www.jholt.co.uk : affordable business website solutions
> www.htpshareware.com : software for the disorganized
> --------------------------------------------------------
>
> "You don't needs eyes to see, you need vision" - Maxi Jazz
>
> "Justin Patrin" <papercranereversefold.com> wrote in message
> news:20040130004933.60914.qmailpb1.pair.com...
>
>>Jimbo wrote:
>>
>>
>>>I query and use mysql_fetch_array to get the data into an associative
>
> array.
>
>>>I then build a string and output it like this:
>>>echo "blah blah ".$row["thecolumn"]." blah blah";
>>>
>>
>>What you need to understand is that the string parsing for variables
>>only happens when the string is actually in your script. When you
>>dynamically create a string (or get it from a DB) it's just a string of
>>characters in memory and is *not* parsed.
>>
>>To do something like this, you would have to use one of a few things.
>>The first would be to use some kind of search and replace to replace
>>those variables with what you really want.
>>
>>$text = str_replace('$name', $name, $text);
>>
>>That's fairly simple and could even be done for multiple variables.
>>
>>foreach(array('name', 'price') as $varName) {
>> //yes, the $$ is correct
>> $text = str_replace('$'.$varName, $$varName, $text);
>>}
>>
>>You could also use a regular expression if you *really* wanted to, but
>>what's above is easier.
>>
>>--
>>paperCrane <Justin Patrin>

Well, I would have mentioned eval(), but you have to put PHP code in
there instead of just strings. For example, "Hello $name." would have to
become.

'return "Hello $name."';

or

'return \'Hello \'.$name.\'.\'';

If you eval a string with "Hello $name." in it, you will get a parse
error. For readability, I would think that using str_replace to replace
specific variables would be better.

Actually, it would be even better if you used a templating system to do
this kind of thing, such as Smarty. That way you don't have to worry
about variable replacement, but your strings can still be easily edited.

--
paperCrane <Justin Patrin>

attached mail follows:


From: "Justin Patrin" <papercranereversefold.com>

> >>What you need to understand is that the string parsing for variables
> >>only happens when the string is actually in your script. When you
> >>dynamically create a string (or get it from a DB) it's just a string of
> >>characters in memory and is *not* parsed.
> >>
> >>To do something like this, you would have to use one of a few things.
> >>The first would be to use some kind of search and replace to replace
> >>those variables with what you really want.
> >>
> >>$text = str_replace('$name', $name, $text);
> >>
> >>That's fairly simple and could even be done for multiple variables.
> >>
> >>foreach(array('name', 'price') as $varName) {
> >> //yes, the $$ is correct
> >> $text = str_replace('$'.$varName, $$varName, $text);
> >>}
> >>
> >>You could also use a regular expression if you *really* wanted to, but
> >>what's above is easier.

For a regular expression example of how to do this:

<?php

$str = 'this is $name a $test';

$name = 'John';
$test = 'foobar';

$evaled_str = preg_replace('/\$([a-z0-9_]+)/ie','\$\1',$str);

echo $evaled_str;

?>

Where "$str" is what's retrieved from the database with the "variables" in
it.

---John Holmes...

attached mail follows:


[snip]
Yes i think java would be the best to learn proper OO, i've nevr done
it,
but coming the other way knowing php OO, java became more familiar to
me,
i'm gonna do it this year.
[/snip]

Why not start with the king of OOP, C++? Currently C++ is the most
robust implementor of OOP design issues. From there it is easier to come
to grips with PHP, JAVA and any other language in which you may need or
want to use OOP. I heartily recommend that JAVA is NOT the way to learn
OOP.

attached mail follows:


Jay Blanchard wrote:

> [snip]
> Yes i think java would be the best to learn proper OO, i've nevr done
> it,
> but coming the other way knowing php OO, java became more familiar to
> me,
> i'm gonna do it this year.
> [/snip]
>
> Why not start with the king of OOP, C++? Currently C++ is the most
> robust implementor of OOP design issues. From there it is easier to come
> to grips with PHP, JAVA and any other language in which you may need or
> want to use OOP. I heartily recommend that JAVA is NOT the way to learn
> OOP.

Hehe, and here is where we start a holy war.

I would have to disagree. While it may be possible to implement good OOP
in C++, it does not nearly implement OOP as well as many other
languages. It also has many other design problems that hinder the
learning of OOP.

However, if you know C++ already it may be easier to learn good OOP in
C++ (it has much more full OOP than PHP4).

--
paperCrane <Justin Patrin>

attached mail follows:


[snip]
Hehe, and here is where we start a holy war.
[/snip]

Bring it.

[snip]
I would have to disagree. While it may be possible to implement good OOP
in C++, it does not nearly implement OOP as well as many other
languages. It also has many other design problems that hinder the
learning of OOP.
[/snip]

I respect your opinion and all, but how do you come to this conclusion?
Which of the "many other languages" implement OOP better? And what other
design problems do you speak of?

attached mail follows:


> Which of the "many other languages" implement OOP better?

Smalltalk, for one.

Chris

attached mail follows:


On Fri, 30 Jan 2004, Jay Blanchard wrote:
> > I would have to disagree. While it may be possible to implement good
> > OOP in C++, it does not nearly implement OOP as well as many other
> > languages. It also has many other design problems that hinder the
> > learning of OOP.
>
> I respect your opinion and all, but how do you come to this conclusion?
> Which of the "many other languages" implement OOP better?

Python, Ruby...?

Of course, I've never done any OOP in C++. My guess is part of the reason
he said this is because you've got to learn C++ before you're going to do
much successful OOP with it. Not exactly a small learning curve.

Other languages dispense with a lot of the formalities found in C++ (a
good or bad thing, depending on your perspective). I found Python to be a
great language to learn OOP, since it forces good habits on you.

--
Kelly Hallman
// Ultrafancy

attached mail follows:


On Fri, 30 Jan 2004, Kelly Hallman wrote:

> Other languages dispense with a lot of the formalities found in C++ (a
> good or bad thing, depending on your perspective). I found Python to be a
> great language to learn OOP, since it forces good habits on you.

C++ is a very large unwieldly language - it has too many constructs and
too much syntax. Experience has chown that smaller simpler languages are
easier to learn and apply than larger ones. This is why C is still the
language of choice for a lot of systems coding (among other reasons).

While purists will no doubt damn me to hell, I know a lot of people would
put C++ at the bottom of their list of OOP coding languages of choice.

--
Aj.
Sys. Admin / Developer

attached mail follows:


Does anyone have any experience connecting with the new Tourico Holidays
 system via xml with php? I need help if so.

--
Diana Castillo

attached mail follows:


If you refer to the gilboa/galileo reservation system, I've had a project on
it for a Greece-based travel company.
It involved XML messaging with the Gilboa server.

Lucian COZMA
"Diana Castillo" <dianainterhotel.com> wrote in message
news:20040130124827.54721.qmailpb1.pair.com...
> Does anyone have any experience connecting with the new Tourico Holidays
> system via xml with php? I need help if so.
>
> --
> Diana Castillo

attached mail follows:


Burhan,

Thanks for your kind offer of help. I was able to get it up and running with
no problems.

Best,

Marc A. Garrett
marcsince1968.com

-----Original Message-----
From: Burhan Khalid [mailto:phplistmeidomus.com]
Sent: Thursday, January 29, 2004 11:47 AM
To: 'Marc A. Garrett'
Subject: RE: [PHP] phpCollab on shared server?

Marc A. Garrett wrote:
> Has anyone installed phpCollab on a shared server? I have a php
> account with MediaTemple and was hoping to find a few pointers. --
> Marc A. Garrett
> since1968.com

I have installed it a few times on shared hosting accounts without any
problems. Nothing exotic to do either.

Email me offlist if you get stuck.

--
Burhan <--> phplist[at]meidomus[dot]com

attached mail follows:


Hi at all,

> Indeed. The following script had my machine happily swapping like crazy
> at 320,000 array items (each being 1k, task manager showed 640meg total
> memory in use on this development machine with 512meg RAM running WinXP).
>
> <?php
> while (ob_end_flush());
> $data = Array();
> while (true)
> {
> $data[] = str_repeat('#', 1024);
> print count($data)."\n";
> }
> ?>
>
> To the OP, why do you need to store all the items in memory at the same
> time? Can't you read some, process them then read the next lot, process
> them, read the next lot.... etc?

No I couldn't because we have to use 1,6 Mio values direktly. If we read
them each for each it will take a lot of time.

We discover we can use an Array with 2.000.000 Values - if higher the server
(Intel 1 GHz, 32 Bit, 1 GB RAM) gives up.

Ciao,

Sandro

attached mail follows:


Gandolf wrote:
>>To the OP, why do you need to store all the items in memory at the same
>>time? Can't you read some, process them then read the next lot, process
>>them, read the next lot.... etc?
>
> No I couldn't because we have to use 1,6 Mio values direktly. If we read
> them each for each it will take a lot of time.

Without testing I can't be sure, but my past experience suggests that
working with several smaller sets of data one at a time would be more
efficient than working with one big one if that's possible. I could of
course be wrong since I don't know the internals of PHP too well, but
I'd be surprised if I was.

--
Stuart

attached mail follows:


Hello

Sorry for bothering you with that 'question'. There was an article about
an authentication-system in the German version of the magazin 'php
solutions' issue October/November 2003. Unfortunately, my CD that was
provided with the magazin has got a lot of CRC-errors (scratches). Could
somebody that got this cd e-mail me the files concerning the mentioned
article, please?

Thanks a lot in advance!

--
Regards
 Marco

attached mail follows:


Hi all,

I Need to access certain data in a Page protected by user login.
I have written a script with socket functions which connect to port 80
and automates what any browser does.
That's Ok .. Now I have the Data What I wanted in a variable.

But I am also in need of a Mechanism where I can transfer an
Initiated session to the User's Browser ...
( Not Just OutPutting the above variable .. But actually Transferring the
  Session to the User's Browser )

Any Hacks ??? ..
/Chandu

attached mail follows:


<snip>
But I am also in need of a Mechanism where I can transfer an
Initiated session to the User's Browser ...
( Not Just OutPutting the above variable .. But actually Transferring
the
  Session to the User's Browser )

</snip>

not sure I understand 100% what you mean.

You could send a cookie or form field to the browser with the session
id.

You could serialize the $_SESSION array and send that to the browser.
There are a bunch of options.

attached mail follows:


From: "Admin - CpanelPlus" <admincpanelplus.net>

> I Need to access certain data in a Page protected by user login.
> I have written a script with socket functions which connect to port 80
> and automates what any browser does.
> That's Ok .. Now I have the Data What I wanted in a variable.
>
> But I am also in need of a Mechanism where I can transfer an
> Initiated ses