Register and Login errors

Post here is you are having problems with any of the tutorials.
Post Reply
AndrewD92
Posts: 18
Joined: Sat Jan 28, 2012 7:24 pm

Register and Login errors

Post by AndrewD92 »

Hey! I'm doing programming as part of my computing uni course. I'm still a beginner but I want to learn. I'm taking things slowly and following the videos step by step. I'm up to Register and Login (User Account System), which I think is the third or forth playlist. Everything else I done works perfectly!

The errors I have is: (I have copied the errored lines)

Strict Standards: Only variables should be passed by reference in C:\xampp\htdocs\user_system\core\init.inc.php on line 7
<?php
 
session_start();
 
$exceptions = array('register', 'login');
 
$page = substr(end(explode('/', $_SERVER['SCRIPT_NAME'])), 0, -4);
 
if (in_array($page, $exceptions) === false){
        if (isset($_SESSION['username']) === false){
                header('Location: login.php');
                die();
        }
}
 
mysql_connect('localhost', 'root', '');
mysql_select_db('user_system');

$path = dirname(__FILE__);
 
include("{$path}/inc/user.inc.php");

?>
(SOLVED THE OTHER 2)
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Register and Login errors

Post by jacek »

Yeah this is a pain, essentially the problem is that php wants you to do
$page = explode('/', $_SERVER['SCRIPT_NAME']);
$page = end($page)l
$page = substr($page, 0, -4);
instaead of
$page = substr(end(explode('/', $_SERVER['SCRIPT_NAME'])), 0, -4);
i.e separating all of the functions.

It's very convenient to be able to pass a function to another function though so you can just hide these messages which is what I do by doing
error_reporting(E_ALL & ~E_STRICT);
at the top of your file.
Image
AndrewD92
Posts: 18
Joined: Sat Jan 28, 2012 7:24 pm

Re: Register and Login errors

Post by AndrewD92 »

Wow. Your so totally going to be my best friend for the next 3 years :D

Your tutorials are extremely good by the way. Clean, clear and easy to follow. Much better than a lecturer. Thanks for a personal reply!
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Register and Login errors

Post by jacek »

AndrewD92 wrote:Your tutorials are extremely good by the way. Clean, clear and easy to follow. Much better than a lecturer. Thanks for a personal reply!
No problem :D Thank you for the nice things you said :D
Image
Post Reply