mitsucats 01-26-2012, 10:23 AM Hello
I have a Guestbook but after i have move my webhotel to a new
server i get this error, After what i can read is it because that the "eregi" dont work in the new PHP version and it shall change to "preg"
But i have no idea how to change it so good i am not to PHP
Deprecated: Function eregi() is deprecated in /mnt/webf/e2/35/53159135/htdocs/images/guestbook/include/funct_utiles.php on line 512
Line 512 : if (eregi("^[a-z0-9]$", $chr))
The whole code is this
function generatePwdGuest3($chrs=10){
$pwd = "";
mt_srand ((double) microtime() * 1000000);
while (strlen($pwd)<$chrs){
$chr = chr(mt_rand (0,255));
if (eregi("^[a-z0-9]$", $chr))
$pwd = $pwd.$chr;
};
return $pwd;
}
//----------
Dan13071992 01-26-2012, 11:17 AM this is what i use for passwords:
function generatePW() {
$validpw='12345qwertyuiopasdfghjklzxcvbnm1234567890QWERTYUIOPASDFGHJKLZXCVBNM67890';
$strPW='';
for ($i=0;$i<8;++$i) {
$strPW.=$validpw[mt_rand(0,strlen($validpw))];
}
return $strPW;
}
so replace all the $strPW in this one to $pwd and replace function generatePW with generatePwdGuest3
this is based on me assuming this is to make a random password for the user
mitsucats 01-26-2012, 11:46 AM Hello
Then i get a new error in another file ...
eprecated: Function eregi_replace() is deprecated in /mnt/webf/e2/35/53159135/htdocs/images/guestbook/index.php on line 166 Deprecated
$chaine_smileys .= "<img src=\"".$chem_absolu."images/smileys/".$alex_livre_smileys_smiley[$i]."\" alt=\"\" title=\"".ucfirst(str_replace("_", " ", eregi_replace("[.]{1}(.)*$", "", $alex_livre_smileys_smiley[$i]))).
Dan13071992 01-26-2012, 11:50 AM did that last one work? also, is this to do with smiles? aka bbcoding?
mitsucats 01-26-2012, 12:02 PM The las one worked fine with the text but give me a error in the index.php
but that i fix
was just to change generatePwdGuest3 to generatePW
Then now i get the new error as you can see in my topic or look at
my link
http://www.mitsucats.de/images/guestbook/guestbook.php
Dan13071992 01-26-2012, 12:06 PM change all of the:
eregi_replace()
to
preg_replace()
mitsucats 01-26-2012, 12:09 PM That dident work
$chaine_smileys .= "<img src=\"".$chem_absolu."images/smileys/".$alex_livre_smileys_smiley[$i]."\" alt=\"\" title=\"".ucfirst(str_replace("_", " ", preg_replace(("[.]{1}(.)*$", "", $alex_livre_smileys_smiley[$i]))).
Parse error: syntax error, unexpected ',' in /mnt/webf/e2/35/53159135/htdocs/images/guestbook/index.php on line 166
mitsucats 01-26-2012, 12:11 PM That dident work
if i try with only one ( and not ((
$chaine_smileys .= "<img src=\"".$chem_absolu."images/smileys/".$alex_livre_smileys_smiley[$i]."\" alt=\"\" title=\"".ucfirst(str_replace("_", " ", preg_replace("[.]{1}(.)*$", "", $alex_livre_smileys_smiley[$i]))).
Warning: preg_replace(): Unknown modifier '{' in /mnt/webf/e2/35/53159135/htdocs/images/guestbook/index.php on line 166
jmj001 01-26-2012, 12:52 PM this is what i use for passwords:
function generatePW() {
$validpw='12345qwertyuiopasdfghjklzxcvbnm1234567890QWERTYUIOPASDFGHJKLZXCVBNM67890';
$strPW='';
for ($i=0;$i<8;++$i) {
$strPW.=$validpw[mt_rand(0,strlen($validpw))];
}
return $strPW;
}
so replace all the $strPW in this one to $pwd and replace function generatePW with generatePwdGuest3
this is based on me assuming this is to make a random password for the user
Just a personal though on password generators, you should remove 1(one) & l(lowercase L) & 0(zero) & O(capital o) & probably o(lowercase O) from the string as these are very similar characters and can cause confusion with the user if they are typing passwords in manually.
These days there are a lot of mobile users typing in passwords manually...
Just my thoughts..
mitsucats 01-26-2012, 01:38 PM I have download the complete script for the guestbok and i like it much and i have also
wrote to the owner of the script if he could help but nothing yet...
I am not so good to php. i am best to use dreamweaver.
Therefore i hope i can get help to fix this problem.
I thank you all for trying to help me ;)
Inigoesdr 01-26-2012, 05:08 PM change all of the:
eregi_replace()
to
preg_replace()
PREG and EREG do not use the same syntax. There are some simple patterns that work with both, but you can't simply change the name of the function and expect it to always work properly.
Just a personal though on password generators, you should remove 1(one) & l(lowercase L) & 0(zero) & O(capital o) & probably o(lowercase O) from the string as these are very similar characters and can cause confusion with the user if they are typing passwords in manually.
These days there are a lot of mobile users typing in passwords manually...
Limiting the characters in your random password generator isn't necessary since anyone on a desktop/laptop/smartphone is going to be able to copy/paste it and likely change it to something they can remember anyway.
That dident work
if i try with only one ( and not ((
$chaine_smileys .= "<img src=\"".$chem_absolu."images/smileys/".$alex_livre_smileys_smiley[$i]."\" alt=\"\" title=\"".ucfirst(str_replace("_", " ", preg_replace("[.]{1}(.)*$", "", $alex_livre_smileys_smiley[$i]))).
Warning: preg_replace(): Unknown modifier '{' in /mnt/webf/e2/35/53159135/htdocs/images/guestbook/index.php on line 166
Try something like this:
$chaine_smileys .= '<img src="' . $chem_absolu . 'images/smileys/' . $alex_livre_smileys_smiley[$i] . '" ' .
'alt="" ' .
'title="' . ucfirst(str_replace('_', ' ', preg_replace('/\..*$/s', '', $alex_livre_smileys_smiley[$i]))) . '" ' .
'/>';
I separated the img tag's attributes on to different lines to make it clearer.
Edit: here is what that regular expression does(removes the file extension):
\..*$
Match the character “.” literally «\.»
Match any single character «.*»
`- Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»
Assert position at the end of the string (or before the line break at the end of the string, if any) «$»
|
|