Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include "../class/controller.php";
- $reg = new Register();
- $reg->dbConnect();
- $username = $_POST['username'];
- $username = trim(htmlentities($username));
- $email = $_POST['email'];
- if ($email == "" || $username == "")
- {
- $data['success'] = "false";
- }
- else if ($email != "" && $username != "")
- {
- $query = "SELECT * FROM jos_users WHERE username = '".$username."'";
- $sql = mysql_query($query);
- $check_sql = mysql_num_rows($sql) or die (mysql_error());
- $checkmail = explode("@", $email);
- $data['success'] = validate($check_sql, $checkmail[1]);
- }
- function validate($sql, $mail){
- if($sql == 0 && $mail == 'ucc.ie'){
- return "true";
- }else{
- return "false";
- }
- }
- echo json_encode($data);
- ?>
Add Comment
Please, Sign In to add comment