Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 05-10-2012, 03:33 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 113,373
Abronsyth is on a distinguished road
Default Error in Register.php

So, this is odd...it seems that when a user gos to register, the 'register' button redirects them as though they had clicked the 'login' button instead, so it responds as though they were attempting to login, but didn't fill in details, instead of newly registering. Here's my register.php...one of my users experienced this when signing up (the first to attempt yet), and I experienced then when trying to register a test account.
PHP Code:
<?php

include("functions/functions.php");
include(
"functions/functions_users.php");
include(
"inc/config_forums.php");
include(
"inc/lang.php");

//***************//
//  START SCRIPT //
//***************//

if($isloggedin == "yes"){

$article_title "You already have an account";
$article_content "You already have an account, thus there is no need for you to register a new one.";

}
else{

//Grab the post data from the form

$username $_POST["username"];
$username secure($username);
$pass1 $_POST["pass1"];
$pass1 secure($pass1);
$pass2 $_POST["pass2"];
$pass2 secure($pass2);
$email $_POST["email"];
$ip $_POST['ip'];
$birthday $_POST['birthday'];
$avatar $_POST["avatar"];
$tos $_POST["tos"];
$hidden $_POST["hidden"];
$answer $_POST["answer"];
$answer2 $_POST["answer2"];

  if(
$hidden != "goregister"){

    
//The form was not submitted, so we are showing the signup page...
    
$question grabanysetting("securityquestion");
    
$answer grabanysetting("securityanswer");
    
$article_title $regnew;
    
$article_content $regnewexplain."<br><form name='form1' method='post' action='register.php'>
      <p>Username: <input name='username' type='text' id='username' maxlength='20'></p>
      <p>Your username may be up to 20 characters long and may only contain letters, numbers and spaces. </p>
      <p>Password: <input name='pass1' type='password' id='pass1' maxlength='20'></p>
      <p>Your password may be up to 20 characters long and may contain letters, numbers, spaces and special characters. The use of a special character, such as * or ! is recommended for increased security. </p>
      <p>Confirm Password: <input name='pass2' type='password' id='pass2' maxlength='20'></p>
      <p>Email Address: <input name='email' type='text' id='email'></p>
    <p>Birthday(mm/dd/yyyy): <input name='birthday' type='text' id='birthday'></p>
      <p>Avatar url: <input name='avatar' type='text' id='avatar' value='templates/icons/default_avatar.gif'></p>
    <p>Security Question: 
{$question}
    <input name='answer' type='hidden' id='answer' value='
{$answer}'></p>
    <p>Answer: <input name='answer2' type='text' id='answer2'></p>
      <p><input name='tos' type='checkbox' id='tos' value='yes'> I agree to the <a href='tos.php' target='_blank'>Terms of Service</a>. 
      <input name='ip' type='hidden' id='ip' value='
{$_SERVER['REMOTE_ADDR']}'></p>
    <input name='hidden' type='hidden' id='hidden' value='goregister'></p>
      <p><input type='submit' name='Submit' value='Register'>
      </p></form>"
;


  }
  else{

    
//We are attempting to register the user...
    
    
$salt codegen(150);
    
$password1 passencr($username$pass1$salt);
    
$password2 passencr($username$pass2$salt);

    
//Next check that the username does not already exist...

    
$flag 0;
    
$row $adopts->select("users", array(), "username = '{$username}'")->fetchObject();
    if(
is_object($row)) $flag 1;
    
//Now we verify that the email address is a valid email address...
    
$emailisvalid "no";
    
$regex '/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i'
    
    if(
preg_match($regex$email)) $emailisvalid "yes";
    
    
//First check that something required was not left blank...

    
if($username == "" or $password1 == "" or $password2 == "" or $email == ""){
       
$article_title "Error";
       
$article_content $regblank;
    }
    else if(
$password1 != $password2){
    
       
//Passwords do not match
       
$article_title "Your passwords do not match";
       
$article_content $passnomatch;
    }
    else if(
$tos != "yes"){

       
//User did not agree to TOS
       
$article_title "Terms of Service Error";
       
$article_content $notos;
    }
    else if(
$flag 0){
    
       
//Username already exists
       
$article_title "Your username already exists";
       
$article_content $userexists;    
    }
    else if(
$emailisvalid != "yes"){

        
//Email address is not valid or is a fake
       
$article_title "Email address is not valid";
       
$article_content $emailinvalid;
    }
    else if(
$answer != $answer2){

       
//Email address is not valid or is a fake
       
$article_title "An error has occurred";
       
$article_content "It seems that you did not answer the security question correctly...";
    }
    else{

       
//All checks are done, actually create the user's account on the database

       
$date date('Y-m-d');
       
$session session_id();
       
$myssession md5($uid.$session);
       
$adopts->insert("users", array("uid" => NULL"username" => $username"salt" => $salt"password" => $password1"session" => $myssession"email" => $email"ip" => $_SERVER['REMOTE_ADDR'], 
                                      
"usergroup" => 3"birthday" => $birthday"membersince" => $date"money" => $GLOBALS['settings']['startmoney'], "friends" => NULL));
    
       
$adopts->insert("users_contacts", array("uid" => NULL"username" => $username"website" => NULL"facebook" => NULL"twitter" => NULL
                                               
"aim" => NULL"yahoo" => NULL"msn" => NULL"skype" => NULL));
    
       
$adopts->insert("users_options", array("uid" => NULL"username" => $username"newmessagenotify" => 1"pmstatus" => 0
                                              
"vmstatus" => 0"tradestatus" => 0"theme" => $GLOBALS['settings']['theme']));

       
$adopts->insert("users_profile", array("uid" => NULL"username" => $username"avatar" => $avatar"bio" => NULL"color" => NULL
                                              
"about" => NULL"favpet" => 0"gender" => 'unknown'"nickname" => NULL));                                              
    
       
$adopts->insert("users_status", array("uid" => NULL"username" => $username"canlevel" => 'yes'"canvm" => 'yes'"canfriend" => 'yes'
                                             
"cantrade" => 'yes'"canbreed" => 'yes'"canpound" => 'yes'"canshop" => 'yes'));    
        
       
//Now check if Mybb forum integration is enabled
       
if($mybbenabled == 1){
           
//Mybb forum integration is enabled, now generate the user account on Mybb forum!
           
include("functions/functions_forums.php");
           
$forums = new Database($mybbdbname$mybbhost$mybbuser$mybbpass$mybbprefix) or die("Cannot connect to forum database, please contact an admin immediately.");

           
//Now the database has been switched to mybb forum's. Before inserting user info, lets generate the password and salt in Mybb format.
           
$salty codegen(80);
           
$loginkey codegen(500);
           
$md5pass md5($pass1);
           
$fpass md5(md5($salty).$md5pass); 
           
$ip $_SERVER['REMOTE_ADDR'];
           
$altip ipgen($ip);  
           
$query "INSERT INTO {$mybbprefix}users (uid, username, password, salt, loginkey, email, postnum, avatar, avatardimensions, avatartype, usergroup, additionalgroups, displaygroup, usertitle, regdate, lastactive, lastvisit, lastpost, website, icq, aim, yahoo, msn, birthday, birthdayprivacy, signature, allownotices, hideemail, subscriptionmethod, invisible, receivepms, receivefrombuddy, pmnotice, pmnotify, threadmode, showsigs, showavatars, showquickreply, showredirect, ppp, tpp, daysprune, dateformat, timeformat, timezone, dst, dstcorrection, buddylist, ignorelist, style, away, awaydate, returndate, awayreason, pmfolders, notepad, referrer, referrals, reputation, regip, lastip, longregip, longlastip, language, timeonline, showcodebuttons, totalpms, unreadpms, warningpoints, moderateposts, moderationtime, suspendposting, suspensiontime, suspendsignature, suspendsigtime, coppauser, classicpostbit, loginattempts, failedlogin, usernotes)
                                                                               VALUES ('', '
$username', '$fpass','$salty','$loginkey','$email', '0', '', '', '0', '2', '', '0', '', 'time()', 'time()', 'time()', '0', '', '', '', '', '', '$birthday', 'all', '', '1', '0', '0', '0', '1', '0', '1', '1', '', '1', '1', '1', '1', '0', '0', '0', '', '', '0', '0', '0', '', '', '0', '0', '0', '', '', '', '', '0','0','0','$ip', '$ip','$altip','$altip','','0','1', '0', '0', '0','0','0','0','0','0','0','0','0','1','0','')";
           
$forums->query($query) or die("Failed to create forum account");

           
// Now set the cookie for user on MyBB        
           
$mybbuser $forums->select("users", array("uid""loginkey"), "username = '{$username}'")->fetchObject();
           
$cookiesettings = array();
           
$cookiesettings['cookiedomain'] = $forums->select("settings", array("value"), "name = 'cookiedomain'")->fetchColumn();
           
$cookiesettings['cookiepath'] = $forums->select("settings", array("value"), "name = 'cookiepath'")->fetchColumn();
           
$cookiesettings['cookieprefix'] = $forums->select("settings", array("value"), "name = 'cookieprefix'")->fetchColumn();
           
mybbsetcookie("mybbuser"$mybbuser->uid."_".$mybbuser->loginkeyNULLtrue$cookiesettings);

           
$mybbsid mybb_random_str(32); 
           
mybbsetcookie("sid"$mybbsid, -1true); 
       }    

       
//Now that we have created the user, let's log them in...

       
$status dologin($username$password1$myssession);

       if(
$status != "success"){
    
          
$article_title "Something is Wrong!";
          
$article_content "Something is very, very wrong.  Please contact Mysidia Adoptables about this error.";

       }
       else{

       
//We are registered and logged in...
       
$article_title $titleregsuccess;
       
$article_content $regsuccess."".$username."".$regsuccess2;

       if(
$mybbenabled == 1$article_content .= "</br></br>Welcome {$username}, and thankyou for joining the Archurub Raptor Reserve! Before you start your adventure, please read our <a href='pages.php?page=guide'>Beginner Guide!</a></br></br>You may also visit your forum account and edit your profile."

       
//Reflect our changes in the sidebar... 
       
$sidebar "Welcome {$username}, and thankyou for joining the Archurub Raptor Reserve! Before you start your adventure, please read our <a href='pages.php?page=guide'>Beginner Guide!</a>";

       }
    }
    


  }

}

//***************//
//  OUTPUT PAGE  //
//***************//

echo showpage($article_title$article_content$date);

?>
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #2  
Old 05-10-2012, 04:15 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 82,339
SilverDragonTears is on a distinguished road
Default

have you edited this file at all?
__________________

Check out SilvaTales
Reply With Quote
  #3  
Old 05-11-2012, 04:19 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 113,373
Abronsyth is on a distinguished road
Default

Yes...I edited the message that appears after a user registers...
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #4  
Old 05-11-2012, 05:44 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 82,339
SilverDragonTears is on a distinguished road
Default

I'll take a look at it and see if I can figure it out for you.
__________________

Check out SilvaTales
Reply With Quote
  #5  
Old 05-12-2012, 07:36 AM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 333,234
Hall of Famer is on a distinguished road
Default

Are you sure you posted the register.php from your site? This one looks identical to the official script, as I cant find any differences. Please lemme know where you made the changes if you can.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #6  
Old 05-12-2012, 11:19 AM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 113,373
Abronsyth is on a distinguished road
Default

Towards the very bottom, I just changed the message...but may have messed up somewhere..?
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Register Error Tequila Questions and Supports 2 02-13-2012 07:07 PM
Register glitche,can someone help me? ;A; kitty08 Questions and Supports 4 10-18-2011 03:28 AM
Register bug? KaceKuma Questions and Supports 3 10-12-2011 08:57 PM
Register with no password? Slix Questions and Supports 6 08-01-2011 12:26 PM
How to add a Re captcha Code in Register Page? SieghartZeke Questions and Supports 5 10-09-2009 03:35 AM


All times are GMT -5. The time now is 04:33 AM.

Currently Active Users: 9779 (0 members and 9779 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636