php-general Digest 9 Jan 2008 14:23:25 -0000 Issue 5225

Topics (messages 266947 through 266965):

Re: ereg help!
        266947 by: Casey
        266948 by: Chris
        266949 by: steve
        266954 by: Anup Shukla
        266955 by: Richard Heyes

Re: MSSQL
        266950 by: Andrew Ballard

Re: client time zone?
        266951 by: Wolf

Re: Posting Summary for Week Ending 4 January, 2008: [EMAIL PROTECTED]
        266952 by: Wolf

Re: Can't find .php3 files
        266953 by: Peter Ford
        266956 by: Ford, Mike
        266962 by: Jim
        266963 by: Anup Shukla
        266965 by: Ford, Mike

PHPInfo - the application
        266957 by: Richard Heyes
        266958 by: Lester Caine
        266959 by: Richard Heyes
        266960 by: Stut
        266961 by: Richard Heyes

Re: First stupid post of the year. [SOLVED]
        266964 by: Nisse Engström

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 ---
On Jan 8, 2008, at 5:45 PM, steve <[EMAIL PROTECTED]> wrote:

I have a dir of html files that link to websites, i would like to read the dir and print a list of those files as a link. Which the script i have does. I would like to take this one step further and replace the ".html" extension
with ".com" so it winds up being:
website.com instead of website.html

I am apparently having problems getting my head around eregi enough to
acomplish this.

any help is greatly appreciated.

<?
$source_dir = "./mydir";

$dir=opendir($source_dir);
$files=array();
while (($file=readdir($dir)) !== false)
{


if ($file != "." && $file != ".." && strpos(strtolower ($file),".php") ===
false)
   {
   array_push($files, $file);
   }
}
closedir($dir);
sort($files);
foreach ($files as $file)
{

echo "<A href='$file'>$file<br>";


}
?>

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


I think glob('*.html'); would be easier.
--- End Message ---
--- Begin Message ---
steve wrote:
I have a dir of html files that link to websites, i would like to read the dir and print a list of those files as a link. Which the script i have does. I would like to take this one step further and replace the ".html" extension with ".com" so it winds up being:
website.com instead of website.html

I am apparently having problems getting my head around eregi enough to acomplish this.

any help is greatly appreciated.

<?
$source_dir = "./mydir";

$dir=opendir($source_dir);
$files=array();
while (($file=readdir($dir)) !== false)
{


if ($file != "." && $file != ".." && strpos(strtolower($file),".php") === false)
        {
        array_push($files, $file);
        }
}
closedir($dir);
sort($files);
foreach ($files as $file)
{

echo "<A href='$file'>$file<br>";


}
?>


I usually use preg_* functions so here's my go:

echo preg_replace('/\.php$/', '.com', $file);

The '$' at the end makes sure it's a .php file and won't cause problems with files like xyz.php.txt .

(otherwise I'd just use a straight str_replace).

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
On Tuesday 08 January 2008 20:30:29 Chris wrote:
>I usually use preg_* functions so here's my go:

>echo preg_replace('/\.php$/', '.com', $file);

>The '$' at the end makes sure it's a .php file and won't cause problems 
>with files like xyz.php.txt .

>(otherwise I'd just use a straight str_replace).

Thanks

Guess i was just trying to over think it. Have not done much with files.


Steve

--- End Message ---
--- Begin Message ---
steve wrote:
On Tuesday 08 January 2008 20:30:29 Chris wrote:
I usually use preg_* functions so here's my go:

echo preg_replace('/\.php$/', '.com', $file);

The '$' at the end makes sure it's a .php file and won't cause problems with files like xyz.php.txt .

(otherwise I'd just use a straight str_replace).

Thanks

Guess i was just trying to over think it. Have not done much with files.


Steve


$out = basename($file, ".html") . ".com";

fairly limited i think, but simple.

--
Regards,
Anup Shukla

--- End Message ---
--- Begin Message ---
$out = basename($file, ".html") . ".com";

fairly limited i think, but simple.

Nothing wrong with being simple, and therefore both fast and easy to understand by a wider audience. The only downer I can immediately think of though is that whitespace isn't accommodated, but who really ends a file name with white space?

--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **

--- End Message ---
--- Begin Message ---
On Jan 8, 2008 8:58 PM, Shelley Shyan <[EMAIL PROTECTED]> wrote:
> Did you check that you have enabled MSSQL extension?
> That is,
> On XP system, you should have this line 'extension=php_msql.dll' in php.ini 
> file and the leading ';' be removed.
> On Ubuntu, you should also install mssql extension, which is a little more 
> complex.
>
> There should be no problem once you have managed mssql.
> It talks to sql server 2005/2000 quite well.
>
>
> Regards,
> Shelley

Just to be clear, the post above has a typo and should read
'extension=php_mssql.dll'.

I have found that for PHP hosted on a Windows box to talk to SQL
Server 2005 you have to have the latest version of the library
ntwdblib.dll or it won't connect. (The details were in the comments in
the manual page for mssql if you haven't checked this already.) SQL
Server 2000 doesn't usually have a problem. I haven't tried to connect
to SQL Server from a Linux box, though.

Other than that, the only tricks I have found involve making sure you
are using the correct server address syntax if SQL Server is using
something other than the default port (pretty simple, but I've seen it
trip a few folks up) and using SQL Authentication rather than Windows
(trusted) authentication. If you are ultimately looking to connect
from a Linux box I am guessing this is already the case.

Andrew

--- End Message ---
--- Begin Message ---
Sure, have a look on google for php: time zone class and you should be good to 
go!

What code have you written so far to try using the  data from the server?

Wolf

-----Original Message-----
From: jekillen <[EMAIL PROTECTED]>
Sent: Saturday, January 05, 2008 10:51 PM
To: PHP General list <[EMAIL PROTECTED]>
Subject: [PHP] client time zone?

Hello;
I am running a server that is using UTC
and I want to be able to convert to
clients local time in some display presentations.
Is this indicated by $_SERVER["REQUEST_TIME"]?
If not, is there a way to get the requesting host's
time zone so I can offset the servers clock value correctly?
Thank you for info:
Jeff K

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

--- End Message ---
--- Begin Message ---
Looks like your cron job is set for every minute Don!  Please disable it until 
you get the kinks worked out of it!

-----Original Message-----
From: Daniel Brown <[EMAIL PROTECTED]>
Sent: Friday, January 04, 2008 7:24 PM
To: PostTrack [Dan Brown] <[EMAIL PROTECTED]>
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Posting Summary for Week Ending 4 January, 2008: [EMAIL 
PROTECTED]

    It must be something on the mailing list side of things, because
I'm getting them, too, but there's nothing at all in my outgoing
queue.

On Jan 4, 2008 5:48 PM, PostTrack [Dan Brown]
<[EMAIL PROTECTED]> wrote:
>
>
>         Posting Summary for PHP-General List
>         Week Ending: Friday, 4 January, 2008
>
>         Messages        | Bytes           | Sender
>         ----------------+-----------------+------------------
>         4 (100%)         4305 (100%)      EVERYONE
>         2    (0.5%)      1100    (0.26%)      "Daniel Brown" <[EMAIL 
> PROTECTED]>
>         1    (0.25%)      1532    (0.36%)      "TG" <[EMAIL PROTECTED]>
>         1    (0.25%)      1673    (0.39%)      "Miren Urkixo" <[EMAIL 
> PROTECTED]>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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

--- End Message ---
--- Begin Message ---
Jim wrote:
> I'm sure this is a FAQ but I can't seem to come up with the right search
> keys to dig it out.
> I'm trying to help a friend migrate his application to php 5 from
> another system.  The problem seems to be that he references files
> (require, include, etc) that have a .php3 extension, however there are
> no files in those locations with the .php3.  There are files with .php
> extensions.  It's running on a system that has php 4 on it.
> 
> So I'm sure either php or Apache is rewriting the files somehow, but I
> don't know how.
> 
> Can someone please point me to the appropriate documentation or give me
> a hint as to what is going on here?
> 
> Thanks,
> Jim.

Take a look in the Apache reference docs for mod_rewrite (exactly where you look
depends on which version of Apache you are using).

Then search for (a) any .htaccess files in the web-app, and (b) any Apache
config files: this will be Linux-distro-dependent but somewhere like /etc/apache
or /etc/httpd might be the first thing to try...

You are looking for either directory-specific or system-wide Apache RewriteRule
directives, especially those that contain a pattern which matches ".php3"

If you can't find anything like that, then Apache ain't rewriting...

--- End Message ---
--- Begin Message ---
Chris wrote:
> 
> > I think you misunderstood.  I have lots of file with things like
> > 
> > require "admin.php3"
> > 
> > But there is no admin.php3 anywhere.  There is however a file
> > admin.php. Since this works on the old server then something on
> > that system is translating a request for a .php3 file to .php I'm
> > guessing. Apache or php but I don't know which.
> 
> It will be apache.

If the line quoted above is exactly as it appears in the PHP script, then it 
will definitely *not* be Apache. A require with just a filename like that goes 
straight to the file system, with nary even a hint of a thought  of involving 
Apache.  So the admin.php3 file must exist *somewhere* in the file system.

As someone else suggested, I think your best bet is to examine the include_path 
setting in php.ini (via a phpinfo() script if necessary).

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
JG125, The Headingley Library,
James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 812 4730          Fax:  +44 113 812 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

--- End Message ---
--- Begin Message ---
Ford, Mike wrote:
Chris wrote:
I think you misunderstood.  I have lots of file with things like

require "admin.php3"

But there is no admin.php3 anywhere.  There is however a file
admin.php. Since this works on the old server then something on
that system is translating a request for a .php3 file to .php I'm
guessing. Apache or php but I don't know which.
It will be apache.

If the line quoted above is exactly as it appears in the PHP script, then it 
will definitely *not* be Apache. A require with just a filename like that goes 
straight to the file system, with nary even a hint of a thought  of involving 
Apache.  So the admin.php3 file must exist *somewhere* in the file system.

As someone else suggested, I think your best bet is to examine the include_path 
setting in php.ini (via a phpinfo() script if necessary).

Cheers!

Mike

Hi, Mike,

The include is more like
require "../admin/admin.php3" I don't know exactly how Apache performs its magic so I wasn't sure that the request for an include file would even pass through Apache's hands. In my limited world, an include wouldn't have to involve Apache, just the file systems.

We did look at the php.ini file in /etc and it was pretty much innocuous. Looked like a default from when the system was installed. I'll have a closer look today.

Thanks.
Jim

--- End Message ---
--- Begin Message ---
Jim wrote:
Hi, Mike,

The include is more like
require "../admin/admin.php3" I don't know exactly how Apache performs its magic so I wasn't sure that the request for an include file would even pass through Apache's hands. In my limited world, an include wouldn't have to involve Apache, just the file systems.


The admin.php3 seems to be 2 levels above the current dir.

What about

print realpath("../admin/admin.php3")

in the same script?

--
Regards,
Anup Shukla

--- End Message ---
--- Begin Message ---
On 09 January 2008 12:18, Anup Shukla wrote:

> Jim wrote:
> > Hi, Mike,
> > 
> > The include is more like
> > require "../admin/admin.php3" I don't know exactly how Apache
> > performs its magic so I wasn't sure that the request for an include
> > file would even pass through Apache's hands.  In my limited world,
> > an include wouldn't have to involve Apache, just the file systems.
> > 
> 
> The admin.php3 seems to be 2 levels above the current dir.
> 
> What about
> 
> print realpath("../admin/admin.php3")
> 
> in the same script?

That's quite a good suggestion.

Just to be clear about the other point, an include or require is purely file 
system based, *unless* you give it a full URL beginning with a protocol name 
such as http:// or ftp:// (which, as a general rule, is somewhat 
disrecommended!).

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
JG125, The Headingley Library,
James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 812 4730          Fax:  +44 113 812 3211 



To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

--- End Message ---
--- Begin Message --- Does anyone have a URL for it? Naturally Google returns a lot of pages which are about the actual function.

Thanks.

--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **

--- End Message ---
--- Begin Message ---
Richard Heyes wrote:
Does anyone have a URL for it? Naturally Google returns a lot of pages which are about the actual function.

http://www.php.net/
just put phpinfo into the 'search for' and you will get the REAL data for it.

Google is never the best starting point when you know what you are looking for!

--
Lester Caine - G8HFL
-----------------------------
Contact - http://home.lsces.co.uk/lsces/wiki/?page=contact
L.S.Caine Electronic Services - http://home.lsces.co.uk
MEDW - http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/
Firebird - http://www.firebirdsql.org/index.php

--- End Message ---
--- Begin Message ---
Lester Caine wrote:
Richard Heyes wrote:
Does anyone have a URL for it? Naturally Google returns a lot of pages which are about the actual function.

http://www.php.net/
just put phpinfo into the 'search for' and you will get the REAL data for it.

Google is never the best starting point when you know what you are looking for!

Did you actually read my email? The subject is a rather good hint too.

--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **

--- End Message ---
--- Begin Message ---
Richard Heyes wrote:
Lester Caine wrote:
Richard Heyes wrote:
Does anyone have a URL for it? Naturally Google returns a lot of pages which are about the actual function.

http://www.php.net/
just put phpinfo into the 'search for' and you will get the REAL data for it.

Google is never the best starting point when you know what you are looking for!

Did you actually read my email? The subject is a rather good hint too.

Do you mean phpsysinfo? http://phpsysinfo.sf.net/

-Stut

--
http://stut.net/

--- End Message ---
--- Begin Message ---
Do you mean phpsysinfo? http://phpsysinfo.sf.net/

Bingo, thanks.

--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **

--- End Message ---
--- Begin Message ---
On Mon, 7 Jan 2008 10:29:45 -0500, tedd wrote:

> At 12:03 PM +0100 1/7/08, Nisse Engström wrote:
>>How does the following pages compare? The display
>>should be identical:
>>
>><http://luden.se/test/t-1252.html>
>><http://luden.se/test/t-utf8.html>
> 
> Nisse:
> 
> No, there is quite a difference depending upon 
> the text encoding used in my browser (Safari).

   You said that there was no windows-1252 setting
in Safari, so I am curious to know if it is capable
of mapping the 1252-encoded page to the correct
characters. If you set your browser to detect the
encoding *automatically*, does the two pages display
identically, or are there differences?

   According to the mappings at unicode.org, there
are a lot of difference between MACROMAN and CP1252,
for instance, the first character on the page (0x80)
is A-DIARESIS in MACROMAN and EURO SIGN in 1252.


/Nisse

--- End Message ---

Reply via email to