PDA

View Full Version : Query Question


pein87
07-21-2009, 03:59 PM
Ok I've been working on a mod for profile banners. I'm using the gd2 library for image resizing. My question is this. Is there away to add a file input box on the page usercp?do=editprofile , and add code to the process page so it creates a new directory if a checkbox is checked. Also how would I add the users id number to it so it only names the folders after the users i. Next for the template for memberinfo, I cant seem to get a read from

if(isset($_GET['u']))
{
$userid = $_GET['u'];
}
I use the varible $userid
to read the dir and open it as well.

heres the rotator script

<?php
if(isset($_GET['u']))
{
$userid = $_GET['u'];
$folder = $userid;
$exts = 'jpg jpeg png gif';
$files = array(); $i = -1;
if ($userid) $folder = './$userid';
$handle = opendir($folder);
$exts = explode(' ', $exts);
while (false !== ($file = readdir($handle))) {
foreach($exts as $ext) {
if (preg_match('/\.'.$ext.'$/i', $file, $test)) {
$files[] = $file; // it's good
++$i;
}
}
}
closedir($handle);
mt_srand((double)microtime()*1000000);
$rand = mt_rand(0, $i);

header('Location: '.$folder.$files[$rand]);
}
?>

--------------- Added 1248196054 at 1248196054 ---------------

I link to the file using an if condition to check if the checkbox is checked then it links to the page auto. its <img src="images/profilebanner/random.php?$session[sessionurl_q]u=$userinfo[userid]" alt="$musername" />