Beste,

Ik gebruik PHP-fusion en heb een PHP foutje, iets met de ending,
Error: Parse error: syntax error, unexpected $end in /usr/home/deb39797/domains/chrisbulterman.nl/public_html/startfm/infusions/mg_login_panel/mg_login_panel.php on line 132


<?
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright © 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: mg_login_panel.php
| Author: MarcusG
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }

// Turn off all error reporting
error_reporting(0);
// Report all PHP errors (see changelog)
//error_reporting(E_ALL);
//error_reporting(E_ALL & ~E_NOTICE);

// Check if locale file is available matching the current site locale setting.
if (file_exists(INFUSIONS."mg_login_panel/locale/".$settings['locale'].".php")) {
// Load the locale file matching the current site locale setting.
include INFUSIONS."mg_login_panel/locale/".$settings['locale'].".php";
} else {
// Load the infusion's default locale file.
include INFUSIONS."mg_login_panel/locale/German.php";
}
add_to_head("
<link rel='stylesheet' type='text/css' href='".INFUSIONS."mg_login_panel/includes/mg_login.css' />\n
");

# Konfiguration ##################################################
$use_panel = 1; // 1 = Anzeige im Panel, 0 = Anzeige im Header #
# Hier nur ändern wenn oben Anzeige im Header gewählt. #
$pos_top = "100px"; // Position der Buttons von oben #
# Hier unbedingt nur eins ausfüllen: entweder rechts ODER links! #
$pos_left = ""; // Position der Buttons von links #
$pos_right = "270px"; // Position der Buttons von rechts #
# Konfiguration Ende #############################################

$pos_xy = ($pos_left != "" ? " left:".$pos_left.";" : " right:".($pos_right != "" ? $pos_right : "200px").";");
if (!iMEMBER) {
($use_panel == 1 ? openside($locale['MG_LOG_001']) : "");
echo "<div class='mg_login_overlay' id='mg_login_overlay' style='display:none;'></div>";
echo "<div class='mg_login_content'".($use_panel == 0 ? " style='position:absolute; top:".$pos_top.";".$pos_xy."'" : "").">\n
<a class='mg_link_button' id='mg_login_box'>".$locale['MG_LOG_001']."</a>";
if ($settings['enable_registration']) {
echo "<a class='mg_link_button' id='mg_register_box' href='".BASEDIR."register.php'>".$locale['MG_LOG_002']."</a>";
}
echo "</div>";
echo "<div id='mg_loginbox'>";
echo "<a class='mg_loginboxclose' id='mg_loginboxclose'></a><br />";
echo "<form name='mg_loginform' method='post' action='".FUSION_SELF."'>\n";
echo $locale['global_101']."<br />\n<input type='text' name='user_name' class='user_name default-value' value='".$locale['global_101']."' style='width:100px' /><br />\n";
echo $locale['global_102']."<br />\n<input type='password' name='user_pass' class='user_pass default-value' value='".$locale['global_102']."' style='width:100px' /><br />\n";
echo $locale['global_103'].": <input type='checkbox' name='remember_me' value='y' title='".$locale['global_103']."' style='vertical-align:middle;' />\n<br />";
echo "<input type='submit' name='login' id='login_button' value='".$locale['global_104']."' class='mg_link_button' /><br />\n";
echo "</form>\n<br />\n";
echo $locale['global_106']."</div>";
if (!defined("IN_FUSION")) { die("Access Denied"); }

if (iMEMBER) {
openside($userdata['user_name']);
$msg_count = dbcount("(message_id)", DB_MESSAGES, "message_to='".$userdata['user_id']."' AND message_read='0'AND message_folder='0'");
echo THEME_BULLET." <a href='".BASEDIR."profile.php?lookup=".$userdata['user_id']."' class='side'>Bekijk Mijn Profiel</a><br />\n";
echo THEME_BULLET." <a href='".BASEDIR."edit_profile.php' class='side'>".$locale['global_120']."</a><br />\n";
echo THEME_BULLET." <a href='".BASEDIR."messages.php' class='side'>".$locale['global_121']."</a><br />\n";
echo THEME_BULLET." <a href='".BASEDIR."members.php' class='side'>".$locale['global_122']."</a><br />\n";
if (iADMIN && (iUSER_RIGHTS != "" || iUSER_RIGHTS != "C")) {
echo THEME_BULLET." <a href='".ADMIN."index.php".$aidlink."' class='side'>".$locale['global_123']."</a><br />\n";
}
echo THEME_BULLET." <a href='".BASEDIR."setuser.php?logout=yes' class='side'>".$locale['global_124']."</a>\n";
if ($msg_count) { echo "<br /><br /><div style='text-align:center'><strong><a href='".BASEDIR."messages.php' class='side'>".sprintf($locale['global_125'], $msg_count).($msg_count == 1 ? $locale['global_126'] : $locale['global_127'])."</a></strong></div>\n"; }
} else {
($use_panel == 1 ? closeside() : "");

($use_panel == 1 ? openside($userdata['user_name']) : "");
echo "<div class='mg_login_content'".($use_panel == 0 ? " style='position:absolute; top:".$pos_top.";".$pos_xy."'" : "").">
<a id='mg_logout_box' href='".BASEDIR."setuser.php?logout=yes' class='mg_link_button'>".$locale['global_124']."</a>
</div>";
($use_panel == 1 ? closeside() : "");



echo "<script type='text/javascript'>
$(document).ready(function(){
$('.default-value').each(function() {
var default_value = this.value;
$(this).focus(function() {
if(this.value == default_value) {
this.value = '';
}
});
$(this).blur(function() {
if(this.value == '') {
this.value = default_value;
}
});
});
});
$(function() {
$('#mg_login_box').click(function() {
$('#mg_login_overlay').fadeIn('fast',function(){
$('#mg_loginbox').slideDown('slow', function(){
$('#mg_loginboxclose').fadeIn('slow');
});
});
});
$('#mg_loginboxclose').click(function() {
$('#mg_loginboxclose').fadeOut('slow', function(){
$('#mg_loginbox').slideUp('slow', function(){
$('#mg_login_overlay').fadeOut('fast');
});
});
});
$('#mg_login_overlay').click(function() {
$('#mg_loginboxclose').fadeOut('slow', function(){
$('#mg_loginbox').slideUp('slow', function(){
$('#mg_login_overlay').fadeOut('fast');
});
});
});
});
</script>
?>


Ik kan het foutje zelf niet vinden
Hij word niet goed afgesloten, dus waarschijnlijk mis je ergens een }.
Ja, en dan waar ? :P
Op lijn 68 open je een { maar waar word hij afgesloten?
Op line 77 ?
Je echoot JavaScript, maar je vergeet een dubbele quote en een puntkomma na de </script> tag aan het eind.
Bedankt ! Hij werkt weer!

[size=xsmall]Toevoeging op 25/02/2011 20:21:20:[/size]

Ohnee, hij werkt niet, nu heb ik zelfde error en heb achter </script> "; gezet
En waar word 75 dan afgesloten ?
Goeie vraag, als ik er } bij zet, geeft ie aan, Unspected } on line 75

[size=xsmall]Toevoeging op 25/02/2011 20:27:46:[/size]

Dus waar moet ik de } zetten ?
ik zie al waar de fout zit
op regel 58 open je { maar die sluit niet die moet je boven de echo van javascript zetten dus op regel 90 dan werkt het.

p.s. zelf getest

[size=xsmall]Toevoeging op 25/02/2011 22:30:35:[/size]

en probeer is meet in te springen dit is de code van jou aangepast door mij.
Zodoende kon ik de fout ook traceren.


<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright © 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: mg_login_panel.php
| Author: MarcusG
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }

// Turn off all error reporting
ini_set('display_errors', 1); // 0 = uit, 1 = aan
error_reporting(E_ALL);
// Report all PHP errors (see changelog)
//error_reporting(E_ALL);
//error_reporting(E_ALL & ~E_NOTICE);

// Check if locale file is available matching the current site locale setting.
if (file_exists(INFUSIONS."mg_login_panel/locale/".$settings['locale'].".php")) 
{
    // Load the locale file matching the current site locale setting.
    include INFUSIONS."mg_login_panel/locale/".$settings['locale'].".php";
} 
else 
{
    // Load the infusion's default locale file.
    include INFUSIONS."mg_login_panel/locale/German.php";
}
add_to_head("<link rel='stylesheet' type='text/css' href='".INFUSIONS."mg_login_panel/includes/mg_login.css' />\n");

# Konfiguration ##################################################
$use_panel = 1; // 1 = Anzeige im Panel, 0 = Anzeige im Header   #
# Hier nur ändern wenn oben Anzeige im Header gewählt.           #
$pos_top = "100px"; // Position der Buttons von oben             #
# Hier unbedingt nur eins ausfüllen: entweder rechts ODER links! #
$pos_left = ""; // Position der Buttons von links                #
$pos_right = "270px"; // Position der Buttons von rechts         #
# Konfiguration Ende #############################################

$pos_xy = ($pos_left != "" ? " left:".$pos_left.";" : " right:".($pos_right != "" ? $pos_right : "200px").";");
if (!iMEMBER) 
{
	($use_panel == 1 ? openside($locale['MG_LOG_001']) : "");
    echo "<div class='mg_login_overlay' id='mg_login_overlay' style='display:none;'></div>";
    echo "<div class='mg_login_content'".($use_panel == 0 ? " style='position:absolute; top:".$pos_top.";".$pos_xy."'" : "").">\n
    <a class='mg_link_button' id='mg_login_box'>".$locale['MG_LOG_001']."</a>";
    if ($settings['enable_registration'])
	{
    	echo "<a class='mg_link_button' id='mg_register_box' href='".BASEDIR."register.php'>".$locale['MG_LOG_002']."</a>";
    }
    echo "</div>";
    echo "<div id='mg_loginbox'>";
    echo "<a class='mg_loginboxclose' id='mg_loginboxclose'></a><br />";
    echo "<form name='mg_loginform' method='post' action='".FUSION_SELF."'>\n";
    echo $locale['global_101']."<br />\n<input type='text' name='user_name' class='user_name default-value' value='".$locale['global_101']."' style='width:100px' /><br />\n";
    echo $locale['global_102']."<br />\n<input type='password' name='user_pass' class='user_pass default-value' value='".$locale['global_102']."' style='width:100px' /><br />\n";
    echo $locale['global_103'].": <input type='checkbox' name='remember_me' value='y' title='".$locale['global_103']."' style='vertical-align:middle;' />\n<br />";
    echo "<input type='submit' name='login' id='login_button' value='".$locale['global_104']."' class='mg_link_button' /><br />\n";
    echo "</form>\n<br />\n";
    echo $locale['global_106']."</div>";
	if (!defined("IN_FUSION")) { die("Access Denied"); }

	if (iMEMBER) 
	{
    	openside($userdata['user_name']);
    	$msg_count = dbcount("(message_id)", DB_MESSAGES, "message_to='".$userdata['user_id']."' AND message_read='0'AND message_folder='0'");
    	echo THEME_BULLET." <a href='".BASEDIR."profile.php?lookup=".$userdata['user_id']."' class='side'>Bekijk Mijn Profiel</a><br />\n";
    	echo THEME_BULLET." <a href='".BASEDIR."edit_profile.php' class='side'>".$locale['global_120']."</a><br />\n";
    	echo THEME_BULLET." <a href='".BASEDIR."messages.php' class='side'>".$locale['global_121']."</a><br />\n";
    	echo THEME_BULLET." <a href='".BASEDIR."members.php' class='side'>".$locale['global_122']."</a><br />\n";
    	if (iADMIN && (iUSER_RIGHTS != "" || iUSER_RIGHTS != "C")) 
		{
        	echo THEME_BULLET." <a href='".ADMIN."index.php".$aidlink."' class='side'>".$locale['global_123']."</a><br />\n";
    	}
    	echo THEME_BULLET." <a href='".BASEDIR."setuser.php?logout=yes' class='side'>".$locale['global_124']."</a>\n";
    	if ($msg_count) 
		{ 
			echo "<br /><br /><div style='text-align:center'><strong><a href='".BASEDIR."messages.php' class='side'>".sprintf($locale['global_125'], $msg_count).($msg_count == 1 ? $locale['global_126'] : 
			$locale['global_127'])."</a></strong></div>\n"; 
		}
	} 
	else 
	{
		($use_panel == 1 ? closeside() : "");

		($use_panel == 1 ? openside($userdata['user_name']) : "");
		echo "<div class='mg_login_content'".($use_panel == 0 ? " style='position:absolute; top:".$pos_top.";".$pos_xy."'" : "").">
    	<a id='mg_logout_box' href='".BASEDIR."setuser.php?logout=yes' class='mg_link_button'>".$locale['global_124']."</a></div>";
		($use_panel == 1 ? closeside() : "");    
	}
}

echo "<script type='text/javascript'>
$(document).ready(function()
{
	$('.default-value').each(function()
	{
    	var default_value = this.value;
        $(this).focus(function() 
		{
            if(this.value == default_value) 
			{
                this.value = '';
            }
        });
        $(this).blur(function() 
		{
            if(this.value == '') 
			{
                this.value = default_value;
            }
        });
    });
});

    $(function() 
	{
    	$('#mg_login_box').click(function() 
		{
        	$('#mg_login_overlay').fadeIn('fast',function()
			{
            	$('#mg_loginbox').slideDown('slow', function()
				{
                	$('#mg_loginboxclose').fadeIn('slow');
            	});
        	});
    	});
	
    $('#mg_loginboxclose').click(function() 
	{
    	$('#mg_loginboxclose').fadeOut('slow', function()
		{
        	$('#mg_loginbox').slideUp('slow', function()
			{
            	$('#mg_login_overlay').fadeOut('fast');
        	});
    	});
    });
    
	$('#mg_login_overlay').click(function() 
	{
    	$('#mg_loginboxclose').fadeOut('slow', function()
		{
        	$('#mg_loginbox').slideUp('slow', function()
			{
            	$('#mg_login_overlay').fadeOut('fast');
        	});
    	});
    });
</script>";
?>
Ik vind het wel netjes om te echo'en met dubbele quotes (" ") en om dan HTML met single quotes (' ') te doen. Zo houden we er op het www een lekkere structuur in, als iedereen het anders doet! :-)

Reageren