77. File Comparison Report

Produced on Mon May 12 13:04:41 2008 UTC. This report uses XHTML and CSS2, and is best viewed with a reasonably standards compliant browser such as the latest version of Firefox or Internet Explorer. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

77.1 Files compared

# Location File Last Modified
1 Dolphin-v.6.0.5\admin quotes.php Thu Sep 20 08:58:42 2007 UTC
2 Dolphin-v.6.1.0\admin quotes.php Sat Apr 19 12:05:02 2008 UTC

77.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 832
Changed 1 2
Inserted 0 0
Removed 0 0

77.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

77.4 Active regular expressions

No regular expressions were active.

77.5 Comparison detail

1   <?   1   <?
2     2  
3   /********* ********** ********** ********** ********** ********** ********** ******   3   /********* ********** ********** ********** ********** ********** ********** ******
4   *                              D olphin Sma rt Communi ty Builder   4   *                              D olphin Sma rt Communi ty Builder
5   *                                 --------- --------   5   *                                 --------- --------
6   *     begi n                 : M on Mar 23  2006   6   *     begi n                 : M on Mar 23  2006
7   *     copy right             : ( C) 2006 Bo onEx Group   7   *     copy right             : ( C) 2006 Bo onEx Group
8   *     webs ite               : h ttp://www. boonex.com /   8   *     webs ite               : h ttp://www. boonex.com /
9   * This fil e is part  of Dolphin  - Smart C ommunity B uilder   9   * This fil e is part  of Dolphin  - Smart C ommunity B uilder
10   *   10   *
11   * Dolphin  is free so ftware. Th is work is  licensed  under a Cr eative Com mons Attri bution 3.0  License.    11   * Dolphin  is free so ftware. Th is work is  licensed  under a Cr eative Com mons Attri bution 3.0  License. 
12   * http://c reativecom mons.org/l icenses/by /3.0/   12   * http://c reativecom mons.org/l icenses/by /3.0/
13   *   13   *
14   * Dolphin  is distrib uted in th e hope tha t it will  be useful,  but WITHO UT ANY WAR RANTY;   14   * Dolphin  is distrib uted in th e hope tha t it will  be useful,  but WITHO UT ANY WAR RANTY;
15   * without  even the i mplied war ranty of   MERCHANTAB ILITY or F ITNESS FOR  A PARTICU LAR PURPOS E.   15   * without  even the i mplied war ranty of   MERCHANTAB ILITY or F ITNESS FOR  A PARTICU LAR PURPOS E.
16   * See the  Creative C ommons Att ribution 3 .0 License  for more  details.    16   * See the  Creative C ommons Att ribution 3 .0 License  for more  details. 
17   * You shou ld have re ceived a c opy of the  Creative  Commons At tribution  3.0 Licens e along wi th Dolphin   17   * You shou ld have re ceived a c opy of the  Creative  Commons At tribution  3.0 Licens e along wi th Dolphin
18   * see lice nse.txt fi le; if not , write to  marketing @boonex.co m   18   * see lice nse.txt fi le; if not , write to  marketing @boonex.co m
19   ********** ********** ********** ********** ********** ********** ********** *****/   19   ********** ********** ********** ********** ********** ********** ********** *****/
20     20  
21   require_on ce( '../in c/header.i nc.php' );   21   require_on ce( '../in c/header.i nc.php' );
22   require_on ce( BX_DIR ECTORY_PAT H_INC . 'd esign.inc. php' );   22   require_on ce( BX_DIR ECTORY_PAT H_INC . 'd esign.inc. php' );
23   require_on ce( BX_DIR ECTORY_PAT H_INC . 'p rofiles.in c.php' );   23   require_on ce( BX_DIR ECTORY_PAT H_INC . 'p rofiles.in c.php' );
24   require_on ce( BX_DIR ECTORY_PAT H_INC . 'a dmin_desig n.inc.php'  );   24   require_on ce( BX_DIR ECTORY_PAT H_INC . 'a dmin_desig n.inc.php'  );
25   require_on ce( BX_DIR ECTORY_PAT H_INC . 'u tils.inc.p hp' );   25   require_on ce( BX_DIR ECTORY_PAT H_INC . 'u tils.inc.p hp' );
26     26  
27   // page in dex   27   // page in dex
28   $_page['na me_index']  = 46;   28   $_page['na me_index']  = 46;
29     29  
30   // authent icate admi nistrator   30   // authent icate admi nistrator
31   $logged['a dmin']   =   member_aut h(   1  
);
  31   $logged['a dmin']   =   member_aut h(   1 ,   true,   true   );
32     32  
33   // defina  page heade rs   33   // defina  page heade rs
34   $_page['he ader'] = " Daily Quot es";   34   $_page['he ader'] = " Daily Quot es";
35   $_page['he ader_text' ] = "Add,  remove and  edit Dail y Quotes";   35   $_page['he ader_text' ] = "Add,  remove and  edit Dail y Quotes";
36     36  
37   // describ e table st rure to di splay page  ========= ========== ========== ========== ========== ========== ===   37   // describ e table st rure to di splay page  ========= ========== ========== ========== ========== ========== ===
38     38  
39   $allow_edi t = 1;   39   $allow_edi t = 1;
40   $allow_add  = 1;   40   $allow_add  = 1;
41   $allow_del ete = 1;   41   $allow_del ete = 1;
42     42  
43   $use_table   = 'Daily Quotes';   43   $use_table   = 'Daily Quotes';
44     44  
45   // fields  definition  array   45   // fields  definition  array
46   //  indexe s - exact  names of t he table f ields   46   //  indexe s - exact  names of t he table f ields
47   //  values   - types   47   //  values   - types
48   //    inde x - primar y key if t he field ( integer)   48   //    inde x - primar y key if t he field ( integer)
49   //    char   - string  fieled ma x 255 char s (char/va rchar)   49   //    char   - string  fieled ma x 255 char s (char/va rchar)
50   //    area   - string  fieled (m ediumtext)   50   //    area   - string  fieled (m ediumtext)
51   $fields_ty pes  = arr ay('ID' =>  'index',  'Text' =>  'area', 'A uthor' =>  'char');   51   $fields_ty pes  = arr ay('ID' =>  'index',  'Text' =>  'area', 'A uthor' =>  'char');
52   $fields_ti tles = arr ay('ID' =>  'ID', 'Te xt' => 'Qu tes text',  'Author'  => 'Quote  author');   52   $fields_ti tles = arr ay('ID' =>  'ID', 'Te xt' => 'Qu tes text',  'Author'  => 'Quote  author');
53   $fields_si zes  = arr ay('ID' =>  '10%', 'T ext' => '6 0%', 'Auth or' => '30 %');   53   $fields_si zes  = arr ay('ID' =>  '10%', 'T ext' => '6 0%', 'Auth or' => '30 %');
54   $fields_al ign  = arr ay('ID' =>  'center',  'Text' =>  'left', ' Author' =>  'left');   54   $fields_al ign  = arr ay('ID' =>  'center',  'Text' =>  'left', ' Author' =>  'left');
55     55  
56   $class_tit les = "pan el";   56   $class_tit les = "pan el";
57   $class_dat a   = "tab le";   57   $class_dat a   = "tab le";
58   $class_err or  = "tab le_err";   58   $class_err or  = "tab le_err";
59   $table_wid th  = "90% ";   59   $table_wid th  = "90% ";
60     60  
61   // ======= ========== ========== ========== ========== ========== ========== ========== ========== ========== ===   61   // ======= ========== ========== ========== ========== ========== ========== ========== ========== ========== ===
62     62  
63   // put com mon top HT ML code   63   // put com mon top HT ML code
64   TopCodeAdm in ();   64   TopCodeAdm in ();
65   ContentBlo ckHead("Da ily Quotes ");   65   ContentBlo ckHead("Da ily Quotes ");
66     66  
67       echo " <table cla ss=\"text\ " align=\" center\" w idth=\"$ta ble_width\ "><tr><td  height=\"3 0\"><a hre f=\"quotes .php?actio n=insert\" >Add new<a ></td></tr ></table>\ n\n";   67       echo " <table cla ss=\"text\ " align=\" center\" w idth=\"$ta ble_width\ "><tr><td  height=\"3 0\"><a hre f=\"quotes .php?actio n=insert\" >Add new<a ></td></tr ></table>\ n\n";
68     68  
69       if ('u pdate' ==  $_POST['ac tion'])   69       if ('u pdate' ==  $_POST['ac tion'])
70       {   70       {
71           $r esult = up date_db();   71           $r esult = up date_db();
72       }   72       }
73       else i f ('insert ' == $_POS T['action' ])   73       else i f ('insert ' == $_POS T['action' ])
74       {   74       {
75           $r esult = in sert_db();   75           $r esult = in sert_db();
76     76  
77       }   77       }
78       else i f ( 0 < st rlen ($_PO ST['rows_f orm_submit ']))   78       else i f ( 0 < st rlen ($_PO ST['rows_f orm_submit ']))
79       {   79       {
80           $r esult = de lete_recor ds();   80           $r esult = de lete_recor ds();
81       }   81       }
82     82  
83       if ( s trlen($res ult) )   83       if ( s trlen($res ult) )
84           ec ho "<br><c enter>$res ult</cente r><br>";   84           ec ho "<br><c enter>$res ult</cente r><br>";
85     85  
86       if ('e dit' == $_ GET['actio n'])   86       if ('e dit' == $_ GET['actio n'])
87       {   87       {
88           ec ho get_edi t_new_form  (1);   88           ec ho get_edi t_new_form  (1);
89       }   89       }
90       else   90       else
91       if ('i nsert' ==  $_GET['act ion'])   91       if ('i nsert' ==  $_GET['act ion'])
92       {   92       {
93           ec ho get_edi t_new_form  (0);   93           ec ho get_edi t_new_form  (0);
94       }   94       }
95     95  
96       PrintD ata();   96       PrintD ata();
97     97  
98   // put bot tom top HT ML code   98   // put bot tom top HT ML code
99   BottomCode ();   99   BottomCode ();
100     100  
101   // public  functions  ========== ========== ========== ========== ========== ========== ========== ========== ===   101   // public  functions  ========== ========== ========== ========== ========== ========== ========== ========== ===
102     102  
103   /**   103   /**
104    * print l ist of the  table dat e   104    * print l ist of the  table dat e
105    */   105    */
106   function P rintData()   106   function P rintData()
107   {   107   {
108       global  $fields_t ypes;   108       global  $fields_t ypes;
109       global  $fields_t itles;   109       global  $fields_t itles;
110       global  $fields_s izes;   110       global  $fields_s izes;
111       global  $fields_a lign;   111       global  $fields_a lign;
112       global  $class_ti tles;   112       global  $class_ti tles;
113       global  $class_da ta;   113       global  $class_da ta;
114       global  $class_er ror;   114       global  $class_er ror;
115       global  $table_wi dth;   115       global  $table_wi dth;
116       global  $use_tabl e;   116       global  $use_tabl e;
117       global  $allow_de lete;   117       global  $allow_de lete;
118       global  $allow_ed it;   118       global  $allow_ed it;
119     119  
120       $query  = "SELECT  * FROM $u se_table";   120       $query  = "SELECT  * FROM $u se_table";
121     121  
122       $res =  db_res ($ query);   122       $res =  db_res ($ query);
123     123  
124       if ( ! mysql_num_ rows($res)  )   124       if ( ! mysql_num_ rows($res)  )
125       {   125       {
126           ec ho "<div a lign=cente r class=\" err\">No d ata availa ble</div>" ;   126           ec ho "<div a lign=cente r class=\" err\">No d ata availa ble</div>" ;
127           re turn;   127           re turn;
128       }   128       }
129     129  
130       echo " <table cel lspacing=2  cellpaddi ng=1 class =\"text\"  width=\"$t able_width \" align=\ "center\"> \n\n";   130       echo " <table cel lspacing=2  cellpaddi ng=1 class =\"text\"  width=\"$t able_width \" align=\ "center\"> \n\n";
131     131  
132       // pri nt titles   132       // pri nt titles
133     133  
134       echo " <tr class= \"$class_t itles\">\n ";   134       echo " <tr class= \"$class_t itles\">\n ";
135       if ( $ allow_dele te )   135       if ( $ allow_dele te )
136       {   136       {
137           ec ho "<form  name=\"row s_form\" m ethod=\"PO ST\" actio n=\"quotes .php\">";   137           ec ho "<form  name=\"row s_form\" m ethod=\"PO ST\" actio n=\"quotes .php\">";
138           ec ho "<td>&n bsp;</td>\ n";   138           ec ho "<td>&n bsp;</td>\ n";
139       }   139       }
140       foreac h ($fields _titles as  $k => $v)   140       foreac h ($fields _titles as  $k => $v)
141       {   141       {
142           ec ho "\t<td  width=\"{$ fields_siz es[$k]}\"  align=\"{$ fields_ali gn[$k]}\"> $v</td>\n" ;   142           ec ho "\t<td  width=\"{$ fields_siz es[$k]}\"  align=\"{$ fields_ali gn[$k]}\"> $v</td>\n" ;
143       }   143       }
144       if ( $ allow_edit  )   144       if ( $ allow_edit  )
145       {   145       {
146           ec ho "<td>&n bsp;</td>\ n";   146           ec ho "<td>&n bsp;</td>\ n";
147       }   147       }
148       echo " </tr>\n\n" ;   148       echo " </tr>\n\n" ;
149     149  
150       // pri nt data   150       // pri nt data
151     151  
152       while  ( $row = m ysql_fetch _array ($r es) )   152       while  ( $row = m ysql_fetch _array ($r es) )
153       {   153       {
154           if  ( $row[ge t_index_fi eldname()]  == $_GET[ 'index_fie ld'] || $r ow[get_ind ex_fieldna me()] == $ _POST['ind ex_field'] )   154           if  ( $row[ge t_index_fi eldname()]  == $_GET[ 'index_fie ld'] || $r ow[get_ind ex_fieldna me()] == $ _POST['ind ex_field'] )
155           {   155           {
156                echo "<t r class=\" $class_err or\">\n";   156                echo "<t r class=\" $class_err or\">\n";
157           }   157           }
158           el se   158           el se
159           {   159           {
160                echo "<t r class=\" $class_dat a\">\n";   160                echo "<t r class=\" $class_dat a\">\n";
161           }   161           }
162     162  
163           //  checkboxe s   163           //  checkboxe s
164           if  ( $allow_ delete )   164           if  ( $allow_ delete )
165           {   165           {
166                echo "<t d align=ce nter><inpu t type=che ckbox name =\"".$row[ get_index_ fieldname( )]."\"></t d>\n";   166                echo "<t d align=ce nter><inpu t type=che ckbox name =\"".$row[ get_index_ fieldname( )]."\"></t d>\n";
167           }   167           }
168     168  
169           //  data   169           //  data
170           fo reach ( $f ields_size s as $k =>  $v )   170           fo reach ( $f ields_size s as $k =>  $v )
171           {   171           {
172                echo "\t <td width= \"$v\" ali gn=\"{$fie lds_align[ $k]}\">".  process_te xt_output( $row[$k])  ."</td>\n" ;   172                echo "\t <td width= \"$v\" ali gn=\"{$fie lds_align[ $k]}\">".  process_te xt_output( $row[$k])  ."</td>\n" ;
173           }   173           }
174     174  
175           //  edit butt on   175           //  edit butt on
176           if  ( $allow_ edit )   176           if  ( $allow_ edit )
177           {   177           {
178                echo "<t d align=ce nter><a hr ef=\"?acti on=edit&in dex_field= ". $row[ge t_index_fi eldname()] . "\">Edit </a></td>\ n";   178                echo "<t d align=ce nter><a hr ef=\"?acti on=edit&in dex_field= ". $row[ge t_index_fi eldname()] . "\">Edit </a></td>\ n";
179           }   179           }
180     180  
181           ec ho "</tr>\ n\n";   181           ec ho "</tr>\ n\n";
182       }   182       }
183     183  
184       echo " </table>\n \n";   184       echo " </table>\n \n";
185     185  
186       if ( $ allow_dele te )   186       if ( $ allow_dele te )
187       {   187       {
188           ec ho get_che ckbox_menu () . "</fo rm>";   188           ec ho get_che ckbox_menu () . "</fo rm>";
189       }   189       }
190     190  
191     191  
192   ContentBlo ckFoot();   192   ContentBlo ckFoot();
193   }   193   }
194     194  
195   // private  functions  ========= ========== ========== ========== ========== ========== ========== ========== ===   195   // private  functions  ========= ========== ========== ========== ========== ========== ========== ========== ===
196     196  
197     197  
198   /**   198   /**
199    * get fie lds list   199    * get fie lds list
200    */   200    */
201   function g et_fields_ list ()   201   function g et_fields_ list ()
202   {   202   {
203       global  $fields_t ypes;   203       global  $fields_t ypes;
204     204  
205       $ret =  "";   205       $ret =  "";
206       foreac h ($fields _types as  $k)   206       foreac h ($fields _types as  $k)
207       {   207       {
208           $r et += "`$k `,";   208           $r et += "`$k `,";
209       }   209       }
210       return  substr ($ ret, 0, -1 );   210       return  substr ($ ret, 0, -1 );
211   }   211   }
212     212  
213   /**   213   /**
214    * get ind ex field n ame   214    * get ind ex field n ame
215    */   215    */
216   function g et_index_f ieldname ( )   216   function g et_index_f ieldname ( )
217   {   217   {
218       global  $fields_t ypes;   218       global  $fields_t ypes;
219     219  
220       $ret =  "";   220       $ret =  "";
221       foreac h ($fields _types as  $k => $v)   221       foreac h ($fields _types as  $k => $v)
222       {   222       {
223           if  ($v == 'i ndex' ) re turn $k;   223           if  ($v == 'i ndex' ) re turn $k;
224       }   224       }
225       return  $fields_t ypes[0];   225       return  $fields_t ypes[0];
226   }   226   }
227     227  
228     228  
229   /**   229   /**
230    * get HTM L code for  delete re cords menu   230    * get HTM L code for  delete re cords menu
231    */   231    */
232   function g et_checkbo x_menu ()   232   function g et_checkbo x_menu ()
233   {   233   {
234       global  $table_wi dth;   234       global  $table_wi dth;
235       return  <<<EOS   235       return  <<<EOS
236   <table cla ss="text"  width="$ta ble_width"  align="ce nter" bord er="0">   236   <table cla ss="text"  width="$ta ble_width"  align="ce nter" bord er="0">
237   <tr>   237   <tr>
238       <td wi dth="30%"> &nbsp;<a h ref="javas cript: voi d(0);" onc lick="setC heckboxes(  'rows_for m', true ) ; return f alse;">Che ck all</a>  / <a href ="javascri pt: void(0 );" onclic k="setChec kboxes( 'r ows_form',  false );  return fal se;">Unche ck all</a> &nbsp;</td >   238       <td wi dth="30%"> &nbsp;<a h ref="javas cript: voi d(0);" onc lick="setC heckboxes(  'rows_for m', true ) ; return f alse;">Che ck all</a>  / <a href ="javascri pt: void(0 );" onclic k="setChec kboxes( 'r ows_form',  false );  return fal se;">Unche ck all</a> &nbsp;</td >
239       <td wi dth="20%"> with selec ted:</td>   239       <td wi dth="20%"> with selec ted:</td>
240       <td wi dth="50%"> <input cla ss=text ty pe=submit  name="rows _form_subm it" value= "Delete">< /td>   240       <td wi dth="50%"> <input cla ss=text ty pe=submit  name="rows _form_subm it" value= "Delete">< /td>
241   </tr>   241   </tr>
242   </table>   242   </table>
243   EOS;   243   EOS;
244   }   244   }
245     245  
246   /**   246   /**
247    * get HTM L code for  delete re cords menu   247    * get HTM L code for  delete re cords menu
248    */   248    */
249   function g et_edit_ne w_form ($e dit_form)   249   function g et_edit_ne w_form ($e dit_form)
250   {   250   {
251       global  $table_wi dth;   251       global  $table_wi dth;
252       global  $fields_t ypes;   252       global  $fields_t ypes;
253       global  $fields_t itles;   253       global  $fields_t itles;
254       global  $use_tabl e;   254       global  $use_tabl e;
255       global  $class_da ta;   255       global  $class_da ta;
256     256  
257       if ( $ edit_form  )   257       if ( $ edit_form  )
258       {   258       {
259           $q uery = "SE LECT * FRO M $use_tab le WHERE " . get_inde x_fieldnam e() ."=".  (int)$_GET ['index_fi eld']. " L IMIT 1";   259           $q uery = "SE LECT * FRO M $use_tab le WHERE " . get_inde x_fieldnam e() ."=".  (int)$_GET ['index_fi eld']. " L IMIT 1";
260           $q uote_arr =  db_arr ($ query);   260           $q uote_arr =  db_arr ($ query);
261       }   261       }
262     262  
263       $ret =  "";   263       $ret =  "";
264       $ret . = "<table  class=\"te xt\" width =\"$table_ width\" al ign=\"cent er\">\n\n" ;   264       $ret . = "<table  class=\"te xt\" width =\"$table_ width\" al ign=\"cent er\">\n\n" ;
265       $ret . = "<form m ethod=\"po st\" actio n=\"quotes .php\">\n\ n";   265       $ret . = "<form m ethod=\"po st\" actio n=\"quotes .php\">\n\ n";
266       if ( $ edit_form  )   266       if ( $ edit_form  )
267       {   267       {
268           $r et .= "<in put type=\ "hidden\"  name=\"act ion\" valu e=\"update \" \>\n";   268           $r et .= "<in put type=\ "hidden\"  name=\"act ion\" valu e=\"update \" \>\n";
269           $r et .= "<in put type=\ "hidden\"  name=\"ind ex_field\"  value=\"" . (int)$_G ET['index_ field']. " \" \>\n";   269           $r et .= "<in put type=\ "hidden\"  name=\"ind ex_field\"  value=\"" . (int)$_G ET['index_ field']. " \" \>\n";
270       }   270       }
271       else   271       else
272       {   272       {
273           $r et .= "<in put type=\ "hidden\"  name=\"act ion\" valu e=\"insert \" \>\n";   273           $r et .= "<in put type=\ "hidden\"  name=\"act ion\" valu e=\"insert \" \>\n";
274       }   274       }
275       foreac h ($fields _types as  $k => $v)   275       foreac h ($fields _types as  $k => $v)
276       {   276       {
277           sw itch ($v)   277           sw itch ($v)
278           {   278           {
279           ca se 'index' :   279           ca se 'index' :
280                break;   280                break;
281           ca se 'area':   281           ca se 'area':
282                $ret .=  "<tr class =\"$class_ data\">\n< td valign= top>{$fiel ds_titles[ $k]}</td>\ n";   282                $ret .=  "<tr class =\"$class_ data\">\n< td valign= top>{$fiel ds_titles[ $k]}</td>\ n";
283                $ret .=  "<td><text area name= \"$k\" row s=5 cols=6 0>\n";   283                $ret .=  "<td><text area name= \"$k\" row s=5 cols=6 0>\n";
284                if ( $ed it_form )   284                if ( $ed it_form )
285                {   285                {
286                    $ret  .= htmlsp ecialchars ($quote_ar r[$k]);   286                    $ret  .= htmlsp ecialchars ($quote_ar r[$k]);
287                }   287                }
288                $ret .=  "</textare a></td>\n< /tr>\n\n";   288                $ret .=  "</textare a></td>\n< /tr>\n\n";
289                break;   289                break;
290           ca se 'char':   290           ca se 'char':
291                $ret .=  "<tr class =\"$class_ data\">\n< td>{$field s_titles[$ k]}</td>\n ";   291                $ret .=  "<tr class =\"$class_ data\">\n< td>{$field s_titles[$ k]}</td>\n ";
292                $ret .=  "<td><inpu t name=\"$ k\" size=6 0 value=\" ";   292                $ret .=  "<td><inpu t name=\"$ k\" size=6 0 value=\" ";
293                if ( $ed it_form )   293                if ( $ed it_form )
294                {   294                {
295                    $ret  .= htmlsp ecialchars ($quote_ar r[$k]);   295                    $ret  .= htmlsp ecialchars ($quote_ar r[$k]);
296                }   296                }
297                $ret .=  "\"/></td> \n</tr>\n\ n";   297                $ret .=  "\"/></td> \n</tr>\n\ n";
298                break;   298                break;
299           }   299           }
300       }   300       }
301     301  
302       $ret . = "<tr><td  height=\" 40\" colsp an=\"2\" a lign=\"cen ter\">\n";   302       $ret . = "<tr><td  height=\" 40\" colsp an=\"2\" a lign=\"cen ter\">\n";
303       $ret . = "<input  class =tex t type=\"s ubmit\" na me=\"form_ sibmit\" v alue=\"";   303       $ret . = "<input  class =tex t type=\"s ubmit\" na me=\"form_ sibmit\" v alue=\"";
304       if ( $ edit_form  )   304       if ( $ edit_form  )
305       {   305       {
306           $r et .= "Upd ate";   306           $r et .= "Upd ate";
307       }   307       }
308       else   308       else
309       {   309       {
310           $r et .= "Ins ert";   310           $r et .= "Ins ert";
311       }   311       }
312       $ret . = "\" />";   312       $ret . = "\" />";
313       $ret . = "</td></ tr>\n\n";   313       $ret . = "</td></ tr>\n\n";
314     314  
315       $ret . = "</form> \n";   315       $ret . = "</form> \n";
316       $ret . = "</table >\n\n";   316       $ret . = "</table >\n\n";
317       return  $ret;   317       return  $ret;
318   }   318   }
319     319  
320   /**   320   /**
321    * insert  new record  to the da tabase   321    * insert  new record  to the da tabase
322    */   322    */
323   function i nsert_db ( )   323   function i nsert_db ( )
324   {   324   {
325       global  $use_tabl e;   325       global  $use_tabl e;
326       global  $fields_t ypes;   326       global  $fields_t ypes;
327     327  
328     328  
329       $query  = "INSERT  INTO $use _table SET  ";   329       $query  = "INSERT  INTO $use _table SET  ";
330     330  
331       foreac h ($fields _types as  $k => $v)   331       foreac h ($fields _types as  $k => $v)
332       {   332       {
333           sw itch ($v)   333           sw itch ($v)
334           {   334           {
335           ca se 'index' :   335           ca se 'index' :
336                break;   336                break;
337           ca se 'area':   337           ca se 'area':
338           ca se 'char':   338           ca se 'char':
339                $query . = "$k = '" . process_ db_input(  $_POST[$k]  ) ."', ";   339                $query . = "$k = '" . process_ db_input(  $_POST[$k]  ) ."', ";
340                break;   340                break;
341           }   341           }
342       }   342       }
343       $query  = substr  ($query, 0 , -2);   343       $query  = substr  ($query, 0 , -2);
344     344  
345       if (db _res ($que ry))   345       if (db _res ($que ry))
346       {   346       {
347           re turn "<div  class=\"e rr\">New d ata was su ccessfully  added</di v>";   347           re turn "<div  class=\"e rr\">New d ata was su ccessfully  added</di v>";
348       }   348       }
349       else   349       else
350       {   350       {
351           re turn "<div  class=\"e rr\">New d ata was NO T successf ully added </div>";   351           re turn "<div  class=\"e rr\">New d ata was NO T successf ully added </div>";
352       }   352       }
353   }   353   }
354     354  
355   /**   355   /**
356    * update  record to  the databa se   356    * update  record to  the databa se
357    */   357    */
358   function u pdate_db ( )   358   function u pdate_db ( )
359   {   359   {
360       global  $use_tabl e;   360       global  $use_tabl e;
361       global  $fields_t ypes;   361       global  $fields_t ypes;
362     362  
363     363  
364       $query  = "UPDATE  $use_tabl e SET ";   364       $query  = "UPDATE  $use_tabl e SET ";
365     365  
366       foreac h ($fields _types as  $k => $v)   366       foreac h ($fields _types as  $k => $v)
367       {   367       {
368           sw itch ($v)   368           sw itch ($v)
369           {   369           {
370           ca se 'index' :   370           ca se 'index' :
371                break;   371                break;
372           ca se 'area':   372           ca se 'area':
373           ca se 'char':   373           ca se 'char':
374                $query . = "$k = '" . process_ db_input(  $_POST[$k]  ) ."', ";   374                $query . = "$k = '" . process_ db_input(  $_POST[$k]  ) ."', ";
375                break;   375                break;
376           }   376           }
377       }   377       }
378     378  
379       $query  = substr  ($query, 0 , -2);   379       $query  = substr  ($query, 0 , -2);
380     380  
381       $query  .= " WHER E ".get_in dex_fieldn ame()." =  ". (int)$_ POST['inde x_field']  ." LIMIT 1 ";   381       $query  .= " WHER E ".get_in dex_fieldn ame()." =  ". (int)$_ POST['inde x_field']  ." LIMIT 1 ";
382     382  
383       if (db _res ($que ry))   383       if (db _res ($que ry))
384       {   384       {
385           re turn "<div  class=\"e rr\">Data  was succes sfully upd ated</div> ";   385           re turn "<div  class=\"e rr\">Data  was succes sfully upd ated</div> ";
386       }   386       }
387       else   387       else
388       {   388       {
389           re turn "<div  class=\"e rr\">Data  was NOT up dated</div >";   389           re turn "<div  class=\"e rr\">Data  was NOT up dated</div >";
390       }   390       }
391   }   391   }
392     392  
393   /**   393   /**
394    * delete  the market  records f rom the da tabase   394    * delete  the market  records f rom the da tabase
395    */   395    */
396   function d elete_reco rds ()   396   function d elete_reco rds ()
397   {   397   {
398       global  $use_tabl e;   398       global  $use_tabl e;
399       global  $fields_t ypes;   399       global  $fields_t ypes;
400       global  $MySQL;   400       global  $MySQL;
401     401  
402       $num =  0;   402       $num =  0;
403       foreac h ($_POST  as $k => $ v)   403       foreac h ($_POST  as $k => $ v)
404       {   404       {
405           $k  = (int)$k ;   405           $k  = (int)$k ;
406           if  ( $k > 0  && $v == ' on' )   406           if  ( $k > 0  && $v == ' on' )
407           {   407           {
408                $query =  "DELETE F ROM $use_t able WHERE  ". get_in dex_fieldn ame() ." =  $k";   408                $query =  "DELETE F ROM $use_t able WHERE  ". get_in dex_fieldn ame() ." =  $k";
409                if ( db_ res ($quer y) )   409                if ( db_ res ($quer y) )
410                    $num  += mysql_ affected_r ows( $MySQ L->link );   410                    $num  += mysql_ affected_r ows( $MySQ L->link );
411           }   411           }
412       }   412       }
413       return  "<div cla ss=\"err\" >$num rows  was delet ed</div>";   413       return  "<div cla ss=\"err\" >$num rows  was delet ed</div>";
414   }   414   }
415     415  
416     416  
417   ?>   417   ?>