Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

HelloMartins

Paginação

Recommended Posts

Ainda não sou muito experiente em php e estou utilizando o seguinte codigo para paginação.

 

<?php
class QueryString{
	var $get;
	var $get_t = 'tal';
	var $loc;
	var $ini = 'home.php';
	var $dir = 'arquivos';
	 
	function __construct(){
		 $this->get = (isset($_GET[$this->get_t])) ? $_GET[$this->get_t] : '';
		 $this->get = strip_tags(trim($this->get));
		 $this->get = htmlentities($this->get);
	}
	
	function qs1(){
		 if(empty($this->get)){
			include($this->dir."/".$this->ini);
		 }
		 elseif(preg_match("/(http|www|.php|.asp|.net|.gif|.exe|.jpg|.png)/i", $this->get)){
			include($this->dir."/".$this->ini);
		 }
		 elseif(!file_exists($this->dir."/".$this->get.".php")){
			include($this->dir."/".$this->ini);
		 }else{
			include($this->dir."/".$this->get.".php");
		 }
	}
	
	function qs2(){
		$arrow = ' <span>»</span> ';
		
		$formated_get = explode('_', $this->get);
		$formated_get = ucfirst($formated_get[0]) . ' ' . ucfirst($formated_get[1]);
		
		switch($this->get){
			case '':
			case 'home': $this->loc = ''; break;
			case 'contato': $this->loc = $arrow . 'Contato'; break;
			default:
				if(!file_exists($this->dir."/".$this->get.".php")) $this->loc = '';
				else $this->loc = $arrow . $formated_get;
				break;
		}
		
		echo '<a href="?tal=home" class="active">Home</a>' . $this->loc;
	}
}
?>

Gostaria de saber se posso continuar usando se esse código é seguro.

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.