-
Notifications
You must be signed in to change notification settings - Fork 4
/
validate.php
52 lines (52 loc) · 1.28 KB
/
validate.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
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="content">
<center>
<h1>jQuery sMention Plugin</h1>
</center>
<?
include("get_users.php");
function smention($s,$t){
global$users;
$userid=$t[1];
$nxs=strpos($s,"@$userid");
$nxs=strlen("@$userid")+$nxs;
$nxs=substr($s,$nxs,1);
$name="";
foreach($users as $k=>$v){
if($v[2]==$userid){
$name=$v[0];
}
}
if($name==""){
return"@$userid".$nxs;
}else{
$html="<a href='//open.subinsb.com/$userid'>@$name</a>".$nxs;
return$html;
}
}
if(isset($_POST['input'])){
if($_POST['input']==""){
echo"<h2>No value entered</h2>";
}else{
$q=htmlspecialchars($_POST['input']);
$q=preg_replace_callback("/\@(.*?)(\s|\z)/", function($t) use ($q){return smention($q,$t);},$q);
echo"<h2>The Parsed Value Of Input Data</h2><blockquote>$q</blockquote>";
}
}
if(isset($_POST['textarea'])){
if($_POST['textarea']==""){
echo"<h2>No value entered</h2>";
}else{
$q=htmlspecialchars($_POST['textarea']);
$q=preg_replace_callback("/\@(.*?)(\s|\z)/", function($t) use ($q){return smention($q,$t);},$q);
echo"<h2>The Parsed Value Of Textarea Data</h2><blockquote>$q</blockquote>";
}
}
?>
</div>
</body>
</html>