Jump to content

hariharen

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.forumforastral.com/

Profile Information

  • Gender
    Not Telling

hariharen's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. But Actually I need an URL Like http://localhost/Myname Is that not possible with this code? Please Help.. the http://localhost/profile/Myname looks little bit ugly.. so..
  2. <?php class Bootstrap { function __construct() { // Here I fetch the http://localhost/"Myname" "Myname" ie, http://localhost/index.php?url=Myname $url = isset($_GET['url']) ? $_GET['url'] : null; $url = rtrim($url, '/'); $url = explode('/', $url); if (empty($url[0])) { require 'controllers/index.php'; $controller = new Index(); $controller->index(); return false; } // M struck with this part // Here in this part m finding the file like "index page, login page, registration page etc.." // Here I want to check the database to find the username & render profile page if username exists. $file = 'controllers/' . $url[0] . '.php'; if (file_exists($file)) { require $file; } else { $this->error(); } $controller = new $url[0]; $controller->loadModel($url[0]); // calling methods if (isset($url[2])) { if (method_exists($controller, $url[1])) { $controller->{$url[1]}($url[2]); } else { $this->error(); } } else { if (isset($url[1])) { if (method_exists($controller, $url[1])) { $controller->{$url[1]}(); } else { $this->error(); } } else { $controller->index(); } } } function error() { require 'controllers/error.php'; $controller = new Error(); $controller->index(); return false; } }
  3. Hi, I am using jream's MVC pattern and building a new movie review site, But i have some problem on profile page, i am trying to show the profile page when 'http://localhost/Myname', I use .htaccess file too.. I fetch that 'Myname' from url & i can find the controller file, but the problem is I don't kno how to check weather the username exists in database, If it exists I need to diaplay the profile page f that person else to the error page.. I tried many time, but m not getting how to do it.. Here's my code.. anyone please help, M struck with this [attachment deleted by admin]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.