php-text-converter

Gesponsorde koppelingen

PHP script bestanden

  1. php-text-converter

« Lees de omschrijving en reacties

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<html><head><title>Php Mass Text Changer</title></head><body>
<?php
global $self;
$self = explode("/", $_SERVER['PHP_SELF']);
$self = $self[count($self)-1];
if(isset($_POST['dir']) && isset($_POST['from']) && isset($_POST['to']) && isset($_POST['ext'])) {
if(($_POST['ext'] != '') && ($_POST['from'] != '') && ($_POST['to'] != '') && ($_POST['dir'] != '')) {
$newdir = str_replace("\\\\","\\", $_POST['dir']);
echo "<br>DIR: ".$newdir."\n";
echo "<br>FROM: ".$_POST['from']."\n";
echo "<br>TO: ".$_POST['to']."\n";
echo "<br>EXT: ".$_POST['ext']."\n";
echo "<br>Running...\n";
echo "<br>\n";
global $filestochange;
global $dirstochange;
global $extension;
global $tobechanged;
global $tobechangedto;
$extension = $_POST['ext'];
$tobechanged = $_POST['from'];
$tobechangedto = $_POST['to'];
checkfiles($newdir);
}
else {
echo "<br>DIR: ".$newdir."\n";
echo "<br>FROM: ".$_POST['from']."\n";
echo "<br>TO: ".$_POST['to']."\n";
echo "<br>EXT: ".$_POST['ext']."\n";
echo "<br>One or more of these fields are empty!...\n";
echo "<br>\n";
}
}
else {
echo "<form method=\"post\" action=".$self.">\n";
echo "<table>\n";
echo "<tr>\n";
echo "Dir: <input type=\"text\" name=\"dir\" value=\"D:\Website\game\" />\n";
echo "</tr>\n";
echo "<tr>\n";
echo "Extension: <input type=\"text\" name=\"ext\" value=\"php\" />\n";
echo "</tr>\n";
echo "<tr>\n";
echo "From: <input type=\"text\" name=\"from\" value=\"/[<][?] /\" />\n";
echo "</tr>\n";
echo "<tr>\n";
echo "To: <input type=\"text\" name=\"to\" value=\"<?php \" />\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<input type=\"submit\" name=\"submit\" value=\"Change\" />";
echo "</tr>\n";
echo "</table>\n";
echo "</form>\n";
}
function
checkfiles($dir) {
global $dirstochange;
global $filestochange;
global $extension;
global $tobechanged;
global $tobechangedto;
global $self;
echo "<p><font color=blue>Entering ".$dir."\\";
$d = dir($dir);
while ( ($file = $d->read() ) != false ) {
 if (@ dir($file) && ($file != ".") && ($file != "..")) {
  checkfiles($dir."\\".$file);
 }

 elseif (preg_match ("/.\.".$extension."$/i", $file) && ($file != $self)) {
  replacezor($dir."\\".$file);
 }
}

echo "<p><font color=blue>Leaving ".$dir."\\".$file;
}
function
replacezor($filez) {
global $dirstochange;
global $filestochange;
global $extension;
global $tobechanged;
global $tobechangedto;
global $self;
if( ($fh = fopen($filez, 'r'))  != FALSE) {
$theData = @fread($fh, filesize($filez));
fclose($fh);
unlink($filez);
if( ($fh = fopen($filez, 'w'))  != FALSE) {
$theData = preg_replace($tobechanged,$tobechangedto,$theData);
fwrite($fh, $theData);
fclose($fh);
echo "<br><font color=green>Replacing: ".$filez;
}
else {
echo "<br><font color=red>ERROR writing: ".$filez;
} }
else {
echo "<br><font color=red>ERROR reading: ".$filez;
}
}

?>
</body>

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.