Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php]skrypt logowania - pomoc
Adrianz
post
Post #1





Grupa: Zarejestrowani
Postów: 12
Pomógł: 0
Dołączył: 3.02.2008

Ostrzeżenie: (0%)
-----


witam ,mam problem ze skryptem,myślę że wszystko zrobiłem dobrze a tutaj zaskakuje mnie błąd :
CODE
Parse error: parse error, unexpected T_ELSE in E:\APACHE\httpd\projekt\login.php on line 38




Możliwe iż pominąłem jakis { lub }

To jest kod skryptu na logowanie się
CODE


<?php require_once("inc/session.php"); ?>
<?php require_once("inc/connection.php"); ?>
<?php require_once("inc/functions.php"); ?>
<?php
include_once("inc/ffunctions.php");
if (isset($_POST['submit'])) {
$errors = array();
$required_fields = array('user', 'password');
$errors = array_merge($errors, check_required_fields($required_fields,$_POST));
$fields_with_lenghts = array('user' => 16, 'password' => 12);
$errors = array_merge($errors, check_max_field_lenght($fields_with_lenghts,$_POST));
$user = trim(mysql_prep($_POST['user']));
$password = trim(mysql_prep($_POST['password']));
$h_password = md5($password);

if ( empty($errors) ) {
$query = "SELECT id, user ";
$query .= "FROM users ";
$query .= "WHERE user = '{$user}' ";
$query .= "AND h_password = '{$h_password}'";
$query .= "LIMIT 1";
$result_set = mysql_query($query);
$confirm_query = mysql_query($result_set);

if (mysql_num_rows($result_set)== 1) {
$f_user = mysql_fetch_array($result_set);
$_SESSION['user_id'] = $found_user['id'];
$_SESSION['user'] = $found_user['id'];
redirect_to("user_area.php");
} else {
if (count($errors) == 1) {
$msg = "Jedno z pól jest niepoprawne";
} else {
$msg = count($errors) "pól jest niepoprawnych";
}
{
} else {
if (isset($_GET['logout'])) && $_GET['logout'] == 1) {
$msg = "zostales poprawnie wylogowany ze strony,Miłego Dnia" ;
}
$user = "";
$password = "";
}
?>
<?php include("inc/header.php") ?>





Jeżeli jest ktoś chętny,proszę mi udzielić pomocy
Pozdrawiam

Ten post edytował Adrianz 19.08.2008, 22:19:05
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 5)
pyro
post
Post #2





Grupa: Zarejestrowani
Postów: 2 148
Pomógł: 230
Dołączył: 26.03.2008

Ostrzeżenie: (0%)
-----


  1. <?php
  2. } else { 
  3. $msg = count($errors) "pól jest niepoprawnych";
  4.  }
  5.  {
  6.  } else {
  7. ?>


dajesz else po else co jest błędem
Go to the top of the page
+Quote Post
tomm
post
Post #3





Grupa: Zarejestrowani
Postów: 142
Pomógł: 28
Dołączył: 7.04.2008

Ostrzeżenie: (0%)
-----


jak na moje oko to masz wiecej { niż }
Go to the top of the page
+Quote Post
Adrianz
post
Post #4





Grupa: Zarejestrowani
Postów: 12
Pomógł: 0
Dołączył: 3.02.2008

Ostrzeżenie: (0%)
-----


faktycznie ,hmh jakbyś rozwiązał tą linijkę? bo jeżeli nie moge else po raz drugi dać .
z góry dzięki za pomoc
pozdrawiam
Go to the top of the page
+Quote Post
marcio
post
Post #5





Grupa: Zarejestrowani
Postów: 2 291
Pomógł: 156
Dołączył: 23.09.2007
Skąd: ITALY-MILAN

Ostrzeżenie: (10%)
X----


Cytat
faktycznie ,hmh jakbyś rozwiązał tą linijkę? bo jeżeli nie moge else po raz drugi dać .

No jak to jak:
1.if()
2.Else if()
3.else
Go to the top of the page
+Quote Post
Adrianz
post
Post #6





Grupa: Zarejestrowani
Postów: 12
Pomógł: 0
Dołączył: 3.02.2008

Ostrzeżenie: (0%)
-----


dzieki wielkie
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 23:30