-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions423.php
55 lines (45 loc) · 1.41 KB
/
functions423.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
46
47
48
49
50
51
52
53
54
55
<?php
function strip_all($in) {
$in = trim($in);
$in = stripslashes($in);
$in = htmlspecialchars($in);
return $in;
}
function validate_tnam1($in) {
if (empty($in)) {
return false;
}
$in = strip_all($in);
if (strlen($in) <> 45) {return false;}
$reg_tnam1 = '/tnam1[a-zA-Z0-9]{40}$/i';
return preg_match($reg_tnam1, $in);
}
function validate_proposal_id($in) {
if (empty($in)) {
return false;
}
$in = strip_all($in);
if (strlen($in) > 25) {return false;}
$reg_tnam1 = '/\d+$/i';
return preg_match($reg_tnam1, $in);
}
function hyperlink_address($in, $mode_arg) {
$in = strip_all($in);
$mode_arg = strip_all($mode_arg);
if (validate_tnam1($in) == false) {die('wrong internal parameter call');}
$uri = strip_all($_SERVER['REQUEST_URI']);
$uri = array_shift(explode('?', $uri));
$servername = strip_all($_SERVER['HTTP_HOST']);
$newlink = 'https://' . $servername . $uri . '?address=' . $in . '&mode=' . $mode_arg . '&proposal_id=';
$returnstring = '<a href="' . $newlink . '">' . $in . '</a>';
return $returnstring;
}
function hyperlink_proposal($in, $mode_arg) {
$uri = strip_all($_SERVER['REQUEST_URI']);
$uri = array_shift(explode('?', $uri));
$servername = strip_all($_SERVER['HTTP_HOST']);
$newlink = 'https://' . $servername . $uri . '?proposal_id=' . $in;
$returnstring = '<a href="' . $newlink . '">' . $in . '</a>';
return $returnstring;
}
?>