controllo file su upload
-
ciao raga,
in un form ho 4 input nome email titolo immagine e post, piu un hidden.
i rultati miarrivano regolarmente per meial con tutti i dati, mi arriva anche il nome del file caricato.
solo che:
il file non lo trovo nella cartella selezionata, non mi viene effettuato il controllo sui filr caricati.
infatti sono riuscito a caricare anche degli exe.vi allego il codice, mi vedete che c'è che non va?!
il sito è su aruba.grassieee.
[COLOR=#000000] [COLOR=#0000bb]<?PHP [/COLOR][COLOR=#ff8000]// RECUPERO I PARAMETRI DA PASSARE ALLA FUNZIONE PREDEFINITA PER L'UPLOAD [/COLOR][COLOR=#0000bb]$cartella [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#dd0000]'upload/'[/COLOR][COLOR=#007700]; [/COLOR][COLOR=#0000bb]$percorso [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]$_FILES[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]'miofile'[/COLOR][COLOR=#007700]][[/COLOR][COLOR=#dd0000]'tmp_name'[/COLOR][COLOR=#007700]]; [/COLOR][COLOR=#0000bb]$nome [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]$_FILES[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]'miofile'[/COLOR][COLOR=#007700]][[/COLOR][COLOR=#dd0000]'name'[/COLOR][COLOR=#007700]]; [/COLOR][COLOR=#ff8000]// CONTROLLO SE IL FILE NON E' UN .exe [/COLOR][COLOR=#007700]if([/COLOR][COLOR=#0000bb]$_FILES[/COLOR][COLOR=#007700][[/COLOR][COLOR=#dd0000]'miofile'[/COLOR][COLOR=#007700]][[/COLOR][COLOR=#dd0000]'type'[/COLOR][COLOR=#007700]] == [/COLOR][COLOR=#dd0000]"application/octet-stream"[/COLOR][COLOR=#007700]) { print [/COLOR][COLOR=#dd0000]"Non puoi uppare questo tipo di file!"[/COLOR][COLOR=#007700]; exit(); } [/COLOR][COLOR=#ff8000]// ESEGUO L'UPLOAD CONTROLLANDO L'ESITO [/COLOR][COLOR=#007700]if ([/COLOR][COLOR=#0000bb]move_uploaded_file[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]$percorso[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]$cartella [/COLOR][COLOR=#007700]. [/COLOR][COLOR=#0000bb]$nome[/COLOR][COLOR=#007700])) { print [/COLOR][COLOR=#dd0000]"Upload eseguito con successo"[/COLOR][COLOR=#007700]; } else { print [/COLOR][COLOR=#dd0000]"Si sono verificati dei problemi durante l'Upload"[/COLOR][COLOR=#007700]; } [/COLOR][COLOR=#0000bb]?><?php $oggi [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000bb]date[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]"j F Y G:i"[/COLOR][COLOR=#007700]); [/COLOR][COLOR=#0000bb]$sito [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#dd0000]"http://www.tuosito.xx"[/COLOR][COLOR=#007700]; [/COLOR][COLOR=#0000bb]$ip [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#dd0000]"$_SERVER[REMOTE_ADDR]"[/COLOR][COLOR=#007700]; [/COLOR][COLOR=#0000bb]$browser [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#dd0000]"$_SERVER[HTTP_USER_AGENT]"[/COLOR][COLOR=#007700]; [/COLOR][COLOR=#0000bb]$to [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#dd0000]"xxxx"[/COLOR][COLOR=#007700]; [/COLOR][COLOR=#0000bb]$soggetto [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#dd0000]"xxxxxxx "[/COLOR][COLOR=#007700]; [/COLOR][COLOR=#0000bb]$body [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#dd0000]"Modulo inviato il $oggi da $ip - $browser \n\n"[/COLOR][COLOR=#007700]; [/COLOR][COLOR=#0000bb]$body [/COLOR][COLOR=#007700].= [/COLOR][COLOR=#dd0000]"Nome: $_POST[nome] \nEmail: $_POST[email] \nTitolo: $_POST[titolo] \nImmagine:$nome \nPer: $_POST[per] \nPost: $_POST[post] "[/COLOR][COLOR=#007700]; [/COLOR][COLOR=#0000bb]$mail_in_html [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#dd0000]"From: xxxx <[email protected]>\n"[/COLOR][COLOR=#007700]; [/COLOR][COLOR=#0000bb]mail[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]"$to"[/COLOR][COLOR=#007700],[/COLOR][COLOR=#dd0000]"$soggetto"[/COLOR][COLOR=#007700],[/COLOR][COLOR=#dd0000]"$body"[/COLOR][COLOR=#007700], [/COLOR][COLOR=#dd0000]"$mail_in_html"[/COLOR][COLOR=#007700]); [/COLOR][COLOR=#0000bb]header [/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]"Location: <a href="[/COLOR][COLOR=#0000bb]http[/COLOR][COLOR=#007700]:[/COLOR][COLOR=#ff8000]//www.xxxx.com/insert-bacheca-ok.asp" target="_blank">http://www.xxxx.com/insert-bacheca-ok.asp</a>"); [/COLOR][COLOR=#0000bb]?>[/COLOR] [/COLOR]
Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.
Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.
Con il tuo contributo, questo post potrebbe essere ancora migliore 💗
Registrati Accedi