} if(!$HTTP_POST_VARS['news']) { echo "You must enter some news"; exit; } if(strstr($HTTP_POST_VARS['name'],"|")) { echo "Name cannot contain the pipe symbol - |"; exit; } if(strstr($HTTP_POST_VARS['news'],"|")) { echo "News cannot contain the pipe symbol - |"; exit; } $fp = fopen('news.txt','a'); if(!$fp) { echo "Error opening file!"; exit; } $line = date("y.m.d") . "|" . $HTTP_POST_VARS['name']; $line .= "|" . $HTTP_POST_VARS['news']; $line = str_replace("\r\n","<BR>",$line); $line .= "\r\n"; fwrite($fp, $line); if(!fclose($fp)) { echo "Error closing file!"; exit; } echo "<b>Nyhet tillagd!</b>\n"; } else { echo "Fel lösenord"; } } ?> <html> <head> <title>LÄGG TILL NYHETER !</title> </head> <body onLoad="info.innerHTML = description[3]; return true"> <script language="JavaScript" type="text/javascript"> /* Funktion som lägger till olika taggar */ function tag(f, i, t){ if (t=='lnk') f.elements[i].value += "<a href=LÄNKEN HÄR> LÄNKTEXT </a>"; if (t=='fet') f.elements[i].value += "<b></b>"; if (t=='kursiv') f.elements[i].value += "<i></i>"; } /* Förklaringar till taggarna */ var description = new Array(); description[0] = "Lägg till en länk"; description[1] = "Lägg till fet text"; description[2] = "Lägg till kursiv text"; description[3] = "<-- Klicka för att lägga till taggar"; </script> <title>LÄGG TILL NYHETER !</title> <FORM ACTION="<?=$PHP_SELF?>" METHOD="POST" NAME="newsentry"> Ditt namn:<BR> <INPUT TYPE="text" SIZE="30" NAME="name"><BR> Nyheten:<BR> <TEXTAREA NAME="news" COLS="40" ROWS="5"></TEXTAREA><BR> <input type="button" value="« url" onMouseOver="info.innerHTML = description[0]; return true" onMouseOut="info.innerHTML=description[3]; return true" onClick="tag(this.form, 'news', 'lnk')" /> <input type="button" value="« b" onMouseOver="info.innerHTML = description[1]; return true" onMouseOut="info.innerHTML=description[3]; return true" onClick="tag(this.form, 'news', 'fet')" /> <input type="button" value="« i" onMouseOver="info.innerHTML = description[2]; return true" onMouseOut="info.innerHTML=description[3]; return true" onClick="tag(this.form, 'news', 'kursiv')" /> <span id="info"></span> <BR> <BR> Lösenord:<BR> <INPUT TYPE="password" SIZE="30" NAME="password"><BR> <INPUT TYPE="submit" NAME="submit" VALUE="Spara"><BR> </FORM> </body> </html>
Since 1984 @realgizlee // twitter