STRING, 'uid' => INT, 'age' => STRING, 'knum' => STRING, 'agree' => STRING, 'invite' => STRING)); typecast($_POST, array('pick_username' => STRING, 'email' => STRING, 'password' => STRING, 'passwordconfirm' => STRING, 'homepage' => STRING, 'cap' => INT, 'icq' => STRING, 'aim' => STRING, 'yahoo' => STRING, 'year' => STRING, 'mature' => STRING, 'hobbies' => STRING, 'occupation' => STRING, 'location' => STRING, 'bio' => STRING, 'rpass' => STRING, 'year' => INT, 'month' => INT, 'day' => INT, ', link' => INT, 'realname' => STRING)); authenticate(); topmenu(); if ( $Globals['ppboards'] == "closed" && $User['adminedit'] != 1 ) { diewell( $Globals['closedmsg'] ); } if ($Globals['allowregs'] == "no" ) { diewell( $Globals['pp_lang']['nonew'] ); } if ($gologin != 1) { if ($ppaction != "vfy") { diewell( "{$Globals['pp_lang']['loggedin']}

{$Globals['pp_lang']['retfront']} {$Globals['galleryname']}." ); } } if ( $invite ) { $q = ppmysql_query( "SELECT name,email,referer FROM {$Globals['pp_db_prefix']}invites WHERE code='$invite' AND status < 9 LIMIT 1", $link ); list( $iname, $iemail, $ireferer ) = mysql_fetch_row($q); if ( !$iemail ) { diewell( $Globals['pp_lang']['invalidcode'] ); } } // If using Coppa, spit out the Coppa form $gocoppa = 0; $months = array($Globals['pp_lang']['month1'],$Globals['pp_lang']['month2'],$Globals['pp_lang']['month3'],$Globals['pp_lang']['month4'], $Globals['pp_lang']['month5'],$Globals['pp_lang']['month6'],$Globals['pp_lang']['month7'],$Globals['pp_lang']['month8'], $Globals['pp_lang']['month9'],$Globals['pp_lang']['month10'],$Globals['pp_lang']['month11'],$Globals['pp_lang']['month12']); // Some inits if ( !isset($ppaction) ) { $ppaction = "register"; } if ( $ppaction == "register" ) { if ( $age == "" ) { if ( $Globals['coppa'] == "yes" ) { $age = "coppa"; $gocoppa = 1; } else { $age="adult"; } } else { if ( $age != "coppa" && $age != "adult" ) { $age = "coppa"; } if ( $Globals['coppa'] == "yes" ) { $gocoppa=2; } } if ( $gocoppa == 1 ) { printheader( 0, "COPPA Form" ); include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/menubar.tmpl" ); include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/coppa.tmpl" ); printfooter(); exit; } $coppavar = $coppa; // First see if they agree to the rules printheader( 0, "Registration" ); if ($agree == "") { if ($age == "adult") { $ruleshtml = trim($Globals['rules']); if ( $ruleshtml == "" || !file_exists($ruleshtml) ) { $rulestext = $Globals['pp_lang']['reginstruct']; } else { $filearray = file($ruleshtml); $rules = implode( " ", $filearray ); $rulestext = $rules; } } if ($age == "coppa") { $coppahtml = trim($Globals['copparules']); if ( empty($coppahtml) || !file_exists($coppahtml) ) { $rulestext = "{$Globals['pp_lang']['coppaform']} {$Globals['pp_lang']['permformlower']}. {$Globals['pp_lang']['formore']} {$Globals['adminemail']}"; } else { $filearray = file($coppahtml); $rulestext = implode( " ", $filearray ); } } include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/menubar.tmpl" ); include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/reg_agree.tmpl" ); printfooter(); exit; } // If they agreed to the rules, spit out the reg form if ($agree == "yes") { $julian = time(); $cclock = formatpptime( $julian ); $ppdate = formatppdate( $julian ); $thetime = "$ppdate $cclock"; $newid = 0; if ( $Globals['usecaptcha'] == "yes" ) { // Let's generate a totally random string using md5 $md5 = md5(rand(0,999)); // We don't need a 32 character long string so we trim it down to 5 $pass = substr($md5, 10, 5); $r = ppmysql_query( "INSERT INTO {$Globals['pp_db_prefix']}captcha (id,code) VALUES (NULL,'$pass')", $link ); $newid = mysql_insert_id($link); if ( !$newid ) { diewell( $Globals['pp_lang']['caperror'] ); } } include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/menubar.tmpl" ); include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/register.tmpl" ); printfooter(); exit; } } // Process registration input, send verify email or enable acct if ($ppaction == "submit") { if ( $Globals['usecaptcha'] == "yes" ) { if ( $cap ) { $q = ppmysql_query( "SELECT code FROM {$Globals['pp_db_prefix']}captcha WHERE id=$cap LIMIT 1", $link ); list( $pass ) = mysql_fetch_row($q); if ( strtolower($rpass) != $pass ) { diewell( $Globals['pp_lang']['keyinvalid'] ); } } else { diewell( $Globals['pp_lang']['noverif'] ); } } $reason = null; if ($pick_username == "") { $reason .= "
  • {$Globals['pp_lang']['userblank']}
  • "; $stop = 1; } wordchars( $pick_username ); // check username for bad characters $resulta = ppmysql_query("SELECT userid FROM {$Globals['pp_db_prefix']}users WHERE username='$pick_username' LIMIT 1", $link); $matchu = mysql_num_rows( $resulta ); if ( $matchu > 0 ) { $reason .= "
  • {$Globals['pp_lang']['userexists']}
  • "; $stop = 1; } if ($Globals['emailunique'] == "yes") { $resulta = ppmysql_query("SELECT email FROM {$Globals['pp_db_prefix']}users WHERE email='$email' LIMIT 1", $link); list( $dbemail ) = mysql_fetch_row($resulta); if ( !strcasecmp($dbemail, $email) ) { $reason .= "
  • {$Globals['pp_lang']['emailexists']}
  • "; $stop = 1; } } if ( !valid_email($email) ) { $reason .= "
  • {$Globals['pp_lang']['emailbad']}
  • "; $stop = 1; } if ($password == "") { $reason .= "
  • {$Globals['pp_lang']['passblank']}
  • "; $stop = 1; } if ($password != "") { $pwdlength = strlen($password); if ($pwdlength < 4) { $reason .= "
  • {$Globals['pp_lang']['fourchars']}
  • "; $stop = 1; } } if ($pick_username != "") { $userlength = strlen($pick_username); if ($userlength < 2) { $reason .= "
  • {$Globals['pp_lang']['user2char']}
  • "; $stop = 1; } } if ($passwordconfirm == "") { $reason .= "
  • {$Globals['pp_lang']['passverblank']}
  • "; $stop = 1; } if ($password != $passwordconfirm) { $reason .= "
  • {$Globals['pp_lang']['passnomatch']}
  • "; $stop = 1; } if ($email == "") { $reason .= "
  • {$Globals['pp_lang']['emailblank']}
  • "; $stop = 1; } if ($stop == 1) { diewell($reason); } if ( $Globals['getoptional'] == "yes" ) { $homepage = fixstring( $homepage ); $icq = fixstring( $icq ); $aim = fixstring( $aim ); $yahoo = fixstring( $yahoo ); $year = fixstring( $year ); $hobbies = fixstring( $hobbies ); $occupation = fixstring( $occupation ); $location = fixstring( $location ); $bio = fixstring( $bio ); $birthday = null; if ( $year != "" ) { $birthday = "$year-$month-$day"; } } else { $homepage = null; $icq = null; $aim = null; $yahoo = null; $year = null; $hobbies = null; $occupation = null; $bio = null; $location = null; $birthday = null; } $ipaddress = findenv("REMOTE_ADDR"); $joindate = time(); if ($age == "coppa") { $userlevel = 2; } else { $age = "adult"; if ($Globals['emailverify'] == "yes") { $userlevel = 3; } else { $userlevel = 4; } } $passwordmd5 = addslashes(md5($password)); $thissite = addslashes( $Globals['webname'] ); $maturec = ( $mature == "yes" ? 0 : 1 ); $resulta = ppmysql_query("INSERT INTO {$Globals['pp_db_prefix']}users (userid,usergroupid,username,realname,password,email,mature,homepage,icq,aim,yahoo,joindate,birthday,ipaddress,location,interests,occupation,bio,site) values(NULL, '$userlevel', '$pick_username', '$realname', '$passwordmd5', '$email', $maturec, '$homepage', '$icq', '$aim', '$yahoo', '$joindate', '$birthday', '$ipaddress', '$location', '$hobbies', '$occupation', '$bio', '$thissite')", $link); $newuserid = mysql_insert_id( $link ); if ( !$newuserid ) { diewell( $Globals['pp_lang']['erroradd'] ); } if ( $invite ) { ppmysql_query( "UPDATE {$Globals['pp_db_prefix']}invites SET status=9,uid=$newuserid WHERE code='$invite'", $link ); ppmysql_query( "UPDATE {$Globals['pp_db_prefix']}users SET accepts=(accepts+1),invitesleft=(invitesleft+2) WHERE userid=$ireferer", $link ); $msgtext = get_string( "acceptmsg", "{$pick_username}" ); send_ppmsg( $ireferer, $msgtext, $newuserid, 'i' ); } if ($Globals['emailverify'] == "yes") { $resulta = ppmysql_query("SELECT userid FROM {$Globals['pp_db_prefix']}users WHERE username='$pick_username' AND joindate='$joindate' LIMIT 1", $link); list( $theuid ) = mysql_fetch_row($resulta); include "{$Globals['PP_PATH']}/languages/{$Globals['pplang']}.php"; $email_from = "From: {$Globals['adminemail']}"; $letter = $Globals['pp_lang']['emailreg']; $letter = stripslashes($letter); $subject = $Globals['pp_lang']['emailrsub']; mail( $email, $subject, $letter, $email_from ); diewell( "{$Globals['pp_lang']['thanksreg']}

    {$Globals['pp_lang']['retfront']} {$Globals['galleryname']}" ); } diewell("{$Globals['pp_lang']['thanks']}

    {$Globals['pp_lang']['retfront']} {$Globals['galleryname']}"); } // Verify a user's email, change status from unregistered to registered if ($ppaction == "vfy") { $resulta = ppmysql_query("SELECT joindate,usergroupid FROM {$Globals['pp_db_prefix']}users WHERE userid=$uid LIMIT 1", $link); if ( $resulta ) { list( $joindate, $ugid ) = mysql_fetch_row($resulta); if ($joindate == $knum && ($ugid == 3 || $ugid == 4)) { $resulta = ppmysql_query("UPDATE {$Globals['pp_db_prefix']}users SET usergroupid=4,invites=15 WHERE userid=$uid", $link); diewell("{$Globals['pp_lang']['thanks']}!
    {$Globals['pp_lang']['retfront']} {$Globals['galleryname']}."); } else { diewell($Globals['pp_lang']['notabverify']); } } else { diewell( $Globals['pp_lang']['nonum'] ); } exit; } if ($ppaction == "cform") { topmenu(); printheader( 0, $Globals['pp_lang']['submitreg'] ); include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/menubar.tmpl" ); include( "{$Globals['PP_PATH']}/{$Globals['TMPL_PATH']}/coppa_form.tmpl" ); printfooter(); } ?>