Script written by Stephen Yabziz | > Date started: 14th February 2004 | +-------------------------------------------------------------------------- */ define("IN_MEMBER",1); include "includes/inc.php"; $baseUrl='members.php?'; if($user->logined==0) header('location:login.php'); /** * Process part */ if(isset($input[entercoppon])) { $time=time(); $db->setQuery("select * from coppon where coppon='$input[coppon]' and used$time "); $db->query(); $ok=0; if($db->getNumRows()==0) { $output="$LANG[ErrorCoppon]!"; $input[account]=1; } else { $coupon=$db->loadRow(); $dateinfo=array('D'=>24*60*60,'M'=>30*24*60*60,'Y'=>12*30*24*60*60); $expire_date=time()>$user->account_expire_date?$time+$dateinfo['D']*$coupon[days]:$user->account_expire_date+$dateinfo['D']*$coupon[days]; /** * update the used numbers of this coupon */ $db->setQuery("update coppon set used=used+1,uid='$user->uid',ip='$input[IP_CLIENT]',time='$time' where coppon='$input[coppon]'"); $db->query(); /** * prolong the expire date for this user */ $db->setQuery("update users set expire_date='$expire_date' where id='$user->uid'"); $db->query(); /** * record into db for future reference */ $db->setQuery("insert into records set provider='Coupon',txn_id='$input[coppon]',uid='$user->uid',descr='Coupon!',amount='0',payment_date='$time'"); $db->query(); $output="Update Successfully!"; redirect('account=1','Successfully!'); } } if(isset($input[showgallery])&&$input[task]=='done') { $gallery=New TABLE($db,'gallery','gallery_id'); $gallery->inputData(); $gallery->uid=$user->uid; if(empty($gallery->gallery_id)) { if($user->galleries>=$user->allowed_max_galleries) { $output=$LANG[GetMaxGallery]; redirect('account=1',$output); exit; } $gallery->create_date=time(); $gallery->insert(); $db->setQuery("update users set galleries=galleries+1 where id='$user->uid'"); $db->query(); } else { $gallery->update(); } } if(isset($input[showgallery])&&$input[task]=='del') { $db->setQuery("update images4g set deleted=1 where gallery_id='$input[id]'"); $db->query(); $db->setQuery("delete from gallery where gallery_id='$input[id]'"); $db->query(); if($dels=$db->getAffectedRows()) { $db->setQuery("update users set galleries=galleries-$dels where id='$user->uid'"); $db->query(); } } if(isset($input[chpass])) { $db->setQuery("select * from users where id='$user->uid' and pass='$input[password]'"); $db->query(); if($db->getNumRows()==0) { $output=$LANG[ErrorPassword]; } elseif($input[newpass]!=$input[newpass2]||$input[newpass]=='') { $output=$LANG[PasswordNotMatch]; } else { if($user->username==''&&$input[newusername]) { $db->setQuery("select * from users where user='$input[newusername]' and email='$user->email'"); $db->query(); if($db->getNumRows()==0) { $db->setQuery("update users set pass='$input[newpass]',user='$input[newusername]' where id='$user->uid'"); $db->query(); redirect('?account=1',$LANG[PasswordChanged]); } else { $output=$LANG[NewUsernameNotAvaiable]; } } else { $db->setQuery("update users set pass='$input[newpass]' where id='$user->uid'"); $db->query(); redirect('?account=1',$LANG[PasswordChanged]); } } $input[account]=1; } /** * display part */ $template->set_filenames(array( 'body' => 'members.html') ); if($input[zipupload]==1) { if($input[uploadmode]==2) $input[uploadmode]=0; $user->allowed_filetypes='zip'; $user->allowed_filetype[]='zip'; $input[zipfile]=1; $template->assign_block_vars('ZipfileUpload',array()); buildUploadForm(1); } //account infomation elseif($input[account]==1) { $template->assign_block_vars('Profile',array()); $template->set_filenames(array( 'profile' => 'profile.inc.html') ); /** * allow the user without username to select a username:upgrade from V1.1 */ if($user->username=='') $username_field=""; else $username_field=$user->username; $template->assign_vars(array( 'username'=>$username_field, 'email'=>$user->email, )); $template->assign_var_from_handle('inc_profile','profile'); } elseif($input[showgallery]==1) { $template->assign_block_vars('GalleryList',array()); $input[id]=intval($input[id]); $options=array(1=>$LANG[GalleryStatusOpt1],0=>$LANG[GalleryStatusOpt2],2=>$LANG[GalleryStatusOpt3]); $options2=array(2=>$LANG[GalleryCommentOpt1],1=>$LANG[GalleryCommentOpt2],0=>$LANG[GalleryCommentOpt3]); $options3=array(''=>'Default', 'i.time DESC'=>$LANG[UploadTime].'(DESC)','i.time ASC'=>$LANG[UploadTime].'(ASC)', 'i.views DESC'=>$LANG[ImageViews].'(DESC)','i.views ASC'=>$LANG[ImageViews].'(ASC)', 'i.name DESC'=>$LANG[ImageName].'(DESC)','i.name ASC'=>$LANG[ImageName].'(ASC)', 'i.ratings/i.votes DESC'=>$LANG[ImageAvgRated].'(DESC)','i.ratings/i.votes ASC'=>$LANG[ImageAvgRated].'(ASC)', ); require_once("includes/class_color.inc.php"); $colorlist=getColorList(); $template->assign_var('colorlist',$colorlist); if($input[task]=='edit'&&$input[id]) { $template->set_filenames(array( 'addedit' => 'addedit_gallery.inc.html') ); $db->setQuery("select * from gallery where gallery_id=$input[id]"); $db->query(); $row=$db->loadRow(); if($row[uid]!=$user->uid&&$user->uid) header('location:'.$baseWeb.'/members.php'); $row[cats_list]=buildCatsList($row[category_id]); foreach($options as $key=>$option) $gallery_status.=''; foreach($options2 as $key=>$option) $gallery_comment.=''; foreach($options3 as $key=>$option) $gallery_order.=''; $row[gallery_comment]=$gallery_comment; $row[gallery_status]=$gallery_status; $row[gallery_order]=$gallery_order; $template->assign_vars($row); $template->assign_var_from_handle('inc_gallery_list','addedit'); } elseif($input[task]=='add') { $template->set_filenames(array( 'addedit' => 'addedit_gallery.inc.html') ); $row=array(); $row[cats_list]=buildCatsList(); foreach($options as $key=>$option) $gallery_status.=''; foreach($options2 as $key=>$option) $gallery_comment.=''; foreach($options3 as $key=>$option) $gallery_order.=''; $row[gallery_comment]=$gallery_comment; $row[gallery_status]=$gallery_status; $row[gallery_order]=$gallery_order; $row[bgcolor]='F7F7F7'; $row[forecolor]='FFFFFF'; $row[linkcolor]='000099'; $row[border]='DBDBDB'; $row[textcolor]='111111'; $row[status]=1; $row[comment]=1; $template->assign_vars($row); $template->assign_var_from_handle('inc_gallery_list','addedit'); } else { showMyGalleryList(); } } elseif($input[upgrade]==1) { //do the payment! if($input[dopay]==1&&$input[gateway]&&$input[plan_id]) { list($gid,$pid)=split('-',$input[plan_id]); $db->setQuery("select * from groups where id='$gid'"); $db->query(); $row=$db->loadRow(); $fees=split(',',$row[subscr_fee]); if(intval($fees[$pid])==0) { $db->setQuery("update users set gid='$gid' where id='$user->uid'"); $db->query(); $user->initiate(); } else { if(strlen($input[gateway])&&in_array($input[gateway],array('PP','EG','SP','MB'))) header('location:IPN/'.strtolower($input[gateway]).'_gateway.php?plan_id='.$input[plan_id]); } } $units=array('D'=>'Days','M'=>'Months','Y'=>'Years'); $template->assign_block_vars('Upgrade',array()); $template->set_filenames(array( 'upgrade' => 'upgrade.inc.html') ); $db->setQuery("select * from gateway"); $db->query(); $rows=$db->loadRowList(); foreach($rows as $row) { if($row[Enabled]) $template->assign_block_vars($row[Provider],array()); } $db->setQuery("select * from groups"); $db->query(); $rows=$db->loadRowList(); foreach($rows as $row) { $i++; $row['class']=$i%2==0?'tdrow1':'tdrow2'; if($row[subscr_id]) $row[amount]=''; if($row[subscr_id]) $row[txn_id]=$row[subscr_id]; $template->assign_block_vars('plan',$row); $plans=split(',',$row[subscr_period]); $fees=split(',',$row[subscr_fee]); foreach($plans as $k=>$plan) { $details[value]=$row[id].'-'.$k; if($fees[$k]) { $details[descr]='$'.$fees[$k].'/'.$plan.' '.$units[$row[subscr_unit]]; $details[click_warning]=''; } else { $details[descr]=$LANG['Free']; $details[click_warning]="onclick=\"alert('Warning,your plan will be setted to this free plan fi you click \'submit\'!');\""; } $details[checked]=''; if($user->package_id==$row[id]) $details[checked]='checked'; $template->assign_block_vars('plan.details',$details); } } $template->assign_vars(array('current_plan'=>$user->package,'expire_date'=>$user->account_expire_date)); $template->assign_var_from_handle('inc_upgrade','upgrade'); } elseif($input[bill]==1) { $template->assign_block_vars('Bill',array()); $template->set_filenames(array( 'bill' => 'bill.inc.html') ); $db->setQuery("select * from records where uid='$user->uid' order by payment_date"); $db->query(); $rows=$db->loadRowList(); foreach($rows as $row) { $i++; $row['class']=$i%2==0?'tdrow1':'tdrow2'; $row[totalamount]=$row[amount]; $row[paytype]=($row[subscr_id]?'Subscription by ':'Payment by ').$row[provider]; $row[txn_id]=$row[subscr_id]&&$row[txn_id]==''?$row[subscr_id]:$row[txn_id]; $row[payment_date]=date('m/d/y H:i:s',$row[payment_date]); $template->assign_block_vars('list',$row); } $template->assign_var_from_handle('inc_bill','bill'); } else { showUploadTip(); $template->assign_block_vars('Package_info',$row); } require_once("header.php"); $template->pparse('body'); include "footer.php"; ?>