syntax error in login system - PHP

Asked

Viewed 26 times

-1

ERROR: Parse error: syntax error, Unexpected '$email' (T_VARIABLE) in C: xampp htdocs SUPPORT password.php on line 6

CODE:

<?php
session_start();

include("config/config.php")

    $email = $mysqli ->escape_string($_POST['email']);

    if(filter_var($email, FILTER_VALIDATE_EMAIL)){

        $erro[] = "E-mail inválido.";
    }

    $sql_code = "SELECT senha, codigo FROM usuario WHERE email = '$_SESSION[email]'";
    $sql_query = $mysqli->query($sql_code) or die ($mysqli->error);
    $dado = $sql_query->fetch_assoc();
    $total = $sql_query->num_rows;

    if($total == 0)
        $erro[] = "O e-mail informado é inválido.";

    if(count($erro) ==0 && $total > 0) {


    if(isset($_POST[ok])){
        $novasenha = substr(md5(time()), 0, 6);
        $nscriptografada = md5(md5($novasenha));

          }

        if(mail($email, "Sua nova senha", "Sua nova senha: " .$novasenha)){

        $sql_code = "UPDATE usuario SET senha = '$nscriptografada' WHERE email = '$email' ";
        $sql_query = $mysqli->query($sql_code) or die($mysqli->error);

        }
      }
    }
?>
  • Syntax error, missing ; no include

1 answer

1

Missing a semicolon on this line:

include("config/config.php");

There’s an extra space on this line:

 $email = $mysqli ->escape_string($_POST['email']);

The correct is:

 $email = $mysqli->escape_string($_POST['email']);
  • Stick to the same mistake, buddy.

  • I edited the answer

  • @Space is no problem at all, it’s just the ; same. PHP accepts spaces between the -> and the object and its members https://ideone.com/xY0UIA

  • Notice: Undefined variable: mysqli in C: xampp htdocs SUPPORT password.php on line 6 Fatal error: Uncaught Error: Call to a Member Function escape_string() on null in C: xampp htdocs SUPPORT password.php:6 Stack trace: #0 {main} thrown in C: xampp htdocs SUPPORT password.php on line 6 ...

  • 1

    @Absolutnetinternet this is lack of creating a mysqli object before using. Note that the site is not a Helpdesk and not a help site, posts followed by this type of problem can block your account for posts. Better understand the site on [help]. If it is a code problem, always post a [mcve], and preferably learn basic language before, to avoid mistakes such as the question and the comment you have made now.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.