php-general Digest 8 Apr 2007 11:38:57 -0000 Issue 4722
Topics (messages 252225 through 252241):
Re: MD5 & bot Question
252225 by: Jim Lucas
252238 by: Tijnema !
252239 by: Tijnema !
252241 by: benifactor
Re: PHP4 vs PHP5
252226 by: Yves Arsenault
252227 by: Robert Cummings
252228 by: Travis Doherty
252230 by: Travis Doherty
ribs (rsync) problem
252229 by: Sebe
xdebug with Quanta
252231 by: vuthecuong
Re: Bind IP with fsockopen
252232 by: Tom Rogers
252237 by: Tom Rogers
Re: Design Dilemma - Database Data Abstraction
252233 by: Paul Novitski
Re: Simple question on simplexml
252234 by: Haydar TUNA
Re: read only texbox to html with php
252235 by: Haydar TUNA
Re: form validation
252236 by: Haydar TUNA
Re: spl DirectoryIterator
252240 by: Tijnema !
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:
php-general@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
Stut wrote:
tedd wrote:
Okay, I think I figured out a fix -- try it again. :-)
http://sperling.com/a/arrows/
A little knowledge is a dangerous thing.
Give up now, while you're still sane.
Think about what you're trying to do. You're trying to do something
different on the client every time, but without letting that client know
something is different.
It really really really can't be done. Something needs to be visually
different, therefore something in what the client gets needs to be
different. Do you see why it's not possible now?
-Stut
ah, but it is possible, if he could change the color of the background and arrow on each page
refresh, then it would be pretty damn hard to cache all the possible combinations of that, plus toss
in a few random degrees of difference with say 3 arrows that point to the right, but one is at 90
deg's while another is at 88 and another yet at 92.
This would make things almost impossible for a computer to see, but the chances of a human screwing
it up would be almost impossible.
Jim
--- End Message ---
--- Begin Message ---
On 4/8/07, tedd <[EMAIL PROTECTED]> wrote:
>>Well, I cracked it for you :)
>>
>>http://86.86.80.41/dev/debug/tedd.php
>>
>>At the bottom it shows you the MD5 code of your arrow image, and it
>>shows you which way it points to :)
>>
>>If you're interested in the code:
>>
>>http://86.86.80.41/dev/debug/tedd.txt
>>
>>Tijnema
Tijnema:
Okay, I think I figured out a fix -- try it again. :-)
http://sperling.com/a/arrows/
A little knowledge is a dangerous thing.
Cheers,
tedd
Looks interesting. It generates a different MD5 each time....
I'll take a deeper look at it today, and hope to find a way to crack it :)
Tijnema
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
On 4/8/07, Tijnema ! <[EMAIL PROTECTED]> wrote:
On 4/8/07, tedd <[EMAIL PROTECTED]> wrote:
> >>Well, I cracked it for you :)
> >>
> >>http://86.86.80.41/dev/debug/tedd.php
> >>
> >>At the bottom it shows you the MD5 code of your arrow image, and it
> >>shows you which way it points to :)
> >>
> >>If you're interested in the code:
> >>
> >>http://86.86.80.41/dev/debug/tedd.txt
> >>
> >>Tijnema
>
> Tijnema:
>
> Okay, I think I figured out a fix -- try it again. :-)
>
> http://sperling.com/a/arrows/
>
> A little knowledge is a dangerous thing.
>
> Cheers,
>
> tedd
Looks interesting. It generates a different MD5 each time....
I'll take a deeper look at it today, and hope to find a way to crack it :)
Tijnema
You can't stop me :)
http://86.86.80.41/dev/debug/tedd.php
It's cracked again :)
and of course i show you the code:
http://86.86.80.41/dev/debug/tedd.txt
Waiting for your next try :P
Tijnema
--- End Message ---
--- Begin Message ---
hmm, why don't you md5 more then once..
for example, use a condition that will change with every visitor. like
the third num in $_SERVER['REMOTE_ADDR']; or something of the sort.
then make a loop..
say the third num in my ip address is 5
the person that visits after me would get my value, and say you were
right before me and yours was a 7
the md5 check for me would look like
md5(md5(md5(md5(md5(md5(md5($value)))))));
and for the person right after me
md5(md5(md5(md5(md5($value)))));
this way for each visitor, a piece of the puzzle is changed. just an
idea, and have no idea if it would even work for what your doing...
Tijnema ! wrote:
On 4/8/07, Tijnema ! <[EMAIL PROTECTED]> wrote:
On 4/8/07, tedd <[EMAIL PROTECTED]> wrote:
> >>Well, I cracked it for you :)
> >>
> >>http://86.86.80.41/dev/debug/tedd.php
> >>
> >>At the bottom it shows you the MD5 code of your arrow image, and it
> >>shows you which way it points to :)
> >>
> >>If you're interested in the code:
> >>
> >>http://86.86.80.41/dev/debug/tedd.txt
> >>
> >>Tijnema
>
> Tijnema:
>
> Okay, I think I figured out a fix -- try it again. :-)
>
> http://sperling.com/a/arrows/
>
> A little knowledge is a dangerous thing.
>
> Cheers,
>
> tedd
Looks interesting. It generates a different MD5 each time....
I'll take a deeper look at it today, and hope to find a way to crack
it :)
Tijnema
You can't stop me :)
http://86.86.80.41/dev/debug/tedd.php
It's cracked again :)
and of course i show you the code:
http://86.86.80.41/dev/debug/tedd.txt
Waiting for your next try :P
Tijnema
--- End Message ---
--- Begin Message ---
Although I rarely post here (mostly lurking)...
I would think that the mere fact that support for PHP4 ends in 8 months
should be in and of itself a strong argument for the server admins.
In my current position, I code and am responsible for a few different
servers.
It's certainly a strong argument in my eyes.
I'm also kind of surprised that with the amount of time that PHP5 has now
been out that this is still a question for some people. (not directed at you
but maybe the server admins)
Once again, pretty strong argument is, if support for PHP4 is being
dropped..... that must mean that there is much confidence that PHP5 is
mature enough... to be the only supported version in being rolled out in
production environments.
That's my 2 cents worth.
Yves
On 4/7/07, Fernando Cosso <[EMAIL PROTECTED]> wrote:
I am making a new project, so if you are telling me that php5 is mature
enough I will code for that version.
I'm sure Mambo is ready for php5.
The thing is that I have to give pretty good arguments (like some page at
zend or php.net or whatever) to the guys that install the server. I also
know that debian wait until the last moment to put new versions.
Best regards
--
[EMAIL PROTECTED]
http://www.fernandocosso.com.ar
--
Yves Arsenault
"Love is the only force capable of transforming an enemy into a friend".
--Martin Luther King, Jr.
--- End Message ---
--- Begin Message ---
On Sat, 2007-04-07 at 21:15 -0300, Yves Arsenault wrote:
> Although I rarely post here (mostly lurking)...
>
> I would think that the mere fact that support for PHP4 ends in 8 months
> should be in and of itself a strong argument for the server admins.
>
> In my current position, I code and am responsible for a few different
> servers.
>
> It's certainly a strong argument in my eyes.
>
> I'm also kind of surprised that with the amount of time that PHP5 has now
> been out that this is still a question for some people. (not directed at you
> but maybe the server admins)
>
> Once again, pretty strong argument is, if support for PHP4 is being
> dropped.....
> that must mean that there is much confidence that PHP5 is
> mature enough...
The above line does not follow from any kind of logical reasoning. A in
no way implies B as you have ascertained from thin air.
> to be the only supported version in being rolled out in
> production environments.
Or... there's some strong arming happening to force the move. PHP4
userbase greatly outnumbers the PHP5 userbase. I think the userbase
speaks louder than the support timeframe.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
Myron Turner wrote:
> Travis Doherty wrote:
>
>>>
>>
>> What about the argument that PHP4 is dead. It's done. It's over.
>> There is no reason anyone should be using it, less perhaps a lack of
>> time to tweak scripts for an upgrade from 4 to 5. Even if that is the
>> case, get to work :p
>>
>> "Support for PHP 4 will be dropped at the end of the year, 8 months from
>> now. So now is the time to start upgrading all your scripts as we won't
>> be releasing new versions after December 31st, 2007."
>>
>> http://derickrethans.nl/php_quebec_conference_rip_php_4.php
>>
>> Travis Doherty
>>
>>
>
> This is fine, as long as the newer versions are backwardly
> compatible. If , in particular, if the next version or version 6 does
> not support the PHP 4 object oriented model, it could present real
> problems for some software. PHP isn't used only for "scripts" but for
> large projects. For example, I just began to configure a DokuWicki
> installation, writing code for various features which are not included
> in the install. DokuWicki uses the PHP 4 object oriented model
> throughout, and user plugins, such as mine, are written to the same
> model. DokuWicki contains over 300 php files and more than 3 megs of
> code. It would be no small task to convert such a project over to the
> PHP 5 OO model.
DokuWiki should run just fine under PHP5. It may throw some E_STRICT
errors warning of things that will be deprecated in a later major PHP
release. I doubt DokuWiki needs register_globals, and magic_quotes
shouldn't be a question. Use the strict level warnings as hints to help
you find what needs to be modified in your own code.
Travis Doherty
--- End Message ---
--- Begin Message ---
Robert Cummings wrote:
>Or... there's some strong arming happening to force the move. PHP4
>userbase greatly outnumbers the PHP5 userbase. I think the userbase
>speaks louder than the support timeframe.
>
>Cheers,
>Rob.
>
>
Damien Seguy's latest stats showing the adoption rates of PHP5 show what
Rob said.
http://www.nexen.net/chiffres_cles/phpversion/16814-php_stats_evolution_for_march_2007.php
I'm sure many of the polled domains are shared hosts, who have users,
which exponentially complicates the task of migration.
Travis Doherty
--- End Message ---
--- Begin Message ---
anyone here using the ribs php rsync script?
i keep getting:
rsync: link_stat "/home/site" failed: No such file or directory (2)
does the directory structure need to match on both local/remote servers?
example, i'm trying to back up /home/site to /home/backup
not sure if the remote backup server has to be /home/site as well.. or
if the problem is in the php script as i'm running php5.
--- End Message ---
--- Begin Message ---
Does anyone use xdebug with QUanta?
Could you give a tutorial to use it?
Or give me a website link about this?
Tnx
--- End Message ---
--- Begin Message ---
Hi,
Sunday, April 8, 2007, 6:51:46 AM, you wrote:
cac> Hi is it possible to socket_bind with fsockopen? im using this with all my
scripts...
cac> $fs = fsockopen('example.com', 2043, $errno, $errstr, 60);
cac> if (!$fs) {
cac> fclose($fs);
cac> and I need the remote conection to see me as one of my other IP's
cac> Ive read through socket_bind
cac> http://uk.php.net/manual/en/function.socket-bind.php
cac> but cant see how to use it with my above code
cac> Thanks
You will have to do it using the socket api something like this but
with error checking:
<?php
$sourceip = '192.168.1.1'; // ip you want to bind to
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_bind($sock, $sourceip);
socket_connect($sock, 'example.com', 2043);
// Write
$request = 'GET / HTTP/1.1'."\r\n".'Host: example.com'."\r\n\r\n";
socket_write($sock, $request);
//Read reply
// Close
socket_close($sock);
?>
--
regards,
Tom
--- End Message ---
--- Begin Message ---
Hi,
TR> You will have to do it using the socket api something like this but
TR> with error checking:
TR> <?php
TR> $sourceip = '192.168.1.1'; // ip you want to bind to
TR> $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
TR> socket_bind($sock, $sourceip);
TR> socket_connect($sock, 'example.com', 2043);
TR> // Write
TR> $request = 'GET / HTTP/1.1'."\r\n".'Host: example.com'."\r\n\r\n";
TR> socket_write($sock, $request);
TR> //Read reply
TR> // Close
TR> socket_close($sock);
Another option using streams (php5):
<?php
$opts = array(
'socket'=>array(
'bindto'=>'192.168.1.1:0' //any port will do
)
);
$context = stream_context_create($opts);
$html = file_get_contents('http://example.com:2043', false, $context);
--
regards,
Tom
--- End Message ---
--- Begin Message ---
At 4/7/2007 09:49 AM, Martin Alterisio wrote:
The solution I presented is to access, and act upon, a database as if they
were PHP arrays, meaning that a table is presented as an array of records.
This implies to me that you'll read a series of tables into arrays,
modify the arrays, then update or recreate the database tables from
the arrays. I can't really see how this can work for multiple users
because as soon as a second user reads and starts modifying the data
there will be obvious discontinuities between the two data snapshots,
and updating the tables from one user will erradicate changes made by
others. Is this a single-user application you're working on?
I could index by the order as they are presented by the DB:
$DB['users'][0] is the first user from the query "SELECT * FROM users"
$DB['users'][1] is the second user from the query "SELECT * FROM users"
etc..
But this have many cons. First, without a deterministic order, the array can
change its logic order on the whim of the DB, nobody assures that the order
will be kept after a modification is made to the data, and this can be
confusing and error prone:
$name1 = $DB['users'][3]['name'];
$name2 = $DB['users'][5]['name'];
$DB['users'][3]['name'] = $name2;
$DB['users'][5]['name'] = $name1;
The last sentence may not be writing to the adequate record.
Hmm. I don't see why this wouldn't work -- you're not changing the
keys (3 & 5) required to point to those unique records. I can see a
problem if $name1 and $name2 were themselves the keys, but you're not
doing that in this example.
If that were the problem, though, you could simply mandate a rule
that you can never change the key of an array element that represents
a data record, so that the record sequence remains what it was
originally. However, making your program logic depend on the record
sequence as it was read from the database seems quite iffy anyway
[especially in a multi-user system]; I'd just use the data table's
primary key as the array key and leave it at that. Random access rocks!
From what you write, it almost seems as though you're assuming that
these statements:
$DB['users'][3]['name'] = $name2;
$DB['users'][5]['name'] = $name1;
actually modify the database records they represent. If so, what
system are you using? I just don't see this happening using simple
PHP and MySQL. When you read a data record into a PHP array [with,
for example, mysql_fetch_array()] that array is just a static copy of
the data and doesn't possess any dynamic updating power over the
database. Or are you using an I/O class that you're not showing in
your example code that executes a modifying query each time an "array
element" is changed?
Another possible indexation could be by the value of the PK, but this also
have some problems. First, it can be confusing if the PK is an autonumeric
int, as this might be seen as a numeric indexation.
You can prefix an autonumber field with alphabetic characters to
force it away from numeric indexing:
$sKey = str_pad($aDataRecord['recno'], $iPadLength,
'pk_00000000000000', STR_PAD_LEFT);
$aArray[$sKey] = $aDataRecord;
e.g., recno 12345 becomes array key 'pk_00000000012345'
Using str_pad(...LEFT) ensures that the array keys will be in the
same sequence as the data records even though the autonumber values
will be composed of differing numbers of digits. You just have to
choose a pad length that equals the longest series of digits your
database will generate for an autonumber field.
Second, not all tables
have only one field as PK (I can ask that all tables have at least a PK, but
I can't ask that the PK is made of only one field).
You can construct a single array key from multiple database fields:
$aArray['pk_' . $aDataRecord['fieldA'] . '_' .
$aDataRecord['fieldB']] = $aDataRecord;
unset($DB['users'][$userid]); // delete
Unsetting the array element, rather than retaining it with a deletion
marker, implies that you're intending to recreate the database tables
rather than update them atomically. Is this correct?
Regards,
Paul
__________________________
Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com
--- End Message ---
--- Begin Message ---
Hello,
You can use following example:)
<?php
$xml = simplexml_load_file("test.xml");
$xml->body[0]->addChild("book", "Atatürk The Rebirth Of A Nation");
?>
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net
"Timothy Murphy" <[EMAIL PROTECTED]>, haber iletisinde sunlari
yazdi:[EMAIL PROTECTED]
>
> I have a catalog in XML format:
> <?xml version="1.0" encoding="iso-8859-1" ?>
> <catalog>
> <book>
> ...
> <book>
> <book>
> ...
> <book>
> ...
> </catalog>
>
> Now I want to add another book,
> which I have as a SimpleXMLElement:
>
> $book = new SimpleXMLElement($string);
>
> where $string reads
> <book>
> ...
> <book>
>
> Can I add this new entry to the catalog
> using SimpleXML functions,
> or do I have to introduce a DOMDocument?
>
> As may be obvious, I am very new to PHP programming;
> and advice or suggestions gratefully received.
>
> --
> Timothy Murphy
> e-mail (<80k only): tim /at/ birdsnest.maths.tcd.ie
> tel: +353-86-2336090, +353-1-2842366
> s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland
--- End Message ---
--- Begin Message ---
Hello,
If you use read only textbox in HTML, you can use like a following
HTML code.:)
<input type="text" name="txtYourname" value="Haydar" disabled>
--
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net
""Ross"" <[EMAIL PROTECTED]>, haber iletisinde þunlarý
yazdý:[EMAIL PROTECTED]
>I have a readonly textbox that gets mailed as a newsletter. The text is a
>standard covering letter. The problem is when I try and convert it to html
>it doesn't work It is inserted into a variable via a form textarea
>$mail_text.
>
> "....available on the web site <a
> href="http://www.myurl.org">http://www.myurl.org</a> so you can see who is
> doing....."
>
> I tried this
>
> htmlentities((stripslashes($mail_text)));
>
>
> Any ideas?
>
> R.
--- End Message ---
--- Begin Message ---
Hello,
You can use javascript and Ajax together. If you use the ajax, you
can validate your data with PHP code. Please visit the web site below. You
will find information about PHP and Ajax::)
http://www.w3schools.com/php/default.asp
--
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net
"al phillips" <[EMAIL PROTECTED]>, haber iletisinde sunlari
yazdi:[EMAIL PROTECTED]
> I''ve tried !preg_match and !eregi to validate my form. I get back
> whatever the user inputs into the textboxes. I would like to validate each
> textbox before submitting and redirect the user after submission? Here's
> part of the code
>
> <?php // Script 1 handle .html
> // Should accept First & Last Name email address phone city state
> // Validate input from textfields
>
> if (!preg_match("/[^a-zA-Z\.\-\Ä\ä\Ö\ö\Ü\ü\
> ]+$/s",$firstname)); {
> print '<p>Please enter Letters from A to Z</p>';
> }
>
>
> ---------------------------------
> 8:00? 8:25? 8:40? Find a flick in no time
> with theYahoo! Search movie showtime shortcut.
--- End Message ---
--- Begin Message ---
On 4/8/07, itoctopus <[EMAIL PROTECTED]> wrote:
After some testing and reading, I think this function is still experimental.
Anyone else has some thoughts on this?
I agree with you, this function seems not working correctly. From what
i see of my testing is that this makes an array, with some iterators
inside it. But all these iterators are the same iterator i started
with. Meaning i get an array of all duplicate iterators. This is not
what it should do i think, but there's no documentation on the
fuction, so i can't compare with the "expected output".
Tijnema
--
itoctopus - http://www.itoctopus.com
"Matthew Dellar" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I have a problem,
>
> I need to turn an iterator into an array, but when I do, some methods I
> need to use stop working.
>
> Take a look at the following example:
>
> $dir = 'c:/';
> $files = new DirectoryIterator($dir);
> //$files = iterator_to_array($files);
> foreach ($files as $file) {
> echo "{$file->getFileName()}<br>";//works
> echo "{$file->getPath()}<br>";//works
> }
>
> It works as expected. However, when the iterator is turned into an array:
>
> $dir = 'c:/';
> $files = new DirectoryIterator($dir);
> $files = iterator_to_array($files);
> foreach ($files as $file) {
> echo "{$file->getFileName()}<br>"; //does not work
> echo "{$file->getPath()}<br>";//works
> }
>
> It stops working. Can someone please help me, as a have tried and failed
> to find the cause of the problem.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---