php-general Digest 16 Feb 2008 11:31:00 -0000 Issue 5296

Topics (messages 269392 through 269404):

Re: How to read excel sheet and display it's contents.
        269392 by: g4me0ver

Re: Posting Summary for Week Ending 15 February, 2008: [EMAIL PROTECTED]
        269393 by: Jim Lucas

Re: www. not working
        269394 by: Valedol
        269396 by: Jim Lucas
        269397 by: Jim Lucas
        269398 by: Micky Hulse
        269399 by: Shawn McKenzie
        269400 by: Shawn McKenzie
        269401 by: Shawn McKenzie
        269402 by: Valedol
        269403 by: M. Sokolewicz

Semaphores without sysvmsg?
        269395 by: Michael McGlothlin

Re: check if website has www. in front of domain
        269404 by: Richard Heyes

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 ---
to get phpexcelreader to work you must change the 

require_once line for this one

require_once 'OLERead.inc';


tedd-2 wrote:
> 
> At 3:46 PM -0800 2/11/08, Warren Vail wrote:
>>I finally settled for CSV, but even there Microsoft plays games with the
>>format, or so it seems.
> 
> Yes, it's a bugger.
> 
> M$ always has a better idea and replaces it daily.
> 
> Stick with CSV and let applications sort it out.
> 
> Cheers,
> 
> tedd
> -- 
> -------
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-read-excel-sheet-and-display-it%27s-contents.-tp15422690p15510579.html
Sent from the PHP - General mailing list archive at Nabble.com.

--- End Message ---
--- Begin Message ---
Nathan Rixham wrote:
PostTrack [Dan Brown] wrote:
    Posting Summary for PHP-General List
    Week Ending: Friday, 15 February, 2008

    Messages            | Bytes              | Sender
    --------------------+--------------------+------------------
    394 (100%)          601925 (100%)       EVERYONE
31 (7.9%) 35696 (5.9%) Nathan Nobbe <quickshiftin at gmail dot com> 31 (7.9%) 34504 (5.7%) Richard Lynch <ceo at l-i-e dot com> 28 (7.1%) 23914 (4%) Per Jessen <per at computer dot org> 26 (6.6%) 44143 (7.3%) Nathan Rixham <nrixham at gmail dot com> 20 (5.1%) 22234 (3.7%) Daniel Brown <parasane at gmail dot com> 17 (4.3%) 30201 (5%) Robert Cummings <robert at interjinn dot com> 14 (3.6%) 22218 (3.7%) Stut <stuttle at gmail dot com> 12 (3%) 17847 (3%) Shawn McKenzie <nospam at mckenzies dot net> 10 (2.5%) 11824 (2%) mike <mike503 at gmail dot com> 8 (2%) 15297 (2.5%) Jochem Maas <jochem at iamjochem dot com> 8 (2%) 4854 (0.8%) Greg Donald <gdonald at gmail dot com> 7 (1.8%) 7178 (1.2%) nihilism machine <nihilismmachine at gmail dot com> 7 (1.8%) 7708 (1.3%) Eric Butera <eric dot butera at gmail dot com> 7 (1.8%) 15841 (2.6%) Manuel Lemos <mlemos at acm dot org> 6 (1.5%) 8709 (1.4%) Jason Pruim <japruim at raoset dot com> 6 (1.5%) 9421 (1.6%) Zoltán Németh <znemeth at alterationx dot hu> 6 (1.5%) 4574 (0.8%) admin at buskirkgraphics dot com 6 (1.5%) 7170 (1.2%) Nirmalya Lahiri <nirmalyalahiri at yahoo dot com> 6 (1.5%) 4589 (0.8%) Richard Heyes <richardh at phpguru dot org> 6 (1.5%) 35566 (5.9%) Michael McGlothlin <michaelm at swplumb dot com> 5 (1.3%) 7172 (1.2%) Andrew Ballard <aballard at gmail dot com> 5 (1.3%) 9758 (1.6%) Ron Piggott <ron dot php at actsministries dot org> 5 (1.3%) 9243 (1.5%) Xavier de Lapeyre <xavier at edsnetworks dot net> 5 (1.3%) 4935 (0.8%) Sancar Saran <sancar dot saran at evodot dot com> 5 (1.3%) 4714 (0.8%) Paul Scott <pscott at uwc dot ac dot za> 4 (1%) 7010 (1.2%) Peter Ford <pete at justcroft dot com> 4 (1%) 7595 (1.3%) Wolf <lonewolf at nc dot rr dot com> 4 (1%) 7980 (1.3%) Jim Lucas <lists at cmsws dot com>
    3      (0.8%)      4207    (0.7%)      at 4u <pz4u at vplace dot de>
3 (0.8%) 8764 (1.5%) Ritesh Nadhani <riteshn at gmail dot com> 3 (0.8%) 2037 (0.3%) Siegfried Gipp <siegfried at rorkvell dot de> 3 (0.8%) 1102 (0.2%) Christoph Boget <christoph dot boget at gmail dot com> 3 (0.8%) 2712 (0.5%) Jakub <ja dot cermi at centrum dot cz> 2 (0.5%) 1289 (0.2%) Emil Edeholt <emil at knmedical dot se> 2 (0.5%) 3040 (0.5%) David Giragosian <dgiragosian at gmail dot com> 2 (0.5%) 1289 (0.2%) chetan rane <chetan dot d dot rane at gmail dot com> 2 (0.5%) 1898 (0.3%) Emilio Astarita <emilio dot astarita at gmail dot com> 2 (0.5%) 12436 (2.1%) Børge Holen <borge at arivene dot net> 2 (0.5%) 2176 (0.4%) srihari naidu <srihari_asd at yahoo dot com> 2 (0.5%) 1270 (0.2%) Jay Blanchard <jblanchard at pocket dot com>
    2      (0.5%)      2656    (0.4%)      LKSunny <ad at pc86 dot com>
2 (0.5%) 1646 (0.3%) tedd <tedd dot sperling at gmail dot com> 2 (0.5%) 2576 (0.4%) Michelle Konzack <linux4michelle at freenet dot de> 2 (0.5%) 4420 (0.7%) Aleksandar Vojnovic <muadib at artrebel9 dot com> 2 (0.5%) 1047 (0.2%) Floor Terra <floort at gmail dot com>
    2      (0.5%)      6397    (1.1%)      miren at tinieblas dot com
2 (0.5%) 2092 (0.3%) Angelo Zanetti <angelo at elemental dot co dot za> 2 (0.5%) 1370 (0.2%) NotReally GonnaTell <lithlist at gmail dot com> 2 (0.5%) 1099 (0.2%) Brian Dunning <brian at briandunning dot com> 2 (0.5%) 4661 (0.8%) Hiep Nguyen <hiep at ee dot ucr dot edu> 1 (0.3%) 1069 (0.2%) Marcos Lois Bermúdez <marcos dot list at gmail dot com> 1 (0.3%) 2377 (0.4%) Berkhimer Sterrett <hooliganize at bbbforum dot org> 1 (0.3%) 563 (0.1%) pretty <anu4php at gmail dot com> 1 (0.3%) 2153 (0.4%) Børge Holen <borge at arivene dot net> 1 (0.3%) 876 (0.1%) Arvids Godjuks <arvids dot godjuks at gmail dot com> 1 (0.3%) 2174 (0.4%) Miguel J dot Jiménez <MiguelJose dot Jimenez at isotrol dot com> 1 (0.3%) 1287 (0.2%) Anjan Upadhya <anjan at sproutloud dot com> 1 (0.3%) 1288 (0.2%) Daevid Vincent <daevid at daevid dot com> 1 (0.3%) 8742 (1.5%) PostTrack [Dan Brown] <listwatch-php-general at pilotpig dot net> 1 (0.3%) 542 (0.1%) Christoph Boget <jcboget at yahoo dot com> 1 (0.3%) 1229 (0.2%) Brady Mitchell <mydarb at gmail dot com> 1 (0.3%) 1436 (0.2%) Dax Solomon Umaming <knightlust at ubuntu dot com> 1 (0.3%) 1805 (0.3%) David Robley <robleyd at aapt dot net dot au> 1 (0.3%) 1327 (0.2%) Pastor Steve <smarquez at ccfortsmith dot com> 1 (0.3%) 1049 (0.2%) Rob Gould <gouldimg at mac dot com> 1 (0.3%) 488 (0.1%) julian <correojulian33-php at yahoo dot es> 1 (0.3%) 1885 (0.3%) Aleksandar Vojnovic <muadib at consoriana dot com> 1 (0.3%) 1004 (0.2%) ahlist <ahlist at gmail dot com> 1 (0.3%) 524 (0.1%) Pauau <wakamonka747 at hotmail dot com> 1 (0.3%) 557 (0.1%) Bruce Gilbert <webguync at gmail dot com> 1 (0.3%) 1073 (0.2%) András Csányi <sayusi dot ando at gmail dot com> 1 (0.3%) 275 (0%) �ukasz Wojciechowski <nostrzak at gmail dot com> 1 (0.3%) 1900 (0.3%) Nick Gasparro <nick at remycorp dot com> 1 (0.3%) 352 (0.1%) Richard Kurth <richardkurth at centurytel dot net> 1 (0.3%) 2665 (0.4%) Mick <asurfer at iinet dot net dot au> 1 (0.3%) 2442 (0.4%) Larry Garfield <larry at garfieldtech dot com> 1 (0.3%) 1655 (0.3%) Andrés Robinet <agrobinet at bestplace dot biz> 1 (0.3%) 3319 (0.6%) Gohring Shollenberger <cutch at acif dot org>
    1      (0.3%)      1129    (0.2%)      Al <news at ridersite dot org>
1 (0.3%) 607 (0.1%) John Papas <jspapas at gmail dot com> 1 (0.3%) 1440 (0.2%) Chris <dmagick at gmail dot com> 1 (0.3%) 824 (0.1%) Robert Cox <Robert dot Cox at utas dot edu dot au> 1 (0.3%) 913 (0.2%) Ron Piggott <ron dot piggott at actsministries dot org> 1 (0.3%) 2361 (0.4%) Warren Vail <warren at vailtech dot net> 1 (0.3%) 3317 (0.6%) Rhone Tippetts <trigrams at capitalregion dot org> 1 (0.3%) 391 (0.1%) Ryan A <genphp at yahoo dot com> 1 (0.3%) 466 (0.1%) Mary Anderson <maryfran at demog dot berkeley dot edu> 1 (0.3%) 720 (0.1%) Nate Tallman <nate dot tallman at connectivhealth dot com> 1 (0.3%) 1052 (0.2%) Bastien Koert <bastien_k at hotmail dot com> 1 (0.3%) 3203 (0.5%) Britts Fabiano <exteriorized at derryjournal dot com> 1 (0.3%) 334 (0.1%) clive <clive_lists at immigrationunit dot com> 1 (0.3%) 1115 (0.2%) Brice <brice dot favre at gmail dot com> 1 (0.3%) 1380 (0.2%) Jan Müller <jamuelle at ee dot ethz dot ch> 1 (0.3%) 23805 (4%) jihad A. Al-Ammar \( \) <jalammar at gosi dot gov dot sa> 1 (0.3%) 20374 (3.4%) Yoshika Kehelpannala <yoshikak at csbsl dot com> 1 (0.3%) 359 (0.1%) Michael Moyle <mmoyle at gaba dot co dot jp>


NOTE: Numbers may not add up to 100% due to protection of names and addresses upon request.

DISCLAIMER: If you want your email address omitted from future weekly reports,
please email me privately at [EMAIL PROTECTED] and it will be removed.

top 5 : i can shut up now :'(


But it is the start of a new week.

--- End Message ---
--- Begin Message --- On Fri, 15 Feb 2008 23:46:57 +0300, nihilism machine <[EMAIL PROTECTED]> wrote:

this still does not work, if a domain has no preceeding www. it redirects to http://www.www.site.com, if it has a www. it goes to www.www.mydomain.com, any ideas?

<?php

class URL {

        // Public Variables
        public $ServerName;
        public $WWW;
        
        // Public Functions
        
        public function __construct() {
                $this->checkWWW();
                $this->ServerName = $_SERVER['SERVER_NAME'] . 
$_SERVER['REQUEST_URI'];
        }
        
        // Check if site is preceeded by 'WWW'
        public function checkWWW() {
                $myDomain = $_SERVER['SERVER_NAME'];
                $FindWWW = 'www.';
                $POS = strpos($myDomain, $FindWWW);
                if ($POS === 1) {
                        $this->WWW = true;
                } else {
                        $this->WWW = false;
                }
        }

        // Redirect to WWW
        public function WWWRedirect() {
                if ($this->WWW == false) {
                        $redir = "Location: http://www."; . $this->ServerName;
                        header($redir);
                }
        }

}

$myURL = new URL();
$myURL->WWWRedirect();

?>


just try "if ($POS !== 0) {"


--
-

--- End Message ---
--- Begin Message ---
Valedol wrote:
On Fri, 15 Feb 2008 23:46:57 +0300, nihilism machine <[EMAIL PROTECTED]> wrote:

this still does not work, if a domain has no preceeding www. it redirects to http://www.www.site.com, if it has a www. it goes to www.www.mydomain.com, any ideas?

<?php

class URL {

    // Public Variables
    public $ServerName;
    public $WWW;
// Public Functions public function __construct() {
        $this->checkWWW();
$this->ServerName = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
    }
// Check if site is preceeded by 'WWW'
    public function checkWWW() {
        $myDomain = $_SERVER['SERVER_NAME'];
        $FindWWW = 'www.';
        $POS = strpos($myDomain, $FindWWW);
        if ($POS === 1) {
            $this->WWW = true;
        } else {
            $this->WWW = false;
        }
    }

    // Redirect to WWW
    public function WWWRedirect() {
        if ($this->WWW == false) {
            $redir = "Location: http://www."; . $this->ServerName;
            header($redir);
               }
       }

}

$myURL = new URL();
$myURL->WWWRedirect();

?>


just try "if ($POS !== 0) {"


well, that said, isn't the first position in a string 0 ?

So, in the above  example the OP would need

//  This would mean that www. was found any where in the string
if ( $POS )

or
// Would mean that www. was found at the beginning of the string
if ( $POS === 0 )

--- End Message ---
--- Begin Message ---
nihilism machine wrote:
this still does not work, if a domain has no preceeding www. it redirects to http://www.www.site.com, if it has a www. it goes to www.www.mydomain.com, any ideas?


If you are running Apache, you do realize that all of this can be done in Apache instead of PHP right?

Here is an example of what I have on my domain.

<VirtualHost x.x.x.x:80>
        ServerName example.com
        ServerAlias wwww.example.com
        ServerAlias ww.example.com
        RedirectMatch (.*) http://www.example.com$1
</VirtualHost>



Jim Lucas

--- End Message ---
--- Begin Message ---
Jim Lucas wrote:
If you are running Apache, you do realize that all of this can be done in Apache instead of PHP right?

.htaccess example:

# Power-up the rewrite engine:
RewriteEngine on
# Redirect all non-www traffic:
RewriteCond %{HTTP_HOST} ^mysite\.com [NC]
RewriteRule ^/?(.*)$ http://www.mysite.com/$1 [R=301,L]\

I like to always redirect to www or non-www... not both. I have read that this is good for SEO and/or SE's.

Cheers,
Micky

--
Wishlist: <http://tinyurl.com/22xonb>
Switch: <http://browsehappy.com/>
BCC?: <http://snipurl.com/w6f8>
My: <http://del.icio.us/mhulse>

--- End Message ---
--- Begin Message ---
Jim Lucas wrote:
> nihilism machine wrote:
>> this still does not work, if a domain has no preceeding www. it
>> redirects to http://www.www.site.com, if it has a www. it goes to
>> www.www.mydomain.com, any ideas?
>>
> 
> If you are running Apache, you do realize that all of this can be done
> in Apache instead of PHP right?
> 
> Here is an example of what I have on my domain.
> 
> <VirtualHost x.x.x.x:80>
>         ServerName example.com
>         ServerAlias wwww.example.com
>         ServerAlias ww.example.com
>         RedirectMatch (.*) http://www.example.com$1
> </VirtualHost>
> 
> 
> 
> Jim Lucas

Or in DNS zone file (assuming you have an A record for example.com):

www.example.com.                 IN CNAME        example.com.

Many ways to skin a cat, and they are all fun!

-Shawn

--- End Message ---
--- Begin Message ---
Shawn McKenzie wrote:
> Jim Lucas wrote:
>> nihilism machine wrote:
>>> this still does not work, if a domain has no preceeding www. it
>>> redirects to http://www.www.site.com, if it has a www. it goes to
>>> www.www.mydomain.com, any ideas?
>>>
>> If you are running Apache, you do realize that all of this can be done
>> in Apache instead of PHP right?
>>
>> Here is an example of what I have on my domain.
>>
>> <VirtualHost x.x.x.x:80>
>>         ServerName example.com
>>         ServerAlias wwww.example.com
>>         ServerAlias ww.example.com
>>         RedirectMatch (.*) http://www.example.com$1
>> </VirtualHost>
>>
>>
>>
>> Jim Lucas
> 
> Or in DNS zone file (assuming you have an A record for example.com):
> 
> www.example.com.                 IN CNAME        example.com.
> 
> Many ways to skin a cat, and they are all fun!
> 
> -Shawn
Nevermind.  I guess this would already be in place or the conf,
.htaccess or PHP wouldn't even be running.  :-(

--- End Message ---
--- Begin Message ---
Shawn McKenzie wrote:
> Shawn McKenzie wrote:
>> Jim Lucas wrote:
>>> nihilism machine wrote:
>>>> this still does not work, if a domain has no preceeding www. it
>>>> redirects to http://www.www.site.com, if it has a www. it goes to
>>>> www.www.mydomain.com, any ideas?
>>>>
>>> If you are running Apache, you do realize that all of this can be done
>>> in Apache instead of PHP right?
>>>
>>> Here is an example of what I have on my domain.
>>>
>>> <VirtualHost x.x.x.x:80>
>>>         ServerName example.com
>>>         ServerAlias wwww.example.com
>>>         ServerAlias ww.example.com
>>>         RedirectMatch (.*) http://www.example.com$1
>>> </VirtualHost>
>>>
>>>
>>>
>>> Jim Lucas
>> Or in DNS zone file (assuming you have an A record for example.com):
>>
>> www.example.com.                 IN CNAME        example.com.
>>
>> Many ways to skin a cat, and they are all fun!
>>
>> -Shawn
> Nevermind.  I guess this would already be in place or the conf,
> .htaccess or PHP wouldn't even be running.  :-(

I thought about starting a new thread for every different idea that I
had in reply to this post.  What do y'all think?

-Shawn

--- End Message ---
--- Begin Message ---
On Sat, 16 Feb 2008 05:45:54 +0300, Jim Lucas <[EMAIL PROTECTED]> wrote:

Valedol wrote:
 just try "if ($POS !== 0) {"

well, that said, isn't the first position in a string 0 ?

So, in the above  example the OP would need

//  This would mean that www. was found any where in the string
if ( $POS )

or
// Would mean that www. was found at the beginning of the string
if ( $POS === 0 )

sorry, that was bad idea


--
-

--- End Message ---
--- Begin Message ---
Jim Lucas wrote:
Valedol wrote:
On Fri, 15 Feb 2008 23:46:57 +0300, nihilism machine <[EMAIL PROTECTED]> wrote:

this still does not work, if a domain has no preceeding www. it redirects to http://www.www.site.com, if it has a www. it goes to www.www.mydomain.com, any ideas?

<?php

class URL {

    // Public Variables
    public $ServerName;
    public $WWW;
        // Public Functions
        public function __construct() {
        $this->checkWWW();
$this->ServerName = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
    }
        // Check if site is preceeded by 'WWW'
    public function checkWWW() {
        $myDomain = $_SERVER['SERVER_NAME'];
        $FindWWW = 'www.';
        $POS = strpos($myDomain, $FindWWW);
        if ($POS === 1) {
            $this->WWW = true;
        } else {
            $this->WWW = false;
        }
    }

    // Redirect to WWW
    public function WWWRedirect() {
        if ($this->WWW == false) {
            $redir = "Location: http://www."; . $this->ServerName;
            header($redir);
               }
       }

}

$myURL = new URL();
$myURL->WWWRedirect();

?>


just try "if ($POS !== 0) {"


well, that said, isn't the first position in a string 0 ?

So, in the above  example the OP would need

//  This would mean that www. was found any where in the string
if ( $POS )

or
// Would mean that www. was found at the beginning of the string
if ( $POS === 0 )

Remember that in PHP land $var = 0 evaluates to FALSE. So strpos('foo', 'f') will return 0 (first char), which in an if() expression would turn to false:
if(strpos('foo', 'f')) {
   echo 'f found in foo';
} else {
echo 'f not found in foo, or maybe it is the first character; we can not tell';
}
That's the reason people use strpos('foo', 'f) !== false since that differentiates the false result (nothing found) from an integer result (for the position it was found on).

- Tul

--- End Message ---
--- Begin Message --- Does anyone have a good method of supporting semaphores when PHP's System V IPC functions can't be enabled? I'm trying to implement locking for using shmop (actually modifying someone elses code) and it requires sysvmsg but my shared host doesn't have this enabled.

Thanks,
Michael McGlothlin
Southwest Plumbing Supply

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


--- End Message ---
--- Begin Message ---
    // Check if site is preceeded by 'WWW'
    public function checkWWW() {
        $myDomain = $_SERVER['SERVER_NAME'];
        $FindWWW = 'wwww.';
        $POS = strpos($myDomain, $FindWWW);
        if ($POS === false) {
            return false;
        } else {
            return true;
        }
    }

any idea why this is not working? just trying to test if the site is www.site.com and not site.com

Try this:

public function CheckWWW($url = null)
{
        // Default to the current URL if none is given
        if (is_null($url)) {
                $url = $_SERVER['HTTP_HOST'];
        }

        return preg_match('/^www\./i', $url);
}

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

Knowledge Base and Helpdesk software hosted for you - no
installation, no maintenance, new features automatic and free

             ** New Helpdesk demo now available **

--- End Message ---

Reply via email to