d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Php Website > Parse Error
12Next
Add Reply New Topic New Poll
Member
Posts: 25,563
Joined: Mar 10 2007
Gold: 0.71
Sep 17 2014 06:23pm



Keep on getting this error on my website. I can't seem to find why jsp help pls <3


Section of code
Code
if($output)
{
$in_redirect_endpoint = false;
$redirect_endpoints = ['preregister', 'banned', 'account/terms', 'account/settings', 'account/login', 'account/logout'];

foreach ($redirect_endpoints as $endpoint)
{
if(strpos($_SERVER['REQUEST_URI'], $endpoint) !== false)
{
$in_redirect_endpoint = true;
}
}



Line 33:

Code
$redirect_endpoints = ['preregister', 'banned', 'account/terms', 'account/settings', 'account/login', 'account/logout'];
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Sep 17 2014 06:44pm
http://php.net/manual/en/language.types.array.php

i'm not a php expert, but i dont see the [ ] syntax supported. have you tried:

Code
$redirect_endpoints = array('preregister', 'banned', 'account/terms', 'account/settings', 'account/login', 'account/logout');
Member
Posts: 25,563
Joined: Mar 10 2007
Gold: 0.71
Sep 17 2014 07:38pm
Quote (carteblanche @ Sep 17 2014 07:44pm)
http://php.net/manual/en/language.types.array.php

i'm not a php expert, but i dont see the [ ] syntax supported. have you tried:

Code
$redirect_endpoints = array('preregister', 'banned', 'account/terms', 'account/settings', 'account/login', 'account/logout');


Nah that didn't work.

Thanks for the suggestion tho!
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
Sep 17 2014 08:13pm
Try using double quotes.

Also the array [] syntax is only supported in php 5.3 and greater. Else you should use array().
Member
Posts: 31,806
Joined: Jan 22 2008
Gold: 2,235.56
Sep 17 2014 08:48pm
Quote (carteblanche @ Sep 17 2014 08:44pm)
http://php.net/manual/en/language.types.array.php

i'm not a php expert, but i dont see the [ ] syntax supported. have you tried:

Code
$redirect_endpoints = array('preregister', 'banned', 'account/terms', 'account/settings', 'account/login', 'account/logout');


Quote (Denzel @ Sep 17 2014 09:38pm)
Nah that didn't work.

Thanks for the suggestion tho!


What was the error when using this?
Member
Posts: 1,358
Joined: Dec 30 2012
Gold: 0.10
Sep 17 2014 08:50pm
[] brackets are supported but only after php 5.4 i believe. check your php version

however, $redirect_endpoints = array() shouldnt be different from $redirect_endpoints = []

This post was edited by SelfTaught on Sep 17 2014 08:51pm
Member
Posts: 25,563
Joined: Mar 10 2007
Gold: 0.71
Sep 17 2014 08:53pm
Ended up working and fixed a few errors after that as well, moved onto another part of it after I finished fixing the errors on that one.

Getting this error now



Code
<?php
return (
'mode' => 'development',

'template' => (
'path' => './templates',
'cache' => './cache',
'reload' => true
),

'database' => (
'type' => 'mysql',
'host' => '127.0.0.1',
'user' => 'root',
'pass' => 'mysql',
'name' => '',
'models' => './models'
),


the lines

Code
'mode' => 'development',


line 3.

i dont get whuts wrong with it.
Member
Posts: 1,358
Joined: Dec 30 2012
Gold: 0.10
Sep 17 2014 08:54pm
try
Code
return array(
'mode' => 'development',

'template' => (
'path' => './templates',
'cache' => './cache',
'reload' => true
),

'database' => (
'type' => 'mysql',
'host' => '127.0.0.1',
'user' => 'root',
'pass' => 'mysql',
'name' => '',
'models' => './models'
));


i think you're just forgetting array

This post was edited by SelfTaught on Sep 17 2014 08:55pm
Member
Posts: 25,563
Joined: Mar 10 2007
Gold: 0.71
Sep 17 2014 08:56pm
Quote (SelfTaught @ Sep 17 2014 09:54pm)
try
Code
return array(
'mode' => 'development',

'template' => (
  'path' => './templates',
  'cache' => './cache',
  'reload' => true
),

'database' => (
  'type' => 'mysql',
  'host' => '127.0.0.1',
  'user' => 'root',
  'pass' => 'mysql',
  'name' => '',
  'models' => './models'
));


i think you're just forgetting array


Ya

im a moron
Member
Posts: 1,358
Joined: Dec 30 2012
Gold: 0.10
Sep 17 2014 08:57pm
Quote (Denzel @ Sep 17 2014 06:56pm)
Ya

im a moron


:D
Go Back To Programming & Development Topic List
12Next
Add Reply New Topic New Poll