Some Question?

This is guide mostly for website tools and code, for example CMS or registration scripts.
There can also be tools.

Moderators: osRose dev team, ospRose dev team, osiRose dev team, Moderators

Re: Some Question?

Postby Ultra on Fri Apr 13, 2012 4:53 pm

It must be :
/mall_images/1.png
(mall_images - the folder must be in htdocs) !
Ultra
Rackie
Rackie
 
Posts: 226
Joined: Thu Jul 22, 2010 6:31 pm
Location: Usa

Re: Some Question?

Postby karl19 on Fri Apr 13, 2012 5:12 pm

it still not showing.. and i still the image category doesn't showing up too.
what image format does it support? and what image size does it support?
karl19
Little soul
Little soul
 
Posts: 9
Joined: Sat Mar 31, 2012 1:03 pm

Re: Some Question?

Postby hoegarden31 on Sat Apr 14, 2012 2:04 am

it supports all type of images. But i guess you didn't added a new column in the table.
The script has been made without the display of the image. So you must add that column :) it's not that hard to do. And as always, if you can't do that, then just go learn php before you start with this, or just do something else :p
I'm the one and only. In heaven and on earth.
Image
hoegarden31
Rackie
Rackie
 
Posts: 150
Joined: Sun Nov 13, 2011 7:13 pm

Re: Some Question?

Postby Circa on Sat Apr 14, 2012 6:47 am

i don't know PHP, but when I skim through code that's posted it seems pretty straight forward and easy to learn no offense
Circa
Clown
Clown
 
Posts: 404
Joined: Sun Aug 23, 2009 5:52 am
Location: CA

Re: Some Question?

Postby PurpleYouko on Sat Apr 14, 2012 7:42 pm

Circa wrote:i don't know PHP, but when I skim through code that's posted it seems pretty straight forward and easy to learn no offense

Yup.
PHP is pretty easy to read, understand and write.
The syntax is almost identical to C++ and Java with some very small differences.
Need to lookup information on NARose items, skills, quests?
Now featuring a newly completed skill tree for all classes
Formatting fixed for different resolutions
Image

"A Gazelle is nothing but a giraffe plotted logarithmicaly"
User avatar
PurpleYouko
Rose Guru
Rose Guru
 
Posts: 4733
Joined: Fri Aug 10, 2007 2:05 pm

Re: Some Question?

Postby karl19 on Sun Apr 15, 2012 11:33 am

i tried all to solve this but this was happened T.T
Image

here is my code
  1. <style type="text/css">
  2. /*
  3. .type_11 {
  4.     background:#99CCFF;
  5. }
  6. .type_1 {
  7.     background:#CCFF99;
  8. }
  9. .type_13 {
  10.     background:#FFFF99;
  11. }
  12. .type_6 {
  13.     background:#ff8c9e;
  14. }
  15. .type_2, .type_3, .type_4, .type_5, .type_7, .type_8, .type_9,  {
  16.     background:##66CC00;
  17. }
  18. */
  19. .error_block {
  20.     color: #FF0000;
  21. }
  22. .info_block {
  23.     color: #FF8000;
  24. }
  25. .ok_block {
  26.     color: #008000;
  27. }
  28. </style>
  29. <script language="JavaScript" type="text/javascript">
  30.     <!--
  31.     function conf_purchase( item, quantity, price) {
  32.       if (window.confirm("Are you sure you want to purchase
  33.  
  34. "+quantity+" "+item+" for "+price+"? This action can not be rolled
  35.  
  36. back!") ) {
  37.         //window.location.href = to;
  38.         return true;
  39.       } else {
  40.         return false;
  41.       }
  42.     }
  43. </script>
  44. <?php
  45. session_start();
  46.  
  47. ################################################
  48. # Script by Rifke for the osrose compunity
  49. # date: 22 Januari 2009
  50. ################################################
  51.  
  52. ############ MySQL connection remove if you already have one
  53.  
  54. #############
  55. mysql_connect('localhost:3306', 'root', 'pass');
  56. mysql_select_db('db');
  57.  
  58. ########### Account information ##################
  59.  
  60. include('class.table.inc.php');
  61.  
  62. $item_mall = new itemmallv2();
  63. // Configuring some data
  64. $item_mall->setlog(true); // enable/disable to create an information
  65.  
  66. stream of who bought what
  67. $item_mall->setaccount_id( ( isset($_SESSION['user_account_id']) ) ?
  68.  
  69. $_SESSION['user_account_id'] : -1 ); // set the users account ID
  70. $item_mall->setalevel(100); // set the users access level
  71.  
  72.  
  73. // A tiny login screen!
  74. if ( ($_SERVER['REQUEST_METHOD'] == 'POST') ) {
  75.     $sql = "SELECT id FROM accounts WHERE username = '%s' AND
  76.  
  77. password = '%s';";
  78.     $sql = sprintf($sql, mysql_real_escape_string($_POST
  79.  
  80. ['user_name']), md5($_POST['password']));
  81.     $res = @mysql_query($sql);
  82.     if ( $res === false ) {
  83.         echo '<p class="error_block">Problem with loggin
  84.  
  85. in</p>';
  86.     } elseif ( mysql_num_rows($res) == 0 ) {
  87.         echo '<p class="error_block">Invalid combination
  88.  
  89. username/password</p>';
  90.     } else {
  91.         echo '<p class="ok_block">Valid login</p>';
  92.         $_SESSION['user_account_id'] = mysql_result($res, 0);
  93.     }
  94. }
  95. if ( isset($_SESSION['user_account_id']) ) {
  96.     #echo 'Welcome: ' . $_SESSION['user_account_id'] . '<br />';
  97. } else {   
  98.     echo '
  99.     <form action="" method="post">
  100.         User name: <input type="text" name="user_name"
  101.  
  102. id="user_name">
  103.         Password: <input type="password" name="password"
  104.  
  105. id="password">
  106.         <input type="submit" name="login" id="login"
  107.  
  108. value="login">
  109.     </form>
  110.     ';
  111. }
  112.  
  113.  
  114.  
  115. // variables
  116. $i_cid = ( isset($_GET['i_cid']) && is_numeric($_GET['i_cid']) ) ?
  117.  
  118. $_GET['i_cid'] : 0;
  119. $i_par = ( isset($_GET['i_par']) && is_numeric($_GET['i_par']) ) ?
  120.  
  121. $_GET['i_par'] : -1;
  122. $i_pur = ( isset($_GET['i_pur']) && is_numeric($_GET['i_pur']) ) ?
  123.  
  124. $_GET['i_pur'] : 0;
  125.  
  126. // make a breadcrum
  127. $item_mall->breadcrum($i_par,$i_cid);
  128.  
  129. // add item to cart
  130. if ( isset($_GET['i_pur']) && $i_pur > 0 ) {
  131.     $item_mall->addItemToCar($i_pur);
  132. }
  133.  
  134. if ( isset($_GET['i_cid']) && $i_cid > 0 ) {
  135.  
  136.     $item_mall->getCategory($i_cid);
  137.    
  138. } else {
  139.     $item_mall->getCategory();
  140. }
  141.  
  142.  
  143. class itemmallv2
  144. {
  145.     private $log = false;
  146.     private $alevel = 300;
  147.     private $table_prefs = NULL;
  148.     private $breadcrum = array();
  149.     private $account_id;
  150.     function __construct() {
  151.         $this->table_prefs = array( 'cellspacing' => 0,
  152.                                    
  153.  
  154. 'cellpading' => 2,
  155.                                    
  156.  
  157. 'width'=> '43%',
  158.                                    
  159.  
  160. 'border' => 0,
  161.                                    
  162.  
  163. 'style'=> "td,th { font-family: Tahoma, Verdana, Geneva, Arial,
  164.  
  165. Helvetica, sans-serif; font-size: 1.1em; }"
  166.                                    
  167.  
  168. );
  169.     }
  170.     // Getters
  171.     function getlog() {
  172.         return $this->log;
  173.     }
  174.     function getalevel() {
  175.         return $this->alevel();
  176.     }
  177.     function gettable_prefs() {
  178.         return $this->table_prefs;
  179.     }
  180.     function getaccount_id(){
  181.         return $this->account_id();
  182.     }
  183.     // Setters
  184.     function setlog($a) {
  185.         $this->log = $a;
  186.     }
  187.     function setalevel($a) {
  188.         $this->alevel = $a;
  189.     }
  190.     function settable_prefs($a) {
  191.         $this->table_prefs = $a;
  192.     }
  193.     function setaccount_id($a) {
  194.         if ( is_numeric($a) )
  195.             $this->account_id = $a;
  196.     }
  197.    
  198.     /*
  199.     * @update   04/02/2009
  200.     * @desc get storage money/nb_donation
  201.     * @param    string $type , int $amount
  202.     * @return   boolean
  203.     */
  204.     function decreaseMoney($type,$amount) {
  205.         if ( $this->account_id == -1 ) {
  206.             echo '<p class="error_block">You are not
  207.  
  208. logged in.</p>';
  209.             return false;
  210.         }
  211.         if ( $type == 'D' ) {
  212.             $sql = "SELECT nb_donation FROM accounts
  213.  
  214. WHERE id=%d;";
  215.         } else {
  216.             $sql = "SELECT zulystorage FROM accounts
  217.  
  218. WHERE id=%d;";
  219.         }
  220.         $sql = sprintf($sql,$this->account_id);
  221.         $res = @mysql_query($sql);
  222.         if ( $res === false ) {
  223.             echo '<p class="error_block">There has been a
  224.  
  225. problem with adding your item.</p>';
  226.             $this->dbError('Database error, '
  227.  
  228. .mysql_error(). ' in ' . nl2br($sql) .' <br />');
  229.         } elseif ( mysql_fetch_assoc($res) == 0 ) {
  230.             echo 'Your account does not exists.';
  231.         } else {
  232.             $a = mysql_result($res,0);
  233.             if ( ($a-$amount) < 0 )
  234.                 echo '<p class="info_block">You have
  235.  
  236. not enough money to purchase this item.</p>';
  237.             else {
  238.                 if ( $type == 'D' ) {
  239.                     $sql = "UPDATE accounts SET
  240.  
  241. nb_donation=nb_donation-%d WHERE id=%d AND online=0;";
  242.                 } else {
  243.                     $sql = "UPDATE accounts SET
  244.  
  245. zulystorage=zulystorage-%d WHERE id=%d AND online=0;";
  246.                 }
  247.                 $sql = sprintf($sql,$amount, $this-
  248.  
  249. >account_id);
  250.                 $res = @mysql_query($sql);
  251.                 if ( $res === false ) {
  252.                     echo '<p
  253.  
  254. class="error_block">Please make sure you are logged out the game!
  255.  
  256. </p>';
  257.                     $this->dbError('Database
  258.  
  259. error, ' .mysql_error(). ' in ' . nl2br($sql) .' <br />');
  260.                 } elseif ( mysql_affected_rows() == 1
  261.  
  262. ) {
  263.                     return true;
  264.                 } else {
  265.                     echo '<p
  266.  
  267. class="error_block">Could not purchase your item, please make sure
  268.  
  269. you are logged out of the game!</p>';
  270.                 }
  271.                 return false;
  272.             }
  273.         }
  274.     }
  275.     /*
  276.     * @update   23/01/2009
  277.     * @desc     make a breadcrum so the users can easly hit
  278.  
  279. the 'back' button'
  280.     * @param    int $i_cid
  281.     * @return   void
  282.     */
  283.     function breadcrum($i_cid) {
  284.         $b = NULL;
  285.         //$b = '<a href="'.$this->getUrl().'&amp;i_par='.
  286.  
  287. $i_par.'">'.$this->getBreadcrumName($i_cid).'</a> &raquo';
  288.         echo $this->getBreadcrums($i_cid);
  289.         $m = count( $this->breadcrum )-1;
  290.         echo '<div><a href="'.$this->getURL(true).'">Main</a>
  291.  
  292. ';
  293.         if ( $m > 0 ) echo ' &raquo; ';
  294.         foreach ( $this->breadcrum as $index => $value )  {
  295.             if ( $m == $index ) {
  296.                 echo ' &raquo; ';
  297.             }
  298.             echo '<a href="'.$this->getURL
  299.  
  300. (true).'&amp;i_cid='.$value[0].'&amp;i_par='.$value[1].'">'.$value
  301.  
  302. [2].'</a>';
  303.            
  304.         }
  305.         echo '</div>';
  306.     }
  307.  
  308.     function getBreadcrums($i) {
  309.        
  310.         $sql = "SELECT ctitle,cparent FROM mall_category
  311.  
  312. WHERE cid=%d;";
  313.         $sql = sprintf($sql,$i);
  314.         $res = @mysql_query($sql);
  315.         if ( $res === false ) {
  316.             $this->dbError('Database error, '
  317.  
  318. .mysql_error(). ' in ' . nl2br($sql) .' <br />');
  319.         } elseif ( mysql_num_rows($res) == 0 ) {
  320.            
  321.         } else {
  322.             $r = mysql_fetch_assoc($res);
  323.             $this->getBreadcrums($r['cparent']);
  324.             $this->breadcrum[] = array($i,$r['cparent'],
  325.  
  326. $r['ctitle']);
  327.         }
  328.     }
  329.     /*
  330.     * @update   02/02/2009
  331.     * @desc     add an item to a user's cart
  332.     * @param    int $iid
  333.     * @return   void
  334.     */
  335.     function addItemToCar($iid) {
  336.         // Check if this item already is in the cart else re
  337.  
  338. raise it
  339.         $sql = "SELECT mc.quantity FROM mall_cart as mc WHERE
  340.  
  341. mc.uid = %d, mc.iid = %d;";
  342.         $sql = sprintf($sql,$this->account_id,$iid);
  343.         $res = @mysql_query($sql);
  344.        
  345.    
  346.         // get some item information (if possible offcourse)
  347.         $sql = "SELECT
  348.                     fs.quantity,
  349.                     fs.payment,
  350.                     fs.price,
  351.                     fs.ref_able,
  352.                     fs.soc_able,
  353.                     mi.item_name,
  354.                     mi.item_type,
  355.                     mi.item_id
  356. i.image
  357.                 FROM
  358.                     mall_forsale AS fs
  359.                     Inner Join mall_items AS mi
  360.  
  361. ON mi.iid = fs.iid
  362.                 WHERE
  363.                     fs.sid = %d;
  364.                 ";
  365.         $sql = sprintf($sql,$iid);
  366.         $res = @mysql_query($sql);
  367.         if ( $res === false ) {
  368.             $this->dbError('Database error, '
  369.  
  370. .mysql_error(). ' in ' . nl2br($sql) .' <br />');
  371.         } elseif ( mysql_num_rows($res) == 0 ) {
  372.             echo '<p class="error_block">The given item
  373.  
  374. doesn not exist anymore.</p>';
  375.         } else {
  376.             $r = mysql_fetch_assoc($res);
  377.             $slotnum = $this->getFreeSlot();
  378.             if ( $slotnum == 0 || $slotnum > 160 ) {
  379.                 echo '<p class="error_block">You have
  380.  
  381. no free storage slot(s) available.</p>';
  382.             }
  383.             else {
  384.                 if ( $this->decreaseMoney($r
  385.  
  386. ['payment'],$r['price']) === true ) {
  387.                     $sql = "INSERT INTO mileage
  388.  
  389. (owner,itemnum,itemtype,refine,slotnum,socketed,count) VALUES (%d,
  390.  
  391. %d,%d,%d,%d,%d,%d);";
  392.                    
  393.                     $sql = sprintf($sql,$this-
  394.  
  395. >account_id,$r['item_id'],$r['item_type'],$this->gradeToServerGrade
  396.  
  397. ($r['ref_able']),$slotnum,$r['soc_able'],$r['quantity']);
  398.                     $res = @mysql_query($sql);
  399.                     if ( $res === false ) {
  400.                         echo '<p
  401.  
  402. class="error_block">Adding your item to your shoping cast has
  403.  
  404. failed.</p>';
  405.                         $this->dbError
  406.  
  407. ('Database error, ' .mysql_error(). ' in ' . nl2br($sql) .' <br />');
  408.                         $this->decreaseMoney
  409.  
  410. ($r['payment'],-$r['price']); // re-adding the money to the account
  411.  
  412. when failed.
  413.                     } elseif (
  414.  
  415. mysql_affected_rows() == 1 ) {
  416.                         echo '<p
  417.  
  418. class="ok_block">'.$r['item_name'] . ' has been added in to your
  419.  
  420. mileage storage<p>';
  421.                         $sql = "INSERT INTO
  422.  
  423. mall_log
  424.  
  425. (date_purchased,owner,itemname,itemid,itemtype,quantity,price,payment
  426.  
  427. ,socket,refine,slot) VALUES
  428.                                 (NOW
  429.  
  430. (),%d,'%s',%d,%d,%d,%d,'%s',%d,%d,%d);";
  431.                         $sql = sprintf($sql,
  432.  
  433. $this->account_id,$r['item_name'],$r['item_id'],$r['item_type'],$r
  434.  
  435. ['quantity'],$r['price'],$r['payment'],$r['soc_able'],$r
  436.  
  437. ['ref_able'],$slotnum);
  438.                         mysql_query($sql);
  439.                     } else {
  440.                         echo '<p
  441.  
  442. class="error_block">Your item is not added to your mileage.</p>';
  443.                         $this->decreaseMoney
  444.  
  445. ($r['payment'],-$r['price']); // re-adding the money to the account
  446.  
  447. when failed.
  448.                     }
  449.                 }
  450.             }
  451.         }
  452.     }
  453.    
  454.     /*
  455.     * @update   04/02/2009
  456.     * @desc     Get a free slot
  457.     * @param    void
  458.     * @return   int
  459.     */
  460.     function getFreeSlot() {
  461.         $slotnum = 0;
  462.         $sql = "SELECT slotnum FROM mileage WHERE owner=%d;";
  463.         $sql = sprintf($sql,$this->account_id);
  464.         $res = mysql_query($sql);
  465.         if ( !($res === false) ) {
  466.             if ( mysql_num_rows($res) > 0 ) {
  467.                 while ( $r = mysql_fetch_assoc($res)
  468.  
  469. ) {
  470.                     $slots[] = $r['slotnum'];
  471.                 }   
  472.             }
  473.         }
  474.         for ( $x = 159; $x >= 1; $x--) {
  475.             if ( !@in_array($x,$slots) ) {
  476.                 $slotnum = $x;
  477.                 break;
  478.             }
  479.         }
  480.         return $slotnum;
  481.     }
  482.     /*
  483.     * @update   22/01/2009
  484.     * @desc show content of a category
  485.     * @param    int $cid
  486.     * @return   void
  487.     */
  488.     function getItems($cid) {
  489.         $sql = "SELECT
  490.                
  491.                     fs.sid,
  492.                     fs.price,
  493.                     fs.payment,
  494.                     fs.price,
  495.                     fs.quantity,
  496.                     fs.ref_able,
  497.                     fs.soc_able,
  498.                     i.image,
  499.                     i.item_type,
  500.                     i.item_id,
  501.                     i.item_name,
  502.                     i.item_desc
  503.                 FROM
  504.                     mall_forsale AS fs
  505.                     Inner Join mall_items AS i ON
  506.  
  507. i.iid = fs.iid
  508.                 WHERE
  509.                     fs.cid = %d
  510.                 ;
  511.                 ";
  512.         $sql = sprintf($sql,$cid);
  513.         $res = @mysql_query($sql);
  514.         if ( $res === false ) {
  515.             $this->dbError('Database error, '
  516.  
  517. .mysql_error(). ' in ' . nl2br($sql) .' <br />');
  518.         } elseif ( mysql_num_rows($res) == 0 ) {
  519.             echo '<p class="error_block">Sorry there are
  520.  
  521. no items available for the selected category.</p>';
  522.         } else {
  523.             // maken van table
  524.             $tbl_cat = new table($this->table_prefs);
  525.             $tbl_cat->table_header( array("image", "Item
  526.  
  527. name", "Quantity", "Socket", "Refine", "Price", "Purchase", NULL) );
  528.             while ( $r = mysql_fetch_assoc($res) ) {
  529.                 // Keep the header layout in mind or
  530.  
  531. your table will be screwed up... I could built in a check for that
  532.  
  533. but that would just make it havier :)
  534.                 if ( $r['price'] > 0 ) {
  535.                     $params = "'".htmlentities
  536.  
  537. ($r['image'])."', '".htmlentities($r['item_name'])."',
  538.  
  539. '".htmlentities($r['quantity'])."', '".htmlentities(number_format($r
  540.  
  541. ['price']).' '.$r['payment'])."'";
  542.                    
  543.                     $values = array($r['image'],
  544.  
  545. $r['item_name']. ' <span style="font-size: 0.8em;">('.$r
  546.  
  547. ['item_desc']. '</span>)',
  548.                                    
  549.  
  550. $r['quantity'],
  551.                                    
  552.  
  553. ( $r['soc_able'] == 1 ) ? 'Y' : 'N',
  554.                                    
  555.  
  556. ($r['ref_able'] > 0 ) ? 'Grade '.$r['ref_able'] : 'N',
  557.                                    
  558.  
  559. number_format($r['price']).$r['payment'],
  560.                                    
  561.  
  562.  '<a href="'.$this->getURL().'&amp;i_pur='.$r['sid'].'"
  563.  
  564. onClick="return conf_purchase('.$params.');">Get me!</a>'
  565.                                    
  566.  
  567. );
  568.                     $tbl_cat->add_values($values,
  569.  
  570. array('valign' => 'top', 'class' => 'type_'.$r['item_id']) );
  571.                 }
  572.             }
  573.             $tbl_cat->printTable();
  574.         }
  575.     }
  576.    
  577.     /*
  578.     * @update   22/01/2009
  579.     * @desc Getting categories and sub categories.
  580.     * @param    int $cid
  581.     * @return   void
  582.     */
  583.     function getCategory($cid = -1) {
  584.         if ( !is_numeric($cid) ) {
  585.             echo '<p class="error_block">Your (sub)
  586.  
  587. category id is invalid.</p>';
  588.         } else {
  589.             $sql = "SELECT
  590.                         c.cid,
  591.                         c.ctitle,
  592.                         c.cdesc,
  593.                         c.cparent
  594.                     FROM
  595.                         mall_category as c
  596.                     WHERE
  597.                         c.cparent = %d AND
  598.                         c.cminlevel <= %d AND
  599.                         c.chidden = 0;
  600.                     ";
  601.             $sql = sprintf($sql,$cid,$this->alevel);
  602.             $res = @mysql_query($sql); // error
  603.  
  604. subpression
  605.             if ( $res === false ) {
  606.                 $this->dbError('Database error, '
  607.  
  608. .mysql_error(). ' in ' . nl2br($sql) .' <br />');
  609.             } elseif ( mysql_num_rows($res) == 0 ) {
  610.                 if ( isset($_GET['i_par']) && $_GET
  611.  
  612. ['i_par'] < 0 )
  613.                     echo '<p
  614.  
  615. class="error_block">Sorry there are no categories available for the
  616.  
  617. selected category.</p>';
  618.                 else
  619.                     $this->getItems($cid);
  620.             } else {
  621.                 $tbl_cat = new table($this-
  622.  
  623. >table_prefs);
  624.                 $tbl_cat->table_header( array
  625.  
  626. ("Category name", "Sub Categories", "Options") );
  627.                     while ( $r =
  628.  
  629. mysql_fetch_assoc($res) ) {
  630.                         // Keep the header
  631.  
  632. layout in mind or your table will be screwed up... I could built in a
  633.  
  634. check for that but that would just make it havier :)
  635.                         $values = array( $r
  636.  
  637. ['ctitle']. ' <span style="font-size: 0.8em;">('.$r['cdesc'].
  638.  
  639. '</span>)',
  640.                                    
  641.  
  642.      $this->deep_out($r['cid']),
  643.                                    
  644.  
  645.      '<a href="'.$this->getURL().'&amp;i_cid='.$r
  646.  
  647. ['cid'].'&amp;i_par='.$r['cparent'].'">View</a>'
  648.                                    
  649.  
  650.     );
  651.                         $tbl_cat->add_values
  652.  
  653. ($values, array('valign' => 'top') );
  654.                     }
  655.                 $tbl_cat->printTable();
  656.             }
  657.         }
  658.     }
  659.     /*
  660.     * @update   22/01/2009
  661.     * @desc Deep out a category
  662.     * @param    int $cid
  663.     * @return   string $c
  664.     */
  665.     function deep_out($cid) {
  666.         $c = Null;
  667.         $sql = "SELECT
  668.                     c.cid,
  669.                     c.ctitle,
  670.                     c.cparent
  671.                 FROM
  672.                     mall_category as c
  673.                 WHERE
  674.                     c.cparent = %d AND
  675.                     c.cminlevel <= %d AND
  676.                     c.chidden = 0;
  677.                 ";
  678.         $sql = sprintf($sql,$cid,$this->alevel);
  679.         $res = @mysql_query($sql); // error subpression
  680.         if ( $res === false ) { 
  681.             // ah shame, but no hard feelings acutaly
  682.         } elseif ( mysql_num_rows($res) == 0 ) {
  683.             // already set
  684.             $c = 'None available';
  685.         } else {
  686.             while ( $r = mysql_fetch_assoc($res) ) {
  687.                 $c .= '<a href="'.$this->getURL
  688.  
  689. ().'&amp;i_cid='.$r['cid'].'&amp;i_par='.$r['cparent'].'">'.$r
  690.  
  691. ['ctitle'].'</a> <br />';
  692.             }
  693.         }
  694.         return $c;
  695.     }
  696.     /*
  697.     * @update   22/01/2009
  698.     * @desc get a url
  699.     * @param    none
  700.     * @return   string $s
  701.     */
  702.     function getURL($bSkip = false) {
  703.         if ( isset($_GET) ) {
  704.         $i = 0;
  705.         $s = NULL;
  706.         $skip = array('i_cid', 'i_fid','i_pur','i_del',
  707.  
  708. 'i_par');
  709.         $skip_a = array('i_pur');
  710.             foreach ( $_GET AS $index => $waarde ) {
  711.                 if ( (in_array($index,$skip) &&
  712.  
  713. $bSkip === true ) || in_array($index,$skip_a) ) {
  714.                
  715.                 } else {
  716.                     $s .= ($i==0) ? '?'.
  717.  
  718. $index.'='.$waarde : '&amp;'.$index.'='.$waarde;
  719.                     $i++;
  720.                 }
  721.             }
  722.         return $s;
  723.         }
  724.     }
  725.     /*
  726.     * @update   04/02/2009
  727.     * @desc     Make some kind of log to track when, how many
  728.  
  729. times a user has bought something
  730.     * @param    string itemname, int itemid, int itemtype,
  731.  
  732. int quantity, int price, string payment, int socket, int refine
  733.     * @return   void
  734.     */
  735.     function addTransactionToLog($itemname,$itemid,$itemtype,
  736.  
  737. $quantity,$price,$payment,$socket,$refine,$slot) {
  738.         if ( $this->log === true ) {
  739.             $sql = "INSERT INTO mall_log
  740.  
  741. (date_purchased,owner,itemname,itemid,itemtype,quantity,price,payment
  742.  
  743. ,socket,refine,slot) VALUES
  744.                     (NOW(),%d,'%s',%d,%d,%d,
  745.  
  746. %d,'%s',%d,%d,%d);";
  747.             $sql = sprintf($sql,$this->account_id,
  748.  
  749. $itemname,$itemid,$itemtype,$quantity,$price,$payment,$socket,
  750.  
  751. $refine,$slot);
  752.             echo $sql;
  753.             $res = mysql_query($sql);
  754.         }
  755.     }
  756.     /*
  757.     * @update   04/02/2009
  758.     * @desc give a grade (0-9) and the function wil convert it in
  759.  
  760. a useable grade to work with for the server (that it will acutaly be
  761.  
  762. refined)
  763.     * @param    int grade
  764.     * @return   int server_grade
  765.     */
  766.     function gradeToServerGrade($grade) {
  767.         $RefiningGrades = array(0 => 0, 1 => 16, 2 => 32, 3
  768.  
  769. => 48, 4 => 64, 5 => 80, 6 => 96, 7 => 112, 8 => 128, 9 => 144);
  770.        
  771.         if ( $RefiningGrades[$grade] != null ) {
  772.             $server_grade = $RefiningGrades[$grade];
  773.         }
  774.         else {
  775.             $server_grade = 0;
  776.         }
  777.             return $server_grade;
  778.     }
  779.     function dbError($msg) {
  780.         // GM only
  781.         if ( $this->alevel >= 300 )
  782.             echo '<p clas="error_block">DB ERROR: ' .$msg
  783.  
  784. .'</p>';
  785.     }
  786. }
  787. ?>
karl19
Little soul
Little soul
 
Posts: 9
Joined: Sat Mar 31, 2012 1:03 pm

Re: Some Question?

Postby hoegarden31 on Wed Apr 18, 2012 9:57 pm

you now just display the text from your image field.
Images ini html are displayed with the tags <img></img> So you miss something in your code :)
I'm the one and only. In heaven and on earth.
Image
hoegarden31
Rackie
Rackie
 
Posts: 150
Joined: Sun Nov 13, 2011 7:13 pm

Previous

Return to PHP / Web Guides, Scripts and tools.

Who is online

Users browsing this forum: No registered users and 5 guests

cron