T
T
The-TS2020-05-06 20:14:19
JavaScript
The-TS, 2020-05-06 20:14:19

Uncaught SyntaxError: missing ) after argument list, how to fix?

There is this code:

<?php
  $name = $_POST['name'];
  $email = $_POST['email'];
    $pass = $_POST['pass'];
    $pass2 = $_POST['pass2'];

    if (strlen($pass) < 8) {
        echo '<meta http-equiv="refresh" content="0;http://localhost/Register_or_Login.php?err=1">';
    }elseif (!preg_match("#[0-9]+#", $pass)) {
        echo '<meta http-equiv="refresh" content="0;http://localhost/Register_or_Login.php?err=2">';
    }elseif (!preg_match("#[a-zA-Z]+#", $pass)) {
        echo '<meta http-equiv="refresh" content="0;http://localhost/Register_or_Login.php?err=3">';
    }else{
    	if($pass == $pass2) {
    	echo ('
  			<!DOCTYPE html>
  			<html>
  			<head>
  				<title>Title</title>
  			</head>
  			<body>

  			
  			<script src="https://ts-forms.web.app/__/firebase/7.14.2/firebase-app.js"></script>
  		<script src="https://ts-forms.web.app/__/firebase/7.14.2/firebase-analytics.js"></script>
  		<script src="https://ts-forms.web.app/__/firebase/7.14.2/firebase-auth.js"></script>
  		<script src="https://ts-forms.web.app/__/firebase/7.14.2/firebase-firestore.js">
  		</script>
  		<script src="https://ts-forms.web.app/__/firebase/init.js"></script>
  			<script>firebase.auth().createUserWithEmailAndPassword('.$email.', '.$pass2.').catch(function(error) {
  // Handle Errors here.
  var errorCode = error.code;
  var errorMessage = error.message;
  // ...
});</script>
  			</body>
  			</html>
  		');
    }else {
    	echo '<meta http-equiv="refresh" content="0;http://localhost/Register_or_Login.php?err=4">';
    }

    }

    
?>


And there is such an error
Uncaught SyntaxError: missing ) after argument list

How to fix it?
Thanks...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Shvedov, 2020-05-07
@Pyhon3x

At least here:

firebase.auth().createUserWithEmailAndPassword("'.$email.'", "'.$pass2.'").catch(function(error) {...}

you need to wrap the arguments in one more quotes, so that in the resulting js these are strings

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question