-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfiguration.php
66 lines (52 loc) · 1.14 KB
/
configuration.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
56
57
58
59
60
61
62
63
64
65
66
<?php
function MongoCon() {
try {
$connection = new Mongo();
$collection = $connection->safedocuments->documentos;
return $collection;
} catch (MongoConnectionException $e) {
die("Fallo en la conexión a la base de datos " . $e->getMessage());
}
}
// Retorna la ruta donde se almacenan los archivos
function pathFiles()
{
// Definir directorio donde almacenar archivos, debe terminar eb "/"
$directorio="KWE54O31MDORBOJRFRPLMM8C7H24LQQR/";
try {
$path="./".$directorio;
if (!file_exists($path)) {
mkdir($path, 0755);
}
writeHtaccess($path);
return $path;
}
catch (Exception $e)
{
echo $e;
return false;
}
}
function writeHtaccess($path)
{
// htaccess documentos
if(!file_exists($path.'.htaccess'))
{
$htaccess_content="Order allow,deny
Deny from all";
$file = fopen($path.'.htaccess' , "w+");
fwrite($file, $htaccess_content);
}
// htaccess Raiz
if(!file_exists('./.htaccess'))
{
$htaccess_content="Options -Indexes
Options +FollowSymlinks
RewriteEngine on
#RewriteBase /safeDocumentsMongoDB/
RewriteRule ^([a-zA-Z]+).html$ index.php?req=$1";
$file = fopen('./.htaccess' , "w+");
fwrite($file, $htaccess_content);
}
}
?>