Jump to content


Photo

Array ( ) - Only showing! - login.php


  • Please log in to reply
2 replies to this topic

#1 MrSamCraft

MrSamCraft

    Member

  • Members
  • PipPip
  • 15 posts

Posted 10 March 2013 - 06:25 PM

I'v been stuck on this now for the past 4 hours! :(

I'm trying to get this code to prompt a user with the right error when not entering the right pass or username but its just prompting with Array ( )

 

<?php
include 'core/init.php';

if (empty($_POST) === false) {
	$username = $_POST['username'];
	$password = $_POST['password'];

	if (empty($username) === true || empty($password) === true) {
		$erros[] = 'You need to enter a username and password!';
	} else if (user_exists($username) === false) {
		$erros[] = 'We can\'t find that username. Have you registerd?';	
	} else if (user_active($username) === false) {
		$erros[] = 'You havn\'t activated your account!';
	} else {
		$login = login($username, $password);
		if ($login === false) {
			$errors[] = 'That username/password combination is incorrect!';
		} else {
			$_SESSION['iduser'] = $login;
			header('Location: index.php');
			exit();
		}	
	}
	
	print_r($errors);
}	
?>

 

Thanks,

 Sam



#2 Barand

Barand

    Sen . ( ile || sei )

  • Gurus
  • 14,132 posts
  • LocationCheshire, UK

Posted 10 March 2013 - 06:35 PM

The only line that puts anything in the $errors array as line 17.

 

All the rest use $erros.


|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts
|baaSelect| generate js and php code for dynamic linked dropdowns

 


#3 MrSamCraft

MrSamCraft

    Member

  • Members
  • PipPip
  • 15 posts

Posted 10 March 2013 - 07:03 PM

The only line that puts anything in the $errors array as line 17.

 

All the rest use $erros.

My noobish coding right there!

Dam the tiredness!

 

Thanks for the help Barand!






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com