- Home
- Categorie
- Coding e Sistemistica
- PHP
- Stanza colori
-
Stanza colori
Ciao a tutti ho una chat di testo senza db, ed è solo php, wap. Come si fa a mettere i messaggi di testo col colore, e lo sfondo? (background)? Grazie mille.
-
Per quello che vuoi fare tu devi utilizzare javascript...
Tipo, per il grassetto:
<script language="JavaScript"> function agg(formattazione){ txtdaformattare=prompt('Inserire il testo da porre fra <'+formattazione+'> e </'+formattazione+'>:'); txt="<"+formattazione+">"+txtdaformattare+"</"+formattazione+">"; document.form.scritto.value+=txt; } </script>
e poi:
<img border="0" src="img/bold.gif" width="21" height="20" onClick="agg('b')" title="Grassetto">
stessa cosa per il sottolineato e il corsivo:
<img border="0" src="img/underline.gif" width="21" height="20" onClick="agg('u')" title="sottolineato">
<img border="0" src="img/italic.gif" width="21" height="20" onClick="agg('i')" title="Grassetto">
-
Grazie.. e dove devo metterli esattamente? nel file chat.php ?
-
Quà c'è un pezzo di codice della chat php..dove devo metterlo esattamente? o cosa devo modificare?
[PHP]<? include("../tools/ipban.php"); ?>
<? include("../tools/admin.php"); ?>
<? include("../tools/ban.php"); ?>
<?php
header("Content-type: text/vnd.wap.wml; charset=ISO-8859-1");
echo "<?xml version="1.0" encoding="ISO-8859-1" ?>";$nimi = $_REQUEST['nimi'];
$salasana = $_REQUEST['salasana'];$swe_from = array("","","","","","","$","&","");
$swe_to = array("", "", "", "", "", "","[usd]","[and]","");for ($t=0; $t<count($swe_from); $t++)
{
$nimi = str_replace ($swe_from, $swe_to, $nimi);
$salasana = str_replace ($swe_from, $swe_to, $salasana);
$viesti = str_replace ($swe_from, $swe_to, $viesti);
}$salasana=crypt($salasana,'password');
$salnim=file('../text/nims.txt');
$salsan=file('../text/sals.txt');
for ($i=0; $i<count($salnim); $i++)
{ if (rtrim($salsan*)==$salasana && rtrim($salnim*)==$nimi){$a="1";}}
if ($a !="1"){echo "<wml>";
echo "<card title="Chat">";
echo "<p align="center">";echo "<small>System:<br/>---<br/><b>*</b>You are NOT logged in! please hit the login button if this matter persist please email one of the staff and we will try to sort the problem asap thanx :-)<br/>";
echo "<a href="../index.php">« Login page</a>";echo "<br/>---<br/>powered by UNIVERSAL 3000 </small>";
echo "</p>";
echo "</card>";
echo "</wml>";
exit();
}$aikanyt=time();
$aika=file('../text/ajat.txt');
$ero=$aikanyt-$aika[0];
if ($ero>=120){
$peke = fopen('../text/chatpaikalla.txt', 'r+');
ftruncate ($peke,0);
fclose($peke);
}
$tiedo = fopen('../text/ajat.txt', 'r+');
ftruncate ($tiedo,0);
$tos=$aikanyt;
fputs($tiedo, $tos);
fclose($tiedo);$sama=0;
$paikalla=file('../text/paikalla.txt');
for ($u=0; $u<count($paikalla); $u++)
{
if (rtrim($paikalla*)==$nimi)
{$sama="1";$u=count($paikalla)+1;}
}
if ($nimi != "hiddenname" && $sama != "1")
{
$tie = fopen('../text/paikalla.txt', 'r+');
$ko=file_get_contents ('../text/paikalla.txt');
$to=$nimi .'
'. $ko;
fputs($tie, $to);
fclose($tie);
}
$lis=0;$katsos=0;$tyhja='';
$jepulio=file('../text/paikalla.txt');
$privaviestit=file('../text/text.txt');
$salasana=crypt($salasana,'password');
$chatpaik=file('../text/chatpaikalla.txt');
$sama=0;
for ($u=0; $u<count($chatpaik); $u++)
{
$alio=explode("",$chatpaik*);
if (rtrim($alio[0])==$nimi)
{$sama="1";$u=count($chatpaik)+1;}
}
if ($nimi != "hiddenname" && $sama != "1") {$tie = fopen('../text/chatpaikalla.txt', 'r+');
$ko=file_get_contents ('../text/chatpaikalla.txt');
$to=$nimi .''.time().'
'. $ko;
fputs($tie, $to);
fclose($tie);
}
if ($sama=="1"){
$tie = fopen('../text/chatpaikalla.txt', 'r+');
$jui=file('../text/chatpaikalla.txt');
$ko=file_get_contents ('../text/chatpaikalla.txt');
for ($i=0; $i<count($jui); $i++)
{
$alo=explode("",$jui*);
if ($nimi==$alo[0]){$hee=$jui*;}
}
$ko = str_replace ($hee,$nimi.''.time().'
', $ko);
fputs($tie, $ko);
fclose($tie);
}$tie = fopen('../text/chatpaikalla.txt', 'r+');
$jui=file('../text/chatpaikalla.txt');
$ko=file_get_contents ('../text/chatpaikalla.txt');
for ($i=0; $i<count($jui); $i++)
{
$hee=$jui*;
$alo=explode("",$jui*);
$erotus=time()-$alo[1];
if ($erotus>=120){$ko = str_replace ($hee,'',$ko);}
}
ftruncate($tie,0);fputs($tie, $ko);
fclose($tie);include("modtools.php");
include ("admintools.php");
include ("ownertools.php");
$salsan=file('../text/sals.txt');
$salnim=file('../text/nims.txt');echo "<wml>";
echo "<head>";
echo "<meta http-equiv="Cache-Control" content="max-age=0"/>";
echo "</head>";$New_Time = time() + (0 * 60 * 60);
$time=date("H:i",$New_Time);$chatpaik=file('../text/chatpaikalla.txt');
echo "<card title="CHAT UNIVERSAL $time - (";echo count($chatpaik);echo ")";echo "" ontimer="chat.php?time=";
echo date('dmHis');
echo '&nimi=$nimi&salasana=$salasana';
echo "">";
echo "<timer value="200"/>";echo "<p align="left">";
for ($i=0; $i<count($salnim); $i++)
{ if (rtrim($salsan*)==$salasana && rtrim($salnim*)==$nimi){$a="1";}}
for ($q=0; $q<count($privaviestit); $q++)
{
$tech=explode('',$privaviestit[$q]);
$testos=str_replace("*", "",$tech[0]);
if ($testos==$nimi){
if ( strpos($privaviestit[$q],"*")===0)
{
$katsos=$katsos+1;
}
$lis=$lis+1;
if ($lis>7)
{
$q=count($privaviestit)+1;
}
}
}echo "<small>".date("D d M y - ")."\n";
echo "<a href="time.php">".date("H:i")."</a>";
echo "<br/>";
echo "<img src=""/><br/>\n";
echo "[1]<anchor>Scrivi";
echo "<go method="post" href="kirj.php?time=".time()."">";
echo "<postfield name="nimi" value="$(nimi)"/>";
echo "<postfield name="salasana" value="$(salasana)"/>";
echo "<setvar name="viesti" value=""/>";
echo "<setvar name="joo" value="h000"/>";
echo "</go>";
echo "</anchor>";
echo "<br/> ";[/PHP]</SPAN> </SPAN>
-
Puoi postare il codice di tutte le pagine?Questo che mi hai dato purtroppo non mi è sufficiente...
-
Qesto e la pagina x scrivere.. lo sfono e testo colorato lo vorrei dentro la stanza.. non in altri posti
[PHP]$nimi = $_REQUEST['nimi'];
$salasana = $_REQUEST['salasana'];
$viesti = $_POST['viesti'];
$kenelle = $_POST['kenelle'];
$salasana=crypt($salasana,'password');
$joo='';
echo "<wml>";
echo "<card title="Write">";
echo "<p align="center">";
echo "<small><b>Message:</b></small><br/>";
echo "<input type="text" name="viesti" value="" emptyok="true" maxlength="500"/>";
echo "<br/><small><anchor>»Send";
echo "<go method="post" href="chat.php?time=";
;echo date('ymHis');echo "">";
echo "<postfield name="joo" value="$(joo)"/>";
echo "<postfield name="viesti" value="$(viesti)"/>";
echo "<postfield name="nimi" value="$(nimi)"/>";
echo "<postfield name="salasana" value="$(salasana)"/>";
echo "</go></anchor><br/>";
echo "<anchor>«Chatroom";
echo "<go method="post" href="chat.php">";
echo "<postfield name="salasana" value="$(salasana)"/>";
echo "<postfield name="nimi" value="$(nimi)"/>";
echo "</go>";
echo "</anchor>\n";[/PHP]