forked from pietrosperoni/Vilfredo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit_trans.php
45 lines (41 loc) · 1.74 KB
/
edit_trans.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
include('config.inc.php');
header('Content-Type: text/html; charset=utf-8');
// Get user ID if logged in
$userid=isloggedin();
if (!$userid)
{
setError("You must be logged in to access this page.");
header("Location: error_page.php");
exit;
}
elseif (!isAdmin($userid))
{
setError("Only Administrators may access this page.");
header("Location: error_page.php");
exit;
}
if (isset($_GET['id']) ) {
$id = (int) $_GET['id'];
if (isset($_POST['submitted'])) {
foreach($_POST AS $key => $value) { $_POST[$key] = mysql_real_escape_string($value); }
$sql = "UPDATE `vga_content` SET `text` = '{$_POST['text']}', `it` = '{$_POST['it']}' WHERE `id` = '$id' ";
mysql_query($sql) or die(mysql_error());
echo (mysql_affected_rows()) ? "Translation saved.<br />" : "Nothing changed. <br />";
}
$row = mysql_fetch_array ( mysql_query("SELECT * FROM `vga_content` WHERE `id` = '$id' "));
?>
<p><a href='list_trans.php'>Back To Listing</a></p>
<form action='' method='POST'>
<p><b>Page:</b><br /><input type='text' name='page' value='<?= stripslashes($row['page']) ?>' disabled="disabled"/>
<p><b>Last Modified Time:</b><br /><input type='text' name='last_modified_time' value='<?= stripslashes($row['last_modified_time']) ?>' disabled="disabled"/>
<p><b>Var Key:</b><br /><input type='text' name='var_key' value='<?= stripslashes($row['var_key']) ?>' disabled="disabled"/>
<p><b>Text:</b><br /><textarea name='text' rows="10" cols="35"><?= stripslashes($row['text']) ?></textarea>
<p><b>It:</b><br />
<textarea name='it' rows="10" cols="35"><?= stripslashes($row['it']) ?></textarea>
<p><input type='submit' value='Save Translation' /><input type='hidden' value='1' name='submitted' />
</form>
<p><a href='list_trans.php'>Back To Listing</a></p>
<?php
}
?>