| [ PHPXref.com ] | [ Generated: Sun Jul 20 19:30:10 2008 ] | [ Photo Organizer 2.30 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 3 // Copyright (C) 2002, 2003, 2004, 2005, 2006 Balint Kis (balint@k-i-s.net) 4 5 // This program is free software; you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation; either version 2 of the License, or 8 // (at your option) any later version. 9 10 // This program is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 15 // You should have received a copy of the GNU General Public License 16 // along with this program; if not, write to the Free Software 17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 19 include_once "include/vars.php"; 20 include_once "include/config.php"; 21 include_once "include/common.php"; 22 include_once "include/site.php"; 23 include_once "include/color.php"; 24 include_once "include/database.php"; 25 include_once "$theme/theme.php"; 26 27 $username = pg_escape_string($_REQUEST['username']); 28 $password_1 = pg_escape_string($_REQUEST['password_1']); 29 $password_2 = pg_escape_string($_REQUEST['password_2']); 30 $first_name = pg_escape_string($_REQUEST['first_name']); 31 $last_name = pg_escape_string($_REQUEST['last_name']); 32 $company = pg_escape_string($_REQUEST['company']); 33 $address1 = pg_escape_string($_REQUEST['address1']); 34 $address2 = pg_escape_string($_REQUEST['address2']); 35 $city = pg_escape_string($_REQUEST['city']); 36 $zipcode = pg_escape_string($_REQUEST['zipcode']); 37 $state = $_REQUEST['state']; 38 $country = $_REQUEST['country']; 39 $email = pg_escape_string($_REQUEST['email']); 40 $url = pg_escape_string($_REQUEST['url']); 41 $phone = pg_escape_string($_REQUEST['phone']); 42 43 $im_preview_quality = $_REQUEST['im_preview_quality']; 44 $im_preview_color_space = $_REQUEST['im_preview_color_space']; 45 $im_preview_gamma = $_REQUEST['im_preview_gamma']; 46 $im_preview_sharpen_radius = $_REQUEST['im_preview_sharpen_radius']; 47 $im_preview_sharpen_sigma = $_REQUEST['im_preview_sharpen_sigma']; 48 $im_preview_sharpen_amount = $_REQUEST['im_preview_sharpen_amount']; 49 $im_preview_sharpen_threshold = $_REQUEST['im_preview_sharpen_threshold']; 50 $im_preview_border_width = $_REQUEST['im_preview_border_width']; 51 $im_preview_border_height = $_REQUEST['im_preview_border_height']; 52 $im_preview_border_color = $_REQUEST['im_preview_border_color']; 53 54 $im_thumb_quality = $_REQUEST['im_thumb_quality']; 55 $im_thumb_color_space = $_REQUEST['im_thumb_color_space']; 56 $im_thumb_gamma = $_REQUEST['im_thumb_gamma']; 57 $im_thumb_sharpen_radius = $_REQUEST['im_thumb_sharpen_radius']; 58 $im_thumb_sharpen_sigma = $_REQUEST['im_thumb_sharpen_sigma']; 59 $im_thumb_sharpen_amount = $_REQUEST['im_thumb_sharpen_amount']; 60 $im_thumb_sharpen_threshold = $_REQUEST['im_thumb_sharpen_threshold']; 61 $im_thumb_border_width = $_REQUEST['im_thumb_border_width']; 62 $im_thumb_border_height = $_REQUEST['im_thumb_border_height']; 63 $im_thumb_border_color = $_REQUEST['im_thumb_border_color']; 64 65 $im_watermark_brightness = $_REQUEST['im_watermark_brightness']; 66 $im_watermark_location = $_REQUEST['im_watermark_location']; 67 68 $dcraw_gamma = $_REQUEST['dcraw_gamma']; 69 $dcraw_brightness = $_REQUEST['dcraw_brightness']; 70 $dcraw_white_balanace = $_REQUEST['dcraw_white_balanace']; 71 $dcraw_red_multiplier = $_REQUEST['dcraw_red_multiplier']; 72 $dcraw_blue_multiplier = $_REQUEST['dcraw_blue_multiplier']; 73 $dcraw_bitdepth = $_REQUEST['dcraw_bitdepth']; 74 75 if (!$im_preview_quality) $im_preview_quality = $default_im_preview_quality; 76 if (!$im_preview_color_space) $im_preview_color_space = $default_im_preview_color_space; 77 if (!$im_preview_gamma) $im_preview_gamma = $default_im_preview_gamma; 78 if (!$im_preview_sharpen_radius) $im_preview_sharpen_radius = $default_im_preview_sharpen_radius; 79 if (!$im_preview_sharpen_sigma) $im_preview_sharpen_sigma = $default_im_preview_sharpen_sigma; 80 if (!$im_preview_sharpen_amount) $im_preview_sharpen_amount = $default_im_preview_sharpen_amount; 81 if (!$im_preview_sharpen_threshold) $im_preview_sharpen_threshold = $default_im_preview_sharpen_threshold; 82 if (!$im_preview_border_width) $im_preview_border_width = $default_im_preview_border_width; 83 if (!$im_preview_border_height) $im_preview_border_height = $default_im_preview_border_height; 84 if (!$im_preview_border_color) $im_preview_border_color = $default_im_preview_border_color; 85 86 if (!$im_thumb_quality) $im_thumb_quality = $default_im_thumb_quality; 87 if (!$im_thumb_color_space) $im_thumb_color_space = $default_im_thumb_color_space; 88 if (!$im_thumb_gamma) $im_thumb_gamma = $default_im_thumb_gamma; 89 if (!$im_thumb_sharpen_radius) $im_thumb_sharpen_radius = $default_im_thumb_sharpen_radius; 90 if (!$im_thumb_sharpen_sigma) $im_thumb_sharpen_sigma = $default_im_thumb_sharpen_sigma; 91 if (!$im_thumb_sharpen_amount) $im_thumb_sharpen_amount = $default_im_thumb_sharpen_amount; 92 if (!$im_thumb_sharpen_threshold) $im_thumb_sharpen_threshold = $default_im_thumb_sharpen_threshold; 93 if (!$im_thumb_border_width) $im_thumb_border_width = $default_im_thumb_border_width; 94 if (!$im_thumb_border_height) $im_thumb_border_height = $default_im_thumb_border_height; 95 if (!$im_thumb_border_color) $im_thumb_border_color = $default_im_thumb_border_color; 96 97 if (!$im_watermark_brightness) $im_watermark_brightness = $default_im_watermark_brightness; 98 if (!$im_watermark_location) $im_watermark_location = $default_im_watermark_location; 99 100 if (!$dcraw_gamma) $dcraw_gamma = $default_dcraw_gamma; 101 if (!$dcraw_brightness) $dcraw_brightness = $default_dcraw_brightness; 102 if (!$dcraw_white_balanace) $dcraw_white_balanace = $default_dcraw_white_balanace; 103 if (!$dcraw_red_multiplier) $dcraw_red_multiplier = $default_dcraw_red_multiplier; 104 if (!$dcraw_blue_multiplier) $dcraw_blue_multiplier = $default_dcraw_blue_multiplier; 105 if (!$dcraw_bitdepth) $dcraw_bitdepth = $default_dcraw_bitdepth; 106 107 108 $start_hour = 8; 109 $end_hour = 20; 110 $start_day = 1; 111 $print_out = "pdf"; 112 113 $num_of_columns = $default_num_of_columns; 114 $num_of_rows = $default_num_of_rows_in_slide_view; 115 $num_of_rows_l = $default_num_of_rows_in_list_view; 116 $folder_view = "slide"; 117 118 $paper = $default_paper; 119 $label = $default_label; 120 $popup_delay = $default_popup_delay; 121 $popup_enable = $default_popup_enable; 122 123 $my_user_id = 0; 124 $registration_error = 0; 125 126 $database = po_dbconnect(); 127 $system_preferences = pg_fetch_row(pg_query($database, " 128 select new_user_type, new_user_bulk_upload_enable, new_user_paper, 129 new_user_label, new_user_shop_enable, 130 new_user_quota_size, new_user_quota_count, new_user_shared 131 from system_preferences")); 132 133 if ($system_preferences[0] == $user_type['disabled']) { 134 header("location: login.php"); 135 exit(); 136 } 137 138 if ($username!="") { 139 $result = pg_fetch_row(pg_query($database, "select identifier from users where username='$username'")); 140 if ($result[0] != 0) { 141 $registration_error = 1; 142 } 143 elseif (($password_2 != $password_1) || (($password_2 == "") && ($password_1 == ""))) { 144 $registration_error = 2; 145 } 146 elseif (($first_name == "") || ($last_name == "")) { 147 $registration_error = 3; 148 } 149 elseif ($email == "") { 150 $registration_error = 4; 151 } 152 else { 153 pg_query($database, "begin"); 154 $new_user_id = pg_fetch_row(pg_query($database, "select nextval('users_id_sequence')")); 155 $new_contact_info_id = pg_fetch_row(pg_query($database, "select nextval('contact_info_id_sequence')")); 156 $new_preferences_id = pg_fetch_row(pg_query($database, "select nextval('preferences_id_sequence')")); 157 $new_imagemagick_options_id = pg_fetch_row(pg_query($database, "select nextval('imagemagick_options_id_sequence')")); 158 $new_imagemagick_composite_options_id = pg_fetch_row(pg_query($database, "select nextval('imagemagick_composite_options_id_sequence')")); 159 $new_dcraw_options_id = pg_fetch_row(pg_query($database, "select nextval('dcraw_options_id_sequence')")); 160 $my_user_id = $new_user_id[0]; 161 $my_contact_info_id = $new_contact_info_id[0]; 162 $my_preferences_id = $new_preferences_id[0]; 163 $my_imagemagick_options_id = $new_imagemagick_options_id[0]; 164 $my_imagemagick_composite_options_id = $new_imagemagick_composite_options_id[0]; 165 $my_dcraw_options_id = $new_dcraw_options_id[0]; 166 167 $result = pg_query($database, " 168 insert into preferences 169 (identifier, print_out, start_hour, end_hour, start_day, 170 num_of_rows, num_of_columns, folder_view, num_of_rows_l, 171 bulk_upload_enable, paper, label, popup_enable, popup_delay, 172 shop_enable, quota_size, quota_count, download_counter, download_expiry_period) 173 values ('$my_preferences_id', '$print_out', '$start_hour', '$end_hour', '$start_day', 174 '$num_of_rows', '$num_of_columns', '$folder_view', '$num_of_rows_l', 175 '$system_preferences[1]', '$paper', '$label', '$popup_enable', $popup_delay, 176 '$system_preferences[4]', $system_preferences[5], $system_preferences[6], 100, 1095)"); 177 if (!$result) 178 $registration_error = 5; 179 180 $result = pg_query($database, " 181 insert into imagemagick_options 182 (identifier, 183 preview_quality, preview_colorspace, preview_gamma, 184 preview_sharpen_radius, preview_sharpen_sigma, 185 preview_sharpen_amount, preview_sharpen_threshold, 186 preview_border_width, preview_border_height, preview_border_color, 187 thumb_quality, thumb_colorspace, thumb_gamma, 188 thumb_sharpen_radius, thumb_sharpen_sigma, 189 thumb_sharpen_amount, thumb_sharpen_threshold, 190 thumb_border_width, thumb_border_height, thumb_border_color) 191 values ($my_imagemagick_options_id, 192 $im_preview_quality, '$im_preview_color_space', $im_preview_gamma, 193 $im_preview_sharpen_radius, $im_preview_sharpen_sigma, 194 $im_preview_sharpen_amount, $im_preview_sharpen_threshold, 195 $im_preview_border_width, $im_preview_border_height, '$im_preview_border_color', 196 $im_thumb_quality, '$im_thumb_color_space', $im_thumb_gamma, 197 $im_thumb_sharpen_radius, $im_thumb_sharpen_sigma, 198 $im_thumb_sharpen_amount, $im_thumb_sharpen_threshold, 199 $im_thumb_border_width, $im_thumb_border_height, '$im_thumb_border_color')"); 200 if (!$result) 201 $registration_error = 5; 202 203 $result = pg_query($database, " 204 insert into imagemagick_composite_options 205 (identifier, gravity, watermark, photo_version) 206 values ($my_imagemagick_composite_options_id, '$im_watermark_location', $im_watermark_brightness, null)"); 207 if (!$result) 208 $registration_error = 5; 209 210 $result = pg_query($database, " 211 insert into dcraw_options 212 (identifier, gamma, brightness, white_balance, red_multiplier, blue_multiplier, bitdepth) 213 values ($my_dcraw_options_id, $dcraw_gamma, $dcraw_brightness, '$dcraw_white_balanace', $dcraw_red_multiplier, $dcraw_blue_multiplier, $dcraw_bitdepth)"); 214 if (!$result) 215 $registration_error = 5; 216 217 if (substr($url, 0, 7) != "http://") 218 $url = "http://".$url; 219 220 $result = pg_query($database, "insert into contact_info (identifier, address1, address2, city, zipcode, state, country, phone, email, url) 221 values ('$my_contact_info_id', '$address1', '$address2', '$city', '$zipcode', $state, $country, '$phone', '$email', '$url')"); 222 if (!$result) 223 $registration_error = 5; 224 225 $session_id = md5($my_user_id . time()); 226 $result = pg_query($database, "insert into users (identifier, first_name, last_name, company, username, password, session_id, contact, member_since, preferences, imagemagick_options, imagemagick_composite_options, dcraw_options, type, shared) 227 values ('$my_user_id', '$first_name', '$last_name', '$company', '$username', '$password_1', '$session_id', '$my_contact_info_id', now(), '$my_preferences_id', '$my_imagemagick_options_id', '$my_imagemagick_composite_options_id', '$my_dcraw_options_id', $system_preferences[0], '$system_preferences[7]')"); 228 if (!$result) 229 $registration_error = 5; 230 $result = pg_query($database, "insert into folder (identifier, parent_folder, users, caption, date_of_creation, access_rights, orderby) 231 values (nextval('folder_id_sequence'), null, '$my_user_id', 'Orphanage', now(), 3, 1)"); 232 if (!$result) 233 $registration_error = 5; 234 $result = pg_query($database, "insert into folder (identifier, parent_folder, users, caption, date_of_creation, access_rights, orderby) 235 values (nextval('folder_id_sequence'), null, '$my_user_id', 'Trash', now(), 3, 1)"); 236 if (!$result) 237 $registration_error = 5; 238 239 if ($registration_error == 5) 240 pg_query($database, "rollback"); 241 else { 242 pg_query($database, "commit"); 243 setcookie ($po_cookie, $session_id, 0, "", "", 0); 244 } 245 } 246 } 247 248 if ($my_user_id!=0) { 249 header("location: login.php"); 250 exit(); 251 } 252 253 site_header($page_width, "Register"); 254 site_navigator(3, $type[0]); 255 256 switch ($registration_error) { 257 case 1: 258 site_navigator_staus("<font color=\"red\">Username <b>$username</b> already registered.</font>", ""); 259 break; 260 case 2: 261 site_navigator_staus("<font color=\"red\">Password mismatch.</font>", ""); 262 break; 263 case 3: 264 site_navigator_staus("<font color=\"red\">First name and and last name is mandatory.</font>", ""); 265 break; 266 case 4: 267 site_navigator_staus("<font color=\"red\">E-mail is mandatory.</font>", ""); 268 break; 269 case 5: 270 site_navigator_staus("<font color=\"red\">Could not create new user entry, database error.</font>", ""); 271 break; 272 default: 273 site_navigator_staus("<a href=\"login.php\">Login</a> : Registration : fields in <b>bold</b> are mandatory", ""); 274 } 275 276 $all_states = pg_query($database, "select identifier, value from state order by value"); 277 $all_countries = pg_query($database, "select identifier, value from country order by value"); 278 $all_papers = pg_query($database, "select identifier, name from paper"); 279 $all_labels = pg_query($database, " 280 select label.identifier, 281 (select name from manufacturer where identifier=label.manufacturer), 282 label.name, paper.name 283 from label, paper 284 where label.paper=paper.identifier"); 285 286 print "<form action=\"register.php\" method=\"POST\">\n"; 287 print " <br/>\n"; 288 print "<table align=\"center\" valign=\"top\" border=\"0\">\n"; 289 290 print "<tr><td align=\"right\" nowrap><b>Username</b> </td><td align=\"left\"><input tabindex=\"1\" type=\"text\" name=\"username\" value=\"$username\" size=\"35%\"></td></tr>\n"; 291 print "<tr><td align=\"right\" nowrap><b>Password</b> </td><td align=\"left\"><input tabindex=\"2\" type=\"password\" name=\"password_1\" size=\"35%\"></td></tr>\n"; 292 print "<tr><td align=\"right\" nowrap><b>Confirm password</b> </td><td align=\"left\"><input tabindex=\"3\" type=\"password\" name=\"password_2\" size=\"35%\"></td></tr>\n"; 293 print "<tr><td align=\"right\" nowrap><b>First name</b> </td><td align=\"left\"><input tabindex=\"4\" type=\"text\" name=\"first_name\" value=\"$first_name\" size=\"35%\"></td></tr>\n"; 294 print "<tr><td align=\"right\" nowrap><b>Last name</b> </td><td align=\"left\"><input tabindex=\"5\" type=\"text\" name=\"last_name\" value=\"$last_name\" size=\"35%\"></td></tr>\n"; 295 print "<tr><td align=\"right\" nowrap><b>Email</b> </td><td align=\"left\"><input tabindex=\"6\" type=\"text\" name=\"email\" value=\"$email\" size=\"35%\"></td></tr>\n"; 296 297 print "<tr><td valign=\"top\" colspan=\"2\"> </td></tr>\n"; 298 299 print "<tr><td align=\"right\" nowrap>Url </td><td align=\"left\"><input tabindex=\"7\" type=\"text\" name=\"url\" value=\"$url\" size=\"35%\"></td></tr>\n"; 300 print "<tr><td align=\"right\" nowrap>Phone </td><td align=\"left\"><input tabindex=\"8\" type=\"text\" name=\"phone\" value=\"$phone\" size=\"35%\"></td></tr>\n"; 301 print "<tr><td align=\"right\" nowrap>Company </td><td align=\"left\"><input tabindex=\"9\" type=\"text\" name=\"company\" value=\"$company\" size=\"35%\"></td></tr>\n"; 302 print "<tr><td align=\"right\" nowrap>Address </td><td align=\"left\"> 303 <table cellspacing=0 cellpadding=0><tr><td> 304 <input tabindex=\"10\" type=\"text\" name=\"address1\" value=\"$address1\" size=\"35%\"> 305 </td></tr><tr><td height=6></td></tr><tr><td> 306 <input tabindex=\"11\" type=\"text\" name=\"address2\" value=\"$address2\" size=\"35%\"> 307 </td></tr></table> 308 </td></tr>\n"; 309 print "<tr><td align=\"right\" nowrap>City </td><td align=\"left\"><input tabindex=\"12\" type=\"text\" name=\"city\" value=\"$city\" size=\"35%\"></td></tr>\n"; 310 print "<tr><td align=\"right\" nowrap>Zipcode </td><td align=\"left\"><input tabindex=\"13\" type=\"text\" name=\"zipcode\" value=\"$zipcode\" size=\"35%\"></td></tr>\n"; 311 print "<tr><td align=\"right\" nowrap>State </td><td align=\"left\">"; display_combo("state", $all_states, $state, "", 0); print"</td></tr>\n"; 312 print "<tr><td align=\"right\" nowrap>Country </td><td align=\"left\">"; display_combo("country", $all_countries, $country, "", 0); print"</td></tr>\n"; 313 print "</table>\n"; 314 315 print "<div align=\"center\">"; 316 print " <br/>\n"; 317 print "<input tabindex=\"16\" type=\"image\" src=\"$theme/button.register.gif\" border=\"0\" value=\"Register\">"; 318 print "<a class=\"nodecor\" href=\"register.php\"><img src=\"$theme/button.clear.gif\" alt=\"Clear\" border=\"0\"></a>"; 319 print " <br/>\n"; 320 print "</div>"; 321 print "</form>\n"; 322 323 324 site_footer($database); 325 pg_close($database); 326 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |