Author Topic: Bug Found and fixed in shopadmin.php  (Read 4804 times)

Offline bigjoe11a

Bug Found and fixed in shopadmin.php
« on: March 22, 2011, 10:42:03 pm »
After not getting any help and since I know PHP. I fount some errors. and I fixed them. For the web masters who use the item_info1, 2, 3 and 4. Using the filedownload and creating my own items I fount out that there are some errors in the code that I had to fix. So when I loaded in an item, it wouldn't return all 0's in my $item_info

For the ones who want to do it by hand. Open the /sources/shop/shpadmin.php file and go to line 438.
You will see this
Code: [Select]
$item_info[1] = $row['info1'];
$item_info[2] = $row['info2'];
$item_info[3] = $row['info3'];
$item_info[4] = $row['info4'];
change it to this
Code: [Select]
$item_info[1] = strval($row['info1']);
$item_info[2] = strval($row['info2']);
$item_info[3] = strval($row['info3']);
$item_info[4] = strval($row['info4']);

then go to line 515 and you will see this

Code: [Select]

if (isset($_POST['info1']))
$additional .= ', `info1` = "' . intval(($_POST['info1']) . '"';
if (isset($_POST['info2']))
$additional .= ', `info2` = "' . intval($_POST['info2']) . '"';
        if (isset($_POST['info3']))
$additional .= ', `info3` = "' . intval($_POST['info3']) . '"';
if (isset($_POST['info4']))
$additional .= ', `info4` = "' . intval($_POST['info4']) . '"';

and then change the lines to this
Code: [Select]
if (isset($_POST['info1']))
$additional .= ', `info1` = "' . strval($_POST['info1']) . '"';
if (isset($_POST['info2']))
$additional .= ', `info2` = "' . strval($_POST['info2']) . '"';
if (isset($_POST['info3']))
$additional .= ', `info3` = "' . strval($_POST['info3']) . '"';
if (isset($_POST['info4']))
$additional .= ', `info4` = "' . strval($_POST['info4']) . '"';

What was happening is that the script was loading in the intval and not a strval. This is why it was returning nothing but a 0.

Then save it and load your FTP client in. and connect to your FTP server. Then go to
root/sources/shop and upload the edited shopadmin.php to your solder replacing the old on.

Then the next time to edit an item. It will return the settings to set for the $imtem_info[] values

You may have to edit some of your edits and and your new items. to make sure the right values are being saved.

and for the ones that don't want to edit the ShopAdmin.php I attached it for you. Have fun
Serving Gamers from around the world
http://www.df-barracks.com/


Offline goodman84

Re: Bug Found and fixed in shopadmin.php
« Reply #1 on: January 26, 2012, 11:56:40 pm »
Database Error
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 'text" name="example" />

", `info4` = "The user: {$_POST["example"]}' at line 10
File: /home/conjoint/public_html/forum/Sources/shop/ShopAdmin.php
Line: 559

Note: It appears that your database may require an upgrade. Your forum's files are currently at version SMF 2.0.2, while your database is at version 2.0. The above error might possibly go away if you execute the latest version of upgrade.php.


Error occurs when using EmailAdmin if you edit one that exist.

Offline xanenightwing

Re: Bug Found and fixed in shopadmin.php
« Reply #2 on: September 25, 2012, 04:44:42 am »
Database Error
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 'text" name="example" />

", `info4` = "The user: {$_POST["example"]}' at line 10
File: /home/conjoint/public_html/forum/Sources/shop/ShopAdmin.php
Line: 559

Note: It appears that your database may require an upgrade. Your forum's files are currently at version SMF 2.0.2, while your database is at version 2.0. The above error might possibly go away if you execute the latest version of upgrade.php.


Error occurs when using EmailAdmin if you edit one that exist.

is there a fix for this?