Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class homeController extends Controller {
- public function __construct() {
- parent::__construct();
- $u = new usuarios();
- if(!$u->isLogged()){ //Se não estiver logado
- header("Location: /twitter/login");
- }
- }
- public function index() {
- $dados = array(
- 'nome' => ''
- );
- $u = new usuarios($_SESSION['twlog']);
- $dados['nome'] = $u->getNome();
- //Debugando print_r($dados);
- $dados['qt_seguidos'] = $u->countSeguidos();
- $dados['qt_seguidores'] = $u->countSeguidores();
- $dados['sugestao'] = $u->getUsuarios(5);
- $this->loadTemplate('home', $dados);
- }
- public function seguir($id){
- if(!empty($id)){
- $id = addslashes($id);
- $sql = "SELECT * FROM usuarios WHERE id = '$id'";
- $sql = $this->db->query($sql);
- if($sql->rowCount() > 0){
- $r = new relacionamentos();
- $r->seguir($_SESSION['twlog'], $id);
- }
- }
- header("Location: /twitter");
- }
- public function desseguir($id){
- if(!empty($id)){
- $id = addslashes($id);
- $sql = "SELECT * FROM usuarios WHERE id = '$id'";
- $sql = $this->db->query($sql);
- if($sql->rowCount() > 0){
- $r = new relacionamentos();
- $r->desseguir($_SESSION['twlog'], $id);
- }
- }
- header("Location: /twitter");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement