Jump to content

Recommended Posts

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/a2861422/public_html/index.php on line 64

 

<html> 
<head> 
<title>Testing</title> 

<script language="javascript"  type="text/javascript"> 

/*This is the location of your PHP script*/
var url = "register.php?nospam=";

function updateName() {
  document.getElementById('checked').innerHTML = "Verifying...";
  var name = document.getElementById("nospam").value;
  http.open("GET", url + escape(name), true);
  http.onreadystatechange = handleHttpResponse;
  http.send(null);
}

function handleHttpResponse() {
  if (http.readyState == 4) {
    results = http.responseText;
    /* Again, we're assuming your username input ID is "username" */
    var name = document.getElementById("nospam").value;
    /* If the username is available, Print this message: */
    if(results == "") results = "<font color=\"green\"><i>"+name+"</i> is correct!</font>";
    document.getElementById('checked').innerHTML = results;
  }
}

function getHTTPObject() {
  var xmlhttp;
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}
var http = getHTTPObject();
</script> 

</head> 
<body>

<?php
//// Change these to reflect your database details: ///////////////////
$dbhost = '';
$dbuser = '';
$dbpass = '';
$dbname = '';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die("Error connecting to mysql");
mysql_select_db($dbname);

$u = addslashes($_GET['param']);

//// Change these to reflect your database details too: //////////////////
$query = "SELECT username FROM users WHERE username='$u';

$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))

{
$checked = $row['username'];
}

//// Now we’ll make the requested comparison in lowercase so that it’s correct: ///////////////////
$checked = strtolower($checked);
$u2 = strtolower($u);

//// Message to Print if the username is taken: ///////////////////
if($u2 == $checked) { echo "$u is Taken!"; }

mysql_close($conn);
?> 

<form> 
<h1>AJAX Username Availability Checker DEMO</h1> 
<p>Elliott, Joey, and Sam are taken...</p> 
<table> 
	<tr> 
		<td align="right">Username:</td><td><input name="username" type="text" id="username" onblur="updateName();"  /></td><td><div name="checked" id="checked"></div></td> 
	</tr> 
	<tr> 
		<td align="right">Password:</td><td colspan="2"><input type="password" name="pass" id="pass" /></td> 
	</tr> 
	<tr> 
		<td> </td><td align="right"><input type="submit" value="Submit" /></td><td> </td> 
	</tr> 
</table>  
</form> 

</body> 
</html>

Link to comment
https://forums.phpfreaks.com/topic/181645-solved-really-weird-error/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.