Alexandre Duran Posted December 18, 2013 Share Posted December 18, 2013 Caros existe alguma forma de um visitante acessar as estatísticas (awstats por exemplo mas pode ser outra) sem ter que acessar o painel CPANEL ? Link to comment Share on other sites More sharing options...
Otavio Posted December 18, 2013 Share Posted December 18, 2013 De uma olhada nisto: Tem esse script: http://www.josheli.com/vox/view_source.php?awstats.phpBem simples, basta configurar o usuário senha e domínio. A função file_get_contents() está presente em disabled_functions no php.ini. Caso queira faze-lo funcionar, deve retirar a mesma das funções desativadas. http://www.forumcpanel.com.br/topic/5048-visualizar-estatisticas-do-awstats/ Fox Soluções | (011) 3090 4444 / (011) 96841-9797 | www.FoxSolucoes.com | Streaming Áudio | CentovaCast | Revendas de Streaming | Data Center Brasil EUA | | Streaming Vídeo | CastControl WOWZA | Revendas de Streaming | Data Center Brasil EUA | Link to comment Share on other sites More sharing options...
edvan Posted December 18, 2013 Share Posted December 18, 2013 Caros existe alguma forma de um visitante acessar as estatísticas (awstats por exemplo mas pode ser outra) sem ter que acessar o painel CPANEL ? Tenho um script que funciona via cURL, segue abaixo ou link http://d.pr/n/Doy0 Esse script funciona há mais de 6 anos conforme imagem http://clip2net.com/s/6pGAuu <?php $username = "xxxx"; #usuario autenticacao $password = "xxxx"; #Senha autenticacao $site = "xxxxx.com.br"; #site cliente $cpnlusername = "xxxxxx"; #usuario cpanel $cpnlpassword = "xxxxxxx"; #senha cpanel if (!isset($PHP_AUTH_USER)) { header('WWW-Authenticate: Basic realm="Estatísticas"'); header('HTTP/1.0 401 Unauthorized'); echo 'Acesso Restrito!'; exit; } else if (isset($PHP_AUTH_USER)) { if (($PHP_AUTH_USER != $username) || ($PHP_AUTH_PW != $password)) { header('WWW-Authenticate: Basic realm="Estatísticas xxxxxx.com.br - Acesso Restrito"'); header('HTTP/1.0 401 Unauthorized'); echo 'Acesso Restrito!'; exit; } else { if($QUERY_STRING == ""){$query = "config=$site";}else{$query=$QUERY_STRING;}; $Previous = false; if(isset($_POST)) { foreach($_POST as $key => $value) { if($Previous) { $POSTED .= "&"; } $POSTED = "$key=$value"; $Previous = true; } } $Curl = curl_init("http://$cpnlusername:$cpnlpassword@$site:2082/awstats.pl?$query&ssl=&lang=br"); if(isset($_POST)) { curl_setopt($Curl, CURLOPT_POST, TRUE); curl_setopt($Curl, CURLOPT_POSTFIELDS, $POSTED); } curl_setopt($Curl, CURLOPT_RETURNTRANSFER, 1); $results = curl_exec($Curl); for ($i = 0; $i < count($return_message_array); $i++) { $results = $results.$return_message_array[$i]; echo "Restrito!"; } if($query == "config=$site"){$results = str_replace("src=\"", "src=\"?", $results);} if($framename==index){$results = str_replace("src=\"", "src=\"index.php?", $results);} $results = str_replace("action=\"", "action=\"index.php?", $results); $results = str_replace("href=\"", "href=\"?", $results); $results = str_replace("href=\"?http://", "href=\"http://", $results); $results = str_replace("awstats.pl?", "", $results); echo $results; echo "Exclusivo Edvan.com.br"; } } ?> 1 Link to comment Share on other sites More sharing options...
LeandroTC Posted December 18, 2013 Share Posted December 18, 2013 Muito interessante seu script Edvan. O único probleminha é que a senhas do usuário ficam salvas nele. Se tive como ocultar e/ou criptografar, fica show! Mais seguro! Abraços! :) Link to comment Share on other sites More sharing options...
edvan Posted December 18, 2013 Share Posted December 18, 2013 Muito interessante seu script Edvan. O único probleminha é que a senhas do usuário ficam salvas nele. Se tive como ocultar e/ou criptografar, fica show! Mais seguro! Abraços! :) Leandro, Não tem como... neste exemplo meu cliente não tem acesso ao cPanel/FTP e forneço as estatísticas via http://site.com/estatisticas/ compreendeu? Link to comment Share on other sites More sharing options...
Enio F. Posted December 18, 2013 Share Posted December 18, 2013 Tenho um script que funciona via cURL, segue abaixo ou link http://d.pr/n/Doy0 Esse script funciona há mais de 6 anos conforme imagem http://clip2net.com/s/6pGAuu <?php $username = "xxxx"; #usuario autenticacao $password = "xxxx"; #Senha autenticacao $site = "xxxxx.com.br"; #site cliente $cpnlusername = "xxxxxx"; #usuario cpanel $cpnlpassword = "xxxxxxx"; #senha cpanel if (!isset($PHP_AUTH_USER)) { header('WWW-Authenticate: Basic realm="Estatísticas"'); header('HTTP/1.0 401 Unauthorized'); echo 'Acesso Restrito!'; exit; } else if (isset($PHP_AUTH_USER)) { if (($PHP_AUTH_USER != $username) || ($PHP_AUTH_PW != $password)) { header('WWW-Authenticate: Basic realm="Estatísticas xxxxxx.com.br - Acesso Restrito"'); header('HTTP/1.0 401 Unauthorized'); echo 'Acesso Restrito!'; exit; } else { if($QUERY_STRING == ""){$query = "config=$site";}else{$query=$QUERY_STRING;}; $Previous = false; if(isset($_POST)) { foreach($_POST as $key => $value) { if($Previous) { $POSTED .= "&"; } $POSTED = "$key=$value"; $Previous = true; } } $Curl = curl_init("http://$cpnlusername:$cpnlpassword@$site:2082/awstats.pl?$query&ssl=&lang=br"); if(isset($_POST)) { curl_setopt($Curl, CURLOPT_POST, TRUE); curl_setopt($Curl, CURLOPT_POSTFIELDS, $POSTED); } curl_setopt($Curl, CURLOPT_RETURNTRANSFER, 1); $results = curl_exec($Curl); for ($i = 0; $i < count($return_message_array); $i++) { $results = $results.$return_message_array[$i]; echo "Restrito!"; } if($query == "config=$site"){$results = str_replace("src=\"", "src=\"?", $results);} if($framename==index){$results = str_replace("src=\"", "src=\"index.php?", $results);} $results = str_replace("action=\"", "action=\"index.php?", $results); $results = str_replace("href=\"", "href=\"?", $results); $results = str_replace("href=\"?http://", "href=\"http://", $results); $results = str_replace("awstats.pl?", "", $results); echo $results; echo "Exclusivo Edvan.com.br"; } } ?> Excelente, obrigado pela contribuição Edvan! Link to comment Share on other sites More sharing options...
LeandroTC Posted December 18, 2013 Share Posted December 18, 2013 Leandro, Não tem como... neste exemplo meu cliente não tem acesso ao cPanel/FTP e forneço as estatísticas via http://site.com/estatisticas/ compreendeu? Entendi sim! Obrigado! :) Link to comment Share on other sites More sharing options...
Recommended Posts