Plik account.php w komentarz weź
Kod:
/**
* Graphic style change
*/
if (isset($_GET['view']) && $_GET['view'] == 'style') {
/**
* Text style choice
*/
$path = 'css/';
$dir = opendir($path);
$arrname = array();
$i = 0;
while ($file = readdir($dir)) {
if (ereg(".css*$", $file)) {
$arrname[$i] = $file;
$i = $i + 1;
}
}
closedir($dir);
/**
* Check avaible layouts
*/
$path = 'templates/';
$dir = opendir($path);
$arrname1 = array();
$i = 0;
while ($file = readdir($dir)) {
if (!ereg(".htm*$", $file) && !ereg(".tpl*$", $file)) {
if (!ereg("\.$", $file)) {
$arrname1[$i] = $file;
$i++;
}
}
}
closedir($dir);
/**
* Assign variables to template
*/
$smarty -> assign(array("Sselect" => S_SELECT,
"Textstyle" => TEXT_STYLE,
"Graphstyle" => GRAPH_STYLE,
"Graphstyle2" => GRAPH_STYLE2,
"Youchange" => YOU_CHANGE,
"Stylename" => $arrname,
"Refresh" => REFRESH,
"Layoutname" => $arrname1));
/**
* If player choice text style
*/
if (isset($_GET['step']) && $_GET['step'] == 'style') {
if (!isset($_POST['newstyle'])) error(ERROR);
$_POST['newstyle'] = strip_tags($_POST['newstyle']);
if ($player -> graphic) $db -> Execute("UPDATE players SET graphic='' WHERE id=".$player -> id);
$db -> Execute("UPDATE players SET style='".$_POST['newstyle']."' where id=".$player -> id);
}
/**
* If player choice graphic layout
*/
if (isset($_GET['step']) && $_GET['step'] == 'graph') {
if (!isset($_POST['graphsserver'])) error(ERROR);
$_POST['graphserver'] = strip_tags($_POST['graphserver']);
$db -> Execute("UPDATE players SET graphic='".$_POST['graphserver']."' WHERE id=".$player -> id) or error(ERROR2.$path." ".$player -> id);
}
}
i plik account.tpl to również polecam wziąć w komentarz, zawsze się może przydać :)
Kod:
{if $View == "style"}
<form method="post" action="account.php?view=style&step=style">
<table>
<tr>
<td><input type="submit" value="{$Sselect}" /> {$Textstyle}:</td>
</tr>
<tr>
<td><select name="newstyle">
{section name=account loop=$Stylename}
<option value="{$Stylename[account]}">{$Stylename[account]}</option>
{/section}
</select>
</table></form>
<br /><br />
{if $Step == "style" || $Step == "graph"}
{$Youchange}. Jeśli dynamiczne ładowanie linków jest włączone, kliknij F5 lub przeloguj się. (<a href="account.php">{$Refresh}</a>)
{/if}
{/if}