Gå til innhold

Trenger hjelp til shout box,


Anbefalte innlegg

holder på med en shoutbox, har funnet et script på internett..

 

Her er test siden: http://mm-forum.freehostia.com/test/

 

og jeg vil ha denne inn i shoutbox'en her op denne siden: LINK

 

vil forlenge høyden litt, på siden,

 

¤ problemer, å få den til å ta lite plass og få den inn i shout box'en på siden.

¤ problem med at teksten forsetter på en linje, i stede for flere linjer...

 

noen som kan hjelpe med dette? er 99% noob med dette :p

 

koden/scripte:

 

<? 

/* Shoutbox V1.0
*/ 

?>

<html>

<head>

<link rel="stylesheet" href="styles.css" type="text/css">

<script type="text/javascript">

function smily(smile) {

document.shout.shout.value += smile

}

</script>

<Title>Shout Box</Title>

</head>

<?

echo "<div align=\"left\"><H1><u>Shout Box</u></H1></div><table width=\"20%\" align=\"left\" border=\"0\"><tr><td><div align=\"left\">";

if($HTTP_POST_VARS['submit']) {

if(strstr($REMOTE_ADDR,"68.67.222.10")) { // This is how you can set bans on people that abuse the system, just copy and paste this code and change the ip address

echo "You are banned due to abuse."; // A message to tell the banned person they are banned

exit;

}

if(!$HTTP_POST_VARS['name']) {

echo "You must enter a name";

exit;

}

if(!$HTTP_POST_VARS['shout']) {

echo "You must enter a shout";

exit;

}

if(strstr($HTTP_POST_VARS['name'],"|")) {

echo "Name cannot contain the pipe symbol - |";

exit;

}

if(strstr($HTTP_POST_VARS['shout'],"|")) {

echo "shout cannot contain the pipe symbol - |";

exit;

}

$fp = fopen('shouts.txt','a');

if(!$fp) {

echo "Error opening file!";

exit;

}

$line = $HTTP_POST_VARS['name'];

$line .= "|" . $HTTP_POST_VARS['shout'];

$line .= "|" . $HTTP_POST_VARS['Email:'];

$line = str_replace("\r\n","<BR>",$line);

$line = str_replace (":)", "<img src=smiles/icon_smile.gif>", $line);

$line = str_replace (":D", "<img src=smiles/icon_biggrin.gif>", $line);

$line = str_replace (":P", "<img src=smiles/icon_tounge.gif>", $line);

$line = str_replace (":(", "<img src=smiles/icon_sad.gif>", $line);

$line = str_replace ("8)", "<img src=smiles/icon_cool.gif>", $line);

$line = str_replace (";)", "<img src=smiles/icon_wink.gif>", $line);

$line = str_replace (":o", "<img src=smiles/icon_surprised.gif>", $line);

$line = str_replace (":flat:", "<img src=smiles/icon_neutral.gif>", $line);

$line = str_replace ("8o", "<img src=smiles/icon_eek.gif>", $line);

$line = str_replace (":?", "<img src=smiles/icon_confused.gif>", $line);

$line = str_replace (":evil:", "<img src=smiles/icon_twisted.gif>", $line);

$line = str_replace (":eyes:", "<img src=smiles/icon_Eyecrazy.gif>", $line);

$line .= "\r\n";

fwrite($fp, $line);

if(!fclose($fp)) {

echo "Error closing file!";

exit;

}

echo "<b>Shout added!</b>\n"; 

}



$data = file('shouts.txt');

$data = array_reverse($data);

foreach($data as $element) {

$element = trim($element);

$pieces = explode("|", $element);

if(!$pieces[2]) {

echo "<u>" . $pieces[0] . ":</u> " . $pieces[1] . "<hr height=\"1\" color=\"#0066CC\" width=\"20%\">";

}

else {

echo "<a href=$pieces[2]><u>" . $pieces[0] . ":</u></a> " . $pieces[1] . "<hr height=\"1\" color=\"#0066CC\" width=\"20%\">";



}

}

echo "</div><div align=\"left\">";

echo "</td></tr></table><H5><u>Add Shout</u></H5><table width=\"20\" align=\"left\" border=\"0\"><tr><td><div align=\"left\">";

?>

<FORM ACTION="<?=$PHP_SELF?>" METHOD="POST" NAME="shout"><h6>

Name: <br><INPUT TYPE='TEXT' NAME='name' SIZE='20' maxlength='25'><br>
Email:<br>
<input name='Email' type='text' size='30' maxlength='50'>
<br>
Shout: <br>
<input type='TEXT' name='shout' size='50' maxlength='200'>
<br>

Smiles:<br><table width="11%" border="1" bordercolor="#111111">
 <tr><td width="16%"><img src=smiles/icon_smile.gif onClick="smily(':)');" STYLE="cursor:hand;"></td>
<td width="16%"><img src=smiles/icon_biggrin.gif onClick="smily(':D');" STYLE="cursor:hand;"></td>
<td width="16%"><img src=smiles/icon_tounge.gif onClick="smily(':P');" STYLE="cursor:hand;"></td>
<td width="16%"><img src=smiles/icon_sad.gif onClick="smily(':(');" STYLE="cursor:hand;"></td>
<td width="16%"><img src=smiles/icon_cool.gif onClick="smily('8)');" STYLE="cursor:hand;"></td>
<td width="20%"><img src=smiles/icon_wink.gif onClick="smily(';)');" STYLE="cursor:hand;"></td>
</tr><tr><td><img src=smiles/icon_surprised.gif onClick="smily(':o');" STYLE="cursor:hand;"></td><td><img src=smiles/icon_neutral.gif onClick="smily(':flat:');" STYLE="cursor:hand;"></td><td><img src=smiles/icon_eek.gif onClick="smily('8o');" STYLE="cursor:hand;"></td><td><img src=smiles/icon_confused.gif onClick="smily(':?');" STYLE="cursor:hand;"></td><td><img src=smiles/icon_twisted.gif onClick="smily(':evil:');" STYLE="cursor:hand;"></td><td><img src=smiles/icon_Eyecrazy.gif onClick="smily(':eyes:');" STYLE="cursor:hand;"></td></tr></table><p>

<INPUT TYPE="submit" NAME="submit" VALUE="Shout" CLASS=button></h6>
</FORM>

<a href="mailto:[email protected]">e</a>
</body>

Lenke til kommentar
Videoannonse
Annonse

Legg alt som kommer fra shoutboksen i et div med f.eks width: 200px;

Deretter legger du bare inn include ("shoutbox.php"); der shoutboksen skal være.

For å få alt inn i et div kan du f.eks gjøre slik:

 

Klikk for å se/fjerne innholdet nedenfor
<? 

/* Shoutbox V1.0
*/ 

?>

<html>

<head>

<link rel="stylesheet" href="styles.css" type="text/css">

<style>
#shoutbox {
width:200px;
}
</style>
<script type="text/javascript">

function smily(smile) {

document.shout.shout.value += smile

}

</script>

<Title>Shout Box</Title>

</head>

<?php
echo "<div id='shoutbox'>";
echo "<div align=\"left\"><H1><u>Shout Box</u></H1></div><table width=\"20%\" align=\"left\" border=\"0\"><tr><td><div align=\"left\">";

if($HTTP_POST_VARS['submit']) {

if(strstr($REMOTE_ADDR,"68.67.222.10")) { // This is how you can set bans on people that abuse the system, just copy and paste this code and change the ip address

echo "You are banned due to abuse."; // A message to tell the banned person they are banned

exit;

}

if(!$HTTP_POST_VARS['name']) {

echo "You must enter a name";

exit;

}

if(!$HTTP_POST_VARS['shout']) {

echo "You must enter a shout";

exit;

}

if(strstr($HTTP_POST_VARS['name'],"|")) {

echo "Name cannot contain the pipe symbol - |";

exit;

}

if(strstr($HTTP_POST_VARS['shout'],"|")) {

echo "shout cannot contain the pipe symbol - |";

exit;

}

$fp = fopen('shouts.txt','a');

if(!$fp) {

echo "Error opening file!";

exit;

}

$line = $HTTP_POST_VARS['name'];

$line .= "|" . $HTTP_POST_VARS['shout'];

$line .= "|" . $HTTP_POST_VARS['Email:'];

$line = str_replace("\r\n","<BR>",$line);

$line = str_replace (":)", "<img src=smiles/icon_smile.gif>", $line);

$line = str_replace (":D", "<img src=smiles/icon_biggrin.gif>", $line);

$line = str_replace (":P", "<img src=smiles/icon_tounge.gif>", $line);

$line = str_replace (":(", "<img src=smiles/icon_sad.gif>", $line);

$line = str_replace ("8)", "<img src=smiles/icon_cool.gif>", $line);

$line = str_replace (";)", "<img src=smiles/icon_wink.gif>", $line);

$line = str_replace (":o", "<img src=smiles/icon_surprised.gif>", $line);

$line = str_replace (":flat:", "<img src=smiles/icon_neutral.gif>", $line);

$line = str_replace ("8o", "<img src=smiles/icon_eek.gif>", $line);

$line = str_replace (":?", "<img src=smiles/icon_confused.gif>", $line);

$line = str_replace (":evil:", "<img src=smiles/icon_twisted.gif>", $line);

$line = str_replace (":eyes:", "<img src=smiles/icon_Eyecrazy.gif>", $line);

$line .= "\r\n";

fwrite($fp, $line);

if(!fclose($fp)) {

echo "Error closing file!";

exit;

}

echo "<b>Shout added!</b>\n"; 

}



$data = file('shouts.txt');

$data = array_reverse($data);

foreach($data as $element) {

$element = trim($element);

$pieces = explode("|", $element);

if(!$pieces[2]) {

echo "<u>" . $pieces[0] . ":</u> " . $pieces[1] . "<hr height=\"1\" color=\"#0066CC\" width=\"20%\">";

}

else {

echo "<a href=$pieces[2]><u>" . $pieces[0] . ":</u></a> " . $pieces[1] . "<hr height=\"1\" color=\"#0066CC\" width=\"20%\">";



}

}

echo "</div><div align=\"left\">";

echo "</td></tr></table><H5><u>Add Shout</u></H5><table width=\"20\" align=\"left\" border=\"0\"><tr><td><div align=\"left\">";

?>

<FORM ACTION="<?=$PHP_SELF?>" METHOD="POST" NAME="shout"><h6>

Name: <br><INPUT TYPE='TEXT' NAME='name' SIZE='20' maxlength='25'><br>
Email:<br>
<input name='Email' type='text' size='30' maxlength='50'>
<br>
Shout: <br>
<input type='TEXT' name='shout' size='50' maxlength='200'>
<br>

Smiles:<br><table width="11%" border="1" bordercolor="#111111">
<tr><td width="16%"><img src=smiles/icon_smile.gif onClick="smily(':)');" STYLE="cursor:hand;"></td>
<td width="16%"><img src=smiles/icon_biggrin.gif onClick="smily(':D');" STYLE="cursor:hand;"></td>
<td width="16%"><img src=smiles/icon_tounge.gif onClick="smily(':P');" STYLE="cursor:hand;"></td>
<td width="16%"><img src=smiles/icon_sad.gif onClick="smily(':(');" STYLE="cursor:hand;"></td>
<td width="16%"><img src=smiles/icon_cool.gif onClick="smily('8)');" STYLE="cursor:hand;"></td>
<td width="20%"><img src=smiles/icon_wink.gif onClick="smily(';)');" STYLE="cursor:hand;"></td>
</tr><tr><td><img src=smiles/icon_surprised.gif onClick="smily(':o');" STYLE="cursor:hand;"></td><td><img src=smiles/icon_neutral.gif onClick="smily(':flat:');" STYLE="cursor:hand;"></td><td><img src=smiles/icon_eek.gif onClick="smily('8o');" STYLE="cursor:hand;"></td><td><img src=smiles/icon_confused.gif onClick="smily(':?');" STYLE="cursor:hand;"></td><td><img src=smiles/icon_twisted.gif onClick="smily(':evil:');" STYLE="cursor:hand;"></td><td><img src=smiles/icon_Eyecrazy.gif onClick="smily(':eyes:');" STYLE="cursor:hand;"></td></tr></table><p>

<INPUT TYPE="submit" NAME="submit" VALUE="Shout" CLASS=button></h6>
</FORM>

<a href="mailto:[email protected]">e</a></div>
</body></html>[/SKJUL]

Lenke til kommentar

bruk funksjonen wordwrap() til å kappe opp setninger eller ord til flere linjer.

 

Example 1. wordwrap() example


<?php
$text = "The quick brown fox jumped over the lazy dog.";
$newtext = wordwrap($text, 20, "<br />\n");

echo $newtext;
?>

 

This example would display:

 

The quick brown fox<br />

jumped over the lazy<br />

dog.

 

Example 2. wordwrap() example

<?php
$text = "A very long woooooooooooord.";
$newtext = wordwrap($text, 8, "\n", 1);

echo "$newtext\n";
?>

This example would display:

 

A very

long

wooooooo

ooooord.

 

 

hentet fra http://no.php.net/manual/en/function.wordwrap.php

Endret av jimern3
Lenke til kommentar

Opprett en konto eller logg inn for å kommentere

Du må være et medlem for å kunne skrive en kommentar

Opprett konto

Det er enkelt å melde seg inn for å starte en ny konto!

Start en konto

Logg inn

Har du allerede en konto? Logg inn her.

Logg inn nå
×
×
  • Opprett ny...