1 | <?php
|
---|
2 |
|
---|
3 | /* =========== Config aj. =========== */
|
---|
4 | if( !file_exists('./config.php') ){ exit; };
|
---|
5 | require_once './config.php';
|
---|
6 |
|
---|
7 | /* =========== Připojení k Databázi =========== */
|
---|
8 |
|
---|
9 | @mysql_connect( $Config['DB_read']['Database']['Host'], $Config['DB_read']['Database']['User'], $Config['DB_read']['Database']['Password'] )
|
---|
10 | OR DIE("<p>Vyskytla se chyba a nelze se připojit k databázi.<br> Zkuste to později.</p>");
|
---|
11 | $DB_mangos = mysql_select_db($Config['DB_read']['DB_read']['Database_web']);
|
---|
12 | @mysql_query("SET NAMES ".$Config['DB_read']['DB_read']['Charset']);
|
---|
13 |
|
---|
14 |
|
---|
15 | ?>
|
---|
16 |
|
---|
17 | <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
|
---|
18 | <html>
|
---|
19 | <head>
|
---|
20 | <meta name='author' content='Design & Code by HosipLan - HosipLan@seznam.cz'>
|
---|
21 | <meta http-equiv="content-type" content="text/html; charset=utf-8" >
|
---|
22 | <meta http-equiv='imagetoolbar' content='no'>
|
---|
23 | <meta http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate">
|
---|
24 | <meta http-equiv="Pragma" content="no-cache">
|
---|
25 | <meta http-equiv="Expires" content="0">
|
---|
26 | <link rel="shortcut icon" href="img/favicon.ico">
|
---|
27 | <link rel='stylesheet' type='text/css' href='css/css-defaul.css'>
|
---|
28 | <script type='text/javascript' src='js/allJS.js'></script>
|
---|
29 | <title>Generování klíču pro spam ochranu</title>
|
---|
30 | </head>
|
---|
31 | <body>
|
---|
32 |
|
---|
33 | <div style="margin: 50px;">
|
---|
34 | <h3>Generování klíčů pro komentaře</h3>
|
---|
35 | <p>Heslo musí odpovídat heslu do databáze.</p>
|
---|
36 | <form action="generovani_klicu.php" method="post">
|
---|
37 | <label for="heslo"> Heslo: </label> <input type="password" id="heslo" name="heslo" /><br>
|
---|
38 | <label for="make"> Pocet: </label> <input type="text" name="pocet" />
|
---|
39 | <input type="submit" value="Vygenerovat" id="make" name="make" />
|
---|
40 | </form>
|
---|
41 | <p> </p>
|
---|
42 |
|
---|
43 | <?php
|
---|
44 |
|
---|
45 | if( isset($_POST['make']) AND $_POST['heslo'] == $Config['DB_read']['Database']['Password'] ){
|
---|
46 | $i = "1"; $pocet = $_POST['pocet'];
|
---|
47 | echo "<p>";
|
---|
48 | while( $i <= $pocet ){
|
---|
49 | $znak[$i] = strtoupper(substr(md5(rand()),0,5));
|
---|
50 | if( mysql_query("INSERT INTO `klice` ( `klic` ) VALUES ( '".$znak[$i]."' )") ){
|
---|
51 | echo "<b>".$znak[$i]."</b>, \n"; };
|
---|
52 | $i++;
|
---|
53 | };
|
---|
54 | echo "</p>\n";
|
---|
55 | };
|
---|
56 |
|
---|
57 | ?>
|
---|
58 |
|
---|
59 | </div>
|
---|
60 |
|
---|
61 | </body>
|
---|
62 | </head>
|
---|
63 |
|
---|