php-general Digest 21 Sep 2008 12:41:50 -0000 Issue 5694
Topics (messages 280607 through 280627):
Re: Why MS Won't Retire Browsers -- was: Interntet Explorer 8 beater 2
280607 by: Ashley Sheridan
Re: Shopping Carts/Checkout Software
280608 by: Ashley Sheridan
Re: Browser could not get mp3 files from http site
280609 by: hce
280615 by: Lupus Michaelis
280623 by: tedd
280625 by: tedd
Re: The Best PHP Editor.
280610 by: Michael S. Dunsavage
Re: Error message
280611 by: Shawn McKenzie
280617 by: Ashley Sheridan
Re: render html
280612 by: Lupus Michaelis
280618 by: Ashley Sheridan
Re: Header() - POST
280613 by: Lupus Michaelis
280619 by: Maciek Sokolewicz
280626 by: Lupus Michaelis
Re: geolocation
280614 by: Per Jessen
280624 by: Michael Kubler
280627 by: tedd
Re: Thank you...
280616 by: Jochem Maas
Public in Classes
280620 by: Ben Stones
280621 by: Ólafur Waage
280622 by: Jochem Maas
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 Sat, 2008-09-20 at 03:30 +0200, Michelle Konzack wrote:
> Am 2008-09-14 17:09:53, schrieb Ashley Sheridan:
> > on earth anyone is going to give Debian to a Linux newbie, and if they
> > do they should be taken out and shot!
>
> If I find you I will kill you!!!
>
> I am Debian GNU/Linux Consultant for many years and even Newbies running
> here Debian... It just works... if you do not use the bleading edge
> Hardware...
>
> This year I will pass my 3000th Debian installation and I would not
> consider installin another Distribution @freinds or customers...
>
> OK, currently I am <arghhh> poking arround with Fedora since oracle want
> run on Debian... And a customer IS FORCED to use a software which
> support ONLY Oracle... Hell, for the price of this Software AND Oracle
> (1.780.000 Euro), I can engage a whole team to build a custom software
> based on GNU/Linux since from the client side it is egal, what you run
> on the servers...
>
> Thanks, Greetings and nice Day/Evening
> Michelle Konzack
> Systemadministrator
> 24V Electronic Engineer
> Tamay Dogan Network
> Debian GNU/Linux Consultant
>
>
What I was getting at was not that Debian was hard to use, but harder to
install than ones like Suse or Ubuntu.
I understand what you mean about being forced into specific software
though. For some reason the company I work for was advised ages ago that
IIS, MSSQL and ColdFusion was the combination to use, and now we have a
load of legacy sites that we have to maintain. This combo is just not
good for websites, and to do anything useful with CF you have to buy
loads of addons. :(
Ash
www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
On Sat, 2008-09-20 at 04:30 +0200, Michelle Konzack wrote:
> Design can not be changed (colors, look and feel) since it is HTML
> table
> fixed. Also the boxes left and in the middle have broken
> "headings"
> (Titles) which I have tried to solv, but since the sourcecode is
> not
> realy clear it is hopeless to do something with it.
I have to disagree here. Although it uses tables for layout, it can be
changed quite a bit by going into the code that makes up the pages. I
had to do this for a previous site I worked on which used OSCommerce. As
well as changing the whole design, I had to add loads of functionality
to it on the product display area. It took quite a while, as the system
is not intuitive, but it is possible. I do know what you mean about the
source code though, it took me a long time to get to grips with it in
the end!
Ash
www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
On Sat, Sep 20, 2008 at 1:29 PM, Michelle Konzack
<[EMAIL PROTECTED]> wrote:
> Am 2008-09-12 18:14:23, schrieb hce:
>> Hi,
>>
>> I have a php file audio.php to send mp3 file audio.mp3 to browsers,
>> the browser needs following html code to play mp3 file. I thought it
>> should work if I put the the audio.mp3 file in the same localtion with
>> the http://www.myweb.com/audio.php. But the browser could not get the
>> audio.mp3. I guess something is missing here, please correct me.
>>
>> <embed target="audio.mp3"
>
> Hey, what are you blubbering here?
> It is:
>
> <embed src="audio.mp3" width="320" height="240">
Are you sure you can make following my original code work to play the
mp3 automatically in firefox or any other browsers?
<html>
<embed src="audio.mp3" autostart="1"></embed>
</html>
BTW, I also tried to change <object type="audio/x-mpeg" ....., did not
work either.
Thank you.
--- End Message ---
--- Begin Message ---
Michelle Konzack a écrit :
It is a Netscape/Mozilla Extension:
Are you kidding ? This is normalized thing :
<http://www.w3.org/TR/html4/struct/objects.html>
--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org
--- End Message ---
--- Begin Message ---
At 5:29 AM +0200 9/20/08, Michelle Konzack blubbered forth:
Am 2008-09-12 18:14:23, schrieb hce:
> <embed target="audio.mp3"
Hey, what are you blubbering here?
It is:
<embed src="audio.mp3" width="320" height="240">
Whoa dude -- not only is putting width and height in a tag not good
practice, it's not necessary.
Think again.
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
At 5:35 AM +0200 9/20/08, Michelle Konzack wrote:
Am 2008-09-14 13:54:01, schrieb hce:
I've tried the object tag as Ash suggested, the object tag crashed
firefox):
(1) If I open following audio.html directly from "Open File"
file:///home/webserver/audio.html, the embed tag works just fine, the
audio can play. The /home/webserver is the directory where all
applications audio.php and audio.mp3 are stored.
(2) If I open from http://www.myweb.com/audio.php, the audio.mp3 does
not download to firefox. Nothing is played.
> <html>
<embed src="audio.mp3" autostart="1"></embed>
> </html>
It should be:
<html>
<embed src="audio.mp3" />
</html>
No, the autostart attribute is fine, but should be set to true.
<html>
<embed src="audio.mp3" autostart=true ></embed>
</html>
The above will work for Netscape -- but for other browser (i.e.,
IE's, Opera, el all) use:
<html>
<bgsound src="audio.mp3" ></bgsound>
</html>
Also you can add the attribute of "hidden=true" to both.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
On Sat, 2008-09-20 at 04:52 +0200, Michelle Konzack wrote:
> What is the best to edit my PHP file?
Recently I've been doing quick updates in vim but I designed my friends
DJ website in Geany and Quantum.
Geany is really quite good. You'll need GTK libraries, it's a Gnome
program.
--
Michael S. Dunsavage
--- End Message ---
--- Begin Message ---
Terry J Daichendt wrote:
The error message told it all. Jochem was correct albiet not in the
style I prefer. I had the code in an HTML page after the header. I've
been a programmer for 15 years but I'm brand new to PHP. Anyone can make
a rookie mistake. Thanks everyone for the help. Everyone was partially
correct in assessing the problem.
Terry
"Eric Gorr" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
On Sep 18, 2008, at 5:52 PM, Terry J Daichendt wrote:
I'm pasting this code from the example at php.net and getting these
errors. Can anyone determine what I'm doing wrong?
<?php
// page1.php
session_start();
echo 'Welcome to page #1';
$_SESSION['favcolor'] = 'green';
$_SESSION['animal'] = 'cat';
$_SESSION['time'] = time();
// Works if session cookie was accepted
echo '<br /><a href="page2.php">page 2</a>';
// Or maybe pass along the session id, if needed
echo '<br /><a href="page2.php?' . SID . '">page 2</a>';
?>
Well, this is weird. When I copied your text and tried it myself, the
error I got was:
Parse error: syntax error, unexpected T_STRING in /Users/ericgorr/
Sites/page1.php on line 9
Now, of course, there is nothing visibly wrong with line 9
($_SESSION['animal'] = 'cat';). But, when I had my text editor show
invisible characters, there were some on that line and line 10.
Do you have a text editor that can show invisible characters?
On the Mac, the one I really like (and is free) is TextWrangler
(http://www.barebones.com/products/textwrangler/ ) and has this
capability. This may be part of your problem. Once I got rid of the
invisible characters, the example worked without any problems.
Also, are you certain there are no spaces or anything (even invisible
characters) before <?php?
Whenever I've gotten a similar error in the past, that was nearly
always the problem. You are welcome to compress the text file and
send it to me directly so I can see exactly what it contains.
Since you're a PHP rookie, to sum it up: there can not be any output
before you start a session.
When PHP interprets a file (include or otherwise) it considers anything
before <?php as HTML, so it outputs it as HTML (newlines, spaces,
whatever). So if you have whitespace before the <?php, then the PHP
interpreter outputs it, thus the output before the session_start() error.
-Shawn
--- End Message ---
--- Begin Message ---
On Sat, 2008-09-20 at 23:48 -0500, Shawn McKenzie wrote:
> Terry J Daichendt wrote:
> > The error message told it all. Jochem was correct albiet not in the
> > style I prefer. I had the code in an HTML page after the header. I've
> > been a programmer for 15 years but I'm brand new to PHP. Anyone can make
> > a rookie mistake. Thanks everyone for the help. Everyone was partially
> > correct in assessing the problem.
> >
> > Terry
> >
> >
> >
> > "Eric Gorr" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> >> On Sep 18, 2008, at 5:52 PM, Terry J Daichendt wrote:
> >>
> >>> I'm pasting this code from the example at php.net and getting these
> >>> errors. Can anyone determine what I'm doing wrong?
> >>>
> >>> <?php
> >>> // page1.php
> >>>
> >>> session_start();
> >>>
> >>> echo 'Welcome to page #1';
> >>>
> >>> $_SESSION['favcolor'] = 'green';
> >>> $_SESSION['animal'] = 'cat';
> >>> $_SESSION['time'] = time();
> >>>
> >>> // Works if session cookie was accepted
> >>> echo '<br /><a href="page2.php">page 2</a>';
> >>>
> >>> // Or maybe pass along the session id, if needed
> >>> echo '<br /><a href="page2.php?' . SID . '">page 2</a>';
> >>> ?>
> >>
> >> Well, this is weird. When I copied your text and tried it myself, the
> >> error I got was:
> >>
> >> Parse error: syntax error, unexpected T_STRING in /Users/ericgorr/
> >> Sites/page1.php on line 9
> >>
> >> Now, of course, there is nothing visibly wrong with line 9
> >> ($_SESSION['animal'] = 'cat';). But, when I had my text editor show
> >> invisible characters, there were some on that line and line 10.
> >>
> >> Do you have a text editor that can show invisible characters?
> >>
> >> On the Mac, the one I really like (and is free) is TextWrangler
> >> (http://www.barebones.com/products/textwrangler/ ) and has this
> >> capability. This may be part of your problem. Once I got rid of the
> >> invisible characters, the example worked without any problems.
> >>
> >> Also, are you certain there are no spaces or anything (even invisible
> >> characters) before <?php?
> >>
> >> Whenever I've gotten a similar error in the past, that was nearly
> >> always the problem. You are welcome to compress the text file and
> >> send it to me directly so I can see exactly what it contains.
> >>
> >
> Since you're a PHP rookie, to sum it up: there can not be any output
> before you start a session.
>
> When PHP interprets a file (include or otherwise) it considers anything
> before <?php as HTML, so it outputs it as HTML (newlines, spaces,
> whatever). So if you have whitespace before the <?php, then the PHP
> interpreter outputs it, thus the output before the session_start() error.
>
> -Shawn
>
It's an easy mistake to make, not just reserved for rookies ;) I had a
similar problem streaming video to the browser, and found that for some
reason all the video files were larger than the original and wouldn't
play. Turned out (after some very strong words aimed in the general
direction of my laptop) that I'd included a header file which was
outputting some HTML!
Ash
www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
Michelle Konzack a écrit :
$body = "hello<br/><ul>ier</ul>hellohello";
^^^^^
Should be <br />
Definitely no :
<http://www.w3.org/TR/2006/REC-xml-20060816/#dt-empty>
<http://www.w3.org/TR/2006/REC-xml-20060816/#NT-S>
Or maybe for buggy browsers ?
--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org
--- End Message ---
--- Begin Message ---
On Sun, 2008-09-21 at 08:17 +0200, Lupus Michaelis wrote:
> Michelle Konzack a écrit :
> >> $body = "hello<br/><ul>ier</ul>hellohello";
> > ^^^^^
> > Should be <br />
>
> Definitely no :
>
> <http://www.w3.org/TR/2006/REC-xml-20060816/#dt-empty>
> <http://www.w3.org/TR/2006/REC-xml-20060816/#NT-S>
>
> Or maybe for buggy browsers ?
>
> --
> Mickaël Wolff aka Lupus Michaelis
> http://lupusmic.org
>
The space is completely optional, but I don't think it has anything to
do with the form that the tag is using. By default, browser will just
hide any tags they don't understand. I think that what is happening is
that the < and > have been escaped out. Try viewing the source to the
output page. If you see <br/> then your CMS is escaping the
chevrons and interpreting them as literal text rather than code.
Ash
www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
Michelle Konzack a écrit :
Why using JS?
echo "<meta http-equiv=\"refresh\" content=\"0;" . $FULL_URL "\">";
would do the trick...
No, because it'll not send back the datas in the hide form. And if
you suggest to pass datas in a HTTP GET, I'll answer XSS in the scope :)
--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org
--- End Message ---
--- Begin Message ---
Lupus Michaelis wrote:
Michelle Konzack a écrit :
Why using JS?
echo "<meta http-equiv=\"refresh\" content=\"0;" . $FULL_URL "\">";
would do the trick...
No, because it'll not send back the datas in the hide form. And if you
suggest to pass datas in a HTTP GET, I'll answer XSS in the scope :)
Your xss answer is moot. XSS attacks can (almost) just as easily be
performed via POST as they can via GET.
--- End Message ---
--- Begin Message ---
Maciek Sokolewicz a écrit :
Your xss answer is moot. XSS attacks can (almost) just as easily be
performed via POST as they can via GET.
No, because you can't click on a link that make a post. Maybe on
unsecured browser that allows Xhr (and a POST so) on every sites on the
Internet.
--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org
--- End Message ---
--- Begin Message ---
Michelle Konzack wrote:
> Am 2008-09-02 15:05:05, schrieb clive:
>> Hi,
>>
>> Have any developed a site that determines a users location based on
>> IP address, Im not looking for accurate locations, just what country
>> they are coming from.
>>
>> I know I could possible get a list of IP blocks allocated to
>> countries or make use of some web server to get the information, I
>> just want to know how others are doing this?
>
> <hüstel>... This does not work for my (136) Servers and Dial-Up, DSL,
> Wifi-APs since I have 64 blocks of 256 IPs which I use between Iran,
> Turkey, Germany, france, Morocco, Algeria and other countries...
> Same for Compuserve or ALOL.
So we have a few exceptions to prove the rule. Good.
/Per Jessen, Zürich
--- End Message ---
--- Begin Message ---
This is a slightly OT but along the same lines.
I've found that the main way that ISP's and large content hosts control
who can access their site and from where is by using BGP routing (Border
Gateway Protocol), and other advanced things that are beyond the control
of the majority of webserver admins.
It allows them to change the routing that information, which is for
example, how your ISPs servers know where to forward your data packet to
next.
However with some funky router, you can get 'magic' IP addresses, like
Akami and most ISP's DNS server have.
E.g, You will request to access data on a certain Akami IP address,
instead and taking >200ms to hit some server on the other side of the
world, and come back, it could go to a server sitting in your nearest
capital city in <50ms, which is great for video content, and AJAX calls.
The thing is, someone in another country could request the same data
from the same IP, and the request will automatically be sent to a
completely different server, most likely that of one in their capital
city (or at least the closest place that has an Akami server containing
the required info).
Above is just another example of how you can't purely rely on IP
addresses, although it is the easiest thing from a webservers PoV, and
usually right >90% of the time (as far as I am aware, although haven't
tested, nor have any good ways of testing besides Traceroute).
Michael Kubler
*G*rey *P*hoenix *P*roductions <http://www.greyphoenix.biz>
Michelle Konzack wrote:
Am 2008-09-02 09:08:50, schrieb Schiz0:
I use the GeoIP libraries. They work perfectly. YOu just need to
install the pecl-GeoIP package, then make sure you keep the binary
database up-to-date (from www.maxmind.com).
http://php.net/geoip
How does ths work with Compuserver or ALOL or even my IP's?
We are using dynamicaly allocated IPs arround teh world...
AOL in Germany is using IPs from the USA (ARIN) I use IPs from Germany
(RIPE) but they are dynamicaly allocated in Iran, Turkey, Gemany or
other Countries where I have POPs
--- End Message ---
--- Begin Message ---
At 9:56 AM +0200 9/21/08, Per Jessen wrote:
Michelle Konzack wrote:
Am 2008-09-02 15:05:05, schrieb clive:
Hi,
Have any developed a site that determines a users location based on
IP address, Im not looking for accurate locations, just what country
they are coming from.
I know I could possible get a list of IP blocks allocated to
countries or make use of some web server to get the information, I
just want to know how others are doing this?
<hüstel>... This does not work for my (136) Servers and Dial-Up, DSL,
Wifi-APs since I have 64 blocks of 256 IPs which I use between Iran,
Turkey, Germany, france, Morocco, Algeria and other countries...
Same for Compuserve or ALOL.
So we have a few exceptions to prove the rule. Good.
/Per Jessen, Zürich
I used to have a demo of that, but my server
crashed and with it went the database.
It was one of those stupid things of having
everything backed up but the database.
Too bad, I had it running for a couple of years
gathering "correct" or "not correct" input from
visitors.
Just another of my lame attempts to do something of worth.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
Dan Joseph schreef:
Look... Spam the list, but PLEASE do NOT open up this thread again.... we
all let it rest 3 weeks ago.
wtf, Michelle just stated that her 4 daughters we're killed in Casablanca
less than a year ago and all you can say is:
"PLEASE do NOT open up this thread again"
HUZZA for empaphy.
@Michelle: did I read your post correctly? what an awful tale, I wouldn't wish
that
on anyone ... my condolences for your loss.
rgds,
Jochem
--- End Message ---
--- Begin Message ---
Hi,
Just started with object oriented programming and glad I have come across
it, just need a few things clearing up.
When I make a variable or method public, does this mean that it can be used
outside of classes, for instance in other classes or as well as
instantiating classes? So if I made it private, it wouldn't be able to be
instantiated or extended in other classes, am I right?
I have never added public when I am creating methods so I presume its
already set as default if you don't add it?
Hope you can understand my question.
Cheers.
--- End Message ---
--- Begin Message ---
Here you go.
http://talks.php.net/show/php5_ca/4
Ólafur Waage
[EMAIL PROTECTED]
2008/9/21 Ben Stones <[EMAIL PROTECTED]>:
> Hi,
>
> Just started with object oriented programming and glad I have come across
> it, just need a few things clearing up.
>
> When I make a variable or method public, does this mean that it can be used
> outside of classes, for instance in other classes or as well as
> instantiating classes? So if I made it private, it wouldn't be able to be
> instantiated or extended in other classes, am I right?
>
> I have never added public when I am creating methods so I presume its
> already set as default if you don't add it?
>
> Hope you can understand my question.
>
> Cheers.
>
--- End Message ---
--- Begin Message ---
Ben Stones schreef:
Hi,
Just started with object oriented programming and glad I have come across
it, just need a few things clearing up.
When I make a variable or method public, does this mean that it can be used
outside of classes, for instance in other classes or as well as
instantiating classes? So if I made it private, it wouldn't be able to be
instantiated or extended in other classes, am I right?
I have never added public when I am creating methods so I presume its
already set as default if you don't add it?
Hope you can understand my question.
yes, and the answer nearly always lies in trying it out, run this
(and if/when you hit a fatal error, comment the offending line and run it
again):
<?php
class Test
{
public $a = "A";
protected $b = "B";
private $c = "C";
function tryme()
{
echo $this->a, "\n";
echo $this->b, "\n";
echo $this->c, "\n";
echo $this->d, "\n";
}
}
class TestTwo
{
function tryme()
{
echo $this->a, "\n";
echo $this->b, "\n";
echo $this->c, "\n";
echo $this->d, "\n";
}
}
$t1 = new Test;
$t2 = new TestTwo;
$t1->tryme();
echo $t1->a, "\n";
echo $t1->b, "\n";
echo $t1->c, "\n";
echo $t1->d, "\n";
$t2->tryme();
echo $t2->a, "\n";
echo $t2->b, "\n";
echo $t2->c, "\n";
echo $t2->d, "\n";
?>
Cheers.
--- End Message ---