Php Script Help!

w_d_liu1091

New Member
Messages
15
Reaction score
0
Points
0
I've got this script from a admin configuration from a mega file manager script.

but i need help to fix the eregi is deprecated error!

the eregi is located where i coloured it in red.

Please help me!

Thank You!

The script below:


<?php
while($each_file = @mysql_fetch_array($final_query)){
?>
<table width="100%" border="0" cellspacing="0" cellpadding="2" style="border:1px solid #CCCCCC;">
<tr bgcolor="#FFFFFF">
<td width="10%" style="border:1px solid #CCCCCC;"><?=$each_file['file_id']?></td>
<td width="11%" style="border:1px solid #CCCCCC;"><div align="left">
<?php
if(strlen($each_file['file_name_is']) > '2'){
echo '<input type="text" value="'.$each_file['file_name_show'].'" title="'.$each_file['file_name_show'].'" style="width:100%;" readonly>';
} else {
if(eregi('object',$each_file['file_name_show'])){
echo 'Object File';
} else {
echo '<a href="'.$each_file['file_name_show'].'" target="_blank">Link</a>';
}
}?>
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
Switch

PHP:
if(eregi('object',$each_file['file_name_show'])){

to

PHP:
if(  stristr( $each_file['file_name_show'] ,  'object' )   )  {
 

kimiwadesu12

New Member
Messages
1
Reaction score
0
Points
0
or
PHP:
if( stripos( $each_file['file_name_show'], 'object' ) !== FALSE ){
or
PHP:
if( preg_match( '/object/i', $each_file['file_name_show'] ) ){
 

w_d_liu1091

New Member
Messages
15
Reaction score
0
Points
0
I've got this send file by e-mail script which is part of the mega file manager too, but it has another error:

Warning: Division by zero in

the error is on line 116 which is the line i coloured in red!

The script is below (this is not the full script don't worry!):

//Function to encrypt
function encode_password($data,$keyfile) { //ecncrypt $data with the key in $keyfile with an rc4 algorithm
$pwd = $keyfile;
$pwd_length = strlen($pwd);
for ($i = 0; $i < 255; $i++) {
$key[$i] = ord(substr($pwd, ($i % $pwd_length)+1, 1));
$counter[$i] = $i;
}
for ($i = 0; $i < 255; $i++) {
$x = ($x + $counter[$i] + $key[$i]) % 256;
$temp_swap = $counter[$i];
$counter[$i] = $counter[$x];
$counter[$x] = $temp_swap;

}
for ($i = 0; $i < strlen($data); $i++) {
$a = ($a + 1) % 256;
$j = ($j + $counter[$a]) % 256;
$temp = $counter[$a];
$counter[$a] = $counter[$j];
$counter[$j] = $temp;
$k = $counter[(($counter[$a] + $counter[$j]) % 256)];
$Zcipher = ord(substr($data, $i, 1)) ^ $k;
$Zcrypt .= chr($Zcipher);
}
return $Zcrypt;
}


Please help!
Thank You!
 
Last edited:

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
PHP:
$pwd = $keyfile;
$pwd_length = strlen($pwd);
for ($i = 0; $i < 255; $i++) {
$key[$i] = ord(substr($pwd, ($i % $pwd_length)+1, 1));


It is saying that you are calling the function with $keyfile as an empty string, so $pwd is empty, so $pwd_length is 0, so
$i % $pwd_length is dividing by zero.

Find out where you are calling the function.
 

w_d_liu1091

New Member
Messages
15
Reaction score
0
Points
0
you can test out the mega file manager here:

FlameUp

you can test the error here by trying to email a file to someone (you can use fake details but the captcha has to be correct because it dosen't work anyway):

Email File Music.jpg
 
Last edited:

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
http://x10hosting.com/terms

a link for you.

Please note:

* File Hosting Every file on your site must have to do with the website you put up, we are not a file storage service and we strictly prohibit scripts such as torrentflux or rapidleech.

So the site you are building is in violation of the T.O.S. Not to mention the fact that you will probably end up with copyright infringement too.
 

w_d_liu1091

New Member
Messages
15
Reaction score
0
Points
0
I got another eregi error, please help me!

All of the eregi in this snippet of the script is deprecated.


//Open image
list($width, $height) = getimagesize($image_tmp);
if (eregi('\.jpg$', $image_tmp)){
$image = imagecreatefromjpeg($image_tmp);
}else if (eregi('\.gif$', $image_tmp)){
$image = imagecreatefromgif($image_tmp);
}else if (eregi('\.png$', $image_tmp)){
$image = imagecreatefrompng($image_tmp);
}else{
RedirectMessage("upload", "Unable to read preview image. Invalid format. Supported Formats: jpg, gif, png");
}
$ratio = $height/$width;

Thank You!
 
Last edited:

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
You didn't seem to get the message.

File uploading/sharing scripts are not allowed on x10hosting.
 

sonicx.forums65

New Member
Messages
5
Reaction score
0
Points
0
I got another eregi error, please help me!

All of the eregi in this snippet of the script is deprecated.


//Open image
list($width, $height) = getimagesize($image_tmp);
if (eregi('\.jpg$', $image_tmp)){
$image = imagecreatefromjpeg($image_tmp);
}else if (eregi('\.gif$', $image_tmp)){
$image = imagecreatefromgif($image_tmp);
}else if (eregi('\.png$', $image_tmp)){
$image = imagecreatefrompng($image_tmp);
}else{
RedirectMessage("upload", "Unable to read preview image. Invalid format. Supported Formats: jpg, gif, png");
}
$ratio = $height/$width;

Thank You!

try
PHP:
list($width, $height) = getimagesize($image_tmp);
if (@eregi('\.jpg$', $image_tmp)){
$image = imagecreatefromjpeg($image_tmp);
}else if (@eregi('\.gif$', $image_tmp)){
$image = imagecreatefromgif($image_tmp);
}else if (@eregi('\.png$', $image_tmp)){
$image = imagecreatefrompng($image_tmp);
}else{
RedirectMessage("upload", "Unable to read preview image. Invalid format. Supported Formats: jpg, gif, png");
}
$ratio = $height/$width;
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
@sonicx.forums65: suppressing warnings only works in the short term. Long term, calls to the POSIX regex functions need to be replaced with PCRE. See "PHP 5.3 Help" for more.

Not that it matters much to the OP, since his site breaks X10's terms of service. Others with the same issue, however, will need the long term solution.
 
Top