Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Unable to login Admin


Guest

Recommended Posts

Hi all...

 

Store has been working fine, but I received an email from a customer complaing about shipping cost that was way over priced. So I went to login the admin panel and........

 

I am receivng this error:

 

Fatal error: Cannot re-assign $this in /usr/local/apache2/htdocs/cnt-web1/catalog/admin/includes/classes/upload.php on line 31

 

 

Sorry I have no idea what happen or how to correct this. Any help will be much appreciated.

 

Thanks,

 

Bill...

Link to comment
Share on other sites

you will have to post the code for the file upload.php so people can check to see what the issue is.. Obviously it is one or around line 31.. but please post the entire code.

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

you will have to post the code for the file upload.php so people can check to see what the issue is.. Obviously it is one or around line 31.. but please post the entire code.

 

 

So that code would be the "whole" upload.php file?

Link to comment
Share on other sites

yes. post the ENTIRE code.. the issue is on or around the line 31, but having the entire coding for the file will help in general.. So if you could go ahead and post that, you will be on a roll..

 

for future reference.. when you get an error that shows ANY type of file path, you will get a LOT quicker response and better help if you just go ahead and post the code for the file that the error is pointing too.. like in this instance, the upload.php file.. People do get sick of asking the SAME question over and over again " can you please post the code for XXX" No offense, just for future reference.. AND for anyone who MIGHT read this post that have not yet posted.

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

Hi,

 

Below is a paste of the file... but why all of a sudden would this fail?

 

Thanks,

 

Bill...

 

 

 

<?php

/*

$Id: upload.php,v 1.2 2003/06/20 00:18:30 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

class upload {

var $file, $filename, $destination, $permissions, $extensions, $tmp_filename, $message_location;

 

function upload($file = '', $destination = '', $permissions = '777', $extensions = '') {

$this->set_file($file);

$this->set_destination($destination);

$this->set_permissions($permissions);

$this->set_extensions($extensions);

 

$this->set_output_messages('direct');

 

if (tep_not_null($this->file) && tep_not_null($this->destination)) {

$this->set_output_messages('session');

 

if ( ($this->parse() == true) && ($this->save() == true) ) {

return true;

} else {

// self destruct

$this = null;

 

return false;

}

}

}

 

function parse() {

global $messageStack;

 

if (isset($_FILES[$this->file])) {

$file = array('name' => $_FILES[$this->file]['name'],

'type' => $_FILES[$this->file]['type'],

'size' => $_FILES[$this->file]['size'],

'tmp_name' => $_FILES[$this->file]['tmp_name']);

} elseif (isset($GLOBALS['HTTP_POST_FILES'][$this->file])) {

global $HTTP_POST_FILES;

 

$file = array('name' => $HTTP_POST_FILES[$this->file]['name'],

'type' => $HTTP_POST_FILES[$this->file]['type'],

'size' => $HTTP_POST_FILES[$this->file]['size'],

'tmp_name' => $HTTP_POST_FILES[$this->file]['tmp_name']);

} else {

$file = array('name' => (isset($GLOBALS[$this->file . '_name']) ? $GLOBALS[$this->file . '_name'] : ''),

'type' => (isset($GLOBALS[$this->file . '_type']) ? $GLOBALS[$this->file . '_type'] : ''),

'size' => (isset($GLOBALS[$this->file . '_size']) ? $GLOBALS[$this->file . '_size'] : ''),

'tmp_name' => (isset($GLOBALS[$this->file]) ? $GLOBALS[$this->file] : ''));

}

 

if ( tep_not_null($file['tmp_name']) && ($file['tmp_name'] != 'none') && is_uploaded_file($file['tmp_name']) ) {

if (sizeof($this->extensions) > 0) {

if (!in_array(strtolower(substr($file['name'], strrpos($file['name'], '.')+1)), $this->extensions)) {

if ($this->message_location == 'direct') {

$messageStack->add(ERROR_FILETYPE_NOT_ALLOWED, 'error');

} else {

$messageStack->add_session(ERROR_FILETYPE_NOT_ALLOWED, 'error');

}

 

return false;

}

}

 

$this->set_file($file);

$this->set_filename($file['name']);

$this->set_tmp_filename($file['tmp_name']);

 

return $this->check_destination();

} else {

if ($this->message_location == 'direct') {

$messageStack->add(WARNING_NO_FILE_UPLOADED, 'warning');

} else {

$messageStack->add_session(WARNING_NO_FILE_UPLOADED, 'warning');

}

 

return false;

}

}

 

function save() {

global $messageStack;

 

if (substr($this->destination, -1) != '/') $this->destination .= '/';

 

if (move_uploaded_file($this->file['tmp_name'], $this->destination . $this->filename)) {

chmod($this->destination . $this->filename, $this->permissions);

 

if ($this->message_location == 'direct') {

$messageStack->add(SUCCESS_FILE_SAVED_SUCCESSFULLY, 'success');

} else {

$messageStack->add_session(SUCCESS_FILE_SAVED_SUCCESSFULLY, 'success');

}

 

return true;

} else {

if ($this->message_location == 'direct') {

$messageStack->add(ERROR_FILE_NOT_SAVED, 'error');

} else {

$messageStack->add_session(ERROR_FILE_NOT_SAVED, 'error');

}

 

return false;

}

}

 

function set_file($file) {

$this->file = $file;

}

 

function set_destination($destination) {

$this->destination = $destination;

}

 

function set_permissions($permissions) {

$this->permissions = octdec($permissions);

}

 

function set_filename($filename) {

$this->filename = $filename;

}

 

function set_tmp_filename($filename) {

$this->tmp_filename = $filename;

}

 

function set_extensions($extensions) {

if (tep_not_null($extensions)) {

if (is_array($extensions)) {

$this->extensions = $extensions;

} else {

$this->extensions = array($extensions);

}

} else {

$this->extensions = array();

}

}

 

function check_destination() {

global $messageStack;

 

if (!is_writeable($this->destination)) {

if (is_dir($this->destination)) {

if ($this->message_location == 'direct') {

$messageStack->add(sprintf(ERROR_DESTINATION_NOT_WRITEABLE, $this->destination), 'error');

} else {

$messageStack->add_session(sprintf(ERROR_DESTINATION_NOT_WRITEABLE, $this->destination), 'error');

}

} else {

if ($this->message_location == 'direct') {

$messageStack->add(sprintf(ERROR_DESTINATION_DOES_NOT_EXIST, $this->destination), 'error');

} else {

$messageStack->add_session(sprintf(ERROR_DESTINATION_DOES_NOT_EXIST, $this->destination), 'error');

}

}

 

return false;

} else {

return true;

}

}

 

function set_output_messages($location) {

switch ($location) {

case 'session':

$this->message_location = 'session';

break;

case 'direct':

default:

$this->message_location = 'direct';

break;

}

}

}

?>

Link to comment
Share on other sites

is this a hacked upload.php file? Something that you made changes to by yourself or through a contribution??

 

i was just comparing yours and mine and they seem different.. just curious as to what changes you might have made.

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

Just a side note: I compared this file, one on the server and a backup on my computer and I'm not an expert here but I didn't notice any differences.

 

Lindsay - Thanks for the advice

Link to comment
Share on other sites

see that little thing right above live 31 that says //self destruct

 

have you been hacked?? does someone else have access to your site?? i THINK all you have to do is delete this :

 

// self destruct
$this = null;

 

and if that is the case, then i would do some more searching.. thats a little scarey

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

is this a hacked upload.php file? Something that you made changes to by yourself or through a contribution??

 

i was just comparing yours and mine and they seem different.. just curious as to what changes you might have made.

 

 

Really... I am not sure. As I only ever added a couple contributions but they were long ago... Paypal and shipping contribs

Link to comment
Share on other sites

yep.. i am 90% sure you have been hacked.. did you take that out yet?? let me know what happens.. that is the ONLY issue i see so far.. if there are more, the error will tell us

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

see that little thing right above live 31 that says //self destruct

 

have you been hacked?? does someone else have access to your site?? i THINK all you have to do is delete this :

 

// self destruct
$this = null;

 

and if that is the case, then i would do some more searching.. thats a little scarey

 

 

That line on the file on my computer matchs the one on the server... so I don't think so is all I can say

Link to comment
Share on other sites

just delete it and see.. if it does nothing, you can put it back.. WHY would that be on your stock copy and not on mine?? and WHY is it called self destruct..

 

just try it to see..

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

never mind.. i found what you have to do i think

 

change this

 // self destruct
$this=null;

 

 

to this:

 

return false;
}
}
}

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

Hi all...

 

Store has been working fine, but I received an email from a customer complaing about shipping cost that was way over priced. So I went to login the admin panel and........

 

I am receivng this error:

 

Fatal error: Cannot re-assign $this in /usr/local/apache2/htdocs/cnt-web1/catalog/admin/includes/classes/upload.php on line 31

 

 

Sorry I have no idea what happen or how to correct this. Any help will be much appreciated.

 

Thanks,

 

Bill...

Bill,

You haven't been hacked...this is a PHP5 issue. Your host must have upgraded the PHP version in use without letting you know and now you are getting the error.

 

You should upgrade your shop with all of the bug fixes or simply comment out the code:

Find this in the includes/classes/upload.php file:

// self destruct
$this = null;

 

Change it to this:

// self destruct
// $this = null;
unset($this);

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

i just found that SAME thing.. i was just surprised that the same thing was not in my stock upload.php file. Well, we are now fixed i'm sure.. i HOPE he posts back to update everyone

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

i just found that SAME thing.. i was just surprised that the same thing was not in my stock upload.php file. Well, we are now fixed i'm sure.. i HOPE he posts back to update everyone

 

 

Shewwwwwwwwwwww...... relief on the hacked part... yes I will try the edit... my host... yea just did a phpinfo 5.1.4 and now woundering What else I need to do?

Link to comment
Share on other sites

that should be ALL you need to do.. can you do that know.. i am cuious to see if that is the only fix you need.. i need to get to bed soon .. and i NEED to know :)

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

Bill,

You haven't been hacked...this is a PHP5 issue. Your host must have upgraded the PHP version in use without letting you know and now you are getting the error.

 

You should upgrade your shop with all of the bug fixes or simply comment out the code:

Find this in the includes/classes/upload.php file:

// self destruct
$this = null;

 

Change it to this:

// self destruct
// $this = null;
unset($this);

 

 

Bill - Worked like a charm... Thanks!

 

Lindsay - Thanks for your promt help and diligence, much appriciated

Link to comment
Share on other sites

that should be ALL you need to do.. can you do that know.. i am cuious to see if that is the only fix you need.. i need to get to bed soon .. and i NEED to know :)

 

 

Yes that is what else I need to find out ... tomorrow. But speaking of getting to bed... Way past my bed time...

 

Thanks again

Link to comment
Share on other sites

OK... did one more quick check as to the reason I needed to login admin because of shipping charges.

 

Seems that when one goes through checkout, selecting USPS first class, or any other for that matter on checkout confirmation page shipping switches to Express.... ??? reguardless what you choose.

 

So where do I look for that problem or area to post to... (hmmm tomorrow :-) )

Link to comment
Share on other sites

i would start with opening all files associated with the shipping modules that you added when you set up the different shipping options.. when it comes up in orders, do they SHOW as express???

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

i would start with opening all files associated with the shipping modules that you added when you set up the different shipping options.. when it comes up in orders, do they SHOW as express???

 

 

OK... checked my usps.php file and check the mods/contribs in another part of the fourms and I am thinking I just need to upgrade the module. But my only problem not sure which one to use... to me it looks like the standard one that was included when I first did the install ... so I guess it is time to upgrade, but just seems odd that I didn't have any problems that I knew of until my host went to php5....

 

So question would be just to install the upgrade or would it be safer / simpler to edit the usps.php file?

 

Thanks again

 

here is the header of the usps.php

 

<?php

/*

$Id: usps.php,v 1.47 2003/04/08 23:23:42 dgw_ Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

Link to comment
Share on other sites

OK... checked my usps.php file and check the mods/contribs in another part of the fourms and I am thinking I just need to upgrade the module. But my only problem not sure which one to use... to me it looks like the standard one that was included when I first did the install ... so I guess it is time to upgrade, but just seems odd that I didn't have any problems that I knew of until my host went to php5....

 

So question would be just to install the upgrade or would it be safer / simpler to edit the usps.php file?

 

Thanks again

 

here is the header of the usps.php

 

<?php

/*

$Id: usps.php,v 1.47 2003/04/08 23:23:42 dgw_ Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

 

Problem found!

 

It's shamful on my part because I never new there was an issue until my host udated to PHP5.

 

All I had to do was to update the "Caps Fix" What I did and it seems to be working was change in the usps.php file:

 

This...

 

$this->types = array('Express' => 'Express Mail',

'First Class' => 'First-Class Mail',

'Priority' => 'Priority Mail',

'Parcel' => 'Parcel Post');

 

To This....

 

$this->types = array('EXPRESS' => 'Express Mail',

'FIRST CLASS' => 'First-Class Mail',

'PRIORITY MAIL' => 'Priority Mail',

'PARCEL' => 'Parcel Post');

 

 

 

Thanks all for you help!

Link to comment
Share on other sites

Problem found!

 

It's shamful on my part because I never new there was an issue until my host udated to PHP5.

 

All I had to do was to update the "Caps Fix" What I did and it seems to be working was change in the usps.php file:

 

This...

 

$this->types = array('Express' => 'Express Mail',

'First Class' => 'First-Class Mail',

'Priority' => 'Priority Mail',

'Parcel' => 'Parcel Post');

 

To This....

 

$this->types = array('EXPRESS' => 'Express Mail',

'FIRST CLASS' => 'First-Class Mail',

'PRIORITY MAIL' => 'Priority Mail',

'PARCEL' => 'Parcel Post');

 

 

 

Thanks all for you help!

 

Oh... but new problem found... Got an order and the way I found out is though a paypal notification, although no discription of what was ordered.

 

No order email sent, No record of order, but customer info there. In admin when I click on customer orders I received this error:

 

Orders Order ID:

Status: All OrdersPendingProcessingDeliveredShipped

 

 

Customers Order Total Date Purchased Status Action

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-20, 20' at line 1

 

select o.orders_id, o.customers_name, o.customers_id, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, ot.text as order_total from orders o left join orders_total ot on (o.orders_id = ot.orders_id), orders_status s where o.customers_id = '139' and o.orders_status = s.orders_status_id and s.language_id = '1' and ot.class = 'ot_total' order by orders_id DESC limit -20, 20

 

 

So Maybe I should start a new thread / post?

 

Thanks,

 

Bill...

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...