source: Administrace/AddLinks.php

Last change on this file was 1, checked in by george, 15 years ago
  • Import souborů projektu.
File size: 1.7 KB
Line 
1<?php
2 include '../includes/Global.php';
3
4 TestLicence('3');
5
6 if (array_key_exists('Mode', $_GET)) {
7 $Mode = $_GET['Mode'];
8 } else {
9 $Mode = '';
10 }
11
12 If ($Mode == '') { // formuláø pøidání linku
13?>
14 <form enctype="multipart/form-data" action="AddLinks.php?Mode=AddLinks" method="post">
15 <table border="0">
16 <tr><td>Název:</td><td><input type="text" name="Name"></td></tr>
17 <tr><td>Adresa:</td><td><input type="text" value="http://" name="Address">Formát: http://adresa/</td></tr>
18 <tr><td>Uživatel: </td><td><input type="text" name="User" value="<?php echo $_SESSION['User']; ?>"></td></tr>
19 <tr><td>Popis: </td><td><textarea cols="30" name="Description" rows="10"></textarea></td></tr>
20 <tr><td><input type="submit" value="Odeslat"></td></tr>
21 </table>
22 </form>
23
24<?php
25 }
26
27 if ($Mode == 'AddLinks') { //pøidání linku
28 $Name = mysql_escape_string($_POST['Name']);
29 $User = mysql_escape_string($_POST['User']);
30 $Address = mysql_escape_string($_POST['Address']);
31 $Description = mysql_escape_string($_POST['Description']);
32 echo('Jméno: '.$Name.'<br>');
33 echo('Uživatel: '.$User.'<br>');
34 echo('Address: '.$Address.'<br>');
35 echo('Popis: '.$Description.'<br>');
36
37 $sql = "SELECT max(ID) FROM links";
38 $ID = $db->SQLCommand($sql);
39 $Line = mysql_fetch_row($ID);
40 $ID = $Line[0]+1;
41 $sql = "INSERT links VALUE('$ID','$Name','$Description','$Address',now(),'$User')";
42 $db->SQLCommand($sql);
43 echo 'Odkaz '.$Name.' byl uložen';
44 WriteLog('Odkaz byl uložen: '.$Name.' ID: '.$ID.' Popis: '.$Description.' User: '.$User.'Address: '.$Address,'2');
45 }
46
47 //TODO: editování, mazání
48
49 ShowFooter()
50?>
Note: See TracBrowser for help on using the repository browser.