is there anyone to help me about my code ???

i have three page code in the following :

index.php :

[php]<?php
require_once(‘includes/funcs.class.php’);
$objectUser = new func(“localhost”,“root”,"",“mesaeed”);
if(isset($_POST[‘username’]))
{
$objectUser->existUsername($_POST[‘username’]);
}
?>

Untitled Document
Username :

Password :



[/php]

funcs.class.php :

[php]<?php
require_once(‘connect.class.php’);
class func extends connect
{
protected $_dbusername;
protected $_dbemail;
protected $_dbpassword;
//User … Functions …
function existUsername($dbusername)
{
$this->_dbusername = $dbusername;
global $dbtable,$dbsql,$dbquery;
$dbtable = “users”;
$dbsql = “SELECT * FROM “.$dbtable.” WHERE username = ?”;
$dbquery = $this->_connect->prepare($dbsql);
$dbquery->bind_param(“s”, $this->_dbusername);
$dbquery->execute();
$dbquery->store_result();
if($dbquery->num_rows == 1)
{
echo 1;
}
else
{
echo 0;
}
$dbquery->close();
}
function existEmail($dbemail)
{
$this->_dbemail = $dbemail;
global $dbtable,$dbsql,$dbquery;
$dbtable = “users”;
$dbsql = “SELECT * FROM “.$dbtable.” WHERE email = ?”;
$dbquery = $this->_connect->prepare($dbsql);
$dbquery->bind_param(“s”, $this->_dbemail);
$dbquery->execute();
$dbquery->store_result();
if($dbquery->num_rows == 1)
{
return true;
}
else
{
return false;
}
$dbquery->close();
}
function UsernameLinkedPassword($dbusername,$dbpassword)
{
$this->_dbusername = $dbusername;
$this->_dbpassword = $dbpassword;
global $dbtable,$dbsql,$dbquery;
$dbtable = “users”;
$dbsql = “SELECT * FROM “.$dbtable.” WHERE username =? AND password =?”;
$dbquery = $this->_connect->prepare($dbsql);
$dbquery->bind_param(“ss”, $this->_dbusername, $this->_dbpassword);
$dbquery->execute();
$dbquery->store_result();
if($dbquery->num_rows == 1)
{
return true;
}
else
{
return false;
}
}
}
?>[/php]

jquery.js :

// JavaScript Document $(document).ready(function(e) { $("input#username").change(function(e) { var username = $("input#username").val(); $.ajax({ type: "POST", url: "index.php", data: username, success: function(msg){ if(msg == 1) { alert("Ok . "); } } }); }); });

but it doesnt work !!!

the orginal code : http://uploadkon.ir/?file=meSaeed.zip

What doesn’t work?

First you need to tell us what you want the code to do :slight_smile:

Sponsor our Newsletter | Privacy Policy | Terms of Service