<?php session_start();
if(@$_SESSION['INC_USER_ID'] == true){ echo"Error. Signin User";die();}
include('settings.php');
require_once('./languages/lang_'.$config['lang'].'.php');
$tmp = mysql_query("SELECT * FROM categori ORDER BY name ASC")
or die("A MySQL error has occurred.<br />Your Query: " . $tmp . "<br /> Error: (" . mysql_errno() . ") " . mysql_error());
while ($aclrow = mysql_fetch_assoc($tmp))
{
$ccval[] = $aclrow;
}
$smarty->assign('path',$path);
$smarty->assign('title',$title);
$smarty->assign('temp',$temp);
$smarty->assign('categori', $ccval);
$smarty->display('blank.php');
?>
<script language="JavaScript">
function validationEmail(maForm) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(maForm.email.value)){
return (true)
}
alert("Invalid E-mail Address! Please re-enter.")
return (false)
}
</script>
<script type="text/javascript">
var RecaptchaOptions = {
theme : 'white'
};
</script>
<?php
if(isset($_POST['Submit']))
{
require_once('recaptchalib.php');
$privatekey = $config['keycaptcha'];
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
}
$username = $_POST['username'];
$password = $_POST['password'];
$email = $_POST['email'];
$ipse = $_SERVER['REMOTE_ADDR'];
$keys = rand(111111111,888888888) . "&exp=" . date("Yhis");
if (get_magic_quotes_gpc()) {
$username = addslashes($username);
$password = addslashes($password);
$email = addslashes($email);
$keys = addslashes($biosi);
}
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);
$email = mysql_real_escape_string($email);
$keys = mysql_real_escape_string($keys);
if(ereg('[^A-Za-z0-9]', $username)){
echo "<center>The username should be between 4 and 12 letters and numbers only. <a href=\"javascript:history.go(-1)\">Go Back</a></center>";
Die();
}
if(ereg('[^A-Za-z0-9]', $password)){
echo "<center>The password should be between 4 and 12 letters and numbers only. <a href=\"javascript:history.go(-1)\">Go Back</a></center>";
Die();
}
$name=array($username,$password,$email);
foreach ($name as $name)
{
if (ereg("^\.",$name)) {
echo "<center>Invalid Characters:<a href=\"javascript:history.go(-1)\">Go Back</a></center>";
Die();
}
if (ereg("\<", $name)) {
echo "<center>Invalid Characters: <font color = \"red\"><strong><</strong></font> <a href=\"javascript:history.go(-1)\">Go Back</a></center>";
Die();
}
if (ereg("\>", $name)) {
echo "<center>Invalid Characters: <font color = \"red\"><strong>></strong></font> <a href=\"javascript:history.go(-1)\">Go Back</a></center>";
Die();
}
if (ereg("\[", $name)) {
echo "<center>Invalid Characters: <font color = \"red\"><strong>[</strong></font> <a href=\"javascript:history.go(-1)\">Go Back</a></center>";
Die();
}
if (ereg("\]", $name)) {
echo "<center>Invalid Characters: <font color = \"red\"><strong>]</strong></font> <a href=\"javascript:history.go(-1)\">Go Back</a></center>";
Die();
}}
if (strlen($name) < 5) {
echo "<center>Field must be at least 3 characters long:
<a href=\"javascript:history.go(-1)\">Go Back</a></center>";
Die();
}
if (strlen($name) > 80) {
echo "<center>Max Characters Field: 80
<a href=\"javascript:history.go(-1)\">Go Back</a></center>";
Die();
}
if (strlen($email) < 5) {
echo "<center>Field must be at least 3 characters long:
<a href=\"javascript:history.go(-1)\">Go Back</a></center>";
Die();
}
if (strlen($email) > 80) {
echo "<center>Max Characters Field: 80
<a href=\"javascript:history.go(-1)\">Go Back</a></center>";
Die();
}
if (ereg(" ",$username)) {
echo "<center>Wrong Username:<a href=\"javascript:history.go(-1)\">Go Back</a></center>";
Die();
}
if (ereg(" ",$password)) {
echo "<center>Wrong Password:<a href=\"javascript:history.go(-1)\">Go Back</a></center>";
Die();
}
$find_user = mysql_query("SELECT username, email FROM users WHERE username = '" . mysql_real_escape_string($username) ."' or email = '" . mysql_real_escape_string($email) ."'");
$duplicate_user = mysql_num_rows($find_user);
if ($duplicate_user == 0 ) {
//do nothing
} else {
echo"<div style=\"padding:5px;color:#555\" id=\"ercont\"><center>User already exists in database.</center></div>";
die();
}
$current_image=$_FILES['image']['name'];
$extension = substr(strrchr($current_image, '.'), 1);
if (($extension!= "jpg") && ($extension != "jpeg"))
{
die('Please Upload Valid JPG File');
}
$time = date("fYhis");
$new_image = $time . "." . $extension;
$destination="uploads/".$new_image;
$action = copy($_FILES['image']['tmp_name'], $destination);
function ccthumb($imgSrc,$filename,$thumbnail_width,$thumbnail_height) {
list($width_orig, $height_orig) = getimagesize($imgSrc);
if ($width_orig > 780 || $height_orig > 780)
{
echo "<br>Maximum width and height exceeded. Please upload images below 780 x 780 px size";
exit();
}
$tag=explode('.',$imgSrc);
if (preg_match('/jpg|jpeg/',$tag[1])){
if (@$cimage = imagecreatefromjpeg($imgSrc) == true){
$cimage = imagecreatefromjpeg($imgSrc);
}else{
die("wrong file");
}}
$ratio_orig = $width_orig/$height_orig;
if ($thumbnail_width/$thumbnail_height > $ratio_orig) {
$new_height = $thumbnail_width/$ratio_orig;
$new_width = $thumbnail_width;
} else {
$new_width = $thumbnail_height*$ratio_orig;
$new_height = $thumbnail_height;
}
$x_mid = $new_width/2; //horizontal middle
$y_mid = $new_height/2; //vertical middle
$process = imagecreatetruecolor(round($new_width), round($new_height));
imagecopyresampled($process, $cimage, 0, 0, 0, 0, $new_width, $new_height, $width_orig, $height_orig);
$thumb = imagecreatetruecolor($thumbnail_width, $thumbnail_height);
imagecopyresampled($thumb, $process, 0, 0, ($x_mid-($thumbnail_width/2)), ($y_mid-($thumbnail_height/2)), $thumbnail_width, $thumbnail_height, $thumbnail_width, $thumbnail_height);
imagejpeg($thumb,$filename,100);
return $thumb;
}
ccthumb($destination,'maxthumb/' . $new_image,50,50);
ccthumb($destination,'minthumb/' . $new_image,25,25);
$result = mysql_query("INSERT INTO users (username, password, email, ipos, thumbs, date, active, keysi)
VALUES ('$username',(md5('$password')),'$email','$ipse','$new_image',NOW(),'0','$keys')")
or die(mysql_error());
$realmessage = $username . " " . $lang['NEWMEM'];
$resultb = mysql_query("INSERT INTO publictime (texty,imgs,date,amess)
VALUES ('$username','$new_image',NOW(),'$realmessage')")
or die(mysql_error());
$urlh = getenv('HTTP_HOST');
$urls = dirname($_SERVER['PHP_SELF']);
$myurl = "http://$urlh$urls" . "confirm.php";
$body ='
<html>
<head>
<style>
<!--
body, P.msoNormal, LI.msoNormal
{
background-position: top;
background-color: #ffffff;
margin-left: 2em;
margin-top: 1em;
font-family: verdana;
font-size: 10pt;
font-weight:normal;
color: #555555;
lettet-spacing:1px;
}
h4{
font-weight:normal;
border-bottom:1px solid #A2BBCC;
}
</style>
</head>
<body>
';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= "From: $ccmail" . "\r\n";
$bodys = "
<head>
<style>
#content{
align:center;
padding:4px;
margin:0px auto;
background:#fff;
border:1px dotted #f8f8f8;
width:733px;
font-family;tahoma;
color:#222;
}
</style>
</head>
<div id = 'content'>
<h4>$title</h4>$lang[MAILHEAD] \"$username\", $lang[NEWREG]<br><br>
<a href=\"$myurl?id=$keys\">$myurl?id=$keys</a><br><br>
$myurl?id=$keys<br><br>
$lang[THAREG]<br><br>$title";
$subject = "$lang[ACTREG] $title";
mail($email, $subject, $bodys, $headers);
echo"<div style=\"padding:5px;color:#555\" id=\"ercont\"><center>$lang[PASTHE]</center></div>";
}else{
?>
<body style="text-align: center">
<div id="center">
<table width="100%" style="font-size:13px;"><tr><td>
<?php echo $lang['ALLFIELD'] ?>
</td></tr></table>
<form name="maForm" action="signup.php" enctype="multipart/form-data" method="post" onSubmit="return validationEmail(this)">
<table width="100%" style="font-size:13px;"><tr>
<td valign="top" width="195px"><b><?php echo $lang['USER'] ?>:</b> <?php echo $lang['REQUI'] ?></td>
<td><input style="width:318px;" name="username" type="text"><br>
<font style="font-size:11px;"><?php echo $lang['ONLY'] ?></font><br>
<font style="font-size:11px;"><?php echo $lang['ENTER'] ?></font>
</td></tr></table>
<table width="100%" style="font-size:13px;"><tr>
<td valign="top" width="195px"><b><?php echo $lang['PASS'] ?>:</b> <?php echo $lang['REQUI'] ?></td>
<td><input style="width:318px;" name="password" type="password"><br>
<font style="font-size:11px;"><?php echo $lang['ONLY'] ?></font>
</td></tr></table>
<table width="100%" style="font-size:13px;"><tr>
<td valign="top" width="195px"><b><?php echo $lang['EMAIL'] ?>:</b> <?php echo $lang['REQUI'] ?></td>
<td><input style="width:318px;" name="email" type="text"><br>
<font style="font-size:11px;"><?php echo $lang['CMAIL'] ?></font>
</td></tr></table>
<table width="100%" style="font-size:13px;"><tr>
<td valign="top" width="195px"><b><?php echo $lang['IMAGE'] ?>:</b> <?php echo $lang['REQUI'] ?></td>
<td><input type="file" name="image" type="text"><br>
<font style="font-size:11px;"><?php echo $lang['FILES'] ?></font>
</td></tr></table>
<table width="100%" style="font-size:13px;"><tr>
<td valign="top" width="195px">
<?php echo $lang['CODE'] ?>:</td>
<td>
<?php
require_once('recaptchalib.php');
$publickey = $config['keypublic'];
echo recaptcha_get_html($publickey);
?>
</td></tr></table>
<table width="100%" style="font-size:13px;"><tr>
<td valign="top" width="195px"></td>
<td><input class="incc" type="submit" style="color:#ffffff;border:1px solid #ffffff;background:#A5C6EC" value="<?php echo $lang['NEWACC'] ?>" name="Submit" type="button">
</td></tr></table>
</form>
</div>
</td>
</tr>
</table>
</div>
<?php } ?>
</div>
<?php $smarty->display('footer.php'); ?>