Warnung: file_put_contents(/home/www/web1/html/php_dev/test.txt) [function.file-put-contents]: failed to open stream: Permission denied in /home/www/web1/html/php_dev/sys/lib.activity.php (Zeile 58)
passwortabfrage umgehen... [Archiv] - PHP-Scripte PHP-Tutorials PHP-Jobs und vieles mehr
ebiz-webhosting
- Ad -
php-resource




Archiv verlassen und diese Seite im Standarddesign anzeigen :
passwortabfrage umgehen...


 
bastian
26-09-2001, 14:43 
 
hallo progis,
ich habe da ein skript, welches erst nach einer passwortabfrage zu ereichen ist, gebe ich den direkten pfad im browser ein, bekomme ich eine fehlermeldung(vom script) welche mir sagt, das ich das script auf eine unauthorisierte art aufgerufen habe.
hat wer eine idee, wo und was ich in dem code ändern muss, um ohne passworteingabe zum script zu kommen?



$password = "passwort"; # Change this to be your password.
$editurl = "http://meinehomepage.de/cgibin/edit.cgi"; # Location of edit.cgi file.

###### DONT CHAGE THIS CODE ######

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/~!/ ~!/g;
$FORM{$name} = $value;
}

if ($FORM{'pass'} eq $password) {
print "Location: $editurl\n\n";
} else {
print "Content-type:text/html\n\n";
print "Invalid Password! Please go back and try again!";
}

############## END ###############

hier die aufzurufende datei:


#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);

# (c) NueDream Inc. 2000-2001

############## GLOBAL VARS AND CONSTS ############

$file = "questions.db"; # This is the name of your questions file
$quizname = "NueQuiz"; # This is what appears in the TITLE
$editurl = "http://www.meinehp/cgibin/nuequiz/edit.cgi"; # Location of the edit page
$passurl = "http://www.meinehp/cgibin/nuequiz/password.htm"; # Location of Password Check file

############ THESE ARE OPTIONAL CHANGES ###########

$spacer = '|'; # leave it unless you already have a database
@list = ('a','b','c','d','e','f');

############## GET INFO FROM WEBPAGE ############

if($ENV{'HTTP_REFERER'} =~ /$passurl/ || $ENV{'HTTP_REFERER'} =~ /$editurl/) {

print "Content-type: text/html\n\n";

.
.
.



} else {
print "Content-type: text/html\n\n";
dienice("You have not used a valid way to access this program go to the <a href=\"$editurl\">Admin Page</a>");
}

} else {
print "Content-type: text/html\n\n";
dienice("You have not used a vaild way to access this program.");
}
############## DYING SUBROUTINE ############

sub dienice {
my($msg) = @_;
print ("<br><hr><br><h1>FATAL ERROR</h1><hr><br>\n");
print ($msg);
exit;
}



read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name,$value) = split (/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("c", hex($1))/eg;
$value =~ s/\n/ /g; # newlines are now spaces
$value =~ s/\r//g; # removes hard returns
$value =~ s/\cM//g; # deletes ^M's
$FORM{$name} = $value;
}

[Editiert von bastian am 26-09-2001 um 14:47]

 
hannes
26-09-2001, 14:50 
 
Ähm, das ist doch nicht PHP, oder ?
Das sieht mir nach Perl aus !

 
bastian
26-09-2001, 14:59 
 
ähmm,
schon.
hoffe ihr kickt mich nicht in den digitalen orkus :-)
b.

 
schmalle
26-09-2001, 16:22 
 
zwecks dessen gibt es hier ein perl forum :D aber perl ist eh´ schei#*! :D mach´s in PHP!

- -

Alle Zeitangaben in WEZ +2. Es ist jetzt 16:34 Uhr.