Ocena wątku:
  • 0 głosów - średnia: 0
  • 1
  • 2
  • 3
  • 4
  • 5
problem z rejestracja
#1
[/php][/align]witam mam problem na swoim serwerze : z rejestracja niewiem gdzie mam bład :
[align=center]Warning: fopen(users/2wilki.cl50cp1eoq9zj3scotij1a84) [function.fopen]: failed to open stream: No such file or directory in /home/admin21/domains/sciaga.vot.pl/public_html/rejestrator.php on line 14

Warning: fputs(): supplied argument is not a valid stream resource in /home/admin21/domains/sciaga.vot.pl/public_html/rejestrator.php on line 15

Warning: fclose(): supplied argument is not a valid stream resource in /home/admin21/domains/sciaga.vot.pl/public_html/rejestrator.php on line 16

Warning: Cannot modify header information - headers already sent by (output started at /home/admin21/domains/sciaga.vot.pl/public_html/rejestrator.php:14) in /home/admin21/domains/sciaga.vot.pl/public_html/rejestrator.php on line 17


index.html to jako 1 plik

Kod PHP:
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<
html>
<
head>
<
meta http-equiv="Content-type" content="text/html;charset=ISO-8859-2">
<
title>rejestrator.html </title>
</
head>
<
body>


<
form method="post" action="rejestrator.php">
<
input type="text" name="login"> - Login<br>
<
input type="password" name="haslo"> - Haslo<br>
<
input type="password" name="haslo2"> - Potwierdz haslo<br>
<
input type="submit" value="rejestruj!">
</
form>


</
body>
</
html
chronionastrona.php jako nastepny plik

<?php
session_start();
if(!isSet($_SESSION['zalogowany'])){
$_SESSION['komunikat'] = "Nie jestes zalogowany!";
include('form.php');
exit();
}
?>

<html>
<head>
</head>
<body>
Jestes zalogowany jako: <?php echo $_SESSION['zalogowany'] ?>
<br>
Tutaj majš dostęp tylko najlepsi!! Big Grin
<br>
<a href="logout.php">Wylogowanie</a>
</body>
</html>

form.php
Kod PHP:
<html>
<
head>
</
head>
<
body>
<
div align="center">
<
h2>

<?
php
 
if(isSet($_SESSION['komunikat']))
  echo 
$_SESSION['komunikat'];
 else
  echo 
"Wprowadz nazwe użytkownika i haslo:";
?>
</h2>

<form name="formularz1" action="login.php" method="POST">
<b>Nazwa uzytkownika:</b>
<br>
<input type="text" name="login">
<br>
<b>Haslo:</b>
<br>
<input type="password" name="haslo">
<br><br>
<input type="submit" value="loguj!">
</form><br><br>
Nie masz jeszcze konta? <a href="rejestrator.html">zarejestruj sie!</a>
</div>
</body>
</html>

login.php 
<?php

function checkPass($user, $pass)
{
$login = $_POST['login'];
if(!$fd = @fopen("users/$login.cl50cp1eoq9zj3scotij1a84", "r")) return 1;
$result = 2;
while (!feof($fd)){
$line = trim(fgets($fd));
$arr = explode(":", $line);
if(count($arr)<2)
continue;

if($arr[0] != $user)
continue;

if($arr[1] == $pass){
$result = 0;
break;
}

else
break;
}
fclose($fd);
return $result;
}

session_start();
if(isSet($_SESSION['zalogowany'])){
header("Location:chronionastrona.php");
}

else if(!isSet($_POST["haslo"]) || !isSet($_POST["login"])){
$_SESSION['komunikat'] = "Wprowadz nazwe uzytkownika i haslo:";
include('form.php');
}

else{
$val = checkPass($_POST["login"], $_POST["haslo"]);
if($val == 0){
$_SESSION['zalogowany'] = $_POST['login'];
header("Location:chronionastrona.php");
}

else if($val == 1){
$_SESSION['komunikat'] = "Blad serwera. Zalogowanie nie bylo mozliwe!";
include('form.php');
}

else if($val == 2){
$_SESSION['komunikat'] = "Nieprawidlowa nazwa uzytkownika lub haslo";
include('form.php');
}

else {
$_SESSION['komunikat'] = "Blad serwera. Zalogowanie nie bylo mozliwe";
include('form.php');
}
}

?>


logout.php
[/php]<?php
session_start();
if(!isSet($_SESSION['zalogowany'])) {
$komunikat = "Nie byłes zalogowany!";
}

else{
unset($_SESSION['zalogowany']);
$komunikat = "Wylogowanie prawidlowe!";
}

session_destroy();
?>

<html>
<head>
</head>
<body>
<?php echo $komunikat ?>
</body>
</html>


rejestracjapomyslna.php
Kod PHP:
<html>
<
head>
</
head>
<
body>
Zostales zarejestrowanyTeraz mozesz sie zalogowac i w pelni korzystac z serwisu!
</
body>
</
html>

rejestrator.html 
<form method="post" action="rejestrator.php">
<input type="text" name="login"> - Login<br>
<input type="password" name="haslo"> - Haslo<br>
<input type="password" name="haslo2"> - Potwierdz haslo<br>
<input type="submit" value="rejestruj!">
</form>

rejestrator.php
[php]<?

$login = $_POST['login'];
$haslo = $_POST['haslo'];
$haslo2 = $_POST['haslo2'];
$file = ("users/$login.cl50cp1eoq9zj3scotij1a84");
if(file_exists($file)):
echo("Ten login jest juz zajety!");
elseif($haslo != $haslo2):
echo("Podales dwa rozne hasla!");
else:
$ciag = "$login:$haslo";
$zapis = str_replace("$ "," $",$ciag);
$open = fopen("$file", "w+");
fputs($rejestrator.php , $zapis);
fclose($open);
echo header("Location: rejestracjapomyslna.php");
endif;
?>
takie mam pliki a przy rejestracji taki bład jak sie znacie to napiszcie mi gdzie błedy zrobiłem i gdzie zmienic poprawic za pomoc bardzo dziekuje
Odpowiedz


Podobne wątki…
Wątek: Autor Odpowiedzi: Wyświetleń: Ostatni post
Exclamation [PhP] Problem z rejestracją mpm1122 3 2,964 29-12-2011, 20:28
Ostatni post: kancik
Question Logowanie i rejestracja MatixYo 13 8,621 06-05-2011, 20:02
Ostatni post: kancik
Cool Rejestracja i Logowanie użytkowników strona45 1 2,729 09-09-2009, 06:07
Ostatni post: Labsta.com

Skocz do:


Użytkownicy przeglądający ten wątek: 1 gości
Sponsorzy i przyjaciele
SeoHost.pl