<?php
/*
 ########################################################################
#                                                                        #
#           Version 4       /                        /   /               #
#          -----------__---/__---__------__----__---/---/-               #
#           | /| /  /___) /   ) (_ `   /   ) /___) /   /                 #
#          _|/_|/__(___ _(___/_(__)___/___/_(___ _/___/___               #
#                       Free Content / Management System                 #
#                                   /                                    #
#                                                                        #
#                                                                        #
#   Copyright 2005-2006 by webspell.org                                  #
#                                                                        #
#   visit webSPELL.org, webspell.info to get webSPELL for free           #
#   - Script runs under the GNU GENERAL PUBLIC LICENSE                   #
#   - It's NOT allowed to remove this copyright-tag                      #
#   -- http://www.fsf.org/licensing/licenses/gpl.html                    #
#                                                                        #
#   Code based on WebSPELL Clanpackage (Michael Gruber - webspell.at),   #
#   Far Development by Development Team - webspell.org                   #
#                                                                        #
#   visit webspell.org                                                   #
#                                                                        #
 ########################################################################
*/

if(!ispageadmin($userID) OR substr(basename($_SERVER[REQUEST_URI]),0,15) != "admincenter.php") die('Access denied.');
if($_POST['submit'] != "") {
	$text = $_POST['text'];
	$delay = $_POST['delay'];
	$direction = $_POST['direction'];

  if(mysql_num_rows(safe_query("SELECT * FROM ".PREFIX."scrolltext"))) safe_query("UPDATE ".PREFIX."scrolltext SET text='$text', delay='$delay', direction='$direction'");
	else safe_query("INSERT INTO ".PREFIX."scrolltext (text, delay, direction) values( '$text', '$delay', '$direction') ");

  redirect("admincenter.php?site=scrolltext","Successfully updated.");
}
else {
	echo'<h2>scrolltext</h2>';
	$ergebnis=safe_query("SELECT * FROM ".PREFIX."scrolltext");
	$ds=mysql_fetch_array($ergebnis);

	$list = '<option value="right">Right</option><option value="left">Left</option><option value="up">Up</option><option value="down">Down</option>';
	$list = str_replace('value="'.$ds[direction].'"','value="'.$ds[direction].'" selected',$list);

	echo'<form method="post" action="admincenter.php?site=scrolltext">
	     <table cellpadding="0" cellspacing="3">
	     <tr>
		    <td>
			   scrolltext: you can use HTML-tags<br>
			   <input type="text" size="100" name="text" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'" value="'.$ds[text].'"><br><br>
			   <table border="0" width="100%">
			   <tr>
			    <td>Direction:</td><td><select name="direction">'.$list.'</select></td>
			    <td>Delay:</td><td><input type="text" size="4" name="delay" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'" value="'.$ds[delay].'"> (1=max. speed)</td>
			   </tr>
			   </table>
			  </td>
		   </tr>
		   <tr><td><input type="submit" name="submit" value="update"></td></tr>
		 </table>
		 </form>';
}
?>