can't get page to load when script is uploaded to live site.

can’t get page to load when script is uploaded to live site.

Tested on local machine and works. Uploaded and changed the credentials to host provider setting and i get an internal error page.

index.php

<?php echo "yes!"; require_once 'core/init.php'; if(Session::exists('home')) { echo '

' . Session::flash('home'). '

'; } $user = new User(); if (!$user->isLoggedin()) { Redirect::to('login.php'); } else { if ($user->hasPermission('admin')) { echo 'You are an administrator.'; ?>

init.php

<?php session_start(); $GLOBALS['config'] = array( 'mysql' => array( 'host' => 'domian', 'username' => 'username', 'password' => 'password', 'db' => 'lr' ), 'remember' => array( 'cookie_name' => 'hash', 'cookie_expiry' => 604800 ), 'session' => array( 'session_name' => 'user', 'token_name' => 'token' ) ); // closes the $GLOBALS['config'] spl_autoload_register(function($class) { require_once 'classes/' . $class . '.php'; }); require_once 'functions/sanitize.php'; if (Cookie::exists(Config::get('remember/cookie_name')) && !Session::exists(Config::get('session/session_name'))) { $hash = Cookie::get(Config::get('remember/cookie_name')); $hashCheck = DB::getInstance()->get('users_session', array('hash', '=', $hash)); if ($hashCheck->count()) { $user = new User($hashCheck->first()->user_id); $user->login(); } } --- Please help. JT

Your missing two closing braces on the first file. If you use the forums php tags you would clearly see it.

Kevin,

It actually is closed. it was just extra data that I omitted. but here it is again with the closing brackets

index.php
[php]

echo “yes!”;
require_once ‘core/init.php’;

if(Session::exists(‘home’)) {
echo ‘

’ . Session::flash(‘home’). ‘

’;
}
$user = new User();
if (!$user->isLoggedin()) {
Redirect::to(‘login.php’);
}
else {
if ($user->hasPermission(‘admin’)) {
echo ‘You are an administrator.’;
}
}

[/php]

init.php
[php]
session_start();

$GLOBALS[‘config’] = array(
‘mysql’ => array(
‘host’ => ‘domian’,
‘username’ => ‘username’,
‘password’ => ‘password’,
‘db’ => ‘lr’
),
‘remember’ => array(
‘cookie_name’ => ‘hash’,
‘cookie_expiry’ => 604800
),
‘session’ => array(
‘session_name’ => ‘user’,
‘token_name’ => ‘token’
)
); // closes the $GLOBALS[‘config’]

spl_autoload_register(function($class) {
require_once ‘classes/’ . $class . ‘.php’;
});

require_once ‘functions/sanitize.php’;

if (Cookie::exists(Config::get(‘remember/cookie_name’)) && !Session::exists(Config::get(‘session/session_name’))) {
$hash = Cookie::get(Config::get(‘remember/cookie_name’));
$hashCheck = DB::getInstance()->get(‘users_session’, array(‘hash’, ‘=’, $hash));

if ($hashCheck->count()) {
$user = new User($hashCheck->first()->user_id);
$user->login();
}
}
[/php]

again this works in my local machine. however when i uploaded it to my host site. i changed the credentials and i get an error page.

"500 Internal Server Error " - page title

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

The error told you what to do:

More information about this error may be available in the server error log.

That is where you will find the exact error.

i will check with my host provider. Thx.

Sponsor our Newsletter | Privacy Policy | Terms of Service