1. PHP / Говнокод #8283

    +158

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    <script src=scripts.js></script>
    <?
    
        if (isset($remove) && $user1 !="selectuser"):  //to remove user from DB
    	print "Was updated sucsessfully: user '$user1' was removed<br>";
    	print "<font color=red>If You want to reload this page use <u>our 'Reload' button only</u></font>";
    	$query="delete from users where login=\"$user1\"";
            $result=mysql_query($query);     
    
       if (!isset($reloadme) ):
    
    
       //decremet when registered users removed users.txt
    	$file_loc="users.txt";
    	chmod ($file_loc,0755);
    	$newfile = fopen($file_loc, "r");
    	$file_contents = fread($newfile, filesize($file_loc));
            $file_contents=$file_contents-1;   //value contains how many users
    	$newfile = fopen($file_loc, "w+");
    	fwrite($newfile, "$file_contents");
    	fclose($newfile);
    	chmod ($file_loc,0700);       // end of adding data to file
    	endif;
       endif;   //end of reloadme
    //counting of users
    	$file_loc = "users.txt";
    //	chmod ($file_loc,0644);
    	$whattoread = fopen($file_loc, "r");
    	$file_contents = fread($whattoread, filesize($file_loc));
    	fclose($whattoread);
    //	chmod ($file_loc,0755);       // end of adding data to file
    //end of counting
    
    
    
        $query="select * from users order by id";
        $result=mysql_query($query);     // for first while	
        $result1=mysql_query($query);   // for second while
    	print "<table border=1 cellspacing=0 cellpadding=0 bordercolor=#007898><tr><td>";   //external table
    	print "<table border=0 cellspacing=2 cellpadding=2 width=590><tr><td>
    	<form action=$PHP_SELF method=post><select name=\"user1\" class=select1><option value=\"selectuser\"> Select user ";
        while($row=mysql_fetch_object($result)):	
    	print"<option value=\"$row->login\" style=\"background-color:#FFFFFF;\">$row->login";	
    	endwhile;
    	print "</select><br>
    	<input type=hidden name=remove>
    	<input type=hidden name=show>
    	<input type=hidden name=admin_login value=$admin_login_compare>";   // to enter one more time to login.php
    	print "<input type=hidden name=admin_password value=$admin_password_compare>"; // if ($admin_password!=$admin_password_compare) etc....
    	print "<input type=submit value=\"Remove User\" class=button1></form>";
    
    //reload this page
    	print "<form action=$PHP_SELF method=post>
    	<input type=hidden name=show>
    	<input type=hidden name=admin_login value=$admin_login_compare>";   // to enter one more time to login.php
    	print "<input type=hidden name=admin_password value=$admin_password_compare>"; // if ($admin_password!=$admin_password_compare) etc....
    	print "<input type=hidden name=reloadme ><input type=submit value=Reload  class=button1></form>";
    
    
    	print "Counter: $file_contents users
    	</td>";
    
    
    	print "<td>
    	<table border=1 cellspacing=0 cellpadding=4 bordercolor=#007898><tr><td>ID</td><td>Login</td><td>Password</td><td>Email</td><td>Last visit (Y/M/D)</td></tr></tr>";
        while($row=mysql_fetch_object($result1)):	
            print "<tr>";
    	print "<td>$row->id</td>";
    	print "<td><a href=\"javascript:showuserdata('$row->login','$row->address','$row->fax','$row->tel','$row->site')\" title=\"Show about $row->login\">$row->login</td>";
    	print "<td>$row->password </td>";
    	print "<td><a href=\"mailto:$row->email\" title=\"Email to $row->login\">$row->email</td>";
    	print "<td>$row->last_date</td>";
    	print "</tr>";
    	endwhile;
    	print "</table></td></tr></table>";
    	print "	</table>";  //end of external table
    	print "<br>&nbsp; Click user name to view data about him";
    
    	exit;
    
    ?>

    Запостил: ITdocer, 23 Октября 2011

    Комментарии (4) RSS

    Добавить комментарий