[php] file word aangemaakt maar niet verwijderd

Gestart doorDylan17 reacties63 weergaven

18 berichten · pagina 1 van 2

Dylan

Lid · Topicstarter

Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
Gegroet mensen van het Wereld Wijde Web,

Ik heb een probleem:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR]ftp_directory_exists[COLOR= #007700]([/COLOR][COLOR= #0000BB]$ftp_server[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$path[/COLOR][COLOR= #007700])) {[/COLOR]

[COLOR= #0000BB]$ftp_serverpath[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]/../[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$files[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$fix[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]public_html[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$files[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]]);[/COLOR]
[COLOR= #0000BB]$ftp_local[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]/home/x/domains/x.s2.one2xs.com/private_html/source[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$fix[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000].txt[/COLOR][COLOR= #007700];[/COLOR]

[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/ftp_get"]ftp_get[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ftp_server[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$ftp_local[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$ftp_serverpath[/COLOR][COLOR= #007700],[/COLOR] FTP_BINARY[COLOR= #007700])) {[/COLOR]
    [COLOR= #0000BB]$content[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/file_get_contents"]file_get_contents[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ftp_local[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/ftp_delete"]ftp_delete[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ftp_server[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$ftp_local[/COLOR][COLOR= #007700]);
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Oeps, bestand bestaat niet."[/COLOR][COLOR= #007700];
}[/COLOR]


Het bestand met word aangemaakt in het mapje source in private_html.
Daarna word de content in een variable gestopt.
Als laatste word de file verwijderd.

En dat laatste dat lukt niet.
Warning: ftp_delete(): Could not delete /home/x/domains/x.s2.one2xs.com/private_html/source/admin.php.txt: No such file or directory in /home/x/domains/x.s2.one2xs.com/public_html/admin/ftp.php on line 99

nu zou je zeggen dat het pad niet klopt. Maar ik gebruik het zelfde pad om de file aan te maken en dat werkt wel?

Hoe kan ik dit oplossen?

toevoeging op 15 juni 2013, 16:28:06:
Mappen constructie:
Afbeelding
0
Berichten
308
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Controleer eens je chmod instellingen van je bestand.
Ik had dat ook overlaatst eens smile De bestanden werden aangemaakt, maar ik kon ze nergens terugvinden. Uiteindelijk dankzij de juiste chmod instellingen 755 werkte alles perfect wink
0
Dylan

Lid · Topicstarter

Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php
$ftp_serverpath[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]/../[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$files[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$fix[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]public_html[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$files[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]]);[/COLOR]
[COLOR= #0000BB]$ftp_local[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]/home/x/domains/x.s2.one2xs.com/public_html[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$fix[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000].txt[/COLOR][COLOR= #007700];[/COLOR]

[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/ftp_get"]ftp_get[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ftp_server[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$ftp_local[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$ftp_serverpath[/COLOR][COLOR= #007700],[/COLOR] FTP_BINARY[COLOR= #007700])) {[/COLOR]
    [COLOR= #0000BB]$content[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/file_get_contents"]file_get_contents[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ftp_local[/COLOR][COLOR= #007700]);[/COLOR]
    ftp_chmod[COLOR= #007700]([/COLOR][COLOR= #0000BB]$ftp_server[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]755[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$ftp_local[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/ftp_delete"]ftp_delete[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ftp_server[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$ftp_local[/COLOR][COLOR= #007700]);
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Oeps, bestand bestaat niet."[/COLOR][COLOR= #007700];
}[/COLOR]


Zelf als ik handmatig de file op 755 werkt het niet? Alleen het aanmaken werkt en het verwijderen niet? Eerst wel trouwens nu niet meer
0
Berichten
308
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dylanh schreef:
[COLOR= #0000BB]<?php
$ftp_serverpath[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]/../[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$files[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$fix[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/str_replace"]str_replace[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]public_html[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$files[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]]);[/COLOR]
[COLOR= #0000BB]$ftp_local[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]/home/x/domains/x.s2.one2xs.com/public_html[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$fix[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000].txt[/COLOR][COLOR= #007700];[/COLOR]

[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/ftp_get"]ftp_get[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ftp_server[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$ftp_local[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$ftp_serverpath[/COLOR][COLOR= #007700],[/COLOR] FTP_BINARY[COLOR= #007700])) {[/COLOR]
    [COLOR= #0000BB]$content[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/file_get_contents"]file_get_contents[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ftp_local[/COLOR][COLOR= #007700]);[/COLOR]
    ftp_chmod[COLOR= #007700]([/COLOR][COLOR= #0000BB]$ftp_server[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]755[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$ftp_local[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/ftp_delete"]ftp_delete[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ftp_server[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$ftp_local[/COLOR][COLOR= #007700]);
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Oeps, bestand bestaat niet."[/COLOR][COLOR= #007700];
}[/COLOR]
Zelf als ik handmatig de file op 755 werkt het niet? Alleen het aanmaken werkt en het verwijderen niet? Eerst wel trouwens nu niet meer

Staat je directory goed ?

toevoeging op 21 juni 2013, 19:29:11:
Hmmn nvm zie het in de screenshot.
0
Berichten
1.447
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
en als je chmod 777 doet?
0
Dylan

Lid · Topicstarter

Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
Jordymen schreef:
en als je chmod 777 doet?
Hij vind het pad niet. Dus chmodden werkt niet.

Ik heb het maar opgelost door de file buiten de webroot te doen en niet te verwijderen.
0
Berichten
528
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jordymen schreef:
en als je chmod 777 doet?
777 zou ik nooit gebruiken.

En begint $fix met een slash (/) ? anders is je path public_html$fix wat private_html$fix wordt, i.p.v. private_html/$fix
0
Berichten
1.447
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Rudie schreef:
Eerdere citaten tonen
Jordymen schreef:
en als je chmod 777 doet?
777 zou ik nooit gebruiken.

En begint $fix met een slash (/) ? anders is je path public_html$fix wat private_html$fix wordt, i.p.v. private_html/$fix
hoezo niet 777 die word ook veel gebruikt bij habbo cms
0
Berichten
528
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dylanh schreef:
Eerst wel trouwens nu niet meer

Ga dan na wat je hebt veranderd?
toevoeging op 25 juni 2013, 14:47:24:
Jordymen schreef:
Eerdere citaten tonen
Rudie schreef:
Eerdere citaten tonen
Jordymen schreef:
en als je chmod 777 doet?
777 zou ik nooit gebruiken.

En begint $fix met een slash (/) ? anders is je path public_html$fix wat private_html$fix wordt, i.p.v. private_html/$fix
hoezo niet 777 die word ook veel gebruikt bij habbo cms
Ligt aan je server configuration.
Hier op one2xs gebruiken ze volgens mij (?) shared web-hostings. Dus zit je met meerdere op eenzelfde server.. Vaak heeft de hoster wel enig kennis van zaken en zal hij de root van de gehele server wel beveiligen. Dus ook al zet jij alle mappen en bestanden op permissie 777, zodat alle groepen en users alle toegang hebben, wil het nog niet zeggen dat een hacker direct alles kan.

Maar stel jij werkt eens op een minder beveiligde server, die onjuist ingesteld is (of niet voldoende beveiligd is) dan heb je een potentieel probleem smile
Habbo CMSen draaien mensen vaak in combinatie met Apache in een zogenoemd XAMPP OF WAMPP project.
0
Dylan

Lid · Topicstarter

Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
Rudie schreef:
Eerdere citaten tonen
Jordymen schreef:
en als je chmod 777 doet?
777 zou ik nooit gebruiken.

En begint $fix met een slash (/) ? anders is je path public_html$fix wat private_html$fix wordt, i.p.v. private_html/$fix
Nee. ik gebruik het zelfde pad voor het aanmaken.
0
Berichten
528
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Heb je ook de code van het aanmaken?
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Rudie schreef:
Heb je ook de code van het aanmaken?
Lezen, dat werkt zegt ie.
0
Berichten
528
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jellesch schreef:
Eerdere citaten tonen
Rudie schreef:
Heb je ook de code van het aanmaken?
Lezen, dat werkt zegt ie.
ik kan gewoon lezen hoor?
Maar als hij die code geeft kunnen wij helpen met het vergelijken van de code, misschien ziet hij iets over het hoofd.
0
Berichten
3.788
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
De code staat al in de startpost...
0
Berichten
528
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Eleky schreef:
De code staat al in de startpost...
niet het stuk wat wél blijkt te werken.
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren