Dan
06-28-2004, 03:34 PM
Ok trafix kindly helped me by providing me with this script which he thought would work. I also think it should work and tried fooling around with it and changing things to try and make it work.
I added a bunch of avatars to one of my forums and it named a lot of the with the beginning of the file name like Ff Avatars and so forth as I had them all named a certain way. So I have this script which I thought would work to remove those First characters in the title of the avatar but It doesn't. It renames everything in the range to le). So any help would be nice.
Here is the script.
<?php
// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// ##################### DEFINE IMPORTANT CONSTANTS #######################
define('CVS_REVISION', '$RCSfile: avatarrenamer.php,v $ - $Revision: 1.81 $');
define('NO_REGISTER_GLOBALS', 1);
// ########################## REQUIRE BACK-END ############################
require_once('./global.php');
// ################################################## ######################
// ######################### START MAIN SCRIPT ############################
// ################################################## ######################
print_cp_header($vbphrase['avatarz']);
if (empty($_REQUEST['do']))
{
$_REQUEST['do'] = 'modtable';
}
// ###################### Start avatar renaming #######################
if ($_REQUEST['do'] == 'modtable')
{
$min = 83; // set this to the number of the first db row that you want to change
$max = 90; // set this to the number of the last db row that you want to change
for ($x = $min; $x <= $max; $x++)
{
$avname=$DB_site->query_first("
SELECT *
FROM " . TABLE_PREFIX . "avatar
WHERE avatarid=$x ");
$newavname = substr("$avname(title)", 9);
$DB_site->query("
UPDATE " . TABLE_PREFIX . "avatar
SET title = '" . addslashes($newavname) . "'
WHERE avatarid=$x
");
echo"$avname(title) * $newavname<br>";
}
echo"DONE!";
}
?>
I added a bunch of avatars to one of my forums and it named a lot of the with the beginning of the file name like Ff Avatars and so forth as I had them all named a certain way. So I have this script which I thought would work to remove those First characters in the title of the avatar but It doesn't. It renames everything in the range to le). So any help would be nice.
Here is the script.
<?php
// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// ##################### DEFINE IMPORTANT CONSTANTS #######################
define('CVS_REVISION', '$RCSfile: avatarrenamer.php,v $ - $Revision: 1.81 $');
define('NO_REGISTER_GLOBALS', 1);
// ########################## REQUIRE BACK-END ############################
require_once('./global.php');
// ################################################## ######################
// ######################### START MAIN SCRIPT ############################
// ################################################## ######################
print_cp_header($vbphrase['avatarz']);
if (empty($_REQUEST['do']))
{
$_REQUEST['do'] = 'modtable';
}
// ###################### Start avatar renaming #######################
if ($_REQUEST['do'] == 'modtable')
{
$min = 83; // set this to the number of the first db row that you want to change
$max = 90; // set this to the number of the last db row that you want to change
for ($x = $min; $x <= $max; $x++)
{
$avname=$DB_site->query_first("
SELECT *
FROM " . TABLE_PREFIX . "avatar
WHERE avatarid=$x ");
$newavname = substr("$avname(title)", 9);
$DB_site->query("
UPDATE " . TABLE_PREFIX . "avatar
SET title = '" . addslashes($newavname) . "'
WHERE avatarid=$x
");
echo"$avname(title) * $newavname<br>";
}
echo"DONE!";
}
?>