Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Failed Login (http://www.mysidiaadoptables.com/forum/showthread.php?t=643)

Tequila 04-11-2009 08:07 AM

Failed Login
 
Haven't been able to log new users in on my site. The only mods running are the User List, profile pages, and currency (shop hasn't been added yet).

All of the register files are fine, and I don't even see any problems with the login page.

Any ideas?

BMR777 04-11-2009 10:39 AM

RE: Failed Login
 
Do any of those mods alter the "users" table in the database? If they did, then you have to open register2.php and add an extra field to the portion of the script that creates a new user, as if the fields do not match up then there will be issues.

If you ran any queries on the users table post them here and I'll tell you what to edit. Otherwise let me know if you haven't edited the users table at all.

Brandon

Tequila 04-11-2009 11:05 AM

RE: Failed Login
 
I did exactly what the mod set up said to do (including the bit added to register2).

Here's my register2 file:
PHP Code:

<?php

// Easy Adoptables Script by Brandon Rusnak
// Get our includes out of the way

include("inc/functions.php");
include(
"inc/config.php");
include(
"inc/settings.php");
include(
"inc/nbbc.php");  // BBCODE Parser
$bbcode = new BBCode;


// Define our Template File

$file $current_theme;

//Get the user's data from the form

$username $_POST["username"];
$pass1 $_POST["pass1"];
$pass2 $_POST["pass2"];
$email $_POST["email"];
$tos $_POST["tos"];

//Protect the database
$username preg_replace("/[^a-zA-Z0-9\\040.]/"""$username);
$pass1 preg_replace("/[^a-zA-Z0-9s]/"""$pass1);
$pass2 preg_replace("/[^a-zA-Z0-9s]/"""$pass2);
$email preg_replace("/[^a-zA-Z0-9@._-]/"""$email);
$tos preg_replace("/[^a-zA-Z0-9s]/"""$tos);

// Connect to our database

$conn mysql_connect($dbhost$dbuser$dbpass) or die ('Error connecting to mysql database!');
mysql_select_db($dbname);



// Should we show the extra pages in the nav bar?

$link1 "";
if(
$show_extra_page1 == "yes"){
$link1 "<li><a href='$extra_page1_link'>$extra_page1_name<span class='tab-l'></span><span class='tab-r'></span></a></li>"
}

$link2 "";
if(
$show_extra_page2 == "yes"){
$link2 "<li><a href='$extra_page2_link'>$extra_page2_name<span class='tab-l'></span><span class='tab-r'></span></a></li>"
}

// Do the template changes and echo the ready template

$template file_get_contents($file);
$template replace(':SITETITLE:',$site_title,$template);
$template replace(':SITENAME:',$site_name,$template);
//$template = replace(':ARTICLETITLE:',$article_title,$template);
$template replace(':ARTICLEDATE:',date('Y-m-d'),$template);
//$template = replace(':ARTICLECONTENT:',$article_content,$template);
$template replace(':LINK1:',$link1,$template);
$template replace(':LINK2:',$link2,$template);
$template replace(':LINK3:',$link3,$template);

//Get the featured adoptable...
$featured getfeatured();
$template replace(':FEATURED:',$featured,$template);

//Ad Management
$header = @file_get_contents("ads/header.txt");
$footer = @file_get_contents("ads/footer.txt");
$tower = @file_get_contents("ads/tower.txt");

$header stripslashes($header);
$footer stripslashes($footer);
$tower stripslashes($tower);

$template replace(':HEADERAD:',$header,$template);
$template replace(':FOOTERAD:',$footer,$template);
$template replace(':TOWERAD:',$tower,$template);


//Is the user logged in?
$isloggedin "no";
if (
$isloggedin == "yes"){

}
else{

//User is not logged in
$template replace(':WELCOMEORREGISTER:','<u>Member Login:</u>',$template);
$loginform "<form name='form1' method='post' action='login.php'>
  <p>Username: 
    <input name='username' type='text' id='username'>
</p>
  <p>Password: 
    <input name='password' type='password' id='password'>
</p>
  <p>
    <input type='submit' name='Submit' value='Submit'>
  </p>
  <p>Don't have an account?<br>
  <a href='register.php'>Register Free</a>  </p>
</form>
"
;
$template replace(':LOGINORACCT:'$loginform ,$template);
}

//Check for errors...
if($username == "" or $pass1 == "" or $pass2 == "" or $email == ""){
$template replace(':ARTICLETITLE:','Error',$template);
$template replace(':ARTICLECONTENT:','A required form element was left blank.  
Please <a href="register.php">go back</a> and fill out all the form elements and try again.'
,$template);
echo 
$template;
die();

}

if(
$tos != "tosyes"){
$template replace(':ARTICLETITLE:','Error',$template);
$template replace(':ARTICLECONTENT:','You did not agree to the Terms of Service.  
You must agree to the TOS to use this site.'
,$template);
echo 
$template;
die();
}

if(
$pass1 != $pass2){
$template replace(':ARTICLETITLE:','Error',$template);
$template replace(':ARTICLECONTENT:','Your passwords do not match.  
Please <a href="register.php">go back</a> and correct this issue.'
,$template);
echo 
$template;
die();
}

//Check that username does not already exist

$query "SELECT * FROM users WHERE username = '$username'";
$result = @mysql_query($query);
$num = @mysql_numrows($result);

//Loop out code
$i=0;
while (
$i 1) {

$luser=@mysql_result($result,$i,"username");


$i++;
}

$luser strtolower($luser);
$u2 $str strtolower($username);

if(
$luser == $u2){
$template replace(':ARTICLETITLE:','Error',$template);
$template replace(':ARTICLECONTENT:','Your username has been taken.  
Please <a href="register.php">go back</a> and select a different username.'
,$template);
echo 
$template;
die();
}

//All checks pass, create the user
$pass1 md5($pass1); //MD5 the password
mysql_query("INSERT INTO users VALUES ('', '$username', '$pass1','$email','free','0')"); 

$template replace(':ARTICLETITLE:','Success',$template);
$template replace(':ARTICLECONTENT:','Your account has been created with the username '.$username.'.  
<a href="login.php">Click here to log in to your account.</a>'
,$template);


echo 
$template;
?>

and my MySQL table setup (screenshot, I added items (but that may be my problem...) as I want the items to be for the users and their pets).

http://www.rusnakweb.com/forum/attachment.php?aid=157
[attachment=157]

BMR777 04-11-2009 11:09 AM

RE: Failed Login
 
Yep, the problem is that you added that items field. Find:

PHP Code:

mysql_query("INSERT INTO users VALUES ('', '$username', '$pass1','$email','free','0')"); 

Replace With:

PHP Code:

mysql_query("INSERT INTO users VALUES ('', '$username', '$pass1','$email','free','0','0')"); 

Every time you add a field to the users table you also have to make a space for that field in the register2.php file. This is one of the reasons I discourage mods modifying existing tables and encourage them to create new tables of their own. :)

Those users will need to re-register as they were never inserted into the users table.

Tequila 04-11-2009 11:20 AM

RE: Failed Login
 
Heh, heh... I should have realized that...
I've been really having a bad Easter so far...


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

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.