-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconvert.php
50 lines (48 loc) · 1.38 KB
/
convert.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
<?php
if (isset($_POST['str'])) {
$str = $_POST['str'];
if (strpos($_POST['str'], "smb://") === 0) {
// if smb, for mac param
$str_before = $str;
// \\fileserverpath\abc\def\
$str = preg_replace("/smb:/", "", preg_replace("/\//", "\\", $str));
} else {
// if for windows param
$str_before = preg_replace("/\/\//", "\\", preg_replace("/\\\\/", "/", $str));
// smb://
$str = "smb:" . preg_replace("/\/\//", "/", preg_replace("/\\\\/", "/", $str));
}
}
?>
<html>
<head>
<title>File Server Path Converter</title>
</head>
<body>
<div stle="border-radius: 10px; -webkit-border-radius: 10px; -moz-border-radius: 10px; border: 5px dotted #999;">
<h3>How to?</h3>
<ul>
<li>input like below
<ul>
<li>\\fileserverpath\dev\local\file_name</li>
<li>smb://fileserverpath/dev/local/file_name</li>
</ul>
</li>
<li>enter!</li>
<li>Plz do not try security check</li>
</ul>
</div>
<br><br>
<form name="form" id="form" action="./replace.php" method="POST">
<input type="text" value="<?php if(isset($str_before)) echo $str_before;?>" name="str" size="200" placeholder="input here!">
<br>
<input type="submit" value="replace">
</form>
<?php
if (isset($str)) {
echo "<br> Result<br>";
echo "<input type=text value='" . $str . "' size='200' id=result onmousemove='this.select(0,this.value.length)'><br>";
}
?>
</body>
</html>