php-windows Digest 24 Mar 2004 20:20:26 -0000 Issue 2180

Topics (messages 23249 through 23260):

Authentication Problem under IIS 5
        23249 by: MW
        23250 by: MW

Re: Major apache start error!!
        23251 by: Sumito_Oda

Timestamp comparison
        23252 by: Jim MacDiarmid

Favortire Page template Structure
        23253 by: Jim MacDiarmid
        23255 by: Charles P. Killmer
        23257 by: Charles P. Killmer

Session problem
        23254 by: carlos castillo

PHP sql to table code
        23256 by: M.Feoli
        23258 by: trystano.aol.com

Re: php5isapi.dll not handling MySQL
        23259 by: Tom Khoury

Email with attachments coming through damaged
        23260 by: Ron.Herhuth.tatumpartners.com

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 --- I recently installed PHP as an ISAPI module under Win2k. I've followed the instructions as listed on the website, and copied php4ts.dll and php4sapi.dll to the winnt/system32 directory (PHP is installed in d:/php)

My website is set to use basic authentication. The problem is now that when I access pages on the website, I get a login prompt and .htm pages work normally. However when I access .php pages, it will not accept the HTTP authentication. It keeps asking me for the login info again and again.

Interestingly, if I enter the admin user and password in the login info, pages work fine. My default users are members of the Win2k "Users" group, and their auth info is not accepted by the php pages.

I think the issue might be because of NTFS Permissions. My computer is set up as described in the MS KB article Q271071 http://support.microsoft.com/default.aspx?scid=kb;en-us;Q271071

Any help is appreciated.

MW
--- End Message ---
--- Begin Message --- I recently installed PHP as an ISAPI module under Win2k. I've followed the instructions as listed on the website, and copied php4ts.dll and php4sapi.dll to the winnt/system32 directory (PHP is installed in d:/php)

My website is set to use basic authentication. The problem is now that when I access pages on the website, I get a login prompt and .htm pages work normally. However when I access .php pages, it will not accept the HTTP authentication. It keeps asking me for the login info again and again.

Interestingly, if I enter the admin user and password in the login info, pages work fine. My default users are members of the Win2k "Users" group, and their auth info is not accepted by the php pages.

I think the issue might be because of NTFS Permissions. My computer is set up as described in the MS KB article Q271071 http://support.microsoft.com/default.aspx?scid=kb;en-us;Q271071

Any help is appreciated.

MW
--- End Message ---
--- Begin Message ---
>What about updating to Apache2 altogether?

It is "Could you adopt latest Apache1.3.29 now?
(It is not old Apache1.3.14 in version 1.x)" that he says.

However, a similar error did not occur though I obtained
Apache1.3.14r2 from the archive, and tried with PHP4.3.5RC4.
http://archive.apache.org/dist/httpd/binaries/win32/old/

The one by the combination with old Apache
and present PHP seems not to be a cause.

-- 
Sumito_Oda mailto:[EMAIL PROTECTED]

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

I'm looking for some opinions on the best way to do time date
comparison. For example, I have a log file and I'd like to retrieve all
records or the top 15 records within the last day or within the last
hour. Any recommendations?  I was considering splitting Date and time
into 2 fields but wasn't sure if this was the standard practice.

Thanks in advance,
Jim 

--- End Message ---
--- Begin Message ---
I was interested in seeing if anyone has a favorite way of structuring
their PHP pages? For instance, I found one example where pages were laid
out as follows:

Everything was based off of index.php and parameters were submitted
through the hidden fields or through an action variable on the url
querystring.

Index.php
--------- Begin example index.php ----------
<?php
/*
 * Common include files here
 * Database connection initialization includes here
 * Security includes here
 */


/* 
 * define local functions here
 */


/*
 * Initialize globals variables 
 * and constants here 
 */


/*
 * Define a main function here
 */

Function main(){

/*
 * Initialize local variables 
 * and constants here 
 */

  /* capture action variable on url querystring */              

  /* do something based on action */    
  
}
?>

/* HTML Code here */


-----8<-- End Example --->8--

Any thoughts on this? I'm still kinda new at PHP and wanted to learn the
best way to structure my code from the git-go.  :)

Thanks in advance,
Jim

--- End Message ---
--- Begin Message ---
I have been very fond of this method that I developed over the last few
years.

Lets say you have a site with three pages.  Index, about us, and contact
us.

I create index.php like this
<?
function output() {
?>
        html stuff here
<?
}
include "template.php";
?> 

About us and contact us look the same

Template then just has 



<?
        session starting
        any security stuff here
?>
HTML Stuff
<?
output();
?>
More html




Then changing the look of the site is just in that one file.  And things
like webtrends still give accurate results.

Charles Killmer
Netgain Technology









-----Original Message-----
From: Jim MacDiarmid [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 24, 2004 8:36 AM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Favortire Page template Structure

I was interested in seeing if anyone has a favorite way of structuring
their PHP pages? For instance, I found one example where pages were laid
out as follows:

Everything was based off of index.php and parameters were submitted
through the hidden fields or through an action variable on the url
querystring.

Index.php
--------- Begin example index.php ---------- <?php
/*
 * Common include files here
 * Database connection initialization includes here
 * Security includes here
 */


/*
 * define local functions here
 */


/*
 * Initialize globals variables 
 * and constants here 
 */


/*
 * Define a main function here
 */

Function main(){

/*
 * Initialize local variables 
 * and constants here 
 */

  /* capture action variable on url querystring */              

  /* do something based on action */    
  
}
?>

/* HTML Code here */


-----8<-- End Example --->8--

Any thoughts on this? I'm still kinda new at PHP and wanted to learn the
best way to structure my code from the git-go.  :)

Thanks in advance,
Jim

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

--- End Message ---
--- Begin Message ---
Exactly.  I have really loved doing sites this way.  One caveat though.
Unless you buffer the entire page you must send headers before the
template file is included.

<?
if (something) {
        header("Location: somewhere.php4");
        exit();
}

function output() {
}
include "template.php4";
?>


This is because the template will echo to the browser before the output
function is called.  So if the output function is going to redirect the
client to another page, you must do the redirect before the page is
sent.  Then the other thing I have done is define variables outside the
function or multiple functions for things like the title of the page,
maybe meta data, or a function to generate a menu on the template.  Then
to take this a little further you could store the template html in a
database and allow a user to select which template they would like to
see when they log into the site.  And if you break it up still further
you could define sections on the template that could be stored in a DB
so the user could select which sections they see and possibly organize
the layout as they see fit.

Charles Killmer
Netgain Technology
Open Source Rocks!

 

-----Original Message-----
From: Jim MacDiarmid [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 24, 2004 9:38 AM
To: Charles P. Killmer
Subject: RE: [PHP-WIN] Favortire Page template Structure

So in your Output function you would have just tables?  No
<HTML><HEAD><BODY></BODY></HEAD</HTML> stuff?

I'm finding that there are not many examples for layout like this or
other ways. 

Thanks for sharing!  :)

Jim

-----Original Message-----
From: Charles P. Killmer [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 24, 2004 9:53 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-WIN] Favortire Page template Structure


I have been very fond of this method that I developed over the last few
years.

Lets say you have a site with three pages.  Index, about us, and contact
us.

I create index.php like this
<?
function output() {
?>
        html stuff here
<?
}
include "template.php";
?> 

About us and contact us look the same

Template then just has 



<?
        session starting
        any security stuff here
?>
HTML Stuff
<?
output();
?>
More html




Then changing the look of the site is just in that one file.  And things
like webtrends still give accurate results.

Charles Killmer
Netgain Technology









-----Original Message-----
From: Jim MacDiarmid [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 24, 2004 8:36 AM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Favortire Page template Structure

I was interested in seeing if anyone has a favorite way of structuring
their PHP pages? For instance, I found one example where pages were laid
out as follows:

Everything was based off of index.php and parameters were submitted
through the hidden fields or through an action variable on the url
querystring.

Index.php
--------- Begin example index.php ---------- <?php
/*
 * Common include files here
 * Database connection initialization includes here
 * Security includes here
 */


/*
 * define local functions here
 */


/*
 * Initialize globals variables 
 * and constants here 
 */


/*
 * Define a main function here
 */

Function main(){

/*
 * Initialize local variables 
 * and constants here 
 */

  /* capture action variable on url querystring */              

  /* do something based on action */    
  
}
?>

/* HTML Code here */


-----8<-- End Example --->8--

Any thoughts on this? I'm still kinda new at PHP and wanted to learn the
best way to structure my code from the git-go.  :)

Thanks in advance,
Jim

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

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

--- End Message ---
--- Begin Message ---
I want to know how can i do to make the session dont expire?. i have an
application that works with sessions, when i left the browser open for a
while, i dont know maybe 30 minutes, when i try to go into a section it
throw me an error, for session expire, how can i fic that?.

thanks.

Carlos A. Castillo.
Ingeniero de desarrollo
[EMAIL PROTECTED]
____________________________________

Su Aliado Efectivo en Internet
www.imagine.com.co
(57 1)2182064 - (57 1)6163218
Bogotá - Colombia 
____________________________________
- Soluciones web para Internet e Intranet
- Soluciones para redes
- Licenciamiento de Software
- Asesoría y Soporte Técnico
____________________________________

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

Does anyone knows where to find a sample of a code that takes an SQL and
delivers a paged report on html?

say for example 200 records come out of the sql search,  so it displays the
first page of 50 records,  and shows  at the bottom the numbers 2,3,4  to
move forward on pages.

Am I asking too much to find this already done?

thanks for any input

--- End Message ---
--- Begin Message ---
Sitepoint.com have a very nice tutorial/article on this.

I also have another tutorial URL in my house, so will have to post that link when I 
get home.

Tryst

--- End Message ---
--- Begin Message --- Don McFarland wrote:
Im using PHP version Version 5.0.0b4 on XP-Pro (php5isapi.dll) running
IIS 5.1 and have gotten the SQLite to work nicely. However, the when
trying to use an up-and-running MySQL server, the script is always
cut-off at the start with the error "Call to undefined function
mysql_connect" even though I have the MySQL support enabled in the
php.ini file (uncommented the "extension=php_mysql.dll" line), and have
made sure to have the 2 related DLLs (php_mysql.dll and libmysql.dll)
installed in the correct directories. Also, the function call to
mysql_connect has the correct parameters (which is not relevant due to
the error message).

Unless the error message is erroneous, the result of my setup implies
that php5isapi.dll is not able to deal with MySQL queries. If anyone
knows if/how php5isapi.dll can handle MySQL queries, it would be greatly
appreciated if you could let me know how.

Sincerely,

Don

I had a very similar problem with PHP5 and MySQL (on Apache though). I had fixed this problem by copying the libmysql.dll file that comes with the PHP distribution to c:\WINNT\System32.

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

I'm trying to send an attachment via email using the following function,
but it keeps coming through damaged.  I am having no trouble emailing the
same attachment using OutLook.  Is there something wrong with the function
I'm using?  The attachment shows up and I'm not getting any errors, but it
just won't open up in Acrobat.

Thanks,
Ron






<?

$email_address = "[EMAIL PROTECTED]";
$email_from = "[EMAIL PROTECTED]";
$subject = "Testing Email with attachments";
$msg = "Text message shown in email";
$attach_filepath = array("2003_CIO_K1_Memo.pdf");

xmail($email_address,$email_from,$subject,$msg,$attach_filepath);


function xmail($email_address,$email_from,$subject,$msg,$attach_filepath)
{ 
       $b = 0; 
       $mail_attached = ""; 
       $boundary = md5(uniqid(time(),1))."_xmail"; 
       if (count($attach_filepath)>0) { 
           for ($a=0;$a<count($attach_filepath);$a++) { 
               if ($fp = fopen($attach_filepath[$a],"rb")) { 
                   $file_name = basename($attach_filepath[$a]); 
                   $content[$b] = fread($fp,filesize($attach_filepath[$a])); 
                   $mail_attached .= "--".$boundary."\r\n" 
                       ."Content-Type: application/pdf; name=\"$file_name\"\r\n" 
                       . "Content-Transfer-Encoding: base64\r\n" 
                       . "Content-Disposition: attachment; 
filename=\"$file_name\"\r\n\r\n" 
                       .chunk_split(base64_encode($content[$b]))."\r\n"; 
                   $b++; 
                   fclose($fp); 
               } else { 
                   echo "NEIN"; 
               } 
           } 
           $mail_attached .= "--".$boundary." \r\n"; 
           $add_header ="MIME-Version: 1.0\r\nContent-Type: multipart/mixed; 
boundary=\"$boundary\""; 
           $mail_content = "--".$boundary."\r\n" 
                       . "Content-Type: text/plain; charset=iso-8859-1; 
format=flowed\r\n" 
                       . "Content-Transfer-Encoding: 8bit\r\n\r\n" 
                       . $msg."\r\n\r\n".
$mail_attached;
           return mail($email_address,$subject,$mail_content,"From:
".$email_from."\r\n".$add_header);
       } else

           return mail($email_address,$subject,$msg,"From: ".$email_from);
       }
}

?>






--- End Message ---

Reply via email to