PHP hack的使用技巧详解

原创
2016-06-13 11:09:49 1719浏览

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="">
  46. a href="?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="">
  56. ?php echo( $tabs[$index ]['text'] ); ?>
  57. /td>tr>
  58. /table>
  59. ?php
  60. }
  61. ?>

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


声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。