示例#1
0
 public function setId($new_id)
 {
     $connection = new createConnection();
     //i created a new object
     $connection->connectToDatabase();
     // connected to the database
     $this->id = $new_id;
 }
 function doRegister($firstName, $lastName, $emailid, $pass)
 {
     $first_name = $firstName;
     //$_POST['input_fname'];
     $last_name = $lastName;
     // $_POST['input_lname'];
     $pwd = $pass;
     //$_POST['input_password'];
     $email = $emailid;
     //$_POST['input_email'];
     $errorMessage = '';
     createConnection::connectToDatabase();
     $sql = "SELECT email FROM tbl_login WHERE email = '{$email}'";
     $result = createConnection::dbQuery($sql);
     if (createConnection::dbNumRows($result) == 1) {
         $errorMessage = 'Username is already exist, please try another email.';
         return false;
         //$errorMessage;
     } else {
         $insert_id = 0;
         //Insert values in Login Table
         $sql = "INSERT INTO tbl_login (email, password, is_active, added_date, role)\n\t\t\t\t\tVALUES ('{$email}', PASSWORD('{$pwd}'), true, now(), 'USER')";
         createConnection::dbQuery($sql);
         $insert_id = createConnection::dbInsertId();
         //Insert values in Users Table
         $sql = "INSERT INTO tbl_users (login_id, first_name, last_name, added_date)\n\t\t\t \t\tVALUES ('{$insert_id}','{$first_name}','{$last_name}', now())";
         createConnection::dbQuery($sql);
         //Insert values in Address Table
         $sql = "INSERT INTO tbl_address (user_id) \n\t\t\t \t\tVALUES ({$insert_id})";
         createConnection::dbQuery($sql);
         //now send email
         //email it now.
         $subject = "Account Registration";
         $to = $email;
         $msg_body = "Dear Customer,<br/><br/>\n\t\t\tThis is to inform you that your Account # {$email} is register successfully with Demo Project and currently in Inactive state. We will soon contact you once it get activate.<br/><br/>In case you need any further clarification for the same, please do get in touch with your Home Branch.<br/><br/>\n\t\t\tRegards,<br/>Admin, Demo Project";
         $mail_data = array('to' => $to, 'sub' => $subject, 'msg' => 'register', 'body' => $msg_body);
         //send_email($mail_data);
         //header('Location: ../thankyou.php');
         //exit;
         return true;
     }
 }
示例#3
0
<?php

session_start();
require 'connection.php';
$conn = new createConnection();
$conn->connectToDatabase();
$conn->selectDatabase();
$employerId = 2;
//This is the directory where images will be saved
$target = "images/logos/";
$target = $target . basename($_FILES['companyLogo']['name']);
$pic = $_FILES['companyLogo']['name'];
$sql = "UPDATE employer_agent_company SET FirstName = '{$_POST['fname']}', LastName = '{$_POST['lname']}', Address = '{$_POST['address']}', Company_Agent_Logo = '{$pic}', MobilePhone = '{$_POST['mobPhone']}', WorkPhone = '{$_POST['workPhone']}', EmailForApplication = '{$_POST['email']}', Company_Agent_URL = '{$_POST['companyUrl']}', EMPLOYER_TYPE_ID = '{$_POST['empType']}', AGENT_COMPANY_NAME = '{$_POST['agentComName']}' WHERE EMPLOYER_ID = {$employerId}";
var_dump($sql);
$res = $conn->queryDatabase($sql);
if ($res === TRUE) {
    echo "Congratulation on successfully updated profile.";
} else {
    echo "Could Not update your profile, please try again.";
}
//Writes the photo to the server
if (move_uploaded_file($_FILES['companyLogo']['tmp_name'], $target)) {
    //Tells you if its all ok
    echo "The file " . basename($_FILES['companyLogo']['name']) . " has been uploaded, and your information has been added to the directory";
} else {
    //Gives and error if its not
    echo "Sorry, there was a problem uploading your file.";
}
$conn->closeConnection();
示例#4
0
<?php

set_include_path(dirname(__FILE__) . "/../");
require_once '../dbconfig/config.php';
require_once '../library/Account.php';
createConnection::connectToDatabase();
$account = new Account();
if (isset($_REQUEST['email']) && isset($_REQUEST['password']) && isset($_REQUEST['remember'])) {
    $email = createConnection::realEscapeString($_REQUEST['email']);
    $password = createConnection::realEscapeString($_REQUEST['password']);
    $remember = $_REQUEST['remember'];
    $result = $account->doLogin($email, $password, $remember);
    header('Content-Type: application/json');
    if ($result["status"] == true) {
        $arrayName = array('status' => $result["status"], 'name' => $result["name"], 'email' => $result["email"]);
        echo json_encode($arrayName);
    } else {
        echo json_encode(array('status' => $result["status"], 'error' => $result["error"]));
    }
    //echo json_encode($result);
    //    $json = json_encode($result);
    //    $parsed_json = json_decode($json, true);
    //    if($parsed_json['status'])
    //    {
    // 	echo $parsed_json['name'].", ".$parsed_json['email'].", ".$parsed_json['status'].", ".$parsed_json['id'];
    // }
    // else
    // {
    // 	echo $parsed_json['status'].", ".$parsed_json['error'];
    // }
}
示例#5
0
<?php

$ajax = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) and strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
if ($ajax) {
    include '../controller/createConnection.php';
    $connection = new createConnection();
    $conexion = $connection->connectToDatabase();
    //$con = $connection ->selectDatabase($conexion); //creamos la conexion
}
$sql_get_users = "SELECT id, nombre, nickname, edad, id_categoria FROM users";
$consulta_users = $connection->_select_query($sql_get_users);
$elements = array();
//print_r($connection->result);
$cnt = 0;
for ($i = 0; $i < $connection->num_registros; $i++) {
    $id = $connection->result[$i]['id'];
    $nombre = $connection->result[$i]['nombre'];
    $nickname = $connection->result[$i]['nickname'];
    $edad = $connection->result[$i]['edad'];
    $categoria = $connection->result[$i]['id_categoria'];
    $aux = array('Id' => '"' . $id . '"', 'Nombre' => '"' . $nombre . '"', 'Nick' => '"' . $nickname . '"', 'edad' => '"' . $edad . '"', 'id_categoria' => '"' . $categoria . '"');
    array_push($elements, $aux);
    unset($aux);
    //echo "mi array: ";var_dump($elements);
    $cnt += 1;
}
/*
$rs_get_users = mysqli_query($conexion, $sql_get_users);
if($rs_get_users){
    $num_lineas = mysql_num_rows($rs_get_users);
    $elements = array();
示例#6
0
<?php

include 'common/connection.php';
$connection0 = new createConnection();
//i created a new object
$connection0->connectToDatabase();
// connected to the database
echo "<br />";
// putting a html break
$connection0->selectDatabase();
echo "<br />";
$connection0->closeConnection();
// closed connection