当前位置:Gxlcms > PHP教程 > PHPhack的使用技巧详解_PHP教程

PHPhack的使用技巧详解_PHP教程

时间:2021-07-01 10:21:17 帮助过:17人阅读

PHP hack示例:

  1. < ?php
  2. $tabs = array();
  3. function tabs_header()
  4. {
  5. ?>
  6. <style type="text/css">
  7. .tab {
  8. border-bottom: 1px solid black;
  9. text-align: center;
  10. font-family: arial, verdana;
  11. }
  12. .tab-active {
  13. border-left: 1px solid black;
  14. border-top: 1px solid black;
  15. border-right: 1px solid black;
  16. text-align: center;
  17. font-family: arial, verdana;
  18. font-weight: bold;
  19. }
  20. .tab-content {
  21. padding: 5px;
  22. border-left: 1px solid black;
  23. border-right: 1px solid black;
  24. border-bottom: 1px solid black;
  25. }
  26. < /style>

  1. php
  2. }
  3. function tabs_start()
  4. {
  5. ob_start();
  6. }
  7. function endtab()
  8. {
  9. global $tabs;
  10. $text = ob_get_clean();
  11. $tabs[ count( $tabs ) - 1 ][ 'text' ] = $text;
  12. ob_start();
  13. }
  14. function tab( $title )
  15. {
  16. global $tabs;
  17. if ( count( $tabs ) > 0 )
  18. endtab();
  19. $tabs []= array(
  20. title => $title,
  21. text => ""
  22. );
  23. }
  24. function tabs_end( )
  25. {
  26. global $tabs;
  27. endtab( );
  28. ob_end_clean( );
  29. $index = 0;
  30. if ( $_GET['tabindex'] )
  31. $index = $_GET['tabindex'];
  32. ?>
  33. < table width="100%" cellspacing="0" cellpadding="0">
  34. < tr>
  35. < ?php
  36. $baseuri = $_SERVER['REQUEST_URI'];
  37. $baseuri = preg_replace( "/?.*$/", "", $baseuri );
  38. $curindex = 0;
  39. foreach( $tabs as $tab )
  40. {
  41. $class = "tab";
  42. if ( $index == $curindex )
  43. $class ="tab-active";
  44. ?>
  45. < td class="< ?php echo($class); ?>">
  46. < a href="< ?php echo( $baseuri."?tabindex=".$curindex ); ?>">
  47. < ?php echo( $tab['title'] ); ?>
  48. < /a>
  49. < /td>
  50. < ?php
  51. $curindex += 1;
  52. }
  53. ?>
  54. < /tr>
  55. < tr>< td class="tab-content" colspan="< ?php echo( count( $tabs ) + 1 ); ?>">
  56. < ?php echo( $tabs[$index ]['text'] ); ?>
  57. < /td>tr>
  58. < /table>
  59. < ?php
  60. }
  61. ?>

以上这一大段的代码就是有关PHP hack的具体实现方法。


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/446113.htmlTechArticlePHP hack示例: ?php $ tabs = array (); functiontabs_header() { ? style type = text/css .tab{ border-bottom:1pxsolidblack; text-align:center; font-family:arial,verdana; } .tab-ac...

人气教程排行