PageRenderTime 45ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/Includes/blocks/block_login.php

https://code.google.com/p/nuked-klan/
PHP | 213 lines | 169 code | 36 blank | 8 comment | 48 complexity | 15725f8c7c79a880065da0f0447baf21 MD5 | raw file
Possible License(s): GPL-3.0, BSD-3-Clause, GPL-2.0, LGPL-3.0, LGPL-2.1
  1. <?php
  2. // -------------------------------------------------------------------------//
  3. // Nuked-KlaN - PHP Portal //
  4. // http://www.nuked-klan.org //
  5. // -------------------------------------------------------------------------//
  6. // This program is free software. you can redistribute it and/or modify //
  7. // it under the terms of the GNU General Public License as published by //
  8. // the Free Software Foundation; either version 2 of the License. //
  9. // -------------------------------------------------------------------------//
  10. if (!defined("INDEX_CHECK")){
  11. exit('You can\'t run this file alone.');
  12. }
  13. function affich_block_login($blok){
  14. global $user, $nuked, $bgcolor3, $bgcolor1 ;
  15. list($login, $messpv, $members, $online, $avatar) = explode('|', $blok['content']);
  16. $blok['content'] = '';
  17. $c = 0;
  18. if($login != 'off'){
  19. if (!$user){
  20. $blok['content'] = '<form action="index.php?file=User&amp;nuked_nude=index&amp;op=login" method="post">'."\n"
  21. . '<table style="margin-left: auto;margin-right: auto;text-align: left;">'."\n"
  22. . '<tr><td>' . _NICK . ' :</td><td><input type="text" name="pseudo" size="10" maxlength="250" /></td></tr>'."\n"
  23. . '<tr><td>' . _PASSWORD . ' :</td><td><input type="password" name="pass" size="10" maxlength="15" /></td></tr>'."\n"
  24. . '<tr><td colspan="2"><input type="checkbox" class="checkbox" name="remember_me" value="ok" checked="checked" />&nbsp;' . _SAVE . '</td></tr>'."\n"
  25. . '<tr><td colspan="2" align="center"><input type="submit" value="' . _BLOGIN . '" /></td></tr>'."\n"
  26. . '<tr><td colspan="2"><a href="index.php?file=User&amp;op=reg_screen">' . _REGISTER . '</a><br />'."\n"
  27. . '<a href="index.php?file=User&amp;op=oubli_pass">' . _FORGETPASS . '</a> ?</td></tr></table></form>'."\n";
  28. }
  29. else{
  30. $blok['content'] = '<div style="text-align: center;">' . _WELCOME . ', <b>' . $user[2] . '</b><br /><br />'."\n";
  31. if ($avatar != 'off'){
  32. $sql_avatar=mysql_query('SELECT avatar FROM ' . USER_TABLE . ' WHERE id = \'' . $user[0] . '\' ');
  33. list($avatar_url) = mysql_fetch_array($sql_avatar);
  34. if($avatar_url) $blok['content'] .= '<img src="' . $avatar_url . '" style="border:1px ' . $bgcolor3 . ' dashed; width:100px; background:' . $bgcolor1 . '; padding:2px;" alt="' . $user[2] . ' avatar" /><br /><br />';
  35. }
  36. $blok['content'] .= '<a href="index.php?file=User">' . _ACCOUNT . '</a> / <a href="index.php?file=User&amp;nuked_nude=index&amp;op=logout">' . _LOGOUT . '</a></div>'."\n";
  37. }
  38. $c++;
  39. }
  40. if($messpv != 'off' && $user[0] != ''){
  41. if ($c > 0) $blok['content'] .= '<hr style="height: 1px;" />'."\n";
  42. $sql2 = mysql_query('SELECT mid FROM ' . USERBOX_TABLE . ' WHERE user_for = \'' . $user[0] . '\' AND status = 1');
  43. $nb_mess_lu = mysql_num_rows($sql2);
  44. $blok['content'] .= '&nbsp;<img width="14" height="12" src="images/message.gif" alt="" />&nbsp;<span style="text-decoration: underline"><b>' . _MESSPV . '</b></span><br />'."\n";
  45. if ($user[5] > 0){
  46. $blok['content'] .= '&nbsp;<b><big>?</big></b>&nbsp;' . _NOTREAD . ' : <a href="index.php?file=Userbox"><b>' . $user[5] . '</b></a>'."\n";
  47. }
  48. else{
  49. $blok['content'] .= '&nbsp;<b><big>?</big></b>&nbsp;' . _NOTREAD . ' : <b>' . $user[5] . '</b>'."\n";
  50. }
  51. if ($nb_mess_lu > 0){
  52. $blok['content'] .= '<br />&nbsp;<b><big>?</big></b>&nbsp;' . _READ . ' : <a href="index.php?file=Userbox"><b>' . $nb_mess_lu . '</b></a>'."\n";
  53. }
  54. else{
  55. $blok['content'] .= '<br />&nbsp;<b><big>?</big></b>&nbsp;' . _READ . ' : <b>' . $nb_mess_lu . '</b>'."\n";
  56. }
  57. $c++;
  58. }
  59. if ($members != 'off'){
  60. if ($c > 0) $blok['content'] .= '<hr style="height: 1px;" />'."\n";
  61. $blok['content'] .= '&nbsp;<img width="16" height="13" src="images/memberslist.gif" alt="" />&nbsp;<span style="text-decoration: underline"><b>' . _MEMBERS . '</b></span><br />'."\n";
  62. $sql_users = mysql_query('SELECT id FROM ' . USER_TABLE . ' WHERE niveau < 3');
  63. $nb_users = mysql_num_rows($sql_users);
  64. $sql_admin = mysql_query('SELECT id FROM ' . USER_TABLE . ' WHERE niveau > 2');
  65. $nb_admin = mysql_num_rows($sql_admin);
  66. $sql_lastmember = mysql_query('SELECT pseudo FROM ' . USER_TABLE . ' ORDER BY date DESC LIMIT 0, 1');
  67. list($lastmember) = mysql_fetch_array($sql_lastmember);
  68. $blok['content'] .= '&nbsp;<b><big>?</big></b>&nbsp;' . _ADMINS . ' : <b>' . $nb_admin . '</b><br />&nbsp;<b><big>?</big></b>&nbsp;' . _MEMBERS . ' :'
  69. . '&nbsp;<b>' . $nb_users . '</b> [<a href="index.php?file=Members">' . _LIST . '</a>]<br />'."\n"
  70. . '&nbsp;<b><big>?</big></b>&nbsp;' . _LASTMEMBER . ' : <a href="index.php?file=Members&amp;op=detail&amp;autor=' . urlencode($lastmember) . '"><b>' . $lastmember . '</b></a>'."\n";
  71. $c++;
  72. }
  73. if ($online != 'off'){
  74. if ($c > 0) $blok['content'] .= '<hr style="height: 1px;" />'."\n";
  75. $blok['content'] .= '&nbsp;<img width="16" height="13" src="images/online.gif" alt="" />&nbsp;<span style="text-decoration: underline"><b>' . _WHOISONLINE . '</b></span><br />'."\n";
  76. $nb = nbvisiteur();
  77. if ($nb[1] > 0){
  78. $sql4 = mysql_query('SELECT username FROM ' . NBCONNECTE_TABLE . ' WHERE type BETWEEN 1 AND 2 ORDER BY date');
  79. while (list($nom) = mysql_fetch_array($sql4)){
  80. $user_online .= '&nbsp;<b><big>?</big></b>&nbsp;<b>' . $nom . '</b><br />';
  81. }
  82. $user_list = '&nbsp;[<a href="#" onmouseover="AffBulle(\'&nbsp;&nbsp;' . _WHOISONLINE . '\', \'' . htmlentities(mysql_real_escape_string($user_online), ENT_NOQUOTES) . '\', 150)" onmouseout="HideBulle()">' . _LIST . '</a>]';
  83. }
  84. else{
  85. $user_list = '';
  86. }
  87. if ($nb[2] > 0){
  88. $sql5 = mysql_query('SELECT username FROM ' . NBCONNECTE_TABLE . ' WHERE type > 2 ORDER BY date');
  89. while (list($name) = mysql_fetch_array($sql5)){
  90. $admin_online .= '&nbsp;<b><big>?</big></b>&nbsp;<b>' . $name . '</b><br />';
  91. }
  92. $admin_list = '&nbsp;[<a href="#" onmouseover="AffBulle(\'&nbsp;&nbsp;' . _WHOISONLINE . '\', \'' . htmlentities(mysql_real_escape_string($admin_online), ENT_NOQUOTES) . '\', 150)" onmouseout="HideBulle()">' . _LIST . '</a>]';
  93. }
  94. else{
  95. $admin_list = '';
  96. }
  97. $blok['content'] .= '&nbsp;<b><big>?</big></b>&nbsp;' . _VISITOR;
  98. if ($nb[0] > 1) $blok['content'] .= 's';
  99. $blok['content'] .= ' : <b>' . $nb[0] . '</b><br />&nbsp;<b><big>?</big></b>&nbsp;' . _MEMBER;
  100. if ($nb[1] > 1) $blok['content'] .= 's';
  101. $blok['content'] .= ' : <b>' . $nb[1] . '</b>' . $user_list . '<br />&nbsp;<b><big>?</big></b>&nbsp;' . _ADMIN;
  102. if ($nb[2] > 1) $blok['content'] .= 's';
  103. $blok['content'] .= ' : <b>' . $nb[2] . '</b>' . $admin_list . '<br />'."\n";
  104. $c++;
  105. }
  106. return $blok;
  107. }
  108. function edit_block_login($bid){
  109. global $nuked, $language;
  110. $sql = mysql_query('SELECT active, position, titre, module, content, type, nivo, page FROM ' . BLOCK_TABLE . ' WHERE bid = \'' . $bid . '\' ');
  111. list($active, $position, $titre, $modul, $content, $type, $nivo, $pages) = mysql_fetch_array($sql);
  112. $titre = printSecuTags($titre);
  113. list($login, $messpv, $members, $online, $avatar) = explode('|', $content);
  114. if ($active == 1) $checked1 = 'selected="selected"';
  115. else if ($active == 2) $checked2 = 'selected="selected"';
  116. else $checked0 = 'selected="selected"';
  117. if ($login == 'off') $checked3 = 'selected="selected"'; else $checked3 = '';
  118. if ($messpv == 'off') $checked4 = 'selected="selected"'; else $checked4 = '';
  119. if ($members == 'off') $checked5 = 'selected="selected"'; else $checked5 = '';
  120. if ($online == 'off') $checked6 = 'selected="selected"'; else $checked6 = '';
  121. if ($avatar == 'off') $checked7 = 'selected="selected"'; else $checked7 = '';
  122. echo '<div class="content-box">',"\n" //<!-- Start Content Box -->
  123. , '<div class="content-box-header"><h3>' , _BLOCKADMIN , '</h3>',"\n"
  124. , '<a href="help/' , $language , '/block.html" rel="modal">',"\n"
  125. , '<img style="border: 0;" src="help/help.gif" alt="" title="' , _HELP , '" /></a>',"\n"
  126. , '</div>',"\n"
  127. , '<div class="tab-content" id="tab2"><form method="post" action="index.php?file=Admin&amp;page=block&amp;op=modif_block">',"\n"
  128. , '<table style="margin-left: auto;margin-right: auto;text-align: left;" cellspacing="0" cellpadding="2" border="0">',"\n"
  129. , '<tr><td><b>' , _TITLE , '</b></td><td><b>' , _BLOCK , '</b></td><td><b>' , _POSITION , '</b></td><td><b>' , _LEVEL , '</b></td></tr>',"\n"
  130. , '<tr><td align="center"><input type="text" name="titre" size="40" value="' , $titre , '" /></td>',"\n"
  131. , '<td align="center"><select name="active">',"\n"
  132. , '<option value="1" ' , $checked1 , '>' , _LEFT , '</option>',"\n"
  133. , '<option value="2" ' , $checked2 , '>' , _RIGHT , '</option>',"\n"
  134. , '<option value="0" ' , $checked0 , '>' , _OFF , '</option></select></td>',"\n"
  135. , '<td align="center"><input type="text" name="position" size="2" value="' , $position , '" /></td>',"\n"
  136. , '<td align="center"><select name="nivo"><option>' , $nivo , '</option>',"\n"
  137. , '<option>0</option>',"\n"
  138. , '<option>1</option>',"\n"
  139. , '<option>2</option>',"\n"
  140. , '<option>3</option>',"\n"
  141. , '<option>4</option>',"\n"
  142. , '<option>5</option>',"\n"
  143. , '<option>6</option>',"\n"
  144. , '<option>7</option>',"\n"
  145. , '<option>8</option>',"\n"
  146. , '<option>9</option></select></td></tr>',"\n"
  147. , '<tr><td colspan="4">' , _LOGIN , ' : <select name="login">',"\n"
  148. , '<option value="on">' , _YES , '</option>',"\n"
  149. , '<option value="off" ' , $checked3 , '>' , _NO , '</option></select>',"\n"
  150. , '&nbsp;' , _MESSPV , ' : <select name="messpv">',"\n"
  151. , '<option value="on">' , _YES , '</option>',"\n"
  152. , '<option value="off" ' , $checked4 , '>' , _NO , '</option></select>',"\n"
  153. , '&nbsp;' , _MEMBERS , ' : <select name="members">',"\n"
  154. , '<option value="on">' , _YES , '</option>',"\n"
  155. , '<option value="off" ' , $checked5 , '>' , _NO , '</option></select>',"\n"
  156. , '</td></tr><tr><td colspan="4">&nbsp;' , _WHOISONLINE , ' : <select name="online">',"\n"
  157. , '<option value="on">' , _YES , '</option>',"\n"
  158. , '<option value="off" ' , $checked6 , '>' , _NO , '</option></select>',"\n"
  159. , '&nbsp;' , _SHOWAVATAR , ' : <select name="avatar">',"\n"
  160. , '<option value="on">' , _YES , '</option>',"\n"
  161. , '<option value="off" ' , $checked7 , '>' , _NO , '</option></select>',"\n"
  162. , '</td></tr><tr><td colspan="4">&nbsp;</td></tr>',"\n"
  163. , '<tr><td colspan="4" align="center"><b>' , _PAGESELECT , ' :</b></td></tr><tr><td colspan="4">&nbsp;</td></tr>',"\n"
  164. , '<tr><td colspan="4" align="center"><select name="pages[]" size="8" multiple="multiple">',"\n";
  165. select_mod2($pages);
  166. echo '</select></td></tr><tr><td colspan="4" align="center"><br />',"\n"
  167. , '<input type="hidden" name="type" value="' , $type , '" />',"\n"
  168. , '<input type="hidden" name="bid" value="' , $bid , '" />',"\n"
  169. , '<input type="submit" name="send" value="' , _MODIFBLOCK , '" />',"\n"
  170. , '</td></tr></table>'
  171. , '<div style="text-align: center;"><br />[ <a href="index.php?file=Admin&amp;page=block"><b>' , _BACK , '</b></a> ]</div></form><br /></div></div>',"\n";
  172. }
  173. function modif_advanced_login($data){
  174. $data['content'] = $data['login'] . '|' . $data['messpv'] . '|' . $data['members'] . '|' . $data['online']. '|' . $data['avatar'];
  175. return $data;
  176. }
  177. ?>