rendered paste body<?php
session_start();
include 'common.php';
if(isset($Submit)) {
$me = $_FILES['imagefile']['type'];
if ($me == ("image/x-png") || ("image/jpeg") || ("image/jpg") || ("image/gif")){
if($_POST['main'] == 'B1' && trueLogin()) { //MAIN
$user = curUser();
$result = mysql_query("SELECT `id` FROM `users` WHERE `username` = '$user' LIMIT 1");
$this2 = mysql_fetch_assoc($result);
$id = $this2['id'];
$result = mysql_query("SELECT * FROM `image_main` WHERE `id` = $id") or die(mysql_error());
if(mysql_num_rows($result) == 0) {
$rand = rand(0, 100000);
$filename = $rand.$_FILES['imagefile']['name'];
copy ($_FILES['imagefile']['tmp_name'], "images/users/main/".$filename) or die ("Could not copy");
$result = mysql_query("INSERT INTO `image_main` ( `id`, `name` ) VALUES ( '$id', '$filename' )") or die(mysql_error());
redirect("profile.php?error=4");
die('Main picture uploaded! <a href="profile.php?error=4">Click here to continue!</a>');
}else{
redirect("profile.php?error=3");
die('You already have a main picture! <a href="profile.php?error=3">Click here to continue!</a>');
}
}
if($_POST['main'] == 'B2' && trueLogin()) { //gallery
$user = curUser();
$result = mysql_query("SELECT `id` FROM `users` WHERE `username` = '$user' LIMIT 1");
$this2 = mysql_fetch_assoc($result);
$id = $this2['id'];
$result = mysql_query("SELECT * FROM `image_gallery` WHERE `id` = $id") or die(mysql_error());
if(mysql_num_rows($result) < 21) {
$rand = rand(0, 100000);
$filename = $rand.$_FILES['imagefile']['name'];
copy ($_FILES['imagefile']['tmp_name'], "images/users/gallery/".$filename) or die ("Could not copy");
$result = mysql_query("INSERT INTO `image_gallery` ( `id`, `name` ) VALUES ( '$id', '$filename' )") or die(mysql_error());
redirect("profile.php?error=5");
die('Gallery picture uploaded! <a href="profile.php?error=5">Click here to continue!</a>');
}else{
redirect("profile.php?error=6");
die('The maximum amount of gallery pictures is 20!<a href="profile.php?error=6">Click here to continue!</a>');
}
}
}
else {
redirect("profile.php?error=1");
die('Wrong file type! <a href="profile.php?error=1">Click here to continue!</a>');
}
}
?>
<?php include('include/css.inc'); ?>
<style type="text/css">
<!--
.style4 {
color: #FFFFFF;
font-size: x-small;
font-weight: bold;
}
.style5 {font-size: x-small; color: #FFFFFF;}
-->
</style>
<body marginleft="0" marginright="0" leftmargin="0" rightmargin="0" marginwidth="0">
<tr>
<td><div align="center"><img src="images/header.jpg" width="700" height="200"></div>
<table width="700" height="640" border="3" bordercolor="#878471" align="center" cellpadding="0" cellspacing="0" class="table2">
<tr>
<td bgcolor="#878471" valign="top" width="157" class="nav">
<?php include('include/links.inc'); ?>
<td width="533" valign="top" bgcolor="#000000"><table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td ><table width="100%" border="0">
<tr>
<td><div align="center" class="form">
<div align="center">
<span class="style59"><span class="style66 style85">Battle Of The Sexiest</span><br />
<span class="style86">Update your profile images </span></span><br />
</div>
</div></td>
</tr>
</table>
</td>
</tr>
</table>
<br />
<table width="100%" border="0">
<tr>
<td><table width="100%" border="1" bordercolor="#878471">
<tr>
<td bgcolor="#878471"><div align="center" class="style87">PROFILE PICTURES </div></td>
</tr>
</table>
<table width="153" border="0" class="form3">
<tr>
<td><div align="center" class="style88">
<p class="style90"> </p>
<form name="form1" method="post" action="add_image.php" enctype="multipart/form-data">
<div align="center">
<input type="file" name="imagefile">
<span class="style4"><br>
</span><span class="style5">Main:
<input type="radio" value="B1" checked name="main">
|
Gallery:
<input type="radio" name="main" value="B2">
</span><br>
<br>
<input type="submit" name="Submit" value="Submit">
</div>
</form>
</div></td>
</tr>
</table></td>
</tr>
</table>
</tr>
</table>
</td></tr>
</html>