forked from SnowHall/Silurus-Classifieds-Script
/
join_form.php
executable file
·211 lines (190 loc) · 6.13 KB
/
join_form.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<?php
/**
* Silurus Classifieds Builder
*
*
* @author SnowHall - http://snowhall.com
* @website http://snowhall.com/silurus
* @email support@snowhall.com
*
* @version 1.0
* @date May 7, 2009
*
* Silurus is a professionally developed PHP Classifieds script that was built for you.
* Whether you are running classifieds for autos, motorcycles, bicycles, rv's, guns,
* horses, or general merchandise, our product is the right package for you.
* It has template system and no limit to usage with free for any changes.
*
* Copyright (c) 2009
*/
include("./include_php/init.php");
if($_SESSION['memberID']) header("location: /profile.php");
$enable_security_image = $_SERVER['enable_security_image'];
if($_SERVER['REQUEST_METHOD'] == 'POST' && !isset($_REQUEST['banid']))
{
$add_on = '';
require_once './simg/securimage.php';
$image = new Securimage();
if ($image->check($_POST['securityImageValue']) == false) {
$add_on .= report_err ( "Incorrect secret image value");
$err['securityImageValue'] = 1;
}
if($_POST['Email'] != $_POST['Email2'])
{
$add_on .= report_err('Email and confirm not similar');
$err['Email2'] = 1;
}
if(trim($_POST['Password1']) == '')
{
$add_on .= report_err('Enter Password');
$err['Password1'] = 1;
}
if(trim($_POST['NickName']) == '')
{
$add_on .= report_err('Enter NickName');
$err['NickName'] = 1;
}
if(trim($_POST['Email']) == '')
{
$add_on .= report_err('Enter Email');
$err['Email'] = 1;
}
if(trim($_POST['Zip']) == '')
{
$add_on .= report_err('Enter zip');
$err['Zip'] = 1;
}
if($_POST['Password1'] != $_POST['Password2'])
{
$add_on .= report_err('Password and confirm not similar');
$err['Password2'] = 1;
}
if(!isset($_POST['terms']))
{
$add_on .= report_err('Please agree with terms');
$err['terms'] = 1;
}
if(trim($_POST['fname']) == '')
{
$add_on .= report_err('Enter First Name');
$err['fname'] = 1;
}
if(trim($_POST['lname']) == '')
{
$add_on .= report_err('Enter Last Name');
$err['lname'] = 1;
}
if(trim($_POST['city']) == '')
{
$add_on .= report_err('Enter City');
$err['city'] = 1;
}
$us = mysql_numrows(mysql_query("select * from Profiles where NickName='".mysql_escape_string($_POST['NickName'])."'"));
if($us > 0)
{
$add_on.= report_err("This NickName already use");
$err['NickName'] = 1;
}
$us = mysql_numrows(mysql_query("select * from Profiles where Email='".mysql_escape_string($_POST['Email'])."'"));
if($us > 0 && $_POST['Email']!='')
{
$add_on.= report_err("This E-mail already use");
$err['Email'] = 1;
}
if($_SERVER['REQUEST_METHOD']!='POST') $add_on = '';
if(trim($add_on)=='')
{
$collge = mysql_fetch_assoc(mysql_query("select * from City where Title = '".mysql_escape_string(trim($_POST['city']))."'"));
if(intval($collge['ID']) > 0)
$collgeid = intval($collge['ID']);
else
{
mysql_query("insert into City set Title='".mysql_escape_string(trim($_POST['city']))."'");
$collgeid = mysql_insert_id();
}
$cl_values ="INSERT INTO `Profiles` SET
LastModified=".time().",
Status='Active',
NickName='".mysql_escape_string($_POST['NickName'])."',
Email='".mysql_escape_string($_POST['Email'])."',
Password='".md5($_POST['Password1'])."',
zip='".mysql_escape_string($_POST['Zip'])."',
fname='".mysql_escape_string($_POST['fname'])."',
lname='".mysql_escape_string($_POST['lname'])."',
city=".$collgeid.",
$Photo
intro='".mysql_escape_string($_POST['intro'])."',
note='".mysql_escape_string($_POST['note'])."',
altemail='".mysql_escape_string($_POST['altemail'])."',
phone='".mysql_escape_string($_POST['phone'])."',
cell='".mysql_escape_string($_POST['cell'])."',
aim='".mysql_escape_string($_POST['aim'])."',
skype='".mysql_escape_string($_POST['skype'])."' ,
phone_none='".intval($_POST['phone_none'])."',
cell_none='".intval($_POST['cell_none'])."',
aim_none='".intval($_POST['aim_none'])."',
altemail_none='".intval($_POST['altemail_none'])."',
skype_none='".intval($_POST['skype_none'])."' ,
LastReg = NOW()";
mysql_query($cl_values);
$IDnormal = mysql_insert_id();
if($IDnormal > 0)
{
if( !$_FILES['Photo'] or empty( $_FILES['Photo'] ) )
$add_on .= report_err('File not uploaded');
else
{
if( $_FILES['Photo']['error'] != 0 )
$sActionText = 'File upload error<br>';
else
{
$aFileInfo = getimagesize( $_FILES['Photo']['tmp_name'] );
if( !$aFileInfo )
$sActionText = 'You uploaded not image file<br>';
else
{
$ext = false;
switch( $aFileInfo['mime'] )
{
case 'image/jpeg': $ext = 'jpg'; break;
case 'image/gif': $ext = 'gif'; break;
case 'image/png': $ext = 'png'; break;
}
if( !$ext )
$sActionText = 'You uploaded not JPEG, GIF or PNG file<br>';
else
{
$dir = "media/images/profile/".$IDnormal."/";
if(!is_dir($dir)) mkdir($dir, 0755, true);
if(trim($_SESSION['memberINFO']['PrimPhoto'])!='' && trim($_SESSION['memberINFO']['PrimPhoto'])!='0')
$newFileName = $_SESSION['memberINFO']['PrimPhoto'];
else
$newFileName = time().'.'.$ext;
if( !move_uploaded_file( $_FILES['Photo']['tmp_name'], $dir.'photo_'.$newFileName ) )
$sActionText = 'Couldn\'t download file.';
else
{
imageResize( $dir.'photo_'.$newFileName, $dir.'thumb_'.$newFileName,200);
mysql_query("update Profiles set PrimPhoto='$newFileName' where ID=".$IDnormal);
}
}
}
}
}
$_SESSION['memberID'] = $IDnormal;
header("location: /profile.php");
}
}
$smarty->assign("error", $err);
$smarty->assign("t_error", $add_on);
}
function report_err( $str )
{
return "<span style=\"font-size:18px;color:#880000\"><b>" . ( "Error" ) . ":</b> $str</span><br />";
}
$HEADERTEXT = 'Join Now';
addNavigation('',$HEADERTEXT);
$smarty->assign("site_title", $HEADERTEXT." :: ".$gConfig['site_title']);
$smarty->assign("HEADERTEXT", $HEADERTEXT);
show_smarty_template('join');
?>