php-general Digest 31 Mar 2003 19:42:36 -0000 Issue 1971

Topics (messages 141681 through 141723):

Dynamic include_path
        141681 by: Derek J. Belrose

exec different result from command line
        141682 by: Jan-Hendrik

[Newbie] Password()
        141683 by: Bobby Rahman
        141684 by: Chris Hayes
        141685 by: Jon Haworth

Re: File access denied!!!
        141686 by: Marek Kilimajer

Re: Microsoft SQL Server varchar(500) field text concatenated at 255 characters.
        141687 by: Adam Voigt

Re: Classes
        141688 by: Marek Kilimajer

Re: line feeds
        141689 by: Marek Kilimajer

date() and mktime() functions: weeknumbers and months.
        141690 by: Davy Obdam
        141693 by: Marek Kilimajer
        141694 by: Jason Wong
        141723 by: Davy Obdam

accessing protected remote files
        141691 by: David Feldman
        141692 by: Marek Kilimajer
        141698 by: David Feldman

GMT strtotime() problem today!!
        141695 by: Stuart Cochrane

Re: Adding a URL
        141696 by: Scott Thompson

PHP and Front Page XP
        141697 by: Tomás Liendo
        141701 by: Marek Kilimajer

MSSQL/PHP Problem
        141699 by: Poon, Kelvin (Infomart)

Re: Parsing CSS files
        141700 by: Liam Gibbs
        141710 by: Chris Hewitt

Memory
        141702 by: Php general

Re: XML+XSLT or Smarty again??
        141703 by: Pete James
        141705 by: rush
        141706 by: rush
        141709 by: Hardik Doshi
        141711 by: Pete James

Re: Crystal Reports in PHP via COM - SelectPrinter problem
        141704 by: Andrew Powell

Date Problem - Last Day Of Month
        141707 by: Vinesh Hansjee
        141708 by: Liam Gibbs
        141712 by: Daniel Guerrier
        141714 by: Kevin Stone
        141720 by: Daniel Guerrier

Re: GNU & Open Source
        141713 by: John Taylor-Johnston
        141716 by: Chris Shiflett
        141721 by: Rasmus Lerdorf

Re: Is there a PHP for Dummies?
        141715 by: Jennifer Goodie

Re: require/include from a different directory
        141717 by: Jennifer Goodie

php with mcrypt
        141718 by: Gilberto Garcia Jr.

php and mysql
        141719 by: Tyler Durdin
        141722 by: Tyler Durdin

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
Hey folks,

What we are looking to do is give a specific include path for each site in our 
customer base.  This running on MacOSX so basically we have sites set up like:

/Users/username/Sites/site.com/phpinc

There can be numerous sites in each users directory and numerous users in /Users.

Basically what we want to do is have each set up to be able to include only from their 
include directory, but the boss is wondering if it can be done on one or two lines for 
every site total.

Basically looking for something like this:
<Directory /Users/*/Sites/*/phpinc>
        php-value include_path = . 
</Directory>

or something like it.  

Is this possible?  Or should we just go ahead and set it in each sites declaration?


Derek

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

I've got a strage problem I don't know how to solve:

I am calling ImageMagick's identify. If I do that via command line, I get a
textline as result with all images. If I do the same with exec or passthru,
I only get results with certain image-types.

Does anyone have any idea of what the problem could be ?

thanks !



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


Hi,


in my code I am trying to send an email (containing a password) to a user when he has forgotten his password.

The problem is that security leads to needing to encrypt passwords in the database. Im using the password function within mysql. Is there any way of reversing the password function() to get the original password to send out to the user?

Or are there any other suggestions in PHP to reverse encryption of passwords. I do understand the principles of encryption and can see the point of unreversible functions but Im sure that not all applications re-set passwords with random generated ones but do send out forgotten passwords.

Cheers

B





_________________________________________________________________
Worried what your kids see online? Protect them better with MSN 8 http://join.msn.com/?page=features/parental&pgmarket=en-gb&XAPID=186&DI=1059



--- End Message ---
--- Begin Message ---
in my code I am trying to send an email (containing a password) to a user when he has forgotten his password.

The problem is that security leads to needing to encrypt passwords in the database. Im using the password function within mysql. Is there any way of reversing the password function() to get the original password to send out to the user?

Or are there any other suggestions in PHP to reverse encryption of passwords. I do understand the principles of encryption and can see the point of unreversible functions but Im sure that not all applications re-set passwords with random generated ones but do send out forgotten passwords.


$pwtestOK=FALSE

It's a bit tricky to make it really secure. If your site is vulnerable to serious cracker attacks, better find some indepth articles.
What i've seen CMS systems do is take a password from a form and put it as MD5($password) in the database. MD5 is irreversible but when you let people login you simply compare it like this:


if (MD5(enteredpassword)        ==      password_in_database)
                $pwtestOK=TRUE;


if (!$pwtestOK) {echo 'wrong password'; exit;}



http://nl.php.net/manual/en/function.md5.php






--- End Message ---
--- Begin Message ---
Hi Bobby,

> In my code I am trying to send an email (containing a password)
> to a user when he has forgotten his password.
[...]
> The problem is that security leads to needing to encrypt
> passwords in the database. Im using the password function
> within mysql. Is there any way of reversing the password
> function to get the original password to send out to the user?

I think it's a one-way hash, like MD5. You could set their password to
something else - a random 8-letter string, for example - and send them that
along with a note encouraging them to change it.

If you want two-way encryption, have a look at AES_ENCRYPT and AES_DECRYPT:
http://www.mysql.com/doc/en/Miscellaneous_functions.html (scroll down a bit)

Cheers
Jon


--- End Message ---
--- Begin Message --- You need to chmod o+r them (in the ftp client). Also the path must be readable by the web server. You might want to set up the ftp server to give these permisions automaticaly

Joakim Larsson wrote:

I am running a ftp server on my mac along with the webserver on OS 10.2. The
files that i upload to the server i have no access to through the internet.
This is the message i get when trying to access the webpage "You don't have
permission to access /index.html on this server.". What do i do to get
access to the files that i upload?

Sincerely,
Joakim







--- End Message ---
--- Begin Message ---
Yeah, umm, Microsoft SQL Server (mssql) is different
then MySQL Server (mysql), I believe the correct answer,
is if your selecing a VARCHAR longer then 255 is to cast it,
example:

SELECT CAST(somefield AS TEXT) AS somefield FROM table;

That will work.

On Fri, 2003-03-28 at 20:10, Daevid Vincent wrote:
> http://www.mysql.com/doc/en/CHAR.html
> 
> VARCHAR can only be 255 characters in length.
> 
> Here's some useful info:
> 
> # BIGINT      UNSIGNED = 8 Byte = FFFFFFFFFFFFFFFF = 18446744073709551615
> # INT       UNSIGNED = 4 Byte = FFFFFFFF = 4294967295
> # MEDIUMINT UNSIGNED = 3 Byte = FFFFFF   = 16777215
> # SMALLINT  UNSIGNED = 2 Byte = FFFF     = 65535
> # TINYINT   UNSIGNED = 1 Byte = FF       = 255
> 
> # BIGINT      SIGNED = -9223372036854775808  to 9223372036854775807  
> # INT         SIGNED = -2147483648 to 2147483647 
> # MEDIUMINT SIGNED = -8388608  to 8388607  
> # SMALLINT    SIGNED = -32768  to 32767 
> # TINYINT     SIGNED = -128  to 127
> 
> # TINYTEXT     = 255
> # TEXT         = 65535
> # MEDIUMTEXT = 16777215
> # LONGTEXT     = 4294967295
> 
> > -----Original Message-----
> > From: Scott Houseman [mailto:[EMAIL PROTECTED] 
> > Sent: Friday, March 28, 2003 3:35 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] Microsoft SQL Server varchar(500) field text 
> > concatenated at 255 characters.
> > 
> > 
> > Hi There.
> > 
> > I am using PHP 4.3.0 on WIN32 to query data from a Microsoft 
> > SQL Server.
> > One field I am requesting is type VARCHAR size 500. For some 
> > reason, PHP
> > is returning only the first 255 characters of the text from 
> > that field.
> > 
> > If I change the field type to TEXT, all of the data in that 
> > field is returned.
> > 
> > Unfortunately, an ASP application is also using that 
> > database, and when I change
> > the field type to TEXT, it pukes completely.
> > I would rather try to resolve the issue in PHP than waste my 
> > time looking at ASP code.
> > 
> > Has anyone got an idea why this might be hapenning?
> > 
> > Many thanks.
> > 
> > Scott
> > -- 
> > Scott Houseman
> > Senior Software Developer
> > Junk Mail Publishing (Pty) Ltd
> > Tel. +27 12 342 3840 x3806
> > Fax. +27 12 342 1842
> > Mob. +27 82 491 8021
> > 
> > 
> > -- 
> > 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
> 
-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc


--- End Message ---
--- Begin Message --- including or requiring a file does not change the working directory, so if you have this structure:

index.php
A/ClassA.class.php
B/ClassB.class.php

and index.php includes A/ClassA.class.php, from ClassA.class.php you need to use
include('B/ClassB.class.php');


Donahue Ben wrote:

I have a ClassA file and a ClassB file stored in
separate directories.  I am trying to get ClassB to
initiate a ClassA object.  But since they are stored
in seperate directories I get an error.

So I tried including the ClassA file in ClassB
constructor:

function ClassB()
{
 include("../A/ClassA.class.php");
 ...
}

i cant get this working. How do i solve this problem
without having both class files in the same directory.

Ben

__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com





--- End Message ---
--- Begin Message --- $string = str_replace("\n",'', str_replace("\r",'', $string));

Diana Castillo wrote:

How can I remove all line feeds from a document?







--- End Message ---
--- Begin Message ---
Hi people,

I would like to select news from my database bases on week/year and
month/year.
How can i do this.. I would like to pass two arguments in the query
string, like news.php?week=14&year=2003 or news.php?month=3&year=2003.
Can anybody help me.. Thanks in advance. I have been looking at the
date() and mktime() functions, but is there anyway to determine the date
from a weeknumber? I have been using this:

$yr="2003"; 
$mnth="03"; 
$dy="31"; 
echo "base date: ".$yr."-".$mnth."-".$dy."<br />"; 
echo "last sunday: ".date("Y-m-d",
mktime(0,0,0,$mnth,$dy-date("w",mktime(0,0,0,$mnth,$dy,$yr)),$yr))."<br
/>"; 
echo "next saturday: ".date("Y-m-d",
mktime(0,0,0,$mnth,$dy+6-date("w",mktime(0,0,0,$mnth,$dy,$yr)),$yr))."<b
r />";

$sql = "SELECT * FROM news WHERE date>='$last_sunday' AND
date<='$next_saturday').

But i would find it better to use a weeknumber instead

Best regards,

Davy Obdam - Networking4all
Webapplication developer
E-mail: [EMAIL PROTECTED]
Web: http://www.networking4all.com 

Kijk ook eens op: http://www.verzamelgids.nl 



--- End Message ---
--- Begin Message --- Check out mysql manual, section 6.3.4 - Date and Time Functions, example

$condition='';
if($GET['week']) $condition .= "WEEK(date)='$_GET[week]' AND ";
if($GET['year']) $condition .= "YEAR(date)='$_GET[week]' AND ";
and so on
then use the condition:

$sql = "SELECT * FROM news WHERE $condition 1";




Davy Obdam wrote:


Hi people,

I would like to select news from my database bases on week/year and
month/year.
How can i do this.. I would like to pass two arguments in the query
string, like news.php?week=14&year=2003 or news.php?month=3&year=2003.
Can anybody help me.. Thanks in advance. I have been looking at the
date() and mktime() functions, but is there anyway to determine the date
from a weeknumber? I have been using this:

$yr="2003"; $mnth="03"; $dy="31"; echo "base date: ".$yr."-".$mnth."-".$dy."<br />"; echo "last sunday: ".date("Y-m-d",
mktime(0,0,0,$mnth,$dy-date("w",mktime(0,0,0,$mnth,$dy,$yr)),$yr))."<br
/>"; echo "next saturday: ".date("Y-m-d",
mktime(0,0,0,$mnth,$dy+6-date("w",mktime(0,0,0,$mnth,$dy,$yr)),$yr))."<b
r />";


$sql = "SELECT * FROM news WHERE date>='$last_sunday' AND
date<='$next_saturday').

But i would find it better to use a weeknumber instead

Best regards,

Davy Obdam - Networking4all
Webapplication developer
E-mail: [EMAIL PROTECTED]
Web: http://www.networking4all.com


Kijk ook eens op: http://www.verzamelgids.nl







--- End Message ---
--- Begin Message ---
On Monday 31 March 2003 22:07, Davy Obdam wrote:

> I would like to select news from my database bases on week/year and
> month/year.
> How can i do this.. I would like to pass two arguments in the query
> string, like news.php?week=14&year=2003 or news.php?month=3&year=2003.
> Can anybody help me.. Thanks in advance. I have been looking at the
> date() and mktime() functions, but is there anyway to determine the date
> from a weeknumber? I have been using this:

[snip]

> $sql = "SELECT * FROM news WHERE date>='$last_sunday' AND
> date<='$next_saturday').
>
> But i would find it better to use a weeknumber instead

If you're using mysql you can do something like:

  SELECT * FROM news WHERE WEEK(date) = some_week_number_or_another

If you're using some other DBMS check whether it has some similar function.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
We can predict everything, except the future.
*/


--- End Message ---
--- Begin Message ---
Thanks Jason and Marek,

I was thinking to difficult, Thanks for the quick responses.

Best regards,

Davy Obdam

> -----Oorspronkelijk bericht-----
> Van: Jason Wong [mailto:[EMAIL PROTECTED] 
> Verzonden: maandag 31 maart 2003 16:36
> Aan: [EMAIL PROTECTED]
> Onderwerp: Re: [PHP] date() and mktime() functions: 
> weeknumbers and months.
> 
> 
> On Monday 31 March 2003 22:07, Davy Obdam wrote:
> 
> > I would like to select news from my database bases on week/year and 
> > month/year. How can i do this.. I would like to pass two 
> arguments in 
> > the query string, like news.php?week=14&year=2003 or 
> > news.php?month=3&year=2003. Can anybody help me.. Thanks in 
> advance. I 
> > have been looking at the
> > date() and mktime() functions, but is there anyway to determine the 
> > date from a weeknumber? I have been using this:
> 
> [snip]
> 
> > $sql = "SELECT * FROM news WHERE date>='$last_sunday' AND 
> > date<='$next_saturday').
> >
> > But i would find it better to use a weeknumber instead
> 
> If you're using mysql you can do something like:
> 
>   SELECT * FROM news WHERE WEEK(date) = some_week_number_or_another
> 
> If you're using some other DBMS check whether it has some 
> similar function.
> 
> -- 
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications 
> Development *
> ------------------------------------------
> Search the list archives before you post 
> http://marc.theaimsgroup.com/?l=php-general
> 
> ------------------------------------------
> /*
> We can predict everything, except the future.
> */
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> ================================================================
> Deze e-mail is door E-mail VirusScanner van Planet Internet 
> gecontroleerd op virussen. Op http://www.planet.nl/evs staat 
> een verwijzing naar de actuele lijst waar op wordt gecontroleerd.
> 
> 



--- End Message ---
--- Begin Message --- I have a script that needs to open a remote file on another Web server, which may or may not be protected (for example, by an htaccess file). What would be the best way to check if it's protected, and if so, prompt the user for username and password to open it?

Thanks.

--Dave


--- End Message ---
--- Begin Message --- You need to use socket functions and check the response headers

David Feldman wrote:

I have a script that needs to open a remote file on another Web server, which may or may not be protected (for example, by an htaccess file). What would be the best way to check if it's protected, and if so, prompt the user for username and password to open it?

Thanks.

--Dave




--- End Message ---
--- Begin Message --- That's what I thought too, but it's not happening...fopen() is simply returning an error.

--Dave

On Monday, March 31, 2003, at 09:35 AM, [EMAIL PROTECTED] wrote:

Assuming you are retrieving this file via http/https then it's really the remote server that will enforce the access control in whatever manner is uses. I.e., if your script tries to open a file whose access is controlled by a .htaccess file (and http-basic authentication) the user will simply get the authentication prompt when they access your page/php script.


---------- Original Message ----------
From: David Feldman <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Date: Monday, March 31, 2003 09:13:00 AM -0500
Subject: [PHP] accessing protected remote files

I have a script that needs to open a remote file on another Web
server, which may or may not be protected (for example, by an
htaccess file). What would be the best way to check if it's
protected, and if so, prompt the user for username and password to
open it?

Thanks.

--Dave


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

---------- End Original Message ----------








--- End Message ---
--- Begin Message ---
Im having big problems -

I have a script that runs on over 250 Servers, all are running NT4.
here is the script:

[php]
function last_sunday() {
        return gmdate("Y-m-d", strtotime("Last Sunday"));
}
echo "Last Sunday is returned as: ".last_sunday();
[/php]

Some servers have 'automatically adjust clock for daylight saving 
changes' switched on, some have this off - (im in the UK GMT +0).

With daylight saving on the above script returns: 2003-03-29
With daylight saving off the above script returns: 2003-03-30

Im puzzled with this one - any ideas?
-Stuart

|-----------------------------|
|- www.php-editors.com        |
|- php programming contests   |
|- php tool reviews           |
|- php everything else        |
|-----------------------------|


--- End Message ---
--- Begin Message --- Thank you, your suggestions worked perfectly!

~Scott

Don Read wrote:
On 30-Mar-2003 Scott Thompson wrote:

Hi,

I am using the following code to query a database and build an HTML
table.



<snip>

    /* Printing results in HTML */
    print "<table>\n";
    while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {


$line['email'] =
 '<A HREF="mailto:' .$line['email'] .'">' .$line['email'].'</A>';


        print "\t<tr>\n";
        foreach ($line as $col_value) {
         print "\t\t<td>$col_value</td>\n";
        }
        print "\t</tr>\n";


// how about this ?

echo "\n<tr><td>", implode('</td><td>', $line), '</td></tr>';


    }
    print "</table>\n";


<snip>


What I want (and can't figure out) is how to have each email address have a URL (i.e. mailto:[EMAIL PROTECTED]).

I'm fairly new to PHP, I hope this question made some sense.

Suggestions?



Regards,



--- End Message ---
--- Begin Message ---
Hello people, I have the following strange problem:

I designed a form with Front Page XP, and with PHP I save the fields in a
MySQL data base. All fields work perfect, except one. This is a control to
upload files:
<INPUT type="file" name="f1">
The problem is that in the data base the value selected for the user is not
recorded. Instead of that a value as "/tmp/phpd7Fski" is recorded.
I don't know if my problem is Front Page, PHP or my Web server (Apache)...
As a test I printed the value of the varible $f1:
<?
    echo $f1
?>
 This shows the following: "/tmp/phpd7Fski", instead the value selected by
the user.

Well I hope somebody can help me, from already thank you very much,

Tom.





--- End Message ---
--- Begin Message --- $f1 is the temporary file namen your server, you need to use $f1_name, or even better $_FILES['f1']['name']

Tomás Liendo wrote:

Hello people, I have the following strange problem:

I designed a form with Front Page XP, and with PHP I save the fields in a
MySQL data base. All fields work perfect, except one. This is a control to
upload files:
<INPUT type="file" name="f1">
The problem is that in the data base the value selected for the user is not
recorded. Instead of that a value as "/tmp/phpd7Fski" is recorded.
I don't know if my problem is Front Page, PHP or my Web server (Apache)...
As a test I printed the value of the varible $f1:
<?
   echo $f1
?>
This shows the following: "/tmp/phpd7Fski", instead the value selected by
the user.

Well I hope somebody can help me, from already thank you very much,

Tom.









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

I have this problem retrieving data from a mssql table with PHP.

I have this in my mssql table column:

Globe and Mail data are retrieved and processed for CustomSearch.

On the R30, the crontab entry:
0 4 * * 1-6  /usr1/applic/ntgm/ntgm_get.pl
will run the Perl script at 4 a.m. everyday to retrieve the data from Globe
and Mail.  It will look for the file, retry if not found, until 6 a.m.

Most common problem is caused by the data file not available after 6 a.m.
for retrieval.  The system will send an error message to the support team to
alert the problem.

To retry downloading manually, simply sign on to the R30 and run the script
/usr1/applic/ntgm/ntgm_get.pl.

The data file can be found in the done directory and two log files in the
log directory.

WHen I retrieve this data from php to display on my webpage I get this:

Globe and Mail data are retrieved and processed for CustomSearch. 
On the R30, the crontab entry: 
0 4 * * 1-6 /usr1/applic/ntgm/ntgm_get.pl 
will run the Perl script at 4 a.m. everyday to retrieve the data from Globe
and Mail. It will look for the fi

The code I have in my php to display this text is:

$query = "SELECT * FROM knowledgeBase WHERE Title = '$title'";
$result = mssql_query($query);
$line = mssql_fetch_row($result);
echo "$line[2]";

$line[2] because this data is in the second column of the mssql table of the
row '$title'

P.S. I have set the limit of the mssql table to have 8000 character, so it
should exceed the limit, but I just don't know why it takes only 6 lines of
the total 11 lines of what I had in the mssql table.

Please advise! THANKS!

Kelvin

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

> if you have cpanel you can add the extension from there.

Yeah, I need to find out where to add the CSS extension to my list of
parsable files. I tried just sticking regular PHP code into a CSS file, and
it didn't come out properly. I can't find the place where I can specify what
files to parse, though.


--- End Message ---
--- Begin Message --- Liam Gibbs wrote:

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


if you have cpanel you can add the extension from there.


Yeah, I need to find out where to add the CSS extension to my list of parsable files. I tried just sticking regular PHP code into a CSS file, and it didn't come out properly. I can't find the place where I can specify what files to parse, though.


If you are using Apache, its the AddType line in httpd.conf.


HTH
Chris




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

Is there a way to know the memory that was used to execute a php page ?

Thanks !




--- End Message ---
--- Begin Message --- This xml+html+xslt paradigm provides great separation, especially when viewed in light of the traditional xslt=html+code method. I've used it with good success.

http://www.xml.com/pub/a/2000/07/26/xslt/xsltstyle.html

HTH.
Pete.

--
<Pusher>
http://www.shaman.ca/pusher

A news aggregator with email notification.


--- End Message ---
--- Begin Message ---
"Pete James" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> This xml+html+xslt paradigm provides great separation, especially when
> viewed in light of the traditional xslt=html+code method.  I've used it
> with good success.

This does relieve the problem of dirty templates, but with some costs in
inreased complexity. With TT you would have less things to do to achieve
similar, but I assume that in the end it is largely a matter of taste and/or
preferences.

Sincerely,

rush
--
http://www.templatetamer.com/




--- End Message ---
--- Begin Message ---
"Pete James" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> This xml+html+xslt paradigm provides great separation, especially when
> viewed in light of the traditional xslt=html+code method.  I've used it
> with good success.

This does relieve the problem of dirty templates, but with some costs in
inreased complexity. With TT you would have less things to do to achieve
similar, but I assume that in the end it is largely a matter of taste and/or
preferences.

Sincerely,

rush
--
http://www.templatetamer.com/




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

>From my point of view, XML+XSLT increases complexity
with very less number of advantages. 

Fundamental of using XML+XSLT with PHP is to seperate
HTML code from the PHP and database code. But in the
following article, it shows XSL stylesheet comes with
full of logic. Do we really need this approach?? At
this time i think smarty is separating the
presentation from logic in the best manner.

Please correct me if i am wrong.

THanks

Hardik  


--- rush <[EMAIL PROTECTED]> wrote:
> "Pete James" <[EMAIL PROTECTED]> wrote in
> message
> news:[EMAIL PROTECTED]
> > This xml+html+xslt paradigm provides great
> separation, especially when
> > viewed in light of the traditional xslt=html+code
> method.  I've used it
> > with good success.
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

--- End Message ---
--- Begin Message --- IMO, Smarty is just an abstraction of PHP. Smarty templates are HTML templates, but they still contain their own application logic for looping, etc, and so are still not a real separation (or are *dirty*, as 'rush' calls it).

XML+HTML+XSLT (or Template Tamer from what I can gather) take it the extra step. The application logic in PHP generates an XML data stream, which contains no dependencies on output. It is simply data. The XSLT parser parses the HTML template (which contains _only_ HTML and placeholders), and when it encounters a placeholder it executes the relevant XSLT code. This way, the design department can design the HTML fully, without having to learn PHP, Smarty, or any other syntax. They just put in placeholder tags wherever information from the XML file is needed.

There are drawbacks to every abstraction, and templating is no different. Smarty templates are fast, and are enjoyed by a large user base for their relative simplicity. XML, XSLT, etc are complex and verbose, but provide for maximum abstraction. Template Tamer sounds like it combines the best from both (from what I've heard here).

It is a matter of taste, I suppose. I think that people may sometimes waste more time trying to maximize the division between presentation and logic than it's worth. Well written PHP scripts can be almost as good a template as any (by separating the HTML and just using embedded variables).

HTH,
Pete.

--
<Pusher>
http://www.shaman.ca/pusher

A news aggregator with email notification.


--- End Message ---
--- Begin Message --- Crystal Decisions provided a resolution to the problem. If the SelectPrinter method is called, the PaperOrientation method must also be set.

So, to access Crystal Reports from PHP, the following code is used:

$crapp = new COM("CrystalDesignRunTime.Application");
$creport = $crapp->OpenReport("d:\\athermal\\reports\\backlog.rpt", 1);
$creport->SelectPrinter("winspool", "HP LaserJet 1200 Series PCL", "Ne01:");
$creport->PaperOrientation = 0;
$creport->PrintOut(False);


aap

Andrew Powell wrote:

I am receiving an error when attempting to use the SelectPrinter method in the CrystalDesignRunTime.Application COM object. The following code:
-----
$crapp = new COM("CrystalDesignRunTime.Application");
$creport = $crapp->OpenReport("d:\\athermal\\reports\\backlog.rpt", 1);
$creport->SelectPrinter("winspool", "HP LaserJet 1200 Series PCL", "Ne01:");
print "DEBUG|".$creport->DriverName."|".$creport->PrinterName."|".$creport->PortName."|";


$creport->PrintOut(False);
-----
Produces the following output:
-----
Content-type: text/html
X-Powered-By: PHP/4.3.1

winspool|HP LaserJet 1200 Series PCL|Ne01:|<br />
<b>Warning</b>: (null)(): Invoke() failed: Exception occurred.
<b>Source</b>: Crystal Reports ActiveX Designer <b>Description</b>:
Error starting print job. Please check your printer or network connection. in
<b>d:\athermal\temp\test.php</b> on line <b>7</b><br />
-----
Other items to note:
- When the SelectPrinter line is commented out, the report prints fine to the default printer and the DEBUG line prints "DEBUG|||".
- If the PrintOut line is commented out, the DEBUG line prints "DEBUG|winspool|HP LaserJet 1200 Series PCL|Ne01:|" without any error.
- If the PortName is not specified, or specified incorrectly on the SelectPrinter line, it is printed correctly on the DEBUG line. (i.e. if "Ne00:" is specified on the SelectPrinter line, "Ne01:" is reported on the DEBUG line.)


I am in the process of converting an Intranet application from CGI4VB to PHP. Some of the scripts call Crystal Reports RDC to print to either PDF or their printer, which is mapped through the network on the server. I therefore need to call the SelectPrinter method. Any workarounds or patches for this would be very helpful.

aap





--- End Message ---
--- Begin Message ---
Hi there, can anyone tell me how to fix my code so that on the last day of
the month, my code doesn't repeat the months...
What the code suppose to do is, makes a drop down box from which you can
select the month, and if its the current month
the box is already selected.

<select name="month">

<?

for ($i=1; $i<=12; $i++) {
 if ($i == date("m")) {
  print "<option selected value=\"". $i . "\">" .
date("F",mktime(0,0,0,$i,date("d"),date("Y"))) . "</option>";
 } else {
  print "<option value=\"". $i . "\">" .
date("F",mktime(0,0,0,$i,date("d"),date("Y"))) . "</option>";
 }
}

?>

</select>

Thanks
Vinesh


--- End Message ---
--- Begin Message ---
> Hi there, can anyone tell me how to fix my code so that on the last day of
> the month, my code doesn't repeat the months...

I'm not sure what you mean by this, but I can be a moron on this list
sometimes and the clear answer usually comes to me about 2 seconds after I
hit the send button. Do you mean that you don't want any months in the
SELECT control when it's the last of the month? Or you don't want the
SELECTED attribute in the OPTION tags? As far as I can tell, you're not
repeating any months, but you're only listing them once.

Try this (and IMHO a *slight* *slight* improvement in clarity, but again,
that's my HO):

<select name="month">
<?
    for ($counter=1; $counter<=12; $counter++) {
        print "<option value=\"". $counter . "\"";
        if (($counter == date("m")) || (date("d") < date("t"))) {
            print " selected";
        }
        print ">" . date("F",mktime(0,0,0,$counter,date("d"),date("Y"))) .
"</option>";
    }
}
</select>

I adjusted it so that you only print out the SELECTED attribute if it's the
current month, and I called $i as $counter, because, to me anyway, it makes
it clearer what is the $counter. If $i works for you, though, there's
nothing wrong with that, and it's not that it's unclear anyway, what with it
in the FOR loop only a few lines earlier. (I'll shut up now about $counter.)

Anyway, I added a comparison above that said if the current date is less
than the last day of the month, then print SELECTED. That's assuming I have
your question right in that you don't want to select the current month if
it's the last day of that month. Otherwise, if I'm wrong, you can take that
comparison and put it just about anywhere.

Help? Doesn't? Am I a complete goof?


--- End Message ---
--- Begin Message ---
change 
for ($i=1; $i<=12; $i++)

to


for ($i=1; $i<12; $i++)
--- Vinesh Hansjee <[EMAIL PROTECTED]> wrote:
> Hi there, can anyone tell me how to fix my code so
> that on the last day of
> the month, my code doesn't repeat the months...
> What the code suppose to do is, makes a drop down
> box from which you can
> select the month, and if its the current month
> the box is already selected.
> 
> <select name="month">
> 
> <?
> 
> for ($i=1; $i<=12; $i++) {
>  if ($i == date("m")) {
>   print "<option selected value=\"". $i . "\">" .
> date("F",mktime(0,0,0,$i,date("d"),date("Y"))) .
> "</option>";
>  } else {
>   print "<option value=\"". $i . "\">" .
> date("F",mktime(0,0,0,$i,date("d"),date("Y"))) .
> "</option>";
>  }
> }
> 
> ?>
> 
> </select>
> 
> Thanks
> Vinesh
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

--- End Message ---
--- Begin Message ---
----- Original Message -----
From: "Vinesh Hansjee" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 31, 2003 6:55 AM
Subject: [PHP] Date Problem - Last Day Of Month


> Hi there, can anyone tell me how to fix my code so that on the last day of
> the month, my code doesn't repeat the months...
> What the code suppose to do is, makes a drop down box from which you can
> select the month, and if its the current month
> the box is already selected.
>
> <select name="month">
>
> <?
>
> for ($i=1; $i<=12; $i++) {
>  if ($i == date("m")) {
>   print "<option selected value=\"". $i . "\">" .
> date("F",mktime(0,0,0,$i,date("d"),date("Y"))) . "</option>";
>  } else {
>   print "<option value=\"". $i . "\">" .
> date("F",mktime(0,0,0,$i,date("d"),date("Y"))) . "</option>";
>  }
> }
>
> ?>
>
> </select>
>
> Thanks
> Vinesh


Vinesh, there's a fundemental flaw in your logic.  The date("d") input will
fail to produce a reliable list if it is executed on any day after the 28th
of the month.  Since today is the 31st obviously this is going to cause some
problems becuase any month that ends on the 30th or earlier will return plus
one the month.  So February will return March, April willl return May, and
so on.  If you wait until tommorrow (the 1st) your function will magically
work.  :)

One way to fix this is to build your own array of month names and reference
that instead of using the date() function.

$months = array(1=>"January", 2=>"February", 3=>"March", 4=>"April",
5="May", 6=> ... and so on...);

for($i=1; $i<=12; $i++)
{
    $selected = "";
    if ($i == date("m"));{$selected = "SELECTED";}
    echo "<option $selected value=\"${months[$i]}\">\n";
}

HTH,
Kevin




--- End Message ---
--- Begin Message ---
Or just make the date("d") a 1.
Every month has a day #1
--- Kevin Stone <[EMAIL PROTECTED]> wrote:
> 
> ----- Original Message -----
> From: "Vinesh Hansjee" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, March 31, 2003 6:55 AM
> Subject: [PHP] Date Problem - Last Day Of Month
> 
> 
> > Hi there, can anyone tell me how to fix my code so
> that on the last day of
> > the month, my code doesn't repeat the months...
> > What the code suppose to do is, makes a drop down
> box from which you can
> > select the month, and if its the current month
> > the box is already selected.
> >
> > <select name="month">
> >
> > <?
> >
> > for ($i=1; $i<=12; $i++) {
> >  if ($i == date("m")) {
> >   print "<option selected value=\"". $i . "\">" .
> > date("F",mktime(0,0,0,$i,date("d"),date("Y"))) .
> "</option>";
> >  } else {
> >   print "<option value=\"". $i . "\">" .
> > date("F",mktime(0,0,0,$i,date("d"),date("Y"))) .
> "</option>";
> >  }
> > }
> >
> > ?>
> >
> > </select>
> >
> > Thanks
> > Vinesh
> 
> 
> Vinesh, there's a fundemental flaw in your logic. 
> The date("d") input will
> fail to produce a reliable list if it is executed on
> any day after the 28th
> of the month.  Since today is the 31st obviously
> this is going to cause some
> problems becuase any month that ends on the 30th or
> earlier will return plus
> one the month.  So February will return March, April
> willl return May, and
> so on.  If you wait until tommorrow (the 1st) your
> function will magically
> work.  :)
> 
> One way to fix this is to build your own array of
> month names and reference
> that instead of using the date() function.
> 
> $months = array(1=>"January", 2=>"February",
> 3=>"March", 4=>"April",
> 5="May", 6=> ... and so on...);
> 
> for($i=1; $i<=12; $i++)
> {
>     $selected = "";
>     if ($i == date("m"));{$selected = "SELECTED";}
>     echo "<option $selected
> value=\"${months[$i]}\">\n";
> }
> 
> HTH,
> Kevin
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

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

> > This is a list for questions about PHP.  Look in the titlebar of your
> > browser when you go to www.php.net
> He was asking *where* PHP stands (regarding licenses), not *what* PHP
> stands for. Maybe PHP FAQ should have something about licenses.

Indeed, I did find somehting ... in the licence FAQ (frequently asked question) 
section: http://www.php.net/license/ discusses: (I don't mean to frequently ask :) )

"GPL enforces many restrictions on what can and cannot be done with the licensed code. 
 The PHP developers decided to release PHP under a much more loose license ..." But 
you don't go into any further detail.

What I would like to know is what are the restrictions? A couple of examples would 
suffice. In a nutshell ... Something I can document in an academic paper I am 
presenting on the utility of PHP & MySQL "combination" and how it improved our 
research mindset.

Rasmus: I understand there are differences between GNU.org & OpenSource.org but I 
didn't mean to offend anyone. Sorry Rasmus, but I was surprised you would answer that 
way. Is this a touchy subject? The "General" list should be the correct place to ask?

John


--- End Message ---
--- Begin Message ---
--- John Taylor-Johnston <[EMAIL PROTECTED]> wrote:
> Rasmus: I understand there are differences between GNU.org & OpenSource.org
> but I didn't mean to offend anyone. Sorry Rasmus, but I was surprised you
> would answer that way. Is this a touchy subject? The "General" list should be
> the correct place to ask?

John,

I think the main point is that this question is completely off-topic. Neither
gnu.org nor opensource.org are sites that have anything to do with using PHP.

As for licenses, you can read PHP's here:
http://cvs.php.net/co.php/php4/LICENSE?login=2&r=1.22.

Chris

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

--- End Message ---
--- Begin Message ---
> Rasmus: I understand there are differences between GNU.org &
> OpenSource.org but I didn't mean to offend anyone. Sorry Rasmus, but I
> was surprised you would answer that way. Is this a touchy subject? The
> "General" list should be the correct place to ask?

No, the php-general list is not the place for you to do your open source 
license research for your school paper.

-Rasmus


--- End Message ---
--- Begin Message ---
>I tend to get more out of the users comments than the actual manual..

It is possible that is because you don't want to put the time into figuring
things out for yourself.  It's a lot easier to post a ton of RTFM questions
than to actually read the manual or research your question.  I seem to
recall you having the same problem with the MySQL documentation.

-----Original Message-----
From: Beauford.2002 [mailto:[EMAIL PROTECTED]
Sent: Friday, March 28, 2003 6:52 PM
To: Leif K-Brooks
Cc: PHP General
Subject: Re: [PHP] Is there a PHP for Dummies?


I found that after the fact, but my question was regarding tutorials, books,
or other docs. This was just an example I used. In general I don't find the
PHP manual very helpful - I tend to get more out of the users comments than
the actual manual..

----- Original Message -----
From: "Leif K-Brooks" <[EMAIL PROTECTED]>
To: "Beauford.2002" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, March 28, 2003 9:49 PM
Subject: Re: [PHP] Is there a PHP for Dummies?


> After a quick search of the php manual, I came upon
> http://www.php.net/manual/en/ref.info.php#ini.magic-quotes-gpc, which
says:
>
> Sets the magic_quotes state for GPC (Get/Post/Cookie) operations. When
> magic_quotes are on, all ' (single-quote), " (double quote), \
> (backslash) and NUL's are escaped with a backslash automatically.
>
> Seems to explain it pretty nicely.
>
> Beauford.2002 wrote:
>
> >No,  the name explains absolutely squat. What is a magic quote? Sounds
like
> >something I smoked in the 60's. Maybe to you it makes sense as you know
what
> >it does. To me it means absolutely nothing - nor does the PHP manual
explain
> >it.
> >
> >B.
> >
> >
> >----- Original Message -----
> >From: "Jennifer Goodie" <[EMAIL PROTECTED]>
> >To: "Beauford.2002" <[EMAIL PROTECTED]>; "PHP General"
> ><[EMAIL PROTECTED]>
> >Sent: Friday, March 28, 2003 5:07 PM
> >Subject: RE: [PHP] Is there a PHP for Dummies?
> >
> >
> >
> >
> >>That is a really, really, really poor example.  Tha name says it all.
It
> >>gets the magic quotes setting for gpc(get, post, cookie).  You can
figure
> >>out what most PHP functions do just by looking at their names, that's
> >>actually what I like about PHP.
> >>
> >>-----Original Message-----
> >>From: Beauford.2002 [mailto:[EMAIL PROTECTED]
> >>Sent: Friday, March 28, 2003 1:54 PM
> >>To: PHP General
> >>Subject: [PHP] Is there a PHP for Dummies?
> >>
> >>
> >>I'm really tired of trying to figure out the PHP manual and need
something
> >>that explains things in plain straight forward English. Like
> >>get_magic_quotes_gpc() for example - the manual says how to use it and
> >>
> >>
> >what
> >
> >
> >>it returns - but nowhere can I find out what it's for. Does it count
> >>
> >>
> >sheep,
> >
> >
> >>do a quote of the day, or what - maybe I'm just stupid - but in any
event
> >>
> >>
> >I
> >
> >
> >>have spent more time in the last two weeks searching for things and
> >>
> >>
> >getting
> >
> >
> >>no answers - Any help in pointing me a good straight forward
> >>
> >>
> >tutorial/manual
> >
> >
> >>would be appreciated.
> >>
> >>B.
> >>
> >>
> >>--
> >>PHP General Mailing List (http://www.php.net/)
> >>To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >>
> >>
> >
> >
> >
> >
> >
>
> --
> The above message is encrypted with double rot13 encoding.  Any
unauthorized attempt to decrypt it will be prosecuted to the full extent of
the law.
>
>
>



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


--- End Message ---
--- Begin Message ---
If the includes are within the website, using
$_SERVER[DOCUMENT_ROOT]/pathtofile/file is a good way to go.

-----Original Message-----
From: John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 29, 2003 2:10 PM
To: 'Greg Macek'; [EMAIL PROTECTED]
Subject: RE: [PHP] require/include from a different directory


> > try using an absolute path.
>
> I've considered that route, but an issue I have with that is I do most
> of my development work on a machine that a different directory
structure
> than the production server (currently a Cobalt RaQ4), so the paths are
> different. Accommodating both would be a time consuming project for
me.

I always put it into a variable.

$_CONF['path'] = '/home/web/www/';

and then use that variable in all of your includes or requires. I also
make an HTML variable that's used in all links and images.

$_CONF['html'] = 'http://www.mysite.com/';

Sure, you have to get used to using this variable everywhere, but it
makes switching server pretty easy.

---John W. Holmes...

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



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


--- End Message ---
--- Begin Message ---
Hey guys,

How can I enable php to work with mcrypt functions?

I´m using debian woody linux. I´ve had installed libmcrypt already, from
debian cds. But I dont know how to make php understands this lib.

thanks
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.465 / Virus Database: 263 - Release Date: 25/03/03


--- End Message ---
--- Begin Message ---
I have a db with events in it. i would like to pull the events out via php, but i would like them to be ordered by month number (1-12). When I do this (Select blah blah From blah Order By Month_Start ASC) it orders the months by number, but it starts with october (month 10) I am pretty sure it is doing this because I have no events until april (month 4). So how can i get it to order the months by their numbers starting with january (1) and going to december (12) even if I do not have events until april (4)?





_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail



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

yah you're right on. The column is varchar. I will change it. Thanks for the insight.

From: Jimmy Brake <[EMAIL PROTECTED]>
To: Tyler Durdin <[EMAIL PROTECTED]>
CC: [EMAIL PROTECTED]
Subject: Re: [PHP] php and mysql
Date: 31 Mar 2003 10:49:30 -0800

is the column that you are selecting the dates from a date column?

sounds like you may be storing your dates in a varchar or some other
type of general text column

On Mon, 2003-03-31 at 10:53, Tyler Durdin wrote:
> I have a db with events in it. i would like to pull the events out via php,
> but i would like them to be ordered by month number (1-12). When I do this
> (Select blah blah From blah Order By Month_Start ASC) it orders the months
> by number, but it starts with october (month 10) I am pretty sure it is
> doing this because I have no events until april (month 4). So how can i get
> it to order the months by their numbers starting with january (1) and going
> to december (12) even if I do not have events until april (4)?
>
>
>
>
> _________________________________________________________________
> The new MSN 8: advanced junk mail protection and 2 months FREE*
> http://join.msn.com/?page=features/junkmail
>




_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail



--- End Message ---

Reply via email to