Erreur de code sur easyphp

runjoey Messages postés 5 Date d'inscription   Statut Membre Dernière intervention   -  
runjoey Messages postés 5 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,

Je veux installer webcalendar v0.9.43 sur mon easy php 1.6 mais quand j'essaye de me connecter une erreur s'affiche :

Warning: Cannot add header information - headers already sent by (output started at c:\program files\easyphp 1.6\www\webcalendar\includes\config.php:447) in c:\program files\easyphp 1.6\www\webcalendar\login.php on line 57

Warning: Cannot add header information - headers already sent by (output started at c:\program files\easyphp 1.6\www\webcalendar\includes\config.php:447) in c:\program files\easyphp 1.6\www\webcalendar\login.php on line 69

Je vous ai mis le code, les lignes soulignés sont celles qui ont un problème d'après easyphp.

if ( $remember == "yes" )
SetCookie ( "webcalendar_session", $encoded_login, time() + ( 24 * 3600 * 365 ), $cookie_path );
else
SetCookie ( "webcalendar_session", $encoded_login, 0, $cookie_path );
// The cookie "webcalendar_login" is provided as a convenience to
// other apps that may wish to find out what the last calendar
// login was, so they can use week_ssi.php as a server-side include.
// As such, it's not a security risk to have it un-encoded since it
// is not used to allow logins within this app. It is used to
// load user preferences on the login page (before anyone has
// logged in) if $remember_last_login is set to "Y" (in admin.php).
if ( $remember == "yes" )
SetCookie ( "webcalendar_login", $login,
time() + ( 24 * 3600 * 365 ), $cookie_path );
else
SetCookie ( "webcalendar_login", $login, 0, $cookie_path );
do_redirect ( $url );


Je ne vois pas d'ou vient l'erreur si quelqu'un pouvait me donner une solution ce serait vraiment sympa
Merci de votre attention.
A voir également:

7 réponses

Scalpweb Messages postés 1467 Date d'inscription   Statut Membre Dernière intervention   43
 
il ne faut pas mettre d'echo ou de balise html avant les fonctions de gestion de Cookie.
0
runjoey Messages postés 5 Date d'inscription   Statut Membre Dernière intervention  
 
Merci pour la réponse mais je ne vois pas ou sont justement ces balises sur le code.
Pouvez vous m'indiquez les lignes svp
0
Scalpweb Messages postés 1467 Date d'inscription   Statut Membre Dernière intervention   43
 
Pour ça j'ai besoin du code qui se trouve avant l'extrait qui tu as donné ci-dessus.
0
runjoey Messages postés 5 Date d'inscription   Statut Membre Dernière intervention  
 
Voila j'ai mis le code entier merci de votre aide

<?php

include "includes/config.php";
include "includes/php-dbi.php";
include "includes/functions.php";
include "includes/$user_inc";
include "includes/connect.php";

load_global_settings ();

if ( ! empty ( $last_login ) )
$login = "";

if ( empty ( $webcalendar_login ) )
$webcalendar_login = "";
if ( $remember_last_login == "Y" && empty ( $login ) ) {
$last_login = $login = $webcalendar_login;
}

load_user_preferences ();

include "includes/translate.php";

// see if a return path was set
if ( ! empty ( $return_path ) ) {
$url = $return_path;
} else {
$url = "index.php";
}

// calculate path for cookie
if ( empty ( $PHP_SELF ) )
$PHP_SELF = $_SERVER["PHP_SELF"];
$cookie_path = str_replace ( "login.php", "", $PHP_SELF );
//echo "Cookie path: $cookie_path\n";

if ( $single_user == "Y" ) {
// No login for single-user mode
do_redirect ( "index.php" );
} else if ( $use_http_auth ) {
// There is no login page when using HTTP authorization
do_redirect ( "index.php" );
} else {
if ( ! empty ( $login ) && ! empty ( $password ) ) {
$login = trim ( $login );
if ( user_valid_login ( $login, $password ) ) {
user_load_variables ( $login, "" );
// set login to expire in 365 days
srand((double) microtime() * 1000000);
$salt = chr( rand(ord('A'), ord('z'))) . chr( rand(ord('A'), ord('z')));
$encoded_login = encode_string ( $login . "|" . crypt($password, $salt) );

if ( $remember == "yes" )
SetCookie ( "webcalendar_session", $encoded_login,
time() + ( 24 * 3600 * 365 ), $cookie_path );
else
SetCookie ( "webcalendar_session", $encoded_login, 0, $cookie_path );
// The cookie "webcalendar_login" is provided as a convenience to
// other apps that may wish to find out what the last calendar
// login was, so they can use week_ssi.php as a server-side include.
// As such, it's not a security risk to have it un-encoded since it
// is not used to allow logins within this app. It is used to
// load user preferences on the login page (before anyone has
// logged in) if $remember_last_login is set to "Y" (in admin.php).
if ( $remember == "yes" )
SetCookie ( "webcalendar_login", $login,
time() + ( 24 * 3600 * 365 ), $cookie_path );
else
SetCookie ( "webcalendar_login", $login, 0, $cookie_path );
do_redirect ( $url );
}
}
// delete current user
SetCookie ( "webcalendar_session", "", 0, $cookie_path );
// In older versions the cookie path had no trailing slash and NS 4.78
// thinks "path/" and "path" are different, so the line above does not
// delete the "old" cookie. This prohibits the login. So we delete the
// cookie with the trailing slash removed
if (substr($cookie_path, -1) == '/')
SetCookie ( "webcalendar_session", "", 0, substr($cookie_path, 0, -1) );
}
?>
<HTML>
<HEAD>
<TITLE><?php etranslate($application_name)?></TITLE>
<SCRIPT LANGUAGE="JavaScript">
// error check login/password
function valid_form ( form ) {
if ( form.login.value.length == 0 || form.password.value.length == 0 ) {
alert ( "<?php etranslate("You must enter a login and password")?>." );
return false;
}
return true;
}
function myOnLoad() {
<?php if ( $plugins_enabled ) { ?>
if (self != top) {
window.open("login.php","_top","");
return;
}
<?php } ?>
document.forms[0].login.focus();
<?php
if ( ! empty ( $login ) ) echo "document.forms[0].login.select();";
?>
}
</SCRIPT>
<?php include "includes/styles.php"; ?>
</HEAD>
<BODY BGCOLOR="<?php echo $BGCOLOR;?>"
ONLOAD="myOnLoad();" CLASS="defaulttext">
<?php
// Print custom header (since we do not call print_header function)
if ( ! empty ( $CUSTOM_HEADER ) && $CUSTOM_HEADER == 'Y' ) {
$res = dbi_query (
"SELECT cal_template_text FROM webcal_report_template " .
"WHERE cal_template_type = 'H' and cal_report_id = 0" );
if ( $res ) {
if ( $row = dbi_fetch_row ( $res ) ) {
echo $row[0];
}
dbi_free_result ( $res );
}
}
?>

<H2><FONT COLOR="<?php echo $H2COLOR?>"><?php etranslate($application_name)?></FONT></H2>

<?php
if ( ! empty ( $error ) ) {
print "<FONT COLOR=\"#FF0000\"><B>" . translate("Error") .
":</B> $error</FONT><P>\n";
}
?>
<FORM NAME="login_form" ACTION="login.php" METHOD="POST" ONSUBMIT="return valid_form(this)">

<?php
if ( ! empty ( $return_path ) )
echo "<INPUT TYPE=\"hidden\" NAME=\"return_path\" VALUE=\"" .
htmlentities ( $return_path ) . "\">\n";
?>

<TABLE BORDER=0>
<TR><TD><B><?php etranslate("Username")?>:</B></TD>
<TD><INPUT NAME="login" SIZE=10 VALUE="<?php if ( ! empty ( $last_login ) ) echo $last_login;?>" TABINDEX="1"></TD></TR>
<TR><TD><B><?php etranslate("Password")?>:</B></TD>
<TD><INPUT NAME="password" TYPE="password" SIZE=10 TABINDEX="2"></TD></TR>
<TR><TD COLSPAN=2><INPUT TYPE="checkbox" NAME="remember" VALUE="yes" <?php if ( ! empty ( $remember ) && $remember == "yes" ) echo "CHECKED"; ?>> <?php etranslate("Save login via cookies so I don't have to login next time")?></TD></TR>
<TR><TD COLSPAN=2><INPUT TYPE="submit" VALUE="<?php etranslate("Login")?>" TABINDEX="3"></TD></TR>
</TABLE>

</FORM>

<P>
<?php if ( $public_access == "Y" ) { ?>
<A CLASS="navlinks" HREF="index.php"><?php etranslate("Access public calendar")?></A><P>
<?php } ?>

<?php
if ( $demo_mode == "Y" ) {
// This is used on the sourceforge demo page
echo "Demo login: user = \"demo\", password = \"demo\" <P>";
}
?>
<BR><BR><BR>
<FONT SIZE="-1">
<?php etranslate("cookies-note")?>
<P>
<HR><P>
<A HREF="<?php echo $PROGRAM_URL ?>" CLASS="aboutinfo"><?php echo $PROGRAM_NAME?></A>
</FONT>
<?php
// Print custom trailer (since we do not call print_trailer function)
if ( ! empty ( $CUSTOM_TRAILER ) && $CUSTOM_TRAILER == 'Y' ) {
$res = dbi_query (
"SELECT cal_template_text FROM webcal_report_template " .
"WHERE cal_template_type = 'T' and cal_report_id = 0" );
if ( $res ) {
if ( $row = dbi_fetch_row ( $res ) ) {
echo $row[0];
}
dbi_free_result ( $res );
}
}
?>
</BODY>
</HTML>
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
Scalpweb Messages postés 1467 Date d'inscription   Statut Membre Dernière intervention   43
 
Essayes de déplacer le bout de code :

 if ( $remember == "yes" )
SetCookie ( "webcalendar_session", $encoded_login,
time() + ( 24 * 3600 * 365 ), $cookie_path );
else
SetCookie ( "webcalendar_session", $encoded_login, 0, $cookie_path );
// The cookie "webcalendar_login" is provided as a convenience to
// other apps that may wish to find out what the last calendar
// login was, so they can use week_ssi.php as a server-side include.
// As such, it's not a security risk to have it un-encoded since it
// is not used to allow logins within this app. It is used to
// load user preferences on the login page (before anyone has
// logged in) if $remember_last_login is set to "Y" (in admin.php).
if ( $remember == "yes" )
SetCookie ( "webcalendar_login", $login,
time() + ( 24 * 3600 * 365 ), $cookie_path );
else
SetCookie ( "webcalendar_login", $login, 0, $cookie_path );
do_redirect ( $url );
} 


juste après les includes.
0
runjoey Messages postés 5 Date d'inscription   Statut Membre Dernière intervention  
 
Je viens de faire un test et j'ai toujours la même erreur qui s'affiche sauf que bien entendu ce n'est pas la même ligne.
J'ai essayé d'y mettre après le include "includes/connect.php";
et un autre test après le include "includes/translate.php"; mais aucun résultat
0
runjoey Messages postés 5 Date d'inscription   Statut Membre Dernière intervention  
 
Si quelqu'un d'autre a une idée merci de poster vos commentaires
0