View file bclubs/user/avva.php

File size: 1.8Kb
<?php

/* Автор localhost
/* Онлайн игра Бойцовский клуб
/*смена аввы
*/
	if (isset($_POST['sop']))
	{

				require ('inc/class_upload.php');
				$handle = new upload($_FILES['imagefile']);
				$fname = strtolower($_FILES['imagefile']['name']);
				$name = isset($_POST['name']) ? trim($_POST['name']) : '';
				if ($handle->uploaded)
				{
							//$nams = time();
							$handle->file_new_name_body = $user['id'];
							$handle->file_max_size = 1024 * 10000000;
							$handle->file_overwrite = true;
							$handle->image_resize = true;
							$handle->image_x = 50;
							$handle->image_y = 50;
							if (isset($_GET['id']))$handle->image_convert = 'php';
                                                        else $handle->image_convert = 'png';
							$handle->process('img_us/');
							if ($handle->processed)
							{

										mysql_query("UPDATE `user_game` SET
                                    `name` = '" . mysql_real_escape_string($name) . "',  
                                    `img` = '" . $user['id'] . "' WHERE `user_id`='" . $user['id'] .
													"'");

							}
							else
							{

										$err[] = $handle->error;

							}

							$handle->clean();

				}
				echo 'Боец успешно изменен<br />';
	}
	if (isset($_GET['id'])) echo '<form enctype="multipart/form-data" method="post" action="?act=avva&id">';
	else echo '<form enctype="multipart/form-data" method="post" action="?act=avva">';
        echo 'Имя бойца<br /><input type="text" name="name" value="' . $ugame['name'] .			'" maxlength="64" />';
	echo '<br />Изображение<br /><input type="file" name="imagefile" value="" />';
	echo '<br /><input type="submit" name="sop" value="Добавить" />';
	echo '</form>';

?>