<?php
if (basename($_SERVER['SCRIPT_FILENAME']) == basename(__FILE__)){
echo "<p align=center><br><br><br><br><br><br><font size=\"6\" color=\"#FF0000\">ILLEGAL ACCESS !!";
echo "<meta http-equiv=\"refresh\" content=\"2; url=../index.php\">";
exit();} 
// // #-----------------------------------------------------------------------------#
// // #-------------------------------.*PRIMADESAIN*.-------------------------------#
// // #-------------------------------: Script MMM3 :-------------------------------#
// // #------------------- Copyright 2009-2015 Primadesain.com ---------------------#
// // #----------- Email: primapc57@gmail.com Phone: +62 852 2865 7360 -------------#
// // #--------- http://www.primadesain.com - http://www.primadesain.net -----------#
// // #-----------------------------------------------------------------------------#
// // #------------- Primadesain.Com | Jasa Webdesain Bisnis Online ----------------#
// // #--- Website Bisnis MLM, Bisnis Investasi, Forex, Hyip, Binary, Trinary, -----#
// // #------- Matrix 4 -- 10, Toko Online, Iklan Baris, Profil, Reseller. ---------#
// // #-----------------------------------------------------------------------------#
// // # This software is  furnished  under a  license and may  be used and   copied #
// // # only  in accordance with the terms of such  license and with  the inclusion #
// // # of  the above copyright notice.  This software or any other  copies thereof #
// // # may not be  provided or otherwise made available  to any other person.   No #
// // # title to and  ownership of the software is hereby transferred.              #
// // #                                                                             #
// // # You  may  not  reverse   engineer,  decompile,  defeat  license  encryption #
// // # mechanisms, or  disassemble  this  software  product  or software   product #
// // # license. We  may terminate  this license if you  don't comply  with any  of #
// // # the terms and   conditions set forth   in our  End  User  License Agreement #
// // # (EULA). In  such event, licensee  agrees to return licensor or  destroy all #
// // # copies of software upon termination  of the license.                        #
// // # Please see the EULA file for the full End User License Agreement.           #
// // ###############################################################################
?>
<script type="text/javascript">
<!--
function confirmation(noid) {
	var answer = confirm("<?php echo $LANG["testinfo1"]?>")
	if (answer){
		//alert("Bye bye!")
		window.location = "?go=testimonial&page=delete&no=" + noid;
	}
}
//-->
</script>

<!-- BEGIN PAGE HEADER-->
			<h3 class="page-title">
			<?php echo $LANG["testi"]?> <small><?php echo $LANG["testi"]?></small>
			</h3>
			<div class="page-bar">
				<ul class="page-breadcrumb">
					<li>
						<i class="fa fa-home"></i>
						<a href="index.php">Home</a>
						<i class="fa fa-angle-right"></i>
					</li>
					<li>
						<a href="#">Profile</a>
						<i class="fa fa-angle-right"></i>
					</li>
					<li>
						<a href="#"><?php echo $LANG["testi"]?></a>
					</li>
				</ul>
				<div class="page-toolbar">
					
				</div>
			</div>
			<!-- END PAGE HEADER-->

<?php
if($db->dataku("status", $user_session) == 0 || $db->dataku("blokir", $user_session) == 1) {
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>".$LANG["status0"]."</div>";
}else{
?>





<?
if (isset($_GET['page']) && $_GET['page'] == "edit") {
if(isset($_GET["no"])){ $no = anti_injection($_GET["no"]); }
	
		$db->select("no, userid, nama, kota, testimoni, foto, judul, referal, published, tgl, hp, email", "testimonial", "no='".mysql_real_escape_string($no)."' and userid='$user_session'");
		$fotone = $db->result(0, "foto");
		$judul = $db->result(0, "judul");
		$userid = $db->result(0, "userid");
		$kota = $db->result(0, "kota");
		$referal = $db->result(0, "referal");
		$testi = $db->result(0, "testimoni");
		$email = $db->result(0, "email");
		$hp = $db->result(0, "hp");
		$nama = $db->result(0, "nama");
		$kota = $db->result(0, "kota");
		$no = $db->result(0, "no");
?>
 <script type="text/javascript">
var _validFileExtensions = [".jpg", ".jpeg", ".gif", ".png"];

function Validate(oForm) {
    var arrInputs = oForm.getElementsByTagName("input");
    for (var i = 0; i < arrInputs.length; i++) {
        var oInput = arrInputs[i];
        if (oInput.type == "file") {
            var sFileName = oInput.value;
            if (sFileName.length > 0) {
                var blnValid = false;
                for (var j = 0; j < _validFileExtensions.length; j++) {
                    var sCurExtension = _validFileExtensions[j];
                    if (sFileName.substr(sFileName.length - sCurExtension.length, sCurExtension.length).toLowerCase() == sCurExtension.toLowerCase()) {
                        blnValid = true;
                        break;
                    }
                }

                if (!blnValid) {
                    alert("Maaf, " + sFileName + " tidak di ijinkan, silahkan upload hanya file image : " + _validFileExtensions.join(", "));
					window.location.reload();
                    return false;
                }
            }
        }
    }

    return true;
}
</script>
<?php
$results = $_GET['result'];
if($results == "wrong_captcha") { 
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>".$LANG["wrongcaptcha"]."</div>";
}
?>
<?php
$results = $_GET['result'];
if($results == "success") { 
echo "<div class='alert alert-success alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>".$LANG["updtesti"]."</div>";
}
?>
<?php
 if(isset($_GET['result'])&&$_GET['result']=="size_error"){
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>Upload max size only 1 MB</div>";
}
?>  

<?php
 if(isset($_GET['result'])&&$_GET['result']=="file_error"){
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>Upload only file pdf, jpg, png, gif.</div>";
}
?> 
<div class="portlet box blue-hoki">
									<div class="portlet-title">
										<div class="caption">
											<i class="fa fa-edit"></i>&nbsp;Update Testimonial
										</div>
										
									</div>
									<div class="portlet-body form">
										<!-- BEGIN FORM-->
										<form action="?go=testimonial&page=editgo" class="form-horizontal" method="post" name="edittestimonial" id="edittestimonial" enctype="multipart/form-data" onsubmit="return Validate(this);">
                                      
											<div class="form-body">
												
                                                
                                                <div class="form-group">
													<label class="col-md-3 control-label"><?php echo $LANG["name"]?></label>
													<div class="col-md-4">
														<div class="input-group">
															
															<input type="text" class="form-control" name="nama" required='required' value="<?= $nama; ?>">
														</div>
													</div>
												</div>
                                                <div class="form-group">
													<label class="col-md-3 control-label"><?php echo $LANG["city"]?></label>
													<div class="col-md-4">
														<div class="input-group">
															
															<input type="text" class="form-control" name="kota" required='required' value="<?= $kota; ?>">
														</div>
													</div>
												</div>
                                                 <div class="form-group">
													<label class="col-md-3 control-label"><?php echo $LANG["subject"]?></label>
													<div class="col-md-4">
														<div class="input-group">
															
															<input type="text" class="form-control" name="judul" required='required' value="<?= $judul; ?>">
														</div>
													</div>
												</div>
                                                 <div class="form-group">
													<label class="col-md-3 control-label"><?php echo $LANG["testimonials"]?></label>
													<div class="col-md-4">
														<div class="input-group">
                                                            <textarea name="testimoni" class="form-control" required="required"><?= $testi; ?>
                                                             </textarea>
                                                             <input name="userid" type="hidden" class="inputText" id="userid" value="<?= $userid; ?>" size="20" />
			
                    <input name="edit" type="hidden" class="form" id="edit" value="1" size="10" />
					<input name="no" type="hidden" class="form" id="no" value="<?= $no; ?>" size="10" />
                <input name="website" type="hidden" id="website" value="<?= $referal; ?>"/>     
                                           <input name="hp" id="hp" type="hidden" value="<?= $hp; ?>" size="46"/>
                                           <input name="email" id="email" type="hidden" value="<?= $email; ?>" size="46"/>        
													  </div>
													</div>
												</div>
                                                <?php
		  	$adapict = $fotone;
	$dirpict = "../images/foto_testimoni/$adapict";
	$ukr2=getimagesize($dirpict);
						$w2=$ukr2[0];
						$h2=$ukr2[1];
		if($w2>200){	
		$width = "150px";		
		}	
	
	if (!empty($adapict) && (file_exists($dirpict))){
		$picture = "<img src='".$dirpict."'>";
		}
	else
		{
		$picture = "<img src='../images/no_img.png'>";
		} 	
		?>                          
									 
									 
				
                                                 <div class="form-group last">
										<label class="control-label col-md-3">Image</label>
										<div class="col-md-9">
											<div class="fileinput fileinput-new" data-provides="fileinput">
												<div class="fileinput-new thumbnail" style="width: 200px; height: 150px;">
													<?= $picture; ?>
												</div>
												<div class="fileinput-preview fileinput-exists thumbnail" style="max-width: 200px; max-height: 150px;">
												</div>
												<div>
													<span class="btn default btn-file">
													<span class="fileinput-new">
													Select image </span>
													<span class="fileinput-exists">
													Change </span>
													<input name="img1" type="file" id="img1" required='required'>
			   <input name="fotone" type="hidden" id="fotone" value="<?= $fotone; ?>"/>
													</span>
													<a href="javascript:;" class="btn red fileinput-exists" data-dismiss="fileinput">
													Remove </a>
												</div>
											</div>
											<div class="clearfix margin-top-10">
												<span class="label label-danger">
												NOTE! </span>
												&nbsp;&nbsp;Upload only file pdf, jpg, png, gif. Max size upload 1 MB.
											</div>
										</div>
									</div>
								</div>
                                                
                                               <div class="form-group">
													<label class="col-md-3 control-label"></label>
													<div class="col-md-4">
														<div class="input-group">
													  <?php
      // show captcha HTML using Securimage::getCaptchaHtml()
      require_once '../securimage/securimage.php';
      $options = array();
      $options['input_name'] = 'php_captcha'; // change name of input element for form post
      echo Securimage::getCaptchaHtml($options);
    ?>
														</div>
													</div>
												</div>
                                                  <div class="form-group">
													<label class="col-md-3 control-label">Captcha</label>
													<div class="col-md-4">
														<div class="input-group">
															
															<input type="text" class="form-control" name="php_captcha" required='required'>
														</div>
													</div>
												</div>   
                                                
                                              <div class="form-actions">
												<div class="row">
													<div class="col-md-offset-3 col-md-9">
														<button type="submit" class="btn blue-hoki" ><i class="fa fa-check"></i>&nbsp;Update</button>
													</div>
												</div>
											</div>
												
											</div>
                     
										</form>
										<!-- END FORM-->
									</div>
								</div>















<?
} else if (isset($_GET['page']) && $_GET['page'] == "addnew") { ?>
 
<?php
$jatahe = $db->config("testi");
$sql = mysql_query("SELECT * FROM testimonial WHERE userid='$user_session'");
$num = mysql_num_rows($sql);
if($num >= $jatahe) {
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>".$LANG["mxtesti"]."</div>";
}else{
?>
<?php
$results = $_GET['result'];
if($results == "wrong_captcha") { 
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>".$LANG["wrongcaptcha"]."</div>";
}
?>
<?php
$results = $_GET['result'];
if($results == "success") { 
echo "<div class='alert alert-success alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>".$LANG["sbmtdtesti"]."</div>";
}
?>
<?php
 if(isset($_GET['result'])&&$_GET['result']=="size_error"){
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>Upload max size only 1 MB</div>";
}
?>  

<?php
 if(isset($_GET['result'])&&$_GET['result']=="file_error"){
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>Upload only file pdf, jpg, png, gif.</div>";
}
?> 
 <script type="text/javascript">
var _validFileExtensions = [".jpg", ".jpeg", ".gif", ".png"];

function Validate(oForm) {
    var arrInputs = oForm.getElementsByTagName("input");
    for (var i = 0; i < arrInputs.length; i++) {
        var oInput = arrInputs[i];
        if (oInput.type == "file") {
            var sFileName = oInput.value;
            if (sFileName.length > 0) {
                var blnValid = false;
                for (var j = 0; j < _validFileExtensions.length; j++) {
                    var sCurExtension = _validFileExtensions[j];
                    if (sFileName.substr(sFileName.length - sCurExtension.length, sCurExtension.length).toLowerCase() == sCurExtension.toLowerCase()) {
                        blnValid = true;
                        break;
                    }
                }

                if (!blnValid) {
                    alert("Maaf, " + sFileName + " tidak di ijinkan, silahkan upload hanya file image : " + _validFileExtensions.join(", "));
					window.location.reload();
                    return false;
                }
            }
        }
    }

    return true;
}
</script>


























<div class="portlet box blue-hoki">
									<div class="portlet-title">
										<div class="caption">
									<i class="fa fa-edit"></i>&nbsp;Add Testimonials
										</div>
										
									</div>
									<div class="portlet-body form">
										<!-- BEGIN FORM-->
										<form action="?go=testimonial&page=submit" class="form-horizontal" method="post" name="addtestimonial" id="addtestimonial" enctype="multipart/form-data" onsubmit="return Validate(this);">
                                      
											<div class="form-body">
												
                                                
                                                <div class="form-group">
													<label class="col-md-3 control-label"><?php echo $LANG["name"]?></label>
													<div class="col-md-4">
														<div class="input-group">
															
															<input type="text" class="form-control" name="nama" required='required' value="<?= $nama; ?>">
														</div>
													</div>
												</div>
                                                <div class="form-group">
													<label class="col-md-3 control-label"><?php echo $LANG["city"]?></label>
													<div class="col-md-4">
														<div class="input-group">
															
															<input type="text" class="form-control" name="kota" required='required' value="<?= $kota; ?>">
														</div>
													</div>
												</div>
                                                 <div class="form-group">
													<label class="col-md-3 control-label"><?php echo $LANG["subject"]?></label>
													<div class="col-md-4">
														<div class="input-group">
															
															<input type="text" class="form-control" name="judul" required='required' value="<?= $judul; ?>">
														</div>
													</div>
												</div>
                                                 <div class="form-group">
													<label class="col-md-3 control-label"><?php echo $LANG["testimonials"]?></label>
													<div class="col-md-4">
														<div class="input-group">
                                                            <textarea name="testimoni" class="form-control" required="required"><?= $testi; ?>
                                                             </textarea>
                                                            <input name="userid" type="hidden" class="inputText" id="userid" value="<?= $user_session; ?>" size="20" />
			<input name="nama" type="hidden" class="inputText" id="nama" value="<?= $db->dataku("nama", $user_session); ?>" size="46" />
                <input name="website" type="hidden" id="website" value="http://www.<?= $domain; ?>/?id=<?= $user_session; ?>"/>  
                                           <input name="email" id="email" type="hidden" value="<?= $db->dataku("email", $user_session); ?>" size="46"/> 
                                           <input name="hp" id="hp" type="hidden" value="<?= $db->dataku("hp", $user_session); ?>" size="46"/>             
													  </div>
													</div>
												</div>
                                              
									 
				
                                                 <div class="form-group last">
										<label class="control-label col-md-3">Image</label>
										<div class="col-md-9">
											<div class="fileinput fileinput-new" data-provides="fileinput">
												<div class="fileinput-new thumbnail" style="width: 200px; height: 150px;">
												<img src="../images/no_img.png" alt=""/>
												</div>
												<div class="fileinput-preview fileinput-exists thumbnail" style="max-width: 200px; max-height: 150px;">
												</div>
												<div>
													<span class="btn default btn-file">
													<span class="fileinput-new">
													Select image </span>
													<span class="fileinput-exists">
													Change </span>
													<input name="img1" type="file" id="img1" required='required'>
			   <input name="fotone" type="hidden" id="fotone" value="<?= $fotone; ?>"/>
													</span>
													<a href="javascript:;" class="btn red fileinput-exists" data-dismiss="fileinput">
													Remove </a>
												</div>
											</div>
											<div class="clearfix margin-top-10">
												<span class="label label-danger">
												NOTE! </span>
												&nbsp;&nbsp;Upload only file pdf, jpg, png, gif. Max size upload 1 MB.
											</div>
										</div>
									</div>
								</div>
                                                
                                                 <div class="form-group">
													<label class="col-md-3 control-label"></label>
													<div class="col-md-4">
														<div class="input-group">
													  <?php
      // show captcha HTML using Securimage::getCaptchaHtml()
      require_once '../securimage/securimage.php';
      $options = array();
      $options['input_name'] = 'php_captcha'; // change name of input element for form post
      echo Securimage::getCaptchaHtml($options);
    ?>
														</div>
													</div>
												</div>
                                                  <div class="form-group">
													<label class="col-md-3 control-label">Captcha</label>
													<div class="col-md-4">
														<div class="input-group">
															
															<input type="text" class="form-control" name="php_captcha" required='required'>
														</div>
													</div>
												</div>
                                              <div class="form-actions">
												<div class="row">
													<div class="col-md-offset-3 col-md-9">
														<button type="submit" class="btn blue-hoki" ><i class="fa fa-check"></i>&nbsp;Send</button>
													</div>
												</div>
											</div>
												
											</div>
                     
										</form>
										<!-- END FORM-->
									</div>
								</div>





<?php } ?>










<?	
} else if (isset($_GET['page']) && $_GET['page'] == "submit") {

$jatahe = $db->config("testi");

$userid = $_POST['userid'];
$sql = mysql_query("SELECT * FROM testimonial WHERE userid='$userid'");
$num = mysql_num_rows($sql);
if($num >= $jatahe) {
echo "<div class='alert-box errors'><span>".$LANG["mxtesti"]." $jatahe.</span></div>";
}else{

$captcha = $_POST['php_captcha']; // the user's entry for the captcha code

      require_once('../securimage/securimage.php');
      $securimage = new Securimage();

      if ($securimage->check($captcha) == false) {
      $_SESSION["namae"] = $_POST["nama"];
$_SESSION["kotae"] = $_POST["kota"];
$_SESSION["judule"] = $_POST["judul"];
$_SESSION["testimonie"] = $_POST["testimoni"];
	header("location: index.php?go=testimonial&page=addnew&result=wrong_captcha");
	exit;
      } else {
	

$userid = $_POST['userid'];
$nama = anti_injection($_POST['nama']); 
$website = anti_injection($_POST['website']);
$kota = anti_injection($_POST['kota']); 
$email = anti_injection($_POST['email']);
$hp = anti_injection($_POST['hp']);

$jd = anti_injection($_POST['judul']);
$tx = anti_injection($_POST['testimoni']);
$text = nl2br($tx);
$judule = nl2br($jd);
	// SET VARIABLE FOR STORING FILE

	
	if (!empty($_FILES['img1']['name'])) {
$allowed =  array('pdf','png','jpg','jpeg','PNG','gif','JPG');//allowed types
$filename = $_FILES['img1']['name'];//file name
$ext = pathinfo($filename, PATHINFO_EXTENSION);//extension checking
if(!in_array($ext,$allowed) ){
	
	header("location: index.php?go=testimonial&page=addnew&result=file_error");
	exit;



}else{
	
	$img = $_FILES['img1'];
	if($img['size'] > 1000000) {	
	
	header("location: index.php?go=testimonial&page=addnew&result=size_error");
	exit;
	
	}else {
		
		   $time = date("dmYHis");
	   $sess = substr(str_shuffle(str_repeat("WZTYG31113I3N16ZU3F4248V2JY1Q86NYRIL233V5JD3U356BG3Q182Y5I2J598C3VPJ8S213MI741UD84Z1Z", 125)), 34, 64);
	   $filenew  = "testimonial_".$user_session."-".$time."-".$sess;
	 
	 $temp = explode(".", $_FILES["img1"]["name"]);
$newfilename = $filenew. '.' . end($temp);
move_uploaded_file($_FILES["img1"]["tmp_name"], "../images/foto_testimoni/" . $newfilename);
	
	
	
			$db->insert("testimonial", "", "'', '$userid', '".mysql_real_escape_string($nama)."', '".mysql_real_escape_string($kota)."', '".mysql_real_escape_string($text)."', '$newfilename', '$clientdate', '0', '".mysql_real_escape_string($judule)."', '".mysql_real_escape_string($website)."', '".mysql_real_escape_string($email)."', '$hp'");
				
				header("location: ?go=testimonial&result=success");
	exit;
}				
}
}else{
$db->insert("testimonial", "", "'', '$userid', '".mysql_real_escape_string($nama)."', '".mysql_real_escape_string($kota)."', '".mysql_real_escape_string($text)."', '', '$clientdate', '0', '".mysql_real_escape_string($judule)."', '".mysql_real_escape_string($website)."', '".mysql_real_escape_string($email)."', '$hp'");
				
				header("location: ?go=testimonial&result=success");
	exit;	
	
}
}
}	
} else if (isset($_GET['page']) && $_GET['page'] == "editgo") {


$captcha = $_POST['php_captcha']; // the user's entry for the captcha code

      require_once('../securimage/securimage.php');
      $securimage = new Securimage();

      if ($securimage->check($captcha) == false) {
        $no = $_POST['no'];
	header("location: ?go=testimonial&page=edit&no=$no&result=wrong_captcha");
	exit;

      } else {
	


$userid = $_POST['userid'];
$nama = anti_injection($_POST['nama']); 
$website = anti_injection($_POST['website']);
$kota = anti_injection($_POST['kota']); 
$email = anti_injection($_POST['email']);
$hp = anti_injection($_POST['hp']);
$fotone = $_POST['fotone'];
$edit = $_POST['edit'];
$no = $_POST['no'];
$jd = anti_injection($_POST['judul']);
$tx = anti_injection($_POST['testimoni']);
$text = nl2br($tx);
$judule = nl2br($jd);
	// SET VARIABLE FOR STORING FILE

	if (!empty($_FILES['img1']['name'])) {
$allowed =  array('pdf','png','jpg','jpeg','PNG','gif','JPG');//allowed types
$filename = $_FILES['img1']['name'];//file name
$ext = pathinfo($filename, PATHINFO_EXTENSION);//extension checking
if(!in_array($ext,$allowed) ){
	
	header("location: ?go=testimonial&page=edit&no=$no&result=file_error");
	exit;



}else{
	
	$img = $_FILES['img1'];
	if($img['size'] > 1000000) {	
	
	header("location: ?go=testimonial&page=edit&no=$no&result=size_error");
	exit;
	
	}else {
		
		   $time = date("dmYHis");
	   $sess = substr(str_shuffle(str_repeat("WZTYG31113I3N16ZU3F4248V2JY1Q86NYRIL233V5JD3U356BG3Q182Y5I2J598C3VPJ8S213MI741UD84Z1Z", 125)), 34, 64);
	   $filenew  = "testimonial_".$user_session."-".$time."-".$sess;
	 
	 $temp = explode(".", $_FILES["img1"]["name"]);
$newfilename = $filenew. '.' . end($temp);
move_uploaded_file($_FILES["img1"]["tmp_name"], "../images/foto_testimoni/" . $newfilename);
	
	
	
		
			$db->update("testimonial", "testimoni='".mysql_real_escape_string($text)."', kota='".mysql_real_escape_string($kota)."', email='".mysql_real_escape_string($email)."', judul='".mysql_real_escape_string($judule)."', hp='$hp', foto='$newfilename'", "no='$no'");
			
			header("location: ?go=testimonial&page=edit&no=$no&result=success");
	exit;

			
}	
}
}else{
$db->update("testimonial", "testimoni='".mysql_real_escape_string($text)."', kota='".mysql_real_escape_string($kota)."', email='".mysql_real_escape_string($email)."', judul='".mysql_real_escape_string($judule)."', hp='$hp', foto='$fotone'", "no='$no'");
			
			header("location: ?go=testimonial&page=edit&no=$no&result=success");
	exit;

			
}	

	}

}else{
?>
<?php
$results = $_GET['result'];
if($results == "success") { 
echo "<div class='alert alert-success alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>".$LANG["sbmtdtesti"]."</div>";
}
?>
                      
 <!-- BEGIN PAGE CONTENT-->
			<div class="row">
				<div class="col-md-12">
					<!-- BEGIN EXAMPLE TABLE PORTLET-->
					<div class="portlet box blue-hoki">
						<div class="portlet-title">
							<div class="caption">
								<i class="fa fa-edit"></i>&nbsp;Testimonials
							</div>
							
						</div>
						<div class="portlet-body">
							<div class="table-toolbar">
								<div class="row">
									<div class="col-md-6">
										<div class="btn-group">
                                      
                                        
                                         <?php
$jatahe = $db->config("testi");					   
$tax = $db->count_records("testimonial", "username='$user_session'");
if($tax > $jatahe) {
	    echo "<a href='#'><button type='button' class='btn red'>Add New <i class='fa fa-plus'></i></button></a>";
} else {
		echo "<a href='?go=testimonial&page=addnew'><button class='btn green' type='button'>Add New <i class='fa fa-plus'></i></button></a>";	
}	
?>
										</div>
									</div>
									<div class="col-md-6">
										
									</div>
								</div>
							</div>
							<table class="table table-striped table-hover table-bordered" id="sample_editable_1">
							<thead>
							<tr>
								 <th width="166"><?php echo $LANG["date"]?></th>
                            <th width="680"><?php echo $LANG["subject"]?></th>
                            <th width="71"><?php echo $LANG["updd_view"]?></th>
                            <th width="74"><?php echo $LANG["edt"]?></th>
                            <th width="70">Status</th>
							</tr>
							</thead>
							<tbody>
<?

$sql = mysql_query("select * from testimonial where userid='$user_session' order by tgl desc");

while($row=mysql_fetch_row($sql)) {

if($row[7] > 0) {
		$img = "<span class='label label-success'>Active</span>";
	} else {
		$img = "<span class='label label-danger'>Inactive</span>";
	}
$no = $row[0];
$namae = $row[2];
$usernye = $row[1];	
$tanggale = formatgl($row[6]);	
$kotae = $row[3];	
$judule = $row[8];	
$isine = $row[4];	
$adafoto = $row[5];
	$dirfoto = "../images/foto_testimoni/$adafoto";
	if (!empty($adafoto) && (file_exists($dirfoto))){
		$gambar = "<a href='../images/foto_testimoni/".$adafoto."' class='highslide' onclick='return hs.expand(this)' onMouseover=\"ddrivetip('".$LANG["vwdetail"]."')\" onMouseout='hideddrivetip()'><img src='../images/view.png'></a><div class='highslide-caption'>By: $namae (username: $usernye)<br>Date: $tanggale<br>City: $kotae<br><br><b>$judule</b><br>$isine</div>";
		}
	else
		{
		$gambar = "<a href='../images/photo_not_available.jpg' class='highslide' onclick='return hs.expand(this)' onMouseover=\"ddrivetip('".$LANG["vwdetail"]."')\" onMouseout='hideddrivetip()'><img src='../images/view.png' ></a><div class='highslide-caption'>By: $namae (username: $usernye)<br>Date: $tanggale<br>City: $kotae<br><br><b>$judule</b><br>$isine</div>";
		} 		

$tt = date('d-m-Y', strtotime($row[6]));

?>
 <tr> 
							
							<td align="center"><?php echo $tt; ?></td>
							<td align="center"><?php echo $row[8]; ?></td>
							<td align="center"><?php echo $gambar; ?></td>
							<td align="center"><a href="?go=testimonial&page=edit&no=<?= $no; ?>" onMouseover="ddrivetip('<?php echo $LANG["edtesti"];?>')"; onMouseout="hideddrivetip()"><img src='../images/edit_f2.png' border=0 title='Edit' width="22" ></a></td>
							<td align="center"><?php echo $img; ?></td>
						  </tr>
                       

 <?php
 }
 ?>
        
							</tbody>
							</table>
						</div>
					</div>
					<!-- END EXAMPLE TABLE PORTLET-->
				</div>
			</div>
			<!-- END PAGE CONTENT -->                       
                        
                        
               
<?
	}
	}
	?>