Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Community Board > Mysidia Adoptables Official Announcement

Notices

Closed Thread
 
Thread Tools Display Modes
  #51  
Old 04-09-2012, 03:23 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 82,271
SilverDragonTears is on a distinguished road
Default

Ok clicked one and it let me level: You already leveled this adoptable today. You may only level an adoptable once per day. Please come back tomorrow to level this adoptable again.The record is stored as 547 in the voters table.

Clicked another and got this (that I hadn't leveled)
ou already leveled this adoptable today. You may only level an adoptable once per day. Please come back tomorrow to level this adoptable again.The record is stored as 39 in the voters table.
__________________

Check out SilvaTales
  #52  
Old 04-09-2012, 03:31 PM
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: 332,166
Hall of Famer is on a distinguished road
Default

I see, now it is possible that something is wrong with your table prefix.voters, the very last one from your database. Take a look at the row with void '39' and '547', chances are the record of you clicking on these adoptables were already stored in database. Its weird though, no way it should occur with the way I designed the script...
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
  #53  
Old 04-09-2012, 03:44 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 82,271
SilverDragonTears is on a distinguished road
Default

Should I empty it?

Derp. It was the adoptid. You know how I have letters? Forgot to change it in that db :/
__________________

Check out SilvaTales
  #54  
Old 04-09-2012, 04:24 PM
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: 332,166
Hall of Famer is on a distinguished road
Default

Ah I see. I did some test myself and it seems to be working too, glad you figured it out on your own. At least, well, I know for sure this is not a glitch with the new script. I was quite worried before. XD
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
  #55  
Old 04-09-2012, 05:54 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 82,271
SilverDragonTears is on a distinguished road
Default

Darn me and my need for letter codes :D Everyone is ok with the site re install. The new pound features are really neat and I saved everyone's dragons so it's all good. But now I have to get use to another new way of coding, lol. How do I join tables?
__________________

Check out SilvaTales
  #56  
Old 04-09-2012, 09:54 PM
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: 332,166
Hall of Famer is on a distinguished road
Default

I see, glad it works out nicely, thought your members will be angry at the fact that they have to start over again. I do recommend you to be careful next time, you have an active site running already so the cost of rebuilding your site is immensely high compared to those who do not have much activity going on.

Actually the old code still works, you can write $query = "' and run it with $adopts->query(). Thats the beauty of the database class, it has backward compatibility. The new methods are really easy to use though, if you want to learn. The below code demonstrates such an example:

PHP Code:
$row $adopts->join("users_status""users_status.uid = users.uid")->join("users_profile""users_profile.uid = users.uid")
                ->
join("users_options""users_options.uid = users.uid")->join("users_contacts""users_contacts.uid = users.uid")
                ->
select("users", array(), constant("PREFIX")."users.username = '{$user}'")->fetchObject(); 
So the script means you are joining the table users, users_contacts, users_options, users_profile and users_status with records that share the same user id, the where clause is username = $user. Note the current join() method has a tiny bit of problem, as you have to use ".constant('PREFIX')." in the statement. The idea of this database class is to get rid of having to play with table prefixes though, and we will fix it soon.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
  #57  
Old 04-09-2012, 10:01 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 82,271
SilverDragonTears is on a distinguished road
Default

Hmm having some issues with it. I want to join owned_adoptables and adoptables... not sure really how to write it out though. I need currentlevel from owned_adoptables and description, hatchdescript, hatchmdescript and adult descript from adoptables.
__________________

Check out SilvaTales
  #58  
Old 04-09-2012, 10:09 PM
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: 332,166
Hall of Famer is on a distinguished road
Default

The code should look like this:

PHP Code:
$pet $adopts->join("adoptables""adoptables.type = owned_adoptables.type")->select("owned_adoptables", array(), constant("PREFIX")."owned_adoptables.aid = '{$aid}'")->fetchObject(); 
The script means that you are joining tables adoptables and owned_adoptables by referencing the field 'type', which is supposed to be the same for each row fetched from database. The new script allows you to chain class methods by fetching object or array directly after a select query is used, so you do not need to write separate lines for mysql select codes. After applying the codes above, all you have to do is to retrieve the properties such as:

PHP Code:
$pet->id //The adoptables species id from table prefix.adoptables
$pet->description // The adoptables species description from table prefix.adoptables
$pet->currentlevel // The adoptables currentlevel from table prefix.owned_adoptables
$pet->totalclicks // The adoptables totalclicks from table prefix.owned_adoptables 
If you want to join another table, just use the join() method twice in the script and chain them with select() and fetchObject() methods, it will work out nicely too.

And btw the script now wont autoban your user unless they try to adopt pets that have been taken away from pound center one day ago or earlier. In future I may improve this performance by allowing admins to determine how long this 'session' is going to be. Of course if you have a user trying to adopt a pet that has been adopted one day ago, he/she is most likely a cheater/hacker using inspect element(unless he/she takes a day to adopt a pound pet, which is stupid I say?). XD
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
  #59  
Old 04-09-2012, 10:17 PM
KaceKuma KaceKuma is offline
I am a Fish.
 
Join Date: Sep 2011
Location: Under the sea
Posts: 28
Gender: Female
Credits: 2,431
KaceKuma is on a distinguished road
Default

I did everything you said to do to upgrade my sire from 1.3.0 to 1.3.1 and something is wrong :\ Everytime I try to login it just says I have a programing error...help?!

Snapshot: http://www.iaza.com/work/120410C/iaza18671524773200.png

Code of Login Page:
Quote:
<?php

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

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

if($isloggedin == "yes"){

$article_title = $langislog;
$article_content = $langislogfull;

}
else{

//User is not logged in, so let's attempt to log them in...

$username = $_POST["username"];
$username = secure($username);
$password = $_POST["password"];
$password = secure($password);
$salt = $_POST["salt"];
$salt = secure($salt);

//User is not logged in

$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>
<a href='forgotpass.php'>Forgot your password? Click Here</a>
</form>";



if($loggedinname == "" and $password == ""){
// User is viewing login form
$article_title = "Member Login:";

$article_content = $loginform;
}
else if(($username != "" and $password == "") or ($username == "" and $password != "") ){

//Something was left blank
$article_title = "Login Error:";
$article_content = "Something was left blank. Please try logging in again.<br><br>{$loginform}";

}
else if($username != "" and $password != ""){
// Try to log the user in

$user = $adopts->select("users", array(), "username = '{$username}'")->fetchObject();
$password = passencr($username, $password, $user->salt);

if($username == $user->username and $password == $user->password){
$article_title = "Login Successful!";
$article_content = "Welcome back {$username}. You are now logged in. <a href='account.php'>Click Here to view or edit your account.</a>";

// Set the cookie
$Month = 2592000 + time();
// Convert from username to uid to secure data, no need for password since it is already hashed.
$uid = usernametouid($username);
$session = session_id();
$myssession = md5($uid.$session);
setcookie("mysuid",$uid,$Month);
setcookie("myssession",$myssession,$Month);

// Now update the user login session
$adopts->update("users", array("session" => $myssession), "username = '{$username}'");

// Time for forum-integration check
include("inc/config_forums.php");
if($mybbenabled == 1){
include_once("functions/functions_forums.php");
$forums = new Database($mybbdbname, $mybbhost, $mybbuser, $mybbpass, $mybbprefix) or die("Cannot connect to forum database, please contact an admin immediately.");
$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->loginkey, NULL, true, $cookiesettings);

$mybbsid = mybb_random_str(32);
mybbsetcookie("sid", $mybbsid, -1, true);
}
}
else{
$article_title = "Login Failed!";
$article_content = "Sorry, we could not log you on with the details specified. You can <a href='login.php'>try again</a> or <a href='forgotpass.php'>request a password reset.</a>";
$fail = 1;
}
}




}


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

echo showpage($article_title, $article_content, $date);

?>
__________________
Just your average everyday human bean.
  #60  
Old 04-09-2012, 10:17 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 82,271
SilverDragonTears is on a distinguished road
Default

No, what I'm trying to do is if an adopt is a certain currentlevel, then show a certain description...

Code:
if($row->currentlevel == '6') {
$article_content .="<p align='justify'>{$row->adultdescript}";
}else if($row->currentlevel == '5') {
$article_content .="<p align='justify'>{$row->hatchmdescript}";
}else if($row->currentlevel == '4') {
$article_content .="<p align='justify'>{$row->hatchdescript}";
}else if($row->currentlevel <= '3') {
$article_content .="<p align='justify'>{$row->description}";
}
__________________

Check out SilvaTales
Closed Thread


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
Mysidia Adoptables v1.3.3[Security Release] Hall of Famer Mysidia Adoptables Official Announcement 122 05-18-2013 04:02 PM
Mysidia Adoptables v1.3.0[Security Release] Hall of Famer Mysidia Adoptables Official Announcement 180 04-01-2012 10:16 PM
Mysidia Adoptables v1.2.0[Security Release] Hall of Famer Mysidia Adoptables Official Announcement 21 03-22-2011 04:13 PM
Mysidia Adoptables v1.1.4[Security Release] Hall of Famer Mysidia Adoptables Official Announcement 15 01-28-2011 11:48 AM
Mysidia Adoptables v1.1.3[Security Release] Hall of Famer Mysidia Adoptables Official Announcement 27 01-26-2011 02:59 PM


All times are GMT -5. The time now is 07:20 AM.

Currently Active Users: 391 (0 members and 391 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