Peuplarchie
05-19-2008, 01:53 PM
Good day to you all,
I have another problem with my shout box script.
Wrong parameter count for array_splice() in
ERROR LINE : $Data = array_splice($before, 0, 1,$nomcol,$messageq);
Here is my code :
<?php
if (isset($_POST['nameq'])) {
if ($_POST['nameq'] != "" && $_POST['messageq'] != "")
{
$nom = $_POST["nameq"];
$nomcorrecting = strtoupper($nom);
$nomcorr = substr($nomcorrecting, 0, -9);
$messageq = $_POST["messageq"];
$choice = $_POST["COLOUR_CHOICE"];
$handle = @fopen(date('Y')."/".date('m')."/".date('d')."/messages.html", "r");
if ($handle) {
while (!feof($handle)) {
$buffer = fgets($handle, 4096);
$before = $buffer;
}
fclose($handle);
}
$nomcol = "<font color=\"#".$choice."\" size=\"3\">".$nomcorr."</font>";
$File = date('Y')."/".date('m')."/".date('d')."/messages.html";
$Handle = fopen($File, 'w+');
$Data = array_splice($before, 0, 1,$nomcol,$messageq);
fwrite($Handle, $Data);
fclose($Handle);
}
}
?>
<form action="" method="post">
<input type="hidden" name="nameq" value="<? echo $_SESSION['Name'];?>"/>
<textarea name="messageq" cols="70" rows="5"></textarea><br/>
<b>Couleur du text : </b>
<?
echo "<select name=\"COLOUR_CHOICE\" id=\"COLOUR_CHOICE\">";
$colourArray = array("000000", "cccc99", "FFFFFF", "0000FF");
for ($i = 0; $i < count($colourArray); $i++)
{
$selected = ($colourArray[$i] == trim($_POST['COLOUR_CHOICE'])) ? 'selected="selected"' : '';
echo '<option value="' . $colourArray[$i] . '"' . $selected . ' . id="opt' . $colourArray[$i] . '">#' . $colourArray[$i] . '</option>';
}
echo "</select>";
?>
<input type="submit" name="Envoyer !!!" value="post"/>
</form>
<br/>
<iframe id="myframe" name="myframe" src="<?php echo date('Y').'/'.date('m').'/'.date('d').'/messages.html'; ?>" scrolling="auto" marginwidth="0" marginheight="0" frameborder="0" style=" width:580px; height:400px;"></iframe>
Thanks again !
Take good care !
I have another problem with my shout box script.
Wrong parameter count for array_splice() in
ERROR LINE : $Data = array_splice($before, 0, 1,$nomcol,$messageq);
Here is my code :
<?php
if (isset($_POST['nameq'])) {
if ($_POST['nameq'] != "" && $_POST['messageq'] != "")
{
$nom = $_POST["nameq"];
$nomcorrecting = strtoupper($nom);
$nomcorr = substr($nomcorrecting, 0, -9);
$messageq = $_POST["messageq"];
$choice = $_POST["COLOUR_CHOICE"];
$handle = @fopen(date('Y')."/".date('m')."/".date('d')."/messages.html", "r");
if ($handle) {
while (!feof($handle)) {
$buffer = fgets($handle, 4096);
$before = $buffer;
}
fclose($handle);
}
$nomcol = "<font color=\"#".$choice."\" size=\"3\">".$nomcorr."</font>";
$File = date('Y')."/".date('m')."/".date('d')."/messages.html";
$Handle = fopen($File, 'w+');
$Data = array_splice($before, 0, 1,$nomcol,$messageq);
fwrite($Handle, $Data);
fclose($Handle);
}
}
?>
<form action="" method="post">
<input type="hidden" name="nameq" value="<? echo $_SESSION['Name'];?>"/>
<textarea name="messageq" cols="70" rows="5"></textarea><br/>
<b>Couleur du text : </b>
<?
echo "<select name=\"COLOUR_CHOICE\" id=\"COLOUR_CHOICE\">";
$colourArray = array("000000", "cccc99", "FFFFFF", "0000FF");
for ($i = 0; $i < count($colourArray); $i++)
{
$selected = ($colourArray[$i] == trim($_POST['COLOUR_CHOICE'])) ? 'selected="selected"' : '';
echo '<option value="' . $colourArray[$i] . '"' . $selected . ' . id="opt' . $colourArray[$i] . '">#' . $colourArray[$i] . '</option>';
}
echo "</select>";
?>
<input type="submit" name="Envoyer !!!" value="post"/>
</form>
<br/>
<iframe id="myframe" name="myframe" src="<?php echo date('Y').'/'.date('m').'/'.date('d').'/messages.html'; ?>" scrolling="auto" marginwidth="0" marginheight="0" frameborder="0" style=" width:580px; height:400px;"></iframe>
Thanks again !
Take good care !