<?php
if (session_id() == "") session_start(); // if no active session we start a new one
// echo $SESSION['user_logged'];
// echo $SESSION['username'];
// echo $_SESSION['uidno'];
// echo"<BR>";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>iTopService.com - Adding a new user</title>
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style10 {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
.style19 {
font-size: 12px;
font-family: Arial;
font-weight: normal;
font-variant: normal;
}
a:link {
color: #0000CC;
}
a:visited {
color: #0000CC;
}
a:hover {
color: #CC0000;
}
body,td,th {
font-family: Arial;
font-size: 12px;
}
-->
</style>
</head>
<body>
<?php
include 'menu.inc.php'; //TOP MENU and picture
include 'database.inc.php';
if ($_REQUEST['added']!=1) {
echo'
<table width="900" border="0" align="left" cellpadding="2" cellspacing="2">
<tr>
<th width="440" height="300" nowrap="nowrap" bgcolor="#FFFFFF" scope="col"><div align="left">
<form action="adduser.php?added=1" method="post" id="offer">
<table width="900" border="0" align="left" cellpadding="2" cellspacing="2">
<tr>
<th width="440" height="300" nowrap="nowrap" bgcolor="#FFFFFF" scope="col"><div align="left">
<p class="style10">Login<br />
<input name="login" type="text" id="offer2" size="40" maxlength="40"/>
</p>
<p align="left" class="style10">Password<br />
<input name="password" type="password" id="city3" size="40" maxlength="40" />
</p>
<p class="style10">First name<br />
<input name="firstname" type="text" id="offer3" size="40" maxlength="40"/>
</p>
<p class="style10">Last Name<br />
<input name="lastname" type="text" id="offer4" size="40" maxlength="40"/>
</p>
<p align="left" class="style10">Phone number<br />
<input name="phoenumber" type="text" id="city4" size="40" maxlength="40" />
</p>
<p align="left" class="style10">Sex<br />
<select name="sex" id="city6">
<option>Male</option>
<option>Female</option>
</select>
</p>
<p align="left" class="style10">I am good at<br />
<span class="style10"><input name="pers1" type="text" id="city7" size="40" maxlength="40" />
<br />
<br />
</span>Additional Information about me<br />
<span class="style10">
<textarea name="pers2" cols="40" rows="2" id="city8"></textarea>
</span></p>
<p align="left" class="style10"> </p>
<p class="style10"> </p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
</div></th>
<th width="446" scope="col"><p align="left" class="style10"> </p>
<p align="left" class="style10">City you are living in:
<select name="city" id="city"> ';
$citiesSQL=mysql_query("SELECT number, name, islabel FROM cities");
while ($SQLresult=mysql_fetch_array($citiesSQL)) {
if ($SQLresult['islabel']==1)
{ echo'</optgroup><optgroup label="'.$SQLresult['name'] .'">'; }
else
{
if ($_SESSION['city']==$SQLresult['number'])
{
echo'<option value="'.$SQLresult['number'].'"selected="selected">'.$SQLresult['name'].'</option>';
}
else
{
echo'<option value="'.$SQLresult['number'].'">'.$SQLresult['name'].'</option>';
}
}
}
echo'
</select>
</p>
<p align="left"><span class="style10">Upload Picture</span>
<input type="file" name="image" />
</p>
<p align="left" class="style10"> </p>
<p align="left"> </p>
<p align="left"><span class="style10">
<input name="button" type="submit" id="city" value="Request Membership"/>
</span></p>
</th>
</tr>
</table>
</label>
<label>
<div align="left">
<p><br /></p>
</div>
<div align="left"></p>
</div>
<p align="left"> </p>
</form>
<label><br />
</label>
<BR>
<label></label>
</th>
</tr>
</table>
';}
if ($_REQUEST['added']==1) {
$firstname=$POST['firstname'];
$lastname=$POST['lastname'];
$city=$POST['city'];
$sex=$POST['sex'];
$birthday=$POST['birthday'];
$login=$POST['login'];
$password=$POST['password'];
$school=$POST['school'];
$field=$POST['field'];
$email=$POST['email'];
$sql="INSERT INTO users SET
firstname='$firstname',
lastname='$lastname',
city='$city',
sex='$sex',
birthday='$birthday',
login='$login',
password='$password',
school='$school',
field='$field',
email='$email'";
if (@mysql_query($sql)) {
// if (1==1) {
echo '<p> Entry had been added.';
$idno = mysql_insert_id();
$size = 150; // the thumbnail height
$filedir = 'pics/'; // the directory for the original image
$thumbdir = 'pics/'; // the directory for the thumbnail image
$prefix = 'small_'; // the prefix to be added to the original name
$maxfile = '2000000';
$mode = '0666';
$userfile_name = $_FILES['image']['name'];
$userfile_tmp = $_FILES['image']['tmp_name'];
$userfile_size = $_FILES['image']['size'];
$userfile_type = $_FILES['image']['type'];
if (isset($_FILES['image']['name']))
{
$prod_img = $filedir.$userfile_name;
$prod_img_thumb = $thumbdir.$prefix.$userfile_name;
move_uploaded_file($userfile_tmp, $prod_img);
chmod ($prod_img, octdec($mode));
$sizes = getimagesize($prod_img);
$aspect_ratio = $sizes[1]/$sizes[0];
if ($sizes[1] <= $size)
{
$new_width = $sizes[0];
$new_height = $sizes[1];
}else{
$new_height = $size;
$new_width = abs($new_height/$aspect_ratio);
}
$destimg=ImageCreateTrueColor($new_width,$new_height) or die('Problem In Creating image');
$srcimg=ImageCreateFromJPEG($prod_img) or die('Problem In opening Source Image');
ImageCopyResized($destimg,$srcimg,0,0,0,0,$new_width,$new_height,ImageSX($srcimg),ImageSY($srcimg)) or die('Problem In resizing');
ImageJPEG($destimg,$prod_img_thumb,90) or die('Problem In saving');
imagedestroy($destimg);
}
echo '
<a href="'.$prod_img.'">
<img src="'.$prod_img_thumb.'" width="'.$new_width.'" heigt="'.$new_height.'">
</a>';
}
else
{echo '<p> Error submission: '.mysql_error().'<p>';}
}
?>
<script type="text/javascript">
<!--
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
var MenuBar2 = new Spry.Widget.MenuBar("MenuBar2", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
var MenuBar3 = new Spry.Widget.MenuBar("MenuBar3", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
//-->
</script>
</body>
</html>