Location: PHPKode > projects > Nitrotech > nitrotech/admin/data.php
<?php

//
//start everything needed
//
$root = '../';
$page_name = 'General info - Site data';
$page_file = basename(__FILE__);

$admin = 1;

include($root . "includes/common.php");

$page_mode = (isset($_GET['mode'])) ? $_GET['mode'] : '';

check_admin('3');

//
//Start the page
//

//dbstart();  //start databse     --- already started

//
//Start the output of the page
//

admin_header('normal');

if($page_mode == 'update')
{

	$site_name = addslashes($_POST['site_name']);
    $defalt_style = addslashes($_POST['style']);

    $avatar_info_allow = addslashes($_POST['avatar_info_allow']);
    $avatar_info_uploads = addslashes($_POST['avatar_info_uploads']);
    $avatar_info_remote = addslashes($_POST['avatar_info_remote']);
    $avatar_info_path = addslashes($_POST['avatar_info_path']);
    $avatar_info_width = addslashes($_POST['avatar_info_width']);
    $avatar_info_height = addslashes($_POST['avatar_info_height']);
    $avatar_info_size = addslashes($_POST['avatar_info_size']);

    $smilies_allow = addslashes($_POST['smilies_allow']);
    $smilie_path = addslashes($_POST['smilie_path']);

    $avatar_info = $avatar_info_allow . "," . $avatar_info_uploads . "," . $avatar_info_remote . "," . $avatar_info_path . "," . $avatar_info_width . "," . $avatar_info_height . "," . $avatar_info_size;
    $smilies = $smilies_allow . "," . $smilie_path;

    $query1 = "UPDATE " . $table['data'] . " SET data_values = '" . $site_name . "' WHERE data_name = 'site_name'";
	$result1 = mysql_query($query1);
    if (!$result1)
	{
		message("Could not successfully run query ($query1) from DB: " . mysql_error(), 'die');
	}

    $query1 = "UPDATE " . $table['data'] . " SET data_values = '" . $defalt_style . "' WHERE data_name = 'defalt_style'";
	$result1 = mysql_query($query1);
    if (!$result1)
	{
		message("Could not successfully run query ($query1) from DB: " . mysql_error(), 'die');
	}

    $query1 = "UPDATE " . $table['data'] . " SET data_values = '" . $avatar_info . "' WHERE data_name = 'avatar_info'";
	$result1 = mysql_query($query1);
    if (!$result1)
	{
		message("Could not successfully run query ($query1) from DB: " . mysql_error(), 'die');
	}

    $query1 = "UPDATE " . $table['data'] . " SET data_values = '" . $smilies . "' WHERE data_name = 'smilies'";
	$result1 = mysql_query($query1);
    if (!$result1)
	{
		message("Could not successfully run query ($query1) from DB: " . mysql_error(), 'die');
	}

    $query1 = "UPDATE " . $table['users'] . " SET style = '" . $defalt_style . "' WHERE id = '1'";
	$result1 = mysql_query($query1);
    if (!$result1)
	{
		message("Could not successfully run query ($query1) from DB: " . mysql_error(), 'die');
	}

    echo("Updated...");
}
else
{

$avatar_data = explode(',', $site_data['avatar_info']);

	if($avatar_data['0'])
	{
	    $avatar_allow_yes = "checked";
	    $avatar_allow_no = "";
	}
	else
	{
	    $avatar_allow_yes = "";
	    $avatar_allow_no = "checked";
	}

	if($avatar_data['1'])
	{
	    $avatar_uploads_yes = "checked";
	    $avatar_uploads_no = "";
	}
	else
	{
	    $avatar_uploads_yes = "";
	    $avatar_uploads_no = "checked";
	}

	if($avatar_data['2'])
	{
	    $avatar_remote_yes = "checked";
	    $avatar_remote_no = "";
	}
	else
	{
	    $avatar_remote_yes = "";
	    $avatar_remote_no = "checked";
	}

$smilie_data = explode(',', $site_data['smilies']);

	if($smilie_data['0'])
	{
	    $smilies_yes = "checked";
	    $smilies_no = "";
	}
	else
	{
	    $smilies_yes = "";
	    $smilies_no = "checked";
	}
?>
<form action="data.php?mode=update" method="post">
<table width="100%" border="1">
	<tr>
    	<td width="40%">Site Name:</td>
        <td width="60%"><input type="text" value="<?php echo($site_data['site_name']); ?>" name="site_name"></td>
    </tr>
	<tr>
    	<td width="40%">Defalt style</td>
        <td width="60%"><?php styles_menu($site_data['defalt_style']); ?></td>
    </tr>
	<tr>
    	<td width="40%">Allow avatars:</td>
        <td width="60%">Yes: <input type="radio" value="1" <?php echo($avatar_allow_yes); ?> name="avatar_info_allow"> No: <input type="radio" value="0" <?php echo($avatar_allow_no); ?> name="avatar_info_allow"></td>
    </tr>
	<tr>
    	<td width="40%">Allow avatar uploads:</td>
        <td width="60%">Yes: <input type="radio" value="1" <?php echo($avatar_uploads_yes); ?> name="avatar_info_uploads"> No: <input type="radio" value="0" <?php echo($avatar_uploads_no); ?> name="avatar_info_uploads"></td>
    </tr>
	<tr>
    	<td width="40%">Allow avatar remote links:</td>
        <td width="60%">Yes: <input type="radio" value="1" <?php echo($avatar_remote_yes); ?> name="avatar_info_remote"> No: <input type="radio" value="0" <?php echo($avatar_remote_no); ?> name="avatar_info_remote"></td>
    </tr>
	<tr>
    	<td width="40%">Avatar path:</td>
        <td width="60%"><input type="text" value="<?php echo($avatar_data['3']); ?>" name="avatar_info_path"></td>
    </tr>
	<tr>
    	<td width="40%">Avatar max dimentions: (width X height)</td>
        <td width="60%"><input type="text" value="<?php echo($avatar_data['4']); ?>" name="avatar_info_width"> X <input type="text" value="<?php echo($avatar_data['5']); ?>" name="avatar_info_height"></td>
    </tr>
	<tr>
    	<td width="40%">Avatar max size:</td>
        <td width="60%"><input type="text" value="<?php echo($avatar_data['6']); ?>" name="avatar_info_size"></td>
    </tr>
	<tr>
    	<td width="40%">Allow Smilies:</td>
        <td width="60%">Yes: <input type="radio" value="1" <?php echo($smilies_yes); ?> name="smilies_allow"> No: <input type="radio" value="0" <?php echo($smilies_no); ?> name="smilies_allow"></td>
    </tr>
	<tr>
    	<td width="40%">Smilie path:</td>
        <td width="60%"><input type="text" value="<?php echo($smilie_data['1']); ?>" name="smilie_path"></td>
    </tr>
	<tr>
	    <td colspan="2"><center><input type="submit" value="Update"></center></td>
	</tr>
</table>

</form>
<?php
}
admin_footer('normal');

//
//End the page
//

dbend(); //end the database

?>
Return current item: Nitrotech