/*
+----------------------------------------------------------+
|
| DPI (Lightweight ImageHosting Script)
| By image-host-script.com
| Support support@image-host-script.com
| Version 1.1 Final
|
| Developer Ali Imran Khan Shirani
|
| Copyright Clixint Technologies International
| www.clixint.com
|
+----------------------------------------------------------+
*/
REQUIRE_ONCE('dpi_init.php');
if(act('rate')) {
$id = base64_decode($_GET['rate']);
@list($tid,$xdate) = @explode("_",$id);
$date = hexdec($xdate);
$file = IMAGE_DIR."/images/".@date("Y/F/d",$date)."/$id.jpg";
if(file_exists($file)) {
if(isset($_COOKIE[md5($id)]) or isset($_SESSION[md5($id)])){
alert("You already have rated this image!");
} else {
#rate image here
$i = new iptc($file);
$crating = intval($_GET['rating']);
$orating = $i->get(DPI_RATING);
if(trim($orating) == "") {
#norating
$nrating = "1:$crating";
} else {
@list($n,$r) = explode(":",$orating);
$n++;
$r=intval($r) + $crating;
$nrating = "$n:$r";
}
$i->set(DPI_RATING, $nrating);
$i->write();
@setcookie(md5($id),base64_encode($id),time() + (3600 * 24 * 30),"/",$cdomain);
$_SESSION[md5($id)] = base64_encode($id);
alert("Your rataing has been submitted!");
}
}
die();
}
if(act('e')) {
@list($msg,$url) = explode("^",base64_decode($_GET['e']));
$center = message("".nl2br($msg) . ($url!='' ?"
Click here to continue.":''));
}
if(act('showseries')) {
if($_GET['showseries'] == 'CODES')
$series = explode(",",$_SESSION['CODES']);
else
$series = explode(",",base64_decode($_GET['showseries']));
$forum_codes = Array();
foreach($series as $id) {
@list($tid,$xdate) = @explode("_",$id);
$date = hexdec($xdate);
$th_dir = "$root_path".IMAGE_DIRC."/thumbs/".@date("Y/F/d",$date);
$im_dir = "$root_path".IMAGE_DIRC."/images/".@date("Y/F/d",$date);
$limdir = IMAGE_DIR."/images/".@date("Y/F/d",$date);
$gif = "jpg";
if(file_exists("$limdir/$id.gif"))
$gif = "gif";
$center .= eval_template(@$settings['seourls']=='Y' ? "image_code_seo" : "image_code");
$forum_codes []= $settings['seourls']=='Y' ?
"[url=$root_path/share-$id.html][img]$root_path/thumb-$id.jpg[/img][/url]" :
"[url=$root_path/share.php?id=$id][img]$root_path/thumb.php?id={$id}[/img][/url]";
$html_codes []= $settings['seourls']=='Y' ?
"" :
"";
$direct_codes []= $settings['seourls']=='Y' ?
"[url=$root_path/share-$id.html][img]$root_path/image-$id.{$gif}[/img][/url]" :
"[url=$root_path/share.php?id=$id][img]$root_path/image.php?id=$id&{$gif}[/img][/url]";
$thumbs_codes []= $settings['seourls']=='Y' ?
"" :
"";
}
if(_count($series) > 1) {
$forum_codes = implode("\n\n",$forum_codes);
$html_codes = implode("\n
\n",$html_codes)."";
$direct_codes = implode("\n",$direct_codes);
$thumbs_codes = implode("\n",$thumbs_codes);
$center .= eval_template('image_code_all');
}
}else
if(act('r')) {
if($logged_user)
$center = message("You are a logged user! You must log out in order to reset password of another account.");
else {
$rval = $_GET['r'];
$data = base64_decode($rval);
@list($codemd5,$username) = @explode(",",$data);
$USR = user(_html($username));
if(!$USR)
$center = message("Probably expired link followed!");
else
if(md5($USR['reset_code']) != $codemd5)
$center = message("Password resetting process seems already completed.");
else {
#ask and reset
if(act('reset')) {
check_magic_quotes();
$error = "";
if(strlen($_POST['password']) < 3)
$error = "Too Small new password, use minimun 3 characters.";
else
if(strlen($_POST['password']) > 15)
$error = "Too Large new password, use maximum 15 characters.";
if($error !="") {
$_POST = html_arr($_POST);
$center = eval_template("forgot_reset_password");
}
else {
#update password
$USR['reset_code'] = '';
$USR['password'] = md5($_POST['password']);
save_temp_file('users',strtolower($USR['username']),$USR);
redirect("$root_path/misc.php?e=".base64_encode("Account password for $USR[username] has successfully been reset, you may now proceed with login^$root_path/login.php"),0);
die();
}
} else
$center = eval_template("forgot_reset_password");
}
}
}
echo
eval_template('header').
eval_template('body').
eval_template('footer');
?>