<?
session_start();

header( 'Content-type: text/html; charset=windows-1251' );

define( 'ROOT_DIR', $_SERVER['DOCUMENT_ROOT'] );

if ( $_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest' ) { exit(); }

if ( isset( $_SESSION['iduser'] ) ) exit();

include_once ROOT_DIR . '/engine/config.php';
include_once ROOT_DIR . '/engine/function.php';

?>
  <div class="modal fade bd-example-modal-lg" id="modalf" >
	  <div class="modal-dialog modal-lg" role="document" >
		<div class="modal-content">
		  <div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-label="Close">
			  <span aria-hidden="true">&times;</span>
			</button>
			<h4 class="modal-title">Выбор реферера</h4>
		  </div>
		  
		  <div class="modal-body Reg-modal-content-fix" >
			<div class="Reg_modal-stabilizacion div_centralizator" >
			<div class="div_centralizator" >
			  <?
				$get_all_refer = mysql_query( "SELECT id, name, autoback, reyting, avatar, username, account FROM user ORDER BY reyting DESC LIMIT 100" );
				if ( mysql_num_rows( $get_all_refer ) > 0 ) {
					$iso = 0;
					while ( $get_all_refer_row = mysql_fetch_array( $get_all_refer ) ) {
						$iso++;
						?>
						  <div class="Reg-modal-ref-block">
							<div class="card text-xs-center Reg-modal-card-fix" >
							  <div class="card-header-reg Reg-card-header-fix">
								<div class="Reg-title-header-fix">
								  <i class="fa fa-star-o" aria-hidden="true"></i> <?=status_user( $get_all_refer_row['reyting'], $get_all_refer_row['account'] )?>
								</div>
							  </div>
							  <div class="card-block Reg-modal-center-fix">
								<img src="/temp/avatar/<?=$get_all_refer_row['avatar']?>" class="avatar-ref-register img-circle" >
								<p class="card-text"><?=$get_all_refer_row['username']?></p>
								<a href="#" class="btn btn-primary Reg-modal-button-fix" onclick="send_new_referer(<?=$get_all_refer_row['id']?>);">Выбрать</a>
							  </div>
							  <div class="card-footer text-muted Reg-card-header-fix" >
								<div class="Reg-title-header-fix">
								  Рефбек: <b><?=$get_all_refer_row['autoback']?></b>%
								</div>
							  </div>
							</div>
						  </div>
						<?
					}
				}
			  ?>
			  <div class="error_modal_ultimate" > </div>
			  <p style="display: none;" id="success_text"><span class="glyphicon glyphicon-info-sign"></span> Спасибо что проинформировали, ваша жалоба будет рассмотрена арбитрами &nbsp;&nbsp;&nbsp;&nbsp;в ближайшее время! &hellip;</p>
		    </div>
		    </div>
		  </div>
		  
		  <div class="modal-footer">
			<button type="button" class="btn btn-secondary" data-dismiss="modal">Закрыть</button>
			<!--button type="button" class="btn btn-primary" id="send_walls_gift" onclick="send_complaints();">Выбрать</button-->
		  </div>
		</div>
	  </div>
  </div>
	
  <script type="text/javascript">
	$(document).ready(function(){
		var options = {
			show : true
		}
		$('#modalf').modal(options);
	});
	
	var refer_id;
	var refer_cookie;
	
	function send_new_referer(a) {
		refer_id = a;
		document.cookie = "referer=" + refer_id;
		$('#modalf').modal('hide');
		location.reload();
	}
  </script>
  
  
  
  
  
  
  
  
  
  
  
  
  
  