View Single Post
Old 19.07.2007, 13:28   #1
stpavel
Архивный участник
 
Join Date: Jul 2007
Posts: 1
Default

Some bugs.

1. If item's name have apostrof ( for example Recipe: Zubei's Boots ) , when char try to sale it, item take from inventory but not show in item on sell list, because here sql query error...
For fix this I changed function get_item_name

Code:
function get_item_name($id) {
$q=mssql_query("SELECT name from l2auction..items where item_id='".safe_int($id)."'");
$data=mssql_fetch_array($q);
$item_name = str_replace ("'" , "''",  $data['name']);
return $item_name;
}
2. If count of item , that char try to sell is float have , - count mul to 10 , for example if I type
2,5 and then click sell button , I see 25. If count of item have . ( for example 2.5 ) , item take from inventory but not show in item to sell list, here sql error....
I fix this so:
Code:
 function safe_int($str) {
        $str = str_replace ( ",", '.',  $str );
        $banwords = array ("'", ",", ";", "-");
        if ( eregi ( "[0-9]+", $str ) ) {                 $str = str_replace ( $banwords, '', strtolower ( $str ) );
        } else {
                $str = NULL;
        }
        return trim(ceil($str));
}
3. When char sell item, here write a log, item_id, count of item that sell char e.t.c.,,
Small bug, in log write not count of item, that sell char, but count of item that he has in inventory..
Fix :
Code:
$sale_count=safe_int($_POST['count']);
#makelog(1,get_char_id($_SESSION['char']),get_char_id($_SESSION['char']),$data_sale['item_type'],$data_sale['amount'],$data_sale['enchant'],$data_sale['item_id']);
makelog(1,get_char_id($_SESSION['char']),get_char_id($_SESSION['char']),$data_sale['item_type'],$sale_count,$data_sale['enchant'],$data_sale['item_id']);
4. If account is banned , he anywhere can login in auction
Fix : func.php , function is_logged :

Code:
function is_logged($name,$pass,$char){
...
...
                        sqlconnect("auth");
                        $result1 = mssql_query("SELECT block_flag FROM user_account WHERE account = '".safe($name)."' and block_flag=1");
                        $rows1=mssql_num_rows($result1);
                        if ($rows1>0){
                           unset($_SESSION['user']);
                           unset($_SESSION['pass']);
                           unset($_SESSION['char']);
                           session_destroy();
                            echo '
                             <script language="JavaScript">
                              alert("Sorry, your account is banned.");
                             </script>
                            ';
                          refresh('index.php');
                        }
...
...
...
5. Not correct some records of items in item.txt.
Code:
5927	Book: Basics of Giants Magic	 Chapter 1	etc_paper_blue_i00,1	1
5928	Book: Basics of Giants Magic	 Chapter 2	etc_paper_blue_i00,1	1
5929	Book: Basics of Giants Magic	 Chapter 3	etc_paper_blue_i00,1	1
5930	Book: Basics of Giants Magic	 Chapter 4	etc_paper_blue_i00,1	1
5931	Book: Basics of Giants Magic	 Chapter 5	etc_paper_blue_i00,1	1
5932	Handbook: Giants Architecture	 Chapter 1	etc_paper_red_i00,1	1
5933	Handbook: Giants Architecture	 Chapter 2	etc_paper_red_i00,1	1
5934	Handbook: Giants Architecture	 Chapter 3	etc_paper_red_i00,1	1
5935	Handbook: Giants Architecture	 Chapter 4	etc_paper_red_i00,1	1
5936	Handbook: Giants Architecture	 Chapter 5	etc_paper_red_i00,1	1
5937	Book: Giants Medical Science	 Chapter 1	etc_paper_white_i00,1	1
5938	Book: Giants Medical Science	 Chapter 2	etc_paper_white_i00,1	1
5939	Book: Giants Medical Science	 Chapter 3	etc_paper_white_i00,1	1
5940	Book: Giants Medical Science	 Chapter 4	etc_paper_white_i00,1	1
5941	Book: Giants Medical Science	 Chapter 5	etc_paper_white_i00,1	1
...
5945	Book: Giants Science & Technology	 Chapter 1	etc_spell_books_white_i00,1	1
5946	Book: Giants Science & Technology	 Chapter 2	etc_spell_books_white_i00,1	1
5947	Book: Giants Science & Technology	 Chapter 3	etc_spell_books_white_i00,1	1
5948	Book: Giants Science & Technology	 Chapter 4	etc_spell_books_white_i00,1	1
5949	Book: Giants Science & Technology	 Chapter 5	etc_spell_books_white_i00,1	1
5950	Almanac: Titan Culture	 Chapter 1	etc_spell_books_summon_i00,1	1
5951	Almanac: Titan Culture	 Chapter 2	etc_spell_books_summon_i00,1	1
5952	Almanac: Titan Culture	 Chapter 3	etc_spell_books_summon_i00,1	1
5953	Almanac: Titan Culture	 Chapter 4	etc_spell_books_summon_i00,1	1
5954	Almanac: Titan Culture	 Chapter 5	etc_spell_books_summon_i00,1	1
...
5979	Ancient Epic	 Chapter 1	etc_piece_of_paper_gray_i00,1	1
5980	Ancient Epic	 Chapter 2	etc_piece_of_paper_gray_i00,1	1
5981	Ancient Epic	 Chapter 3	etc_piece_of_paper_gray_i00,1	1
5982	Ancient Epic	 Chapter 4	etc_piece_of_paper_gray_i00,1	1
5983	Ancient Epic	 Chapter 5	etc_piece_of_paper_gray_i00,1	1
...
5989	Blueprint: Tower of Insolence	 1st Floor	etc_letter_blue_i00,1	1
5990	Blueprint: Tower of Insolence	 2nd Floor	etc_letter_blue_i00,1	1
5991	Blueprint: Tower of Insolence	 3rd Floor	etc_letter_blue_i00,1	1
5992	Blueprint: Tower of Insolence	 4th Floor	etc_letter_blue_i00,1	1
5993	Blueprint: Tower of Insolence	 5th Floor	etc_letter_blue_i00,1	1
5994	Blueprint: Tower of Insolence	 6th Floor	etc_letter_blue_i00,1	1
5995	Blueprint: Tower of Insolence	 7th Floor	etc_letter_blue_i00,1	1
5996	Blueprint: Tower of Insolence	 8th Floor	etc_letter_blue_i00,1	1
5997	Blueprint: Tower of Insolence	 9th Floor	etc_letter_blue_i00,1	1
5998	Blueprint: Tower of Insolence	 10th Floor	etc_letter_blue_i00,1	1
5999	Blueprint: Tower of Insolence	 11th Floor	etc_letter_blue_i00,1	1
6000	Blueprint: Tower of Insolence	 12th Floor	etc_letter_blue_i00,1	1
6001	Blueprint: Tower of Insolence	 13th Floor	etc_letter_blue_i00,1	1
...
fix : delete third column, move image's name from fourth column to third or manually edit table items
p.s. sorry for bad english
stpavel is offline