Jump to content

I'm getting 1 where the username should be


Guest

Recommended Posts

Here's the class

 

<?php
session_start();

class Train
{
    private $_clicked;
    private $_name;
    
    
    function __construct()
    {
      $this->_name = (string) $_SESSION['nrpgusername'];
      $this->_clicked = (int) $_SESSION['clicked'];     
    }
    
    public function CheckLogged()
    {
        if(isset($this->_name))
         {}
        else{die("you must be logged in!");}
        
    }
    
    public function CheckClicked()
    {
        if(isset($_POST['go']))
        {
            $this->MysqlUpdate();
            $this->_clicked = 1;
            session_set_cookie_params(84600);
        }
       
        
    }
    
    public function Clicked()
    {
       
       if(isset($this->_clicked))
       {   echo'
            <div id="train"><img src="images/train.jpg" alt="train image"/></div> 
             <div id="text">
              <span id="click">' . $this->_name. ' has gained 7 experience,<br /> and cannot train anymore today.         </span><form method ="post" name="train" action=""> </div>'; 

       }
       
       else
        {
          echo'
           <div id="train"><img src="images/train.jpg" alt="train image"/></div> 
            <div id="text"><span id="click">Click here to train your shinobi!</span>
             <form method ="post" name="train" action=""><input type="submit" name="go" value="train"  /></div>';}

        }

    
    private function MysqlUpdate()
    {
      include("database.php");
      $query = "UPDATE account_info SET experience = experience + 7 WHERE username = '$this->name'"; 
      $result = mysql_query($query) or die(mysql_error());
    }


}


?>

 

For some reason, it's showing 1 has gained 7 experience,

and cannot train anymore today.

Instead of Tony has gained 7 experience,

and cannot train anymore today.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.