Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1374 connectés 

  FORUM HardWare.fr
  Programmation
  PHP

  Erreur de code en PHP

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Erreur de code en PHP

n°1698858
Olshamilo
Posté le 07-03-2008 à 13:51:21  profilanswer
 

Bonjour un peu novice dans la programation, j'ai récupéré un "plugins " pour Guppy qui génère deux erreurs de codes sur ma page.
 
la première erreur:
Ligne: 116
Car: 4
Erreur: 'Stop000' est indéfini
Code: 0
Url: http...mon site... /shoutpro/shoutbox.php?Ing=fr&c=0
 
La deuxième erreur:
Ligne: 131
Car: 94
Erreur: 'j' attendu
Code: 0
Url: http...mon site... /shoutpro/shoutbox.php?Ing=fr&c=0
 
Si on pouvait m'aider à trouver l'erreur!!!
Car j'ai le sentiment même si le plugin fonctionne bien (apparemment=
Que cela ralenti considérablement ma page!
Si quelqu'un peut m'aider et a besoin de voir mon problème...
je lui donnerai les codes d'entrée sur le site car c'est un site privé!!!
 
Le code de la page de shoutbox.php est le suivant:
 
<?php
 
/*
Shoutpro for GuppY by slls freeGuppY.nl
Version 2.0, october 2006
*/
 
 
// if register globals are off (in most cases true)
if ($_POST["shout"]!="" ){
   $shout = $_POST['shout'];
}
if ($_POST["name"]!="" ){
   $name = $_POST['name'];
}
if ($_GET["lng"] !="" ){
   $lng = $_GET['lng'];
}
if ($_GET["c"] !="" ){
   $c = $_GET['c'];
}
if ($_GET["name"] !="" ){
   $name = $_GET['name'];
}
 
define("CHEMIN", "../../" );
// include language variables
include(CHEMIN."plugins/shoutpro/lang/".$lng."-web.inc" );
 
// include.inc calls default ShoutPro functions and settings
require("include.inc" );
// needed to get $user[1] (webmaster's login name)
include("../../data/config.inc" );
 
// create cookie for shoutview setting
// note: MIE does not create cookies in an iFrame this way. Using javascript instead...
/*
if (empty($_COOKIE['shoutbox'])) {
   setcookie('shoutbox','less',time()+1000000,'/','',0);
}
*/
 
// Read value from cookie if cookie exist. Else the value comes from config.inc
// List 'less' or 'all' shouts after click on icon.
$view = $_COOKIE['shoutbox'];
if (!empty($_COOKIE['user_refresh'])) {
   $refresh = $_COOKIE['user_refresh'];
}
 
// Get username from default GuppY cookie is user is logged in
$usercookie = "GuppYUser";
$userprefs = array();
if (!empty($_COOKIE[$usercookie])) {
  $userprefs = explode("||",$_COOKIE[$usercookie]);
  $userprefs[1] = eregi_replace("[^a-zA-Z0-9_]","",substr(strip_tags($userprefs[1]),0,20));
  $name = $userprefs[1];
  // extra check. If name is empty...
  if (empty($name)){
     die();
  }
}
// if guests aren't allowed to shout...
if (empty($name) && $allowguests<>"on" )  {
   die();
}
?>
 
 
<!-- start html output -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>Help</title>
<link rel="stylesheet" href="skin/<?php echo $skin; ?>" type="text/css">
<script language="javascript" type="text/javascript">
 
function insertion(repdeb, repfin) {
var input = document.forms['postshout'].elements['shout'];
input.focus();
if(typeof document.selection != 'undefined') {
   var range = document.selection.createRange();
   var insText = range.text;
   range.text = repdeb + insText + repfin;
   range = document.selection.createRange();
   if (insText.length == 0) {
      range.move('character', -repfin.length);
   } else {
      range.moveStart('character', repdeb.length + insText.length + repfin.length);
   }
   range.select();
} else if (typeof input.selectionStart != 'undefined') {
   var start = input.selectionStart;
   var end = input.selectionEnd;
   var insText = input.value.substring(start, end);
   input.value = input.value.substr(0, start) + repdeb + insText + repfin + input.value.substr(end);
   var pos;
   if (insText.length == 0) {
      pos = start + repdeb.length;
   } else {
      pos = start + repdeb.length + insText.length + repfin.length;
   }
   input.selectionStart = pos;
   input.selectionEnd = pos;
} else {
   var pos;
   var re = new RegExp('^[0-9]{0,3}$');
   while (!re.test(pos)) {
         pos = prompt("Insertion in the position (0.." + input.value.length + " ):", "0" );
   }
   if (pos > input.value.length) {
      pos = input.value.length;
   }
   var insText = prompt("Please enter the text to format:" );
   input.value = input.value.substr(0, pos) + repdeb + insText + repfin + input.value.substr(pos);
}
}
 
function textCounter(field, countfield, maxlimit) {
   if(field.value.length > maxlimit){
      field.value = field.value.substring(0, maxlimit);
   }
   else{
      countfield.value = maxlimit - field.value.length;
   }
}
 
function reload() {
 location.href = "shoutbox.php?lng=<?php echo $lng; ?>&c=<?php echo $c; ?>&name=<?php echo $name; ?>";
}
 
function user_refresh(x) {
 //Make the rest of the shouts viewable. Save setting in cookie
    var later = new Date(2010,1,1,0,0,0,0);
    if (x=="0" ){ document.cookie='user_refresh=5; expires=' + later.toGMTString();}
    if (x=="1" ){ document.cookie='user_refresh=10; expires=' + later.toGMTString();}
    if (x=="2" ){ document.cookie='user_refresh=15; expires=' + later.toGMTString();}
    if (x=="3" ){ document.cookie='user_refresh=20; expires=' + later.toGMTString();}
    if (x=="4" ){ document.cookie='user_refresh=30; expires=' + later.toGMTString();}
    if (x=="5" ){ document.cookie='user_refresh=Stop; expires=' + later.toGMTString();}
}
 
function doviewall() {
 //Make the rest of the shouts viewable. Save setting in cookie
    var later = new Date(2010,1,1,0,0,0,0);
    document.cookie="shoutbox=all; expires=" + later.toGMTString();
}
 
function doviewless() {
 //Hide more shouts. Save setting in cookie
    var later = new Date(2010,1,1,0,0,0,0);
    document.cookie="shoutbox=less; expires=" + later.toGMTString();
}
 
function openadmin() {
    window.open('openadmin.php?lng=<?php echo $lng; ?>','admin','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=710,top=40,left=90,height=400');
}
 
function openhelp() {
 //Pop up the help window
 window.open('help.php?lng=<?php echo $lng; ?>','help_window','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=280,height=340');
 
}
 
function openicons() {
 //Pop up the help window
 window.open('emoticons.php?lng=<?php echo $lng; ?>','emoticon_window','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=270,height=550');
}
 
function stoptmr(){  
 if(tmron){  
  clearTimeout(timerID);  
  tmron = false;  
 }
}  
 
function starttmr(){  
   stoptmr();  
   timerID = setTimeout('reload()', <?php echo $refresh; ?>000);
   tmron = true;  
}
 
var tmron = false;
var tmrid;
<?php echo("starttmr();" ); ?>
 
</script>
</head>
 
<?php
// The following code posts a message.
// When using the image type to post, you need 'post_x' instead of 'post'
if (isset($_POST['post_x'])){
 
   // prepare the name
   $name = trim($name);
   $name = killhtml(killscript($name));
   $name = first($name);
 
   //Prepare the shout
   $shout = trim($shout);
   $shout = stripslashes($shout); // if Magic Quotes are on, remove backslashes
   $shout = killhtml(killscript($shout));
   $shout = str_replace ("\n", " ", $shout);
   $shout = str_replace ("\r", " ", $shout);
   $shout = first($shout);
   
   // Get the date and time
   $date = date("d/m", time() + $timeoffset * 3600);
   $time = date("H:i", time() + $timeoffset * 3600);
 
   // Some checks
   if (!$name){
      echo("<script>alert(\"".$inputname."\" );</script>" );
   }elseif (!$shout){
      echo("<script>alert(\"".$inputshout."\" );</script>" );
   }elseif (strlen($shout) < $minlength){
   echo ("<script language='JavaScript'>
    alert('$shoutpro_web7');
    location.href='shoutbox.php?lng=$lng&amp;c=$c';
    </script>" );
   }elseif ((strlen($shout) > $maxlength) && ($maxlength != 0)) {
   echo ("<script language='JavaScript'>
    alert('$shoutpro_web8');
    location.href='shoutbox.php?lng=$lng&amp;c=$c';
    </script>" );
   }else{
      // Add the shout to the end of the file shouts.inc
      if ($FilePointer = fopen("shouts.inc", "a+" )){
         fwrite($FilePointer,"$name|^|$shout|^|$date|^|$time|^|$_SERVER[REMOTE_ADDR]|^|\n" );
         fclose($FilePointer);
      }
   }
}
 
// Get Browser name
$browser_user_agent = ( isset($_SERVER['HTTP_USER_AGENT']) ) ? strtolower($_SERVER['HTTP_USER_AGENT']) : '';
 
// Show Icons
// Do not use the PHP code \n after the icon. Ending with \n results in extra space between icons.
echo "<a href=\"javascript:openhelp();\"><img src='img/help.png' title='".$icon1."' alt='".$icon1."' style='border: 1px solid #A1A1A1; border-right: 2px;' ></a>";
echo "<img src=\"img/empty.gif\" border=\"0\" alt=\"\">";
echo "<a href=\"javascript:openicons();\"><img src='img/emoticon.png' title='".$icon2."' alt='".$icon2."' style='border: 1px solid #A1A1A1;' ></a>";
echo "<img src=\"img/empty.gif\" border=\"0\" alt=\"\">";
// If set, use the users setting from the cookie
if ($view == "less" || empty($view)) {
   echo "<a href='shoutbox.php?lng=".$lng."&amp;c=".$c."' onClick='doviewall();'><img src='img/all.png' title='".$icon3."' alt='".$icon3."' style='border: 1px solid #A1A1A1;'></a>";
} else {
   echo "<a href='shoutbox.php?lng=".$lng."&amp;c=".$c."' onClick='doviewless();'><img src='img/less.png' title='".$icon4."' alt='".$icon4."' style='border: 1px solid #A1A1A1;'></a>";
}
echo "<img src=\"img/empty.gif\" border=\"0\" alt=\"\">";
echo "<a href=\"javascript:void(0);\" onClick=\"insertion('','')\"><img src=\"img/bold.png\" style=\"border: 1px solid #A1A1A1;\" alt=\"$icon5\" title=\"$icon5\"></a>";
echo "<img src=\"img/empty.gif\" border=\"0\" alt=\"\">";
echo "<a href=\"javascript:void(0);\" onClick=\"insertion('','')\"><img src=\"img/italics.png\" style=\"border: 1px solid #A1A1A1;\" alt=\"$icon6\" title=\"$icon6\"></a>";
echo "<img src=\"img/empty.gif\" border=\"0\" alt=\"\">";
echo "<a href=\"javascript:void(0);\" onClick=\"insertion('','')\"><img src=\"img/link.png\" style=\"border: 1px solid #A1A1A1;\" alt=\"$icon7\" title=\"$icon7\"></a>";
// Firefox need 2 more pixels for the scrollbar. Therefore we only show empty.gif with MIE
if (stristr($browser_user_agent, "Msie" )) {
   echo "<img src=\"img/empty.gif\" border=\"0\" alt=\"\">";
}
echo "<a href=\"javascript:void(0);\" onClick=\"insertion('[mail]','[/mail]')\"><img src=\"img/mail.png\" style=\"border: 1px solid #A1A1A1; \" alt=\"$icon8\" title=\"$icon8\"></a>\n";
// End Icons
 
 
// Start Form
echo("<form name='postshout' method='post' action='shoutbox.php?lng=".$lng."&amp;c=".$c."' style='margin-bottom:5px; margin-top:0px;'>\n" );
// Only show input name field for guests and only if guests are allowed to post
if (empty($userprefs[1]) && $allowguests=="on" ) {
   echo("<input id='name' class='textbox' name='name' type='text' size='19' value='".$name."' style='margin-left:1pt;' onFocus=\"stoptmr()\">" );
   if ($c==1) {
      echo "";
   }
   echo "<br />\n";
}
// Different width textarea for side (c==0) and central box (c==1)
if ($c==1) {
   echo("
   <table><tr>
   <td>
   <textarea name='shout' id='shoutcentrale' class='textbox' cols='' rows='5' style='overflow:hidden; white-space:normal; margin-left:1pt;' onFocus=\"stoptmr();\" onKeyDown=\"textCounter(this.form.shout,this.form.rem,$maxlength);\" onKeyUp=\"textCounter(this.form.shout,this.form.rem,$maxlength)\"></textarea>
   </td>
   <td align=\"center\">
   <a href=\"javascript:void(0);\" onClick=\"insertion(' :non: ','')\"><img border=\"0\" src='smilies/non.gif'></a>
   <a href=\"javascript:void(0);\" onClick=\"insertion(' :oui: ','')\"><img border=\"0\" src='smilies/oui.gif'></a>
   <a href=\"javascript:void(0);\" onClick=\"insertion(' :hihi: ','')\"><img border=\"0\" src='smilies/hihi.gif'></a>
 <a href=\"javascript:void(0);\" onClick=\"insertion(' :coucou: ','')\"><img border=\"0\" src='smilies/coucou.gif'></a>    
<a href=\"javascript:void(0);\" onClick=\"insertion(' :bye: ','')\"><img border=\"0\" src='smilies/bye.gif'></a>
<a href=\"javascript:void(0);\" onClick=\"insertion(' :cool: ','')\"><img border=\"0\" src='smilies/cool.gif'></a>    
<a href=\"javascript:void(0);\" onClick=\"insertion(' :bisou: ','')\"><img border=\"0\" src='smilies/bisou.gif'></a>
   <a href=\"javascript:void(0);\" onClick=\"insertion(' :clin: ','')\"><img border=\"0\" src='smilies/clin.gif'></a><br />
   <a href=\"javascript:void(0);\" onClick=\"insertion(' :chut: ','')\"><img border=\"0\" src='smilies/chut.gif'></a>
   <a href=\"javascript:void(0);\" onClick=\"insertion(' :content: ','')\"><img border=\"0\" src='smilies/content.gif'></a>
   <a href=\"javascript:void(0);\" onClick=\"insertion(' :bravo: ','')\"><img border=\"0\" src='smilies/bravo.gif'></a>
   <a href=\"javascript:void(0);\" onClick=\"insertion(' :saispas: ','')\"><img border=\"0\" src='smilies/saispas.gif'></a>
<a href=\"javascript:void(0);\" onClick=\"insertion(' :fou: ','')\"><img border=\"0\" src='smilies/fou.gif'></a>
<a href=\"javascript:void(0);\" onClick=\"insertion(' :hehe: ','')\"><img border=\"0\" src='smilies/hehe.gif'></a>
<a href=\"javascript:void(0);\" onClick=\"insertion(' :heu: ','')\"><img border=\"0\" src='smilies/heu.gif'></a>
<a href=\"javascript:void(0);\" onClick=\"insertion(' :stress: ','')\"><img border=\"0\" src='smilies/stress.gif'></a>
<a href=\"javascript:void(0);\" onClick=\"insertion(' :hein: ','')\"><img border=\"0\" src='smilies/hein.gif'></a>
<a href=\"javascript:void(0);\" onClick=\"insertion(' :svp: ','')\"><img border=\"0\" src='smilies/svp.gif'></a>
   </td>
   </tr></table>
   <br />\n" );
} else {
   if (stristr($browser_user_agent, "Firefox" )) {
      echo("<textarea name='shout' id='shoutsidebox_Firefox' class='textbox' cols='' rows='5' style='overflow:hidden; white-space:normal; margin-left:1pt;' onFocus=\"stoptmr();\" onKeyDown=\"textCounter(this.form.shout,this.form.rem,$maxlength);\" onKeyUp=\"textCounter(this.form.shout,this.form.rem,$maxlength)\"></textarea><br />\n" );
   }
   if (stristr($browser_user_agent, "Msie" )) {
      echo("<textarea name='shout' id='shoutsidebox_Msie' class='textbox' cols='' rows='5' style='overflow:hidden; white-space:normal; margin-left:1pt;' onFocus=\"stoptmr();\" onKeyDown=\"textCounter(this.form.shout,this.form.rem,$maxlength);\" onKeyUp=\"textCounter(this.form.shout,this.form.rem,$maxlength)\"></textarea><br />\n" );
   }
}
// Post the shout using an image
if (stristr($browser_user_agent, "Firefox" )) {
   echo("<input type ='image' name='post' style='border:1px solid #A1A1A1; vertical-align:-4' src='img/shout.jpg' title='".$icon9."' alt='".$icon9."'>\n" );
}
if (stristr($browser_user_agent, "Msie" )) {
   echo("<input type ='image' name='post' style='border:1px solid #A1A1A1; vertical-align:-1' src='img/shout.jpg' title='".$icon9."' alt='".$icon9."'>\n" );
}
// Show number of characters left. <A href>..</a> needed for text box tooltip
echo("<a href=\"#\" title=\"$shoutpro_web11\">" );
echo("<input type='text' name='rem' class='maxchar' size='1' value=$maxlength readonly>" );
echo("</a>\n" );
// User refresh including tooltip for MIE. Needs wz_tooltip.js (init at bottom of this file)
// MIE does not accept 'title' atribute with 'select', Firefox does.
if (stristr($browser_user_agent, "Msie" )) {
   echo("<a href=\"#\" onmouseover=\"this.T_WIDTH=110;this.T_FONTCOLOR='#000000';this.T_BGCOLOR='#FFFFFF';return escape('$shoutpro_web5')\">\n" );
}
$a_refresh = array("5","10","15","20","30","Stop" );
echo("<select style='font-size:10px; width:48px;' name='my_refresh' title='$shoutpro_web5' onchange='location = this.options[this.selectedIndex].value; user_refresh(this.selectedIndex); reload();'>\n" );
for ($i = 0; $i < count($a_refresh); $i++) {
    if ($a_refresh[$i]==$refresh){
       echo("<option value='shoutbox.php?lng=".$lng."&amp;c=".$c."' selected>$a_refresh[$i]</option>\n" );
    } else {
       echo("<option value='shoutbox.php?lng=".$lng."&amp;c=".$c."'>$a_refresh[$i]</option>\n" );
    }
}
echo("</select>\n" );
// get browsername. next code MIE only
if (stristr($browser_user_agent, "Msie" )) {
   echo("</a>\n" );
}
// if admin add extra edit shouts icon
if ($userprefs[1]==$user[0]) {
   echo "<a href=\"javascript:openadmin();\"><img src='img/edit.gif' title='".$icon10."' alt='".$icon10."' style='border: 0px'></a><br />\n";
}
// If writer is allowed to edit shouts, add extra edit shouts icon
// $allowwriters setting from config.inc
if (is_file(CHEMIN."admin/redac/".$userprefs[1].".inc" ) && $allowwriters=="on" ){
   echo "<a href=\"javascript:openadmin();\"><img src='img/edit.gif' alt='Edit shouts' style='border: 0px'></a><br />\n";
}
// End Form
echo("</form>\n\n" );
 
 
//Display shouts
$row_count = 0;
$shouts = file("shouts.inc" );
$shouts = array_reverse($shouts);
foreach ($shouts as $item){
 if ($row_count == $numshoutsdisplay){ // $numshoutsdisplay from config.php
       if ($view == "all" ){
          echo "<div style='display:inline'>\n";
       } else {
          echo "<div style='display:none'>\n";
       }
 }
 $row = ($row_count % 2) ? "one" : "two";
 list ($poster,$message,$date,$time,$ip) = explode ("|^|", $item);
 $message=profanityfilter(shoutcode(smilies($message)));
 $thisshout = "<span class='name'>$poster: </span><SPAN class='date-time'>$date@$time</span><br />$message";
 echo "<div class='row-$row' title=\"$date @ $time\">$thisshout</div>\n";
 $row_count++;
}
echo("</div><br />\n" );
/* Start Copyright Text - Do not remove! */
copyrighttext();
/* End Copyright Text - Do not remove! */
 
/* Init tooltip with the select box */
/* reason to do this: MIE does not support title attribute with select box :-( */
/* See: http://www.walterzorn.com/tooltip/tooltip_e.htm */
echo("<script language=\"JavaScript\" type=\"text/javascript\" src=\"wz_tooltip.js\"></script>" );
 
// End html output
echo("</body></html>" );
?>

mood
Publicité
Posté le 07-03-2008 à 13:51:21  profilanswer
 

n°1698862
Elmoricq
Modérateur
Posté le 07-03-2008 à 13:54:27  profilanswer
 

Adresse-toi au support du site sur lequel tu as récupéré les scripts.

n°1698892
lenono75
Posté le 07-03-2008 à 14:43:41  profilanswer
 

Elmoricq a écrit :

Adresse-toi au support du site sur lequel tu as récupéré les scripts.


 
+1,
 
Pour Olshamilo : merci de mettre le code dans entre crochets C/C++


Message édité par lenono75 le 07-03-2008 à 14:44:15
n°1699198
Olshamilo
Posté le 08-03-2008 à 01:47:58  profilanswer
 

Oui mais ils sont italiens!!!!
Et parle pas français!!!

n°1699211
CyberDenix
Posté le 08-03-2008 à 09:30:02  profilanswer
 

Coup de boule ! :o


Message édité par CyberDenix le 08-03-2008 à 09:30:30

---------------
Directeur Technique (CTO)

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  PHP

  Erreur de code en PHP

 

Sujets relatifs
Code sources Prog objet ou les trouverCode login
Comment afficher le code binaire du contenu d'une variable quelconqueAide Script PHP
validation code anti-spamProblème code erreur PHP
[HTML/PHP] Erreur simple dans code, mais introuvable[php] erreur dans le code
Erreur de code PHP/HTML/JAVASCRIPT 
Plus de sujets relatifs à : Erreur de code en PHP


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR