51ff3226 |
1 | <?php |
2 | function set_external_link() { |
3 | global $error,$node,$db; |
4 | |
5 | $new_exlink = mysql_real_escape_string($_POST['external_link']); |
6 | $node_id = mysql_real_escape_string($node['node_id']); |
7 | $node_permission=$node['node_permission']; |
8 | $find = '://'; |
9 | $validation = strpos($new_exlink, $find); |
10 | |
11 | if ($validation === true) { |
12 | if (($node_permission == 'owner') || ($node_permission == 'master')) { |
13 | $q = "update nodes set external_link='$new_exlink' where node_id='$node_id'"; |
14 | $db->query($q); |
15 | return true; |
16 | } |
17 | else { |
18 | $error = "Na to nemas prava!"; |
19 | return false; |
20 | } |
21 | } |
22 | else { |
23 | $error = "Nezadal si ://, vole. "; |
24 | return false; |
25 | } |
26 | } |
27 | |
28 | ?> |