Jump to content

Recommended Posts

  • 1 year later...
Posted

Hi,

I have those codes on front page :

Deprecated: mysql_query(): The mysql extension is deprecated and will
be removed in the future: use mysqli or PDO instead in
/home/pilotomeraslan/erisair.com/crew/core/common/HubTransferData.class.php
on line 9

Warning: mysql_query(): Access denied for user
'pilotomeraslan'@'localhost' (using password: NO) in
/home/pilotomeraslan/erisair.com/crew/core/common/HubTransferData.class.php
on line 9

Warning: mysql_query(): A link to the server could not be established
in /home/pilotomeraslan/erisair.com/crew/core/common/HubTransferData.class.php
on line 9

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean
given in /home/pilotomeraslan/erisair.com/crew/core/common/HubTransferData.class.php
on line 10

and on admin page

Deprecated: mysql_affected_rows(): The mysql extension is deprecated
and will be removed in the future: use mysqli or PDO instead in
/home/pilotomeraslan/erisair.com/crew/core/common/HubTransferData.class.php
on line 86

Warning: mysql_affected_rows(): Access denied for user
'pilotomeraslan'@'localhost' (using password: NO) in
/home/pilotomeraslan/erisair.com/crew/core/common/HubTransferData.class.php
on line 86

Warning: mysql_affected_rows(): A link to the server could not be
established in /home/pilotomeraslan/erisair.com/crew/core/common/HubTransferData.class.php
on line 86

Deprecated: mysql_affected_rows(): The mysql extension is deprecated
and will be removed in the future: use mysqli or PDO instead in
/home/pilotomeraslan/erisair.com/crew/admin/modules/HubTransfer/HubTransfer.php
on line 90

Warning: mysql_affected_rows(): Access denied for user
'pilotomeraslan'@'localhost' (using password: NO) in
/home/pilotomeraslan/erisair.com/crew/admin/modules/HubTransfer/HubTransfer.php
on line 90

Warning: mysql_affected_rows(): A link to the server could not be
established in /home/pilotomeraslan/erisair.com/crew/admin/modules/HubTransfer/HubTransfer.php
on line 90

please help thanks.

Posted
On 1/7/2014 at 1:00 PM, joeri said:

to all with the error try the following in your commen change the husstransfer class the part for the get all requests to the following $sql = "SELECT h.pilotid, p.firstname, p.lastname, p.email, p.hub, h.hub_initial, h.hub_req, h.date_submitted, h.reason, h.status FROM ".TABLE_PREFIX."hubtransfer h LEFT JOIN ".TABLE_PREFIX."pilots p ON p.pilotid = h.pilotid";

$ret = DB::get_results($sql);

return $ret;

this fixzd mine thanks to the help of manuel from crazy creatives

This an option still?

Posted
On 12/17/2016 at 1:26 PM, OmerAslan said:

Deprecated: mysql_affected_rows():

 

On 12/17/2016 at 1:26 PM, OmerAslan said:

Deprecated: mysql_query(): The mysql extension is deprecated

That is the explanation. Those functions are garbage now. They are useless. Have ti step up to sqli or PDO one of the two.

If the last post I quoted don't fix this, the module file needs rewritten as was done for the LoA module that had the exact same issue.

Posted
On 12/17/2016 at 1:26 PM, OmerAslan said:

Deprecated: mysql_affected_rows():

 

On 12/17/2016 at 1:26 PM, OmerAslan said:

Deprecated: mysql_query(): The mysql extension is deprecated

That is the explanation. Those functions are garbage now. They are useless. Have ti step up to sqli or PDO one of the two.

If the last post I quoted don't fix this, the module file needs rewritten as was done for the LoA module that had the exact same issue.

 

On second thought, that last fix will not work. it is the same identical code that is in the file direct from github. I'm gonna get back on the side and wait for Sava. My skills are not that great and I don't want to stear anyone in the wrong direction.

Posted
1 hour ago, TAV1702 said:

 

That is the explanation. Those functions are garbage now. They are useless. Have ti step up to sqli or PDO one of the two.

If the last post I quoted don't fix this, the module file needs rewritten as was done for the LoA module that had the exact same issue.

 

On second thought, that last fix will not work. it is the same identical code that is in the file direct from github. I'm gonna get back on the side and wait for Sava. My skills are not that great and I don't want to stear anyone in the wrong direction.

So if i understand you correctly, we have to wait for a while right?

Posted

Probably will.

I am right now as we speak looking in to it. I got all errors fixed but one. I am trying to figure out how Sava fixed it in the LoA Module. I am real close. Just not close enough to say here is a fix. My php skills kind of suck so if I even remotely come close to getting it working, that was a win  lol. Now if I fix this last error and it all works, I'm going to celebrate with a beer!

Posted (edited)

I think I might have it. I am final testing now.

**EDIT**

Please understand,m i am NOT a php expert. I don't pretend to be and not sure if my changes are safe to use live. I don't know php Security very much. With that said, I am willing to share my code changes that made this module work. I STRONGLY urge you to have someone look in to the changes to make sure they are safe to use. With that said, this module now works 100% A-ok on my website.

Admin/modules/HubTransfer/HubTransfer.php

Find:

public function delete()
        {
            $id = $this->get->id;
            $get_msg   = HubTransferData::delete($id);
            if (mysql_affected_rows() == -1)
                {
                $requests = HubTransferData::GetAllRequests(array());
                $this->set('all', $requests);
                $this->set('msg', 'Request wasn\'t de;eted. Please use the phpVMS forums to get support.');
                $this->render('hubtransfer/hubtransfer_admin_index.tpl');

                }else
                {
                $requests = HubTransferData::GetAllRequests(array());
                $this->set('all', $requests);
                $this->set('msg', 'Request successfuly deleted.');
                $this->render('hubtransfer/hubtransfer_admin_index.tpl');
                 }
        }

Change To:

public function delete()
        {
            $id = $this->get->id;
            $get_msg   = HubTransferData::delete($id);
                $this->set('msg', 'Request was de;eted.');
                $this->render('hubtransfer/hubtransfer_admin_index.php');
        }

Save File!

Open Core/Common/HubTransferDataClass.php

Find:

$query = "SELECT * FROM ".TABLE_PREFIX."hubtransfer WHERE pilotid='$pilotid'";
		$sql = mysql_query($query);
		$count = mysql_num_rows($sql);
		return $count;

Change To:

$query = "SELECT * FROM ".TABLE_PREFIX."hubtransfer WHERE pilotid='$pilotid'";
		$count = DB::num_rows(DB::get_results($query)); 
		return $count;

Find:

public static function delete($id)
	{
		$sql = "DELETE FROM ".TABLE_PREFIX."hubtransfer WHERE pilotid='$id'";
		$query = DB::query($sql);
		return mysql_affected_rows();
	}

Change To:

public static function delete($id)
	{
		$sql = "DELETE FROM ".TABLE_PREFIX."hubtransfer WHERE pilotid='$id'";
		$query = DB::query($sql);
		return $count;
	}

Save File!

And I believe that will get you in the game. All my functions work as they should including pending, delete and approve and all email functions.

 

Use at your own risk! If someone comes along who actually knows what they are talking about, please feel free to correct me. This was just a honest try is all. if i am wrong I apologize.

Edited by TAV1702
Added Info
Posted (edited)

Just confirming that those errors are mainly to do with the core/common/HubTransferData.class.php

Delete function should look like this now

public static function delete($id) {
  $sql = "DELETE FROM ".TABLE_PREFIX."hubtransfer WHERE pilotid = '$id'";
  DB::query($sql);
}

And the new CheckRequest function

public static function CheckRequest($pilotid)  {
  $pilotid = intval($pilotid);
  $query = "SELECT * FROM ".TABLE_PREFIX."hubtransfer WHERE pilotid = '$pilotid'";
  $count = DB::num_rows(DB::get_results($query));
  return $count;
}

Or if that last function doesn't work, try swapping out the DB::get_results for DB::get_row as I can't tell whether it is being used to get one or more results.

Edited by web541
Posted

Ah ya ninja posted me  lol. I just edited my post with the fixes I had to do to make it work. please feel free to look at my post and tell me how wrong it is  lol but it actually works.

Posted (edited)
24 minutes ago, web541 said:

Just confirming that those errors are mainly to do with the core/common/HubTransferData.class.php

Delete function should look like this now


public static function delete($id) {
  $sql = "DELETE FROM ".TABLE_PREFIX."hubtransfer WHERE pilotid = '$id'";
  DB::query($sql);
}

And the new CheckRequest function


public static function CheckRequest($pilotid)  {
  $pilotid = intval($pilotid);
  $query = "SELECT * FROM ".TABLE_PREFIX."hubtransfer WHERE pilotid = '$pilotid'";
  $count = DB::num_rows(DB::get_results($query));
  return $count;
}

Or if that last function doesn't work, try swapping out the DB::get_results for DB::get_row as I can't tell whether it is being used to get one or more results.

yes it works. only i get this code on admin page but not important at all... Thanks a lot.

Deprecated: mysql_affected_rows(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/pilotomeraslan/erisair.com/crew/admin/modules/HubTransfer/HubTransfer.php on line 90

Warning: mysql_affected_rows(): Access denied for user 'pilotomeraslan'@'localhost' (using password: NO) in /home/pilotomeraslan/erisair.com/crew/admin/modules/HubTransfer/HubTransfer.php on line 90

Warning: mysql_affected_rows(): A link to the server could not be established in /home/pilotomeraslan/erisair.com/crew/admin/modules/HubTransfer/HubTransfer.php on line 90

 

Edited by OmerAslan
Posted (edited)
27 minutes ago, TAV1702 said:

Ah ya ninja posted me  lol. I just edited my post with the fixes I had to do to make it work. please feel free to look at my post and tell me how wrong it is  lol but it actually works.

No, not a problem at all, everyone has a right to contribute and coding can be done in many different ways, some cleaner than others, some not so clean, but in the end it still works and that's what counts! I have also made my revisions on my Github account if you want to take a look.

17 minutes ago, OmerAslan said:

yes it works. only i get this code on admin page but not important at all... Thanks a lot.


Deprecated: mysql_affected_rows(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/pilotomeraslan/erisair.com/crew/admin/modules/HubTransfer/HubTransfer.php on line 90

Warning: mysql_affected_rows(): Access denied for user 'pilotomeraslan'@'localhost' (using password: NO) in /home/pilotomeraslan/erisair.com/crew/admin/modules/HubTransfer/HubTransfer.php on line 90

Warning: mysql_affected_rows(): A link to the server could not be established in /home/pilotomeraslan/erisair.com/crew/admin/modules/HubTransfer/HubTransfer.php on line 90

 

Feel free to change out your admin/modules/HubTransfer/HubTransfer.php file for mine here and that should fix the problem above.

I have just removed the mysql_affected_rows check as you really don't need to know whether it has been deleted or not, because in the end it will show up (or not if it has just been deleted) in the AllRequests list anyway.

Edited by web541
  • Like 2
Posted
1 hour ago, web541 said:

Just confirming that those errors are mainly to do with the core/common/HubTransferData.class.php

Delete function should look like this now


public static function delete($id) {
  $sql = "DELETE FROM ".TABLE_PREFIX."hubtransfer WHERE pilotid = '$id'";
  DB::query($sql);
}

And the new CheckRequest function


public static function CheckRequest($pilotid)  {
  $pilotid = intval($pilotid);
  $query = "SELECT * FROM ".TABLE_PREFIX."hubtransfer WHERE pilotid = '$pilotid'";
  $count = DB::num_rows(DB::get_results($query));
  return $count;
}

Or if that last function doesn't work, try swapping out the DB::get_results for DB::get_row as I can't tell whether it is being used to get one or more results.

yes it works. only i get this code on admin page but not important at all...

Deprecated: mysql_affected_rows(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/pilotomeraslan/erisair.com/crew/admin/modules/HubTransfer/HubTransfer.php on line 90

Warning: mysql_affected_rows(): Access denied for user 'pilotomeraslan'@'localhost' (using password: NO) in /home/pilotomeraslan/erisair.com/crew/admin/modules/HubTransfer/HubTransfer.php on line 90

Warning: mysql_affected_rows(): A link to the server could not be established in /home/pilotomeraslan/erisair.com/crew/admin/modules/HubTransfer/HubTransfer.php on line 90

woow totally fixed. Thanks.

  • 10 months later...
  • 2 years later...
Posted (edited)

Hi everyone!


I have downloaded and installed the "Hub Transfer Request" module and it works perfectly but I get the following error (view image)

 

https://i.ibb.co/NN9bTrk/Screenshot-2.png


Deprecated: Non-static method HubTransferData::GetAllHubs() should not be called statically in /home/level/public_html/phpvms/core/modules/HubTransfer/HubTransfer.php on line 30

 

This is the code:

 

<?php
/**
 * Hub Transfer Request v.1.0 
 * 
 * phpVMS Module for pilots to submit a Hub Transfer request that is stored in a database 
 * and an option for staff to view all the requests through the admin panel and decide to reject/approve the request.
 * This module is released under the Creative Commons Attribution-Noncommercial-Share Alike  3.0 Unported License
 * Note: Please play fair. I will act immediately upon receiving information of copyright infringement. Thank you.
 * @author Sava Markovic - airserbiavirtual.com
 * @copyright Copyright (c) 2012, Sava Markovic
 * @link http://www.airserbiavirtual.com
 * @license http://creativecommons.org/licenses/by-nc-sa/3.0/
 */

class HubTransfer extends CodonModule 

  {

    public $title = "Hub Transfer Request";
    
    public function index ()
        {
           if (!Auth::LoggedIn())
             {
              $this->set('error', 'You are not logged in.');
              $this->render('hubtransfer/hubtransfer_error.php');
             } 
             else
             {
              $hubs = HubTransferData::GetAllHubs(array()); //have to set the values for populating the drop down list
              $this->set('all_hubs', $hubs);
              $this->render('hubtransfer/hubtransfer_index.php');
             }
        }
  
    public function submit()
        {
             if ($this->post->reason == '') //checking if the reason filed is empty, you can change == '' to something like > 20 to require more than 20 characters
              {
               $this->set('error', 'You haven\'t specified a reason for your hub transfer request. Please supply one below. Thank you.');
               $this->render('hubtransfer/hubtransfer_error.php');
               $hubs = HubTransferData::GetAllHubs(array());
               $this->set('all_hubs', $hubs);
               $this->render('hubtransfer/hubtransfer_index.php'); 
              }
              else
              {
                $reqcheck = HubTransferData::CheckRequest(Auth::$userinfo->pilotid); //checking if there is already a request with the logged in pilot's id
                if ($reqcheck > 0)
                  {
                   $this->set('error', 'You already have a hub transfer request submitted for your ID.');
                   $this->render('hubtransfer/hubtransfer_error.php');
                   $hubs = HubTransferData::GetAllHubs(array());
                   $this->set('all_hubs', $hubs);
                   $this->render('hubtransfer/hubtransfer_index.php');
                  }
                  else 
                  {
                    $data = array(
                            'pilotid'        => Auth::$userinfo->pilotid,
                            'hub_initial'    => Auth::$userinfo->hub,
                            'hub_req' => $this->post->desired_hub,
                            'date_submitted' => date("F jS, Y"),
                            'reason'         => $this->post->reason
                            );
                    //loaded the array, do the magic

                    HubTransferData::AddRequest($data);
                    $this->SendMail();

                  }

              }
        }

    protected function SendMail()
        {
            //sending email to pilot
            $subject = SITE_NAME . ' Hub Transfer Request Submitted';
            $email = Auth::$userinfo->email;
            $message = "This is an automated message sent by our system. <br> Your request has been submitted and processed by our system. You will be contacted when our staff team reviews your request. <Br> Thank you.";
            Util::SendEmail($email, $subject, $message);

            //send email to admin 
            $subject_admin = SITE_NAME . ' A pilot has submitted a Hub Transfer Request';
            $email_admin = ADMIN_EMAIL;
            $message_admin = "A pilot has submitted a Hub Transfer Request. Review the request from the administration panel.";
                                                          
            Util::SendEmail($email_admin, $subject_admin, $message_admin);
            //after all is done, render the submitted tpl file

            $this->render('hubtransfer/hubtransfer_submitted.php');

    }
  }


 

I really appreciate the help to fix this error. I am using: Version 5.5.2.72 simpilot / php7.2.

 

Thank you so much.

Edited by VIELMA16
  • Administrators
Posted

Search the forums for "Non-static method" - it's been covered many times before.

 

If you search for that, you will learn how to fix it - as it will probably occur in other modules as well. If we fix it for you, you won't ever learn how to fix it yourself.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...