Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Mys v1.3.x Mods (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=42)
-   -   Mys v1.3.4 Word Scramble Game (http://www.mysidiaadoptables.com/forum/showthread.php?t=4996)

Hwona 01-27-2016 10:42 PM

Word Scramble Game
 
This word scramble game is a modification of Kyttias's HiLo game! ~courtesy of Kyttias

Word Scramble Game
http://i1290.photobucket.com/albums/...pswnetlzoj.png
Demo: JSBin Preview
Download: Compressed Folder
View game at yoursite.com/wordscramble

Please upload these files:

games/.htaccess
games/wordscramble/sendscore.php
games/wordscramble/wordscramble.php
games/wordscramble/wordscramble.css
games/wordscramble/wordscramble.js
wordscramble.php
classes/class_cookies.php (replace the original file)
view/wordscramble.php

Create this table if you haven't:

phpMyAdmin->SQL->paste
Code:

CREATE TABLE IF NOT EXISTS `adopts_games` (
  `gid` int(11) NOT NULL AUTO_INCREMENT,
  `game` varchar(30) NOT NULL,
  `username` varchar(30) NOT NULL,
  `plays` int(11) NOT NULL,
  `timestamp` int(11) NOT NULL,
  PRIMARY KEY (`gid`),
  UNIQUE KEY `key` (`gid`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=0;

Modifying Game Code (Advised):
The script runs games/wordscramble/wordscramble.js not games/wordscramble/wordscramble_non.js. wordscramble.js is obfuscated for security: Re-obfuscate Edited Files Here.

This game uses three filler words to unscramble! Don't forget to add more! To do so, edit the arrays at lines 8 and 40 in wordscramble_non.js. Then, obfuscate the code and paste it into wordscramble.js.

Abronsyth 01-28-2016 09:36 AM

Er, ok, something's definitely not right. As soon as I submit the answer it tells me game over, see you tomorrow, and says I have 0 plays left for today (though I've only played once), and then if I refresh the page it resets and says
"Plays Left Today: of 20"

Not updated my currency amount at all, though I guarantee I am getting the answers correct. The only thing I changed in the files would be the words available to unscramble.

It's also not updating at all anywhere in the database, despite me now having attempted to play 4 times.

Even with the 100% original files it's still having this error.

Hwona 01-28-2016 10:00 AM

*bangs head on table*
I forgot one more thing... I recently posted a code replacement for the class cookies file in the hilo thread. Please replace your original file with that? Sorry, Ill do a proper thread update when I have access to my computer.

Abronsyth 01-28-2016 04:17 PM

Oh dear, I tried that and it resulted in this;
Catchable fatal error: Argument 2 passed to Registry::set() must implement interface Resource\Native\Objective, instance of Cookies given, called in /home/catisserie/public_html/classes/class_mysidia.php on line 237 and defined in /home/catisserie/public_html/classes/class_registry.php on line 198

Hwona 01-28-2016 04:21 PM

Quote:

Originally Posted by Abronsyth (Post 33605)
Oh dear, I tried that and it resulted in this;
Catchable fatal error: Argument 2 passed to Registry::set() must implement interface Resource\Native\Objective, instance of Cookies given, called in /home/catisserie/public_html/classes/class_mysidia.php on line 237 and defined in /home/catisserie/public_html/classes/class_registry.php on line 198

Yikes! I guess mys.1.3.4 class files are different too! Try this:
PHP Code:

<?php

/**
 * The Cookies Class, it is one of Mysidia system core classes.
 * It acts as an initializer and wrapper for Mys-related cookies.
 * Cookies is a final class, no child class shall derive from it.
 * An instance of Cookies class is generated upon Mysidia system object's creation. 
 * This specific instance is available from Registry, just like any other Mysidia core objects. 
 * @category Resource
 * @package Core
 * @author Hall of Famer 
 * @copyright Mysidia Adoptables Script
 * @link http://www.mysidiaadoptables.com
 * @since 1.3.2
 * @todo better naming of cookies methods.
 */

final class Cookies extends Core{

    
/**
     * The mysuid property, which stores the id of the current user. 
     * For guest, this id is 0.     
     * @access private
     * @var Int
    */
    
private $mysuid;
    
    private 
$mysusername;
  
    
/**
     * The myssession property, which stores the session var of the current user. 
     * @access private
     * @var String
    */
    
private $myssession;
   
    
/**
     * The mysactivity property, which stores the timestamp for the current user's last activity. 
     * @access private
     * @var Int
    */
    
private $mysactivity;
  
    
/**
     * The mysloginattempt property, which stores how many failed login attempt made by this particular user.
     * @access private
     * @var Int
    */
    
private $mysloginattempt;

    
    
/**
     * Constructor of Cookies Class, it loads mys-related cookie vars from $_COOKIE superglobals.    
     * @access public
     * @return Void
     */     
    
public function __construct(){
        
$keyarray = array("mysuid""mysusername""myssession""mysactivity""mysloginattempt");
        foreach(
$_COOKIE as $key => $val){
            if(
in_array($key$keyarray)) $this->$key $val;
        }    
    }
    
    
/**
     * The get method, which retrieves private cookie item from Cookies object.  
     * If supplied argument is invalid, an exception will be thrown.
     * @param String  $prop
     * @access public
     * @return Boolean
     */    
    
public function getcookies($prop){
        if(!
property_exists('Cookies'$prop)) throw new Exception('The specified cookie is invalid...');
        return 
$this->$prop;
    }
  
    
/**
     * The set method, which handles the four basic cookies vars for user who has just successfully logged in.  
     * If operation is successful, the method returns a Boolean value True, so it can be used in conditional statement.
     * @access public
     * @return Boolean
     */
    
public function setcookies($username){
        
$mysidia Registry::get("mysidia");
        
ob_start();
        
$Month 2592000 time();
        
$this->mysuid $mysidia->db->select("users", array("uid"), "username = '{$username}'")->fetchColumn();
        
setcookie("mysuid",$this->mysuid,$Month"/"$_SERVER['HTTP_HOST']);
        
$this->mysusername $username;
        
setcookie("mysusername",$this->mysusername,$Month"/"$_SERVER['HTTP_HOST']);     
        
$session $mysidia->session->getid();
        
$this->myssession md5($this->mysuid.$session);     
        
setcookie("myssession",$this->myssession,$Month"/"$_SERVER['HTTP_HOST']);     
        
$this->mysactivity time();
        
setcookie("mysactivity",$this->mysactivity,$Month"/"$_SERVER['HTTP_HOST']);
        
$this->mysloginattempt 0;
        
setcookie("mysloginattempt"$this->mysloginattempt,$Month"/"$_SERVER['HTTP_HOST']);
        
ob_flush();
        return 
TRUE;
    }
    
    
/**
     * The setadmincookie method, which handles admincp related cookies.  
     * If operation is successful, the method returns a Boolean value True, so it can be used in conditional statement.
     * @access public
     * @return Boolean
     */
    
public function setAdminCookies(){
        
$mysidia Registry::get("mysidia");
        
ob_start();
        
$Month 2592000 time();
        
$session $mysidia->session->getid();
        
$this->mysadmsession sha1($this->mysuid.$session);     
        
setcookie("mysadmsession",$this->mysadmsession,$Month"/"$_SERVER['HTTP_HOST']);    
        
$this->mysadmloginattempt 0;
        
setcookie("mysadmloginattempt"$this->mysadmloginattempt,$Month"/"$_SERVER['HTTP_HOST']);
        
ob_flush();
        return 
TRUE;
    }

    
/**
     * The delete method, which gets rid of cookies to enable users to log out of the site. 
     * If operation is successful, the method returns a Boolean value True, so it can be used in conditional statement.
     * @access public
     * @return Boolean
     */
    
public function deletecookies(){   
        
$expire time() - 2592000;
        
ob_start();
        
setcookie("mysuid"""$expire"/"$_SERVER['HTTP_HOST']);
        
setcookie("mysusername"""$expire"/"$_SERVER['HTTP_HOST']);
        
setcookie("myssession"""$expire,"/"$_SERVER['HTTP_HOST']);
        
setcookie("mysactivity"""$expire"/"$_SERVER['HTTP_HOST']);
        
setcookie("mysloginattempt"""$expire"/"$_SERVER['HTTP_HOST']);
        
ob_flush();
        return 
TRUE;
    }

    
/**
     * The login method, which evaluates the login attempt of a guest user.
     * @access public
     * @return Void
     */
    
public function logincookies($reset FALSE){
        if(!
$reset$this->mysloginattempt++;        
        else 
$this->mysloginattempt 0;
        
ob_start();
        
$Month 2592000 time();
        
setcookie("mysloginattempt"$this->mysloginattempt,$Month"/"$_SERVER['HTTP_HOST']);
        
ob_flush();
    }

    
/**
     * The admLogin method, which evaluates the login attempt from admin control panel.
     * @access public
     * @return Void
     */
    
public function loginAdminCookies($reset FALSE){
        if(!
$reset$this->mysadmloginattempt++;        
        else 
$this->mysadmloginattempt 0;
        
ob_start();
        
$Month 2592000 time();
        
setcookie("mysadmloginattempt"$this->mysadmloginattempt,$Month"/"$_SERVER['HTTP_HOST']);
        
ob_flush();
    }      
}
?>

Edit: Okay, I'm so sorry... I don't know what's wrong with me. The class_cookies file needs to be swapped again. It's correct now.

Abronsyth 01-28-2016 07:23 PM

Okay, it seems to be working so far...hopefully the reset tomorrow works as well (since that's where I was running into major issues with Kyttias's game script).

Thank you, Wallie :)

Edit; Just a note, all of my users have had to log out and then log back in to get it to work correctly.

Hwona 01-28-2016 07:54 PM

Quote:

Originally Posted by Abronsyth (Post 33613)
Okay, it seems to be working so far...hopefully the reset tomorrow works as well (since that's where I was running into major issues with Kyttias's game script).

Thank you, Wallie :)

Edit; Just a note, all of my users have had to log out and then log back in to get it to work correctly.

I hope it works out for you! :D

gunpowdercat 02-16-2016 12:50 PM

Uploaded the files, tried to visit the game, I get this message;
http://prntscr.com/a445x7

NobodysHero 02-16-2016 06:01 PM

Error Message
 
Quote:

Originally Posted by gunpowdercat (Post 33822)
Uploaded the files, tried to visit the game, I get this message;
http://prntscr.com/a445x7

Looks like the files might not have all uploaded to the right spot. Try reuploading the files. If you didn't before, use Filezilla or something similar to drag and drop the files inside the zip.

Hope this helps.

gunpowdercat 02-17-2016 03:03 PM

Quote:

Originally Posted by NobodysHero (Post 33836)
Looks like the files might not have all uploaded to the right spot. Try reuploading the files. If you didn't before, use Filezilla or something similar to drag and drop the files inside the zip.

Hope this helps.

For some reason, it duplicated the games folder. deleting one of them helped. Thanks!

gunpowdercat 02-17-2016 03:11 PM

This one does the same exact thing as Kyttia's hi-lo game-- if you get it correct, it malfunctions and stops working

Kyttias 02-17-2016 07:49 PM

It's really weird two of you are having issues when I know three or four of us are using it actively on our own sites without issue... I almost want to ask if you guys are using a certain browser? (I develop mostly in Chrome, but my gf tests everything in FireFox.) Do the JSBin previews in both our threads present the problem for you?

Abronsyth 02-17-2016 09:36 PM

The JSBin preview is perfectly fine, and I am using Google Chrome. Many of my users are experiencing the issues, sadly (and they use a wide range of browsers). However, the HiLo game has been working fine since the most recent update of it.

gunpowdercat 02-18-2016 07:48 AM

I use firefox; I tested it on the jsb preview, andd it works perfectly fine.

Suzanne 06-15-2016 10:58 AM

Works perfectly. Thank you so much for providing this.

parayna 12-20-2016 05:00 PM

I also had the problem with it not working correctly but after clearing my cookies it fixed itself. That might be an issue with some people?

Chaos77777 01-30-2017 12:51 AM

I needed to put jQuery in my template to make it work, that might be the problem for others

Abronsyth 01-30-2017 09:22 AM

Tested this now that I have jQuery in my template and it seems to be working so far. I'll have to wait out the time-stamp to know for sure.

EDIT: After waiting out the time stamp I had issues where I just could keep replaying it but not ever receive a reward. I just replaced the sendscore.php file with that from the HiLo game, changed "HiLo" to "Word Scramble" and now it's working perfectly!


All times are GMT -5. The time now is 06:24 PM.

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