|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 10 Dec 2006 08:49:51 -0000 Issue 4506
php-general-digest-help
lists.php.net
Date: Sun Dec 10 2006 - 02:49:51 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 10 Dec 2006 08:49:51 -0000 Issue 4506
Topics (messages 245670 through 245684):
Re: file uploads Q?
245670 by: Richard Lynch
Re: problems configuring php5.2.0 and php4.4.4 with mysql5.0.27
245671 by: Richard Lynch
Re: Load Extensions
245672 by: Richard Lynch
Re: How to not be abused by mail form injectors?
245673 by: Richard Lynch
Re: Ensuring that variable contains a number
245674 by: Richard Lynch
245679 by: Dotan Cohen
Re: PHP Grammar
245675 by: Richard Lynch
Re: PHP5 Inheritance/method override problem
245676 by: Richard Lynch
Re: PHP analytics
245677 by: Richard Lynch
Re: Include problem
245678 by: Richard Lynch
Re: PHP Installation question
245680 by: Beauford
Error Display
245681 by: Craige Leeder
Embedded Video
245682 by: Beauford
245683 by: Craige Leeder
Splitting string
245684 by: Steven Macintyre
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
On Sat, December 9, 2006 12:18 pm, William Stokes wrote:
> Is it possible to allow user pick several images and upload them all
> at
> once? (I need to pass the images to a function for the resize). Or do
> I need
> to give several browse buttons to allow multiple file uploads?
Yes, you would need to have several INPUT TYPE="FILE" browse buttons.
> Also I have seen a application (written with MS tools) that allows
> user to
> upload a zip file containing images and the zip is automatically
> uncompressed to a server disk. Can this be done with PHP also?
Yes.
http://php.net/zip
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
Did you configure/install MySQL *and* the mysql-dev packages or
whatever your OS needs for the MySQL headers to be there?
Did you also compile MySQL and install it?
Is there a libmysqlclient somewhere like /usr/local/lib or /usr/lib or
whatever is appropriate for your system?
On Linux, did you do that 'ldconfig' thing that tells the OS to scan
for new libraries in various dirs?
On Linux, is the dir where your libmysqlclient lives listed in
/etc/ld.so.conf so that the OS can find it when you do the ldconfig
thing?
ldconfig -v | grep mysql is your buddy on Linux for this one.
Not that I've ever stumbled through this problem before, oh no.
:-) :-) :-)
It's weird how quickly this stuff becomes second nature after you
screw it up a half-dozen times...
On Sat, December 9, 2006 4:37 am, Erik Nordlander wrote:
> Hi, im having troubles configuring php5.2.0 (since this version didnt
> work i
> also tried 4.4.4 without success) with mysql 5.0.27 and apache 2.2.3.
> The
> apache server is working properly, and so does the mysql server.
>
> Theres a unexpeced error in the configwindow;
>
> checking return type of qsort... void
> checking for mysql_close in -lmysqlclient... no
> checking for mysql_error in -lmysqlclient... no
> configure: error: mysql configure failed. Please check config.log for
> more
> information.
>
> when i execute with command:
>
> ../configure --with-apxs2=/usr/local/apache2/bin/apxs
> --with-mysql=/usr/local/mysql
> --with-zlib-dir=/home/erikn/php5/pph-5.2.0/ext/zlib
> --with-gd
>
> the configlog is attached to this document, if you need it :)
>
> thanks in advance!
> Erik Nordlander
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
On Fri, December 8, 2006 1:25 pm, Igor Kravchenko wrote:
> Can someone help me with this, please? I cannot load extensions.
>
> I setup php5 in the c:\php folder. I specified extension_dir =
> "C:\php\ext".
>
> Everything else is setup correctly because php works. for me, I can
> load
> phpinfo file.
>
> It would not load extensions.
>
> I am going nuts here. Please anyone, what can it be????
When you look at phpinfo() output, where does it tell you that php.ini
should be?
Does it have "php.ini" at the end, or does it end in a directory?
If it does not have "php.ini" at the end, then it didn't *FIND* a
php.ini, and you need to put a php.ini in one of the places it is
looking.
For sure, *ONE* of the places it is looking is the directory listed in
phpinfo() output.
There may be other equally valid, perhaps even superior locations,
from some perspective, but to at least get it rolling quickly, you can
toss your php.ini into THAT directory, instead of wherever you have
it.
Or if you have no php.ini at all yet (the default) make one from one
of the two samples included with the PHP download.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
if (strstr($subject, "\r") || strstr($subject, "\n")) die("spammer");
if (strstr($from, "\r") || strstr($from, "\n")) die("spammer");
That right there will kill off most of your header injection attacks,
assuming you have already got $from = $_REQUEST['from'] or something
similar.
The main thing is to make sure your HEADERS are clean with no injected
junk to insert more Cc: headers or MIME stuff that shouldn't be there.
You can also "throttle" the amount of email you are willing to send
out on behalf of a single IP address -- while this might not work for
high-volume sites with heavily skewed userbase of corporate America
behind firewalls, or AOL users whose IP address changes faster than
drummers change their underwear, it works well for small-scale sites
with reasonable limits of a handful of emails per IP per 24-hour
period.
What is best to do depends on your target audience, who is getting the
emails, who is sending them, and what constitutes "normal" usage.
Security is rarely an off-the-rack solution
:-)
On Wed, December 6, 2006 3:09 pm, Peter Lauri wrote:
> Hi,
>
>
>
> Are there any general protection methods to minimize the risk of
> robots
> using your mailing forms as spam senders?
>
>
>
> /Peter
>
>
>
>
>
>
>
>
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
My take:
$number = (int) $number;
if ($number < 1) $number = 1;
You could error out for < 1, or compare the original with the (int)
cast to see if PHP considers them = and error out if not, while using
the (int) cast to be SURE you have an int, or...
But a typecast and inequality test should be pretty clear and cheap.
On Wed, December 6, 2006 2:01 pm, Dotan Cohen wrote:
> How can I ensure that a variable contains a postive integer number?
> I'm currently using this code:
>
> $number=(10000-$number);
> $number=(10000-$number);
> if ( $number<1 ) { $number=1; }
>
> But I'm sure that there is a better way. What would that be?
>
> Dotan Cohen
>
> http://what-is-what.com/what_is/internet.html
> http://song-lirics.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
On 10/12/06, Richard Lynch <ceo
l-i-e.com> wrote:
> My take:
>
> $number = (int) $number;
> if ($number < 1) $number = 1;
>
> You could error out for < 1, or compare the original with the (int)
> cast to see if PHP considers them = and error out if not, while using
> the (int) cast to be SURE you have an int, or...
>
> But a typecast and inequality test should be pretty clear and cheap.
>
Hey, nice. Thanks!
Dotan Cohen
http://what-is-what.com/what_is/bluetooth.html
http://lyricslist.com/lyrics/artist_albums/509/whitesnake.php
attached mail follows:
I think what you want is in here:
http://lxr.php.net
On Wed, December 6, 2006 10:59 am, yo plop wrote:
> Hello
>
> I have been asked to do a compiler from PHP5 to C code using Lex and
> Yacc
>
> I don't think i can find it already done and open source, but if i
> could get
> the PHP grammar (in Lex/Yacc would be awesome) it would be a great
> help for
> me, as the one i begin to write is full of conflicts.
>
> Does anyone have a clue or hint ?
>
> Thanks a lot folks !
> Fred
>
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
You can't override the method signature in subclasses in PHP5.
If you want this in PHP6, research the ...discusssion... from last
month on this topic on the PHP-Internals mailing list, and weigh in if
it's not already a Dead Horse.
I recall the ...discussion... more for entertainment value than actual
content, so can't tell you what the outcome was.
:-)
On Wed, December 6, 2006 9:22 am, Richard Morris wrote:
> Hi,
>
> I came across this problem and I was wondering if someone might be
> able
> to explain to my why it is happening. I put together a short example
> to
> illustrate the problem that I am having.
>
> Basically I have one class that performs a certain task. I then have
> a
> second class which extends the first class and performs some tasks in
> addition to the first class. Even though ClassA should know nothing
> about ClassB since ClassA is the parent, ClassA actually calls
> ClassB's
> exist method when it should be calling it's own.
>
> I know that description is really wordy and probably confusing which
> is
> why I provided below the example code that illustrates the problem.
>
> Doesn't this break the idea of inheritance? I can get it to work if I
> change ClassB::exists to some other name such as ClassB::exists2.
>
> If anyone can enlighten me as to why this problem is occurring or
> suggest a fix I would really appreciate it. Thank you.
>
>
>
> expected output
> ---------------
> ClassB - save
> ClassA - save
> ClassA - exists
> ClassA - update
>
>
>
> actual output
> -------------
> ClassB - save
> ClassA - save
>
>
> Warning: Missing argument 2 for ClassB::exists(), called in
> /website/overridetest.php on line 6 and defined in
> /website/overridetest.php on line 33
>
> ClassB - exists
> ClassA - update
>
>
>
> overridetest.php
> ----------------
> <?php
> class ClassA {
> public function save($value) {
> echo "ClassA - save\n";
>
> if ($this->exists($value))
> $this->update($value);
> else
> $this->insert($value);
> }
>
> protected function insert($value) {
> echo "ClassA - insert\n";
> }
>
> protected function update($value) {
> echo "ClassA - update\n";
> }
>
> public function exists($value) {
> echo "ClassA - exists\n";
> return true;
> }
> }
>
> class ClassB extends ClassA {
> public function save($value, $classAValue) {
> echo "ClassB - save\n";
> parent::save($classAValue);
> // do some additional work...
> }
>
> public function exists($value, $classAValue) {
> // does a different search than ClassA
> echo "ClassB - exists\n";
> return true;
> }
> }
>
> $c = new ClassB();
> $c->save('test', 'test2');
> ?>
>
> --
> Richard Morris
> HDD Broker, Inc.
>
> Toll-Free: +1 866 960-3331
> International: +1 250 474-6022
> Fax: +1 250 474-6099
> E-Mail: richard
hddbroker.com
> Web Site: www.hddbroker.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
<?php
//untested code:
session_start();
if (!isset($_SESSION['username'])){
require 'login.inc'; //login form to set $_SESSSION['username']
exit;
}
$username_sql = mysql_real_escape_string($_SESSION['username']);
$self_sql = mysql_real_escape_string($_SERVER['PHP_SELF']);
$query = "insert into analytics (username, page) ";
$query .= " values ('$username_sql', '$self_sql') ";
mysql_query($query) or error_log(mysql_error() . $query);
?>
There are a few zillion refinements to be done here, and you had
better make sure the username you stuff into your $_SESSION is
validated, but, really, it's not exactly rocket science to hack
something up to know what the user clicked, once you force them to
login...
On Wed, December 6, 2006 5:48 am, Rick. wrote:
> Hello
>
>
>
> I am new to php and I would like some guidance from those who have a
> bit more expereince with PHP
>
>
> I will be attempting to do a bit of tracking and web analytics.
> Basically, the user will login
> and from there everything that he clicked will be recorded in a
> database and analyzed
> i.e user behaviour, patterns with different user groups.
>
> Is this possible with php and it is a major undertaking ? just trying
> not to get ahead of myself here..
>
> are there any tutorials or scripts or books that you know of ?
>
>
>
> Thanks
> Regards
> Rick
>
>
>
>
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
There is also a set_include_path function, I do believe.
On Wed, December 6, 2006 4:26 am, Ashley Hales wrote:
> I am trying to use includes on a free php server but I cannot set the
> includes_path myself. Consequently when I try to include common
> elements or
> library files I run into trouble as I am unable to store or gain
> acesss to a
> central includes folder for the entire of my website to access. Is
> there
> any way around this?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
attached mail follows:
Solved. Ditched Slackware 10 and installed Slackware 11. Both were installed
the exact same way, so who knows....
Thanks to all.
-----Original Message-----
From: Ryan Creaser [mailto:rjcreaser
internode.on.net]
Sent: December 7, 2006 10:05 PM
To: Beauford
Cc: php-general
lists.php.net
Subject: Re: [PHP] PHP Installation question
Beauford wrote:
> Hi,
>
> I am trying to install vBulletin and keep getting this error: Fatal error:
> Call to undefined function: gzinflate().
>
> The only thing I can find on this is that zlib needs to be configured
> with PHP at compile time. So I reinstalled PHP using the following:
>
> ./configure --with-mysql --with-apache=../apache_1.3.36 --with-zlib
> --with-gd make make install
>
> The above finishes with no error.
>
> I rebooted, but still get same error, and zlib or gd doesn't show up
> in my phpinfo output. zlib is installed, and from my understanding gd
> is included with PHP, all the other libraries for gd are also
> installed. So what am I doing wrong?
>
> Also, how do I find out where something is installed? i.e. zlib. If I
> do a search on it I get hundreds of hits...
>
> Last. In the above ./configure line I get a message from PHP saying I
> am using the built in version of MySQL - if I point it to the actual
> MySQL source directory I get the following error.
>
> configure: error: Cannot find libmysqlclient library under
> ../mysql-5.0.22
>
> Any help is appreciated.
>
> I am using Slacware 10, PHP 4.4.4, MySQL5.0, and Apache 1.3.36
>
> Thanks
>
>
>
Did you recompile apache after running php's make install? Using
--with-apache builds a module that gets compiled *into* apache (as opposed
to --with-apxs which creates a dynamic module), ie. you need to rebuild
apache after building php. My guess is the gzinflate error probably comes
from an old php module.
- rjc
--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php
attached mail follows:
I have been working with PHP5 since it's release, and until a few
months ago, have never experienced the problem I am about to describe
to you. I am not sure weather it has been discovered previously or
not, nor do I know exactly how to replicate it, but I would like to
know if you have encountered the problem as well. The problem is this:
I have noticed that there appears to be (fatal) errors that do not
show when they occur in an included file. The script simply halts
execution, and returns headers to the browser. I do not have a list of
the errors that do not display, but I do not believe it applies to all
fatal errors.
The errors show perfectly fine when the file is called directly from
the php parser (/through the browser), just not when included. This is
an extreme annoyance, and would like to know if it has been
discovered. As far as I can tell, the errors seem to apply mostly to
Objects and classes, but I cannot be certain. I have not run too many
tests on the problem.
Although it should not need to be stated, I do have error reporting
set to E_ALL.
- Craige
attached mail follows:
Not sure if this can be done with PHP, or if I would need to use a java
script or something. If anyone has any ideas it would be appreciated.
I have a video on my site and I want something to say that the video is
loading and then disappear once the video starts.
Thanks again.
attached mail follows:
You would need to use Java or Flash to load the video and check the
loaded size against the total size.
- Craige
On 12/9/06, Beauford <phpuser
netscan.ca> wrote:
> Not sure if this can be done with PHP, or if I would need to use a java
> script or something. If anyone has any ideas it would be appreciated.
>
> I have a video on my site and I want something to say that the video is
> loading and then disappear once the video starts.
>
> Thanks again.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Hello,
(a) I don't have php 5 :)
(b) I have tried to use a < php 5 snippet from manual to no success ...
I have a string like such ... "word another word
yet another"
Now ... from word to another word (excluding another word, including word)
is 50 chars ... and the same fro another word to yet another ...
I need to split this string and get those three "fields"
I manage to get the first section right ...
Example of string;
$string = "EVOLUTION DEAR GOD
BOYZ_II_MEN ";
Will someone be able to assist me?
I cannot strip spaces as some of the "words" will be double ... ie "Dear
God" etc
Kind Regards,
Steven Macintyre
http://steven.macintyre.name
--
http://www.friends4friends.co.za
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]