heslo a upload script
heslo a upload script
Napise mi tu niekto ako pre lamu tieto scripty?
prosiiim 
-
masterdead
SysAdmin
- Príspevky: 1809
- Registrovaný: 03 aug 2005, 23:32
- Bydlisko: Bratislava
- Kontaktovať používateľa:
trochu som nepochopil to heslo, chces zaheslovat zlozku? ak hej tak pouzi .htaccess
upload script(nieje z mojej dielne)
index.php
upload.php
upload script(nieje z mojej dielne)
index.php
Kód: Vybrať všetko
<HTML>
<HEAD>
<TITLE>upload</TITLE>
</HEAD>
<BODY bgcolor="#57738E">
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<div align="center">
<center>
<table border="0" width="966" height="203">
<tr>
<td width="966" height="1" bgcolor="#FFFFFF" align="center">
<p align="center"><font face="Verdana" size="1"><b>
<marquee>Download this code at <a href="http://www.planet-source-code.com">http://www.planet-source-code.com</a></marquee>
</b></font></td>
</tr>
<tr>
<td width="966" height="241" align="center">
<p align="center"> </p>
<form action="upload.php" method="POST" enctype="multipart/form-data">
<p align="center"><font size="2" face="Verdana"><strong>Please upload your
file below:</p>
<input type="file" name="file" size="30">
<p><button name="submit" type="submit">
Upload </button>
</strong></font></p>
<p align="center"> </p>
</form>
</td>
</tr>
<tr>
<td width="966" height="1" bgcolor="#FFFFFF">
<p align="center"><font face="Verdana" size="1"><b>This script was
created by Peter Rekdal Sunde</b></font></td>
</tr>
</table>
</center>
</div>
</BODY>
</HTML>
Kód: Vybrať všetko
<HTML>
<HEAD>
<TITLE>Simple Calculator by Peter Rekdal Sunde</TITLE>
</HEAD>
<BODY bgcolor="#57738E">
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<div align="center">
<center>
<table border="0" width="966" height="203">
<tr>
<td width="966" height="1" bgcolor="#FFFFFF" align="center">
<p align="center"><font face="Verdana" size="1"><b>
<marquee>Download this code at <a href="http://www.planet-source-code.com">http://www.planet-source-code.com</a></marquee>
</b></font></td>
</tr>
<tr>
<td width="966" height="241" align="center">
<p align="center"> </p>
<?
#######################################
# Release date: 10.09.01
# Coding time: 34 minutes
# Coded in: php
# Description: Simply Uploads a file to your server!
# Howto: Configure the script below, and upload it to your server!
#
# Coder: Exion
# Version: 100% STABLE RELEASE!
# Note: Wan't me to add mysql logging and a delete script to delete uploads ? Mail me at [email protected]! And I'll create it for you! :)
#######################################
### Configuration ###
# What directory should the files be uploaded to ? ( Remeber to chmod 777 your_upload_dir )
$upload_directory = "cesta/k/suborom/";
# The Max Upload Size of a file when upload to server!
$max_upload_size = "20121654"; // Set to 2 MB
# What type of files should be allowed to be uploaded ?
$allow_type = "audio/mpeg"; // This is the tag to only allow *.MP3 files to be uploaded!
# Shall the script only allow 1 file type to be uploaded ?
$allow_file_type = "1"; // Only allows 1 file to be uploaded to server!
### Font setup ###
$font = "verdana";
$font_size = "2";
$font_color = "black";
### Error Messages ###
# No file to upload
$no_file = "<b><font face=\"$font\" size=\"$font_size\" color=\"$font_color\">Sorry, but you didn't select a file to upload";
# File is to big
$to_big_file = "<b><font face=\"$font\" size=\"$font_size\" color=\"$font_color\">Sorry, but the file you have select is to big to be uploaded!";
# Not the correct filetype
$not_correct_file = "<b><font face=\"$font\" size=\"$font_size\" color=\"$font_color\">Sorry, but the file you tried to upload is not valid file to upload!";
# Error to write file to upload directory
$error_write_file = "<b><font face=\"$font\" size=\"$font_size\" color=\"$font_color\">Sorry, but there has been an error processing $file_name to the
$upload_directory! Please try again later!";
# The file is already uploaded
$already_uploaded = "<b><font face=\"$font\" size=\"$font_size\" color=\"$font_color\">Sorry, the file already Exists on server!";
### Thank You Message(s) ###
$thank_you = "<b><font face=\"$font\" size=\"$font_size\" color=\"$font_color\">Thank you for your upload ($file_name)!";
####### Code Starting #######
if (!$file_name) die("$no_file");
if ($file_size > $max_upload_size) {
die("$to_big_file");
}
if ($allow_file_type == "1") {
if ($type != $allowtype) {
die("$not_correct_file");
}
}
if (file_exists("$upload_directory/$file_name")) {
die("$already_uploaded");
}
@copy($file, "$upload_directory/$file_name") or die("$error_write_file");
# EOF!
echo "<center><b>$thank_you";
?></font></font></font></font></font></font>
</center>
</b>
</b></b></b></b></b></b>
</td>
</tr>
<tr>
<td width="966" height="1" bgcolor="#FFFFFF">
<p align="center"><font face="Verdana" size="1"><b>This script was
created by Peter Rekdal Sunde</b></font></td>
</tr>
</table>
</center>
</div>
</BODY>
</HTML>
-
vivaSlovakia
Guru wannabe
- Príspevky: 2119
- Registrovaný: 29 júl 2006, 10:30
heslo skript
1.Vytvoris si html subor v nom bude toto
2.Vytvoris si php subor heslo.php
Upozornujem, ze to neni moc bezpecne, neni to session
, ale ked chces tak si to najdi na jaknaweb.cz, php skripty, heslo(session)
GL&HF
1.Vytvoris si html subor v nom bude toto
Kód: Vybrať všetko
<form method="post" action="heslo.php">
Sem zadaj heslo: <input type="password" name="heslo" size="20">
</form>Kód: Vybrať všetko
<?
$heslo=$_POST['heslo'];
if ($heslo == tvojeheslo)
{
Header("Location: http://google.sk");
}
else
{
Header("Location: http//hojko.com");
}
?>GL&HF
-
mastermind
VIP
- Príspevky: 4810
- Registrovaný: 09 feb 2005, 13:17
-
mastermind
VIP
- Príspevky: 4810
- Registrovaný: 09 feb 2005, 13:17
ppt napísal:Aha, cize fruxo tym vytvoril konstantu s nazvom tvojeheslo, ktorej hodnota je string: tvojeheslo? (vlastne nazov tej konstanty)
Kód: Vybrať všetko
<? define ("tvojeheslo","definovanakonstanta");
echo tvojeheslo; //output: definovanakonstanta
?>
druhy pripad
<? if (!defined(tvojeheslo))
{
echo tvojeheslo; //output tvojeheslo
}
?>-
vivaSlovakia
Guru wannabe
- Príspevky: 2119
- Registrovaný: 29 júl 2006, 10:30
Trosku som ti to poupravil, dufam ze tomu chapes, spravil som na to ze ak niekto nevyplni heslo a stlaci tlacitko tak mu ukaze to co je tam...
heslo.php
heslo.php
Kód: Vybrať všetko
<?
$heslo=$_POST['heslo'];
if (!isset($heslo))
{
echo "Nezadali ste HESLO !";
?>
<form method="post" action="heslo.php">
Sem zadaj heslo: <input type="password" name="heslo" size="20">
</form>
<?
}
else
{
if ($heslo == tvojeheslo)
{
Header("Location: http://google.sk");
}
else
{
Header("Location: http//hojko.com");
}
}
?>-
vivaSlovakia
Guru wannabe
- Príspevky: 2119
- Registrovaný: 29 júl 2006, 10:30
-
vivaSlovakia
Guru wannabe
- Príspevky: 2119
- Registrovaný: 29 júl 2006, 10:30
ja to mam vyriesene takto
Kód: Vybrať všetko
<HTML>
<HEAD><TITLE>Upload</TITLE></HEAD>
<BODY>
<?php
function autentifikacia () {
header("WWW-Authenticate: Basic realm=\"Administracia");
header("HTTP/1.0 401 Unauthorized");
echo "Zákaz vstupu !";
die();
}
$users = array( "meno1" => "heslo1", "meno2" => "heslo2" );
if (isset($users[$_SERVER["PHP_AUTH_USER"]])
&& $users[$_SERVER["PHP_AUTH_USER"]] == $_SERVER["PHP_AUTH_PW"]
&& $_REQUEST["log"] != "out");
else {
autentifikacia();
}
?>
<?
if ($akce == "Upload") {
if ($soubor_type == "text/plain" or $soubor_type="text/html") {
if (move_uploaded_file ($soubor, "fotky/$soubor_name")) {
print "Soubor $soubor_name s velkostou $soubor_size bajtov
bol uspesne uploadnuty na server";
}
else {
print "Chyba !<BR>";
}
}
else {
print "Soubor není požadového MIME typu!<BR>";
}
}
?>
<HR SIZE="1" NOSHADE>
Meno suboru:
<FORM ACTION="upload.php" METHOD="post" ENCTYPE="multipart/form-data">
<INPUT TYPE="file" NAME="soubor" SIZE="30">
<INPUT TYPE="submit" NAME="akce" VALUE="Upload">
</FORM>
</BODY>
</HTML>