EasyCFM.COM ColdFusion Forums / PHP to CFML / help translate php to coldfusion code

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: help translate php to coldfusion code

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

zionist
01-14-2009 @ 1:09 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Junior Member
Posts: 94
Joined: Feb 2007

hi guys could someone please help me and translate this php script to coldfusion. thanks

UserInfoService.php:
<?php
class UserInfoService
{
    function getUserInfo(UserCredentials $userCredentials)
    {
        require_once("Classes/UserInfo.php");
        require_once("Classes/UserCredentials.php");
        $userInfo = new UserInfo();
        $userInfoDB = new mysqli("myserver.com", "user", "pass", "DB");
        $query = "SELECT * FROM UserInfo where username='" . $userCredentials->username . "' AND password='" . $userCredentials->password . "'";
        if($result = $userInfoDB->query($query))
        {
            if($result->num_rows == 1)
            {
                $row = $result->fetch_assoc();
                $userInfo->username = $row["username"];
                $userInfo->password = $row["password"];
                $userInfo->firstname = $row["firstname"];
                $userInfo->lastname = $row["lastname"];
                $userInfo->email = $row["email"];
            }
        }
        return $userInfo;
    }
  
    function loginUser(UserCredentials $userCredentials)
    {
        require_once("Classes/UserCredentials.php");
        $loginResult = "Failure";
        $userInfoDB = new mysqli("myserver.com", "user", "pass", "DB");
        $query = "SELECT * FROM UserInfo where username='" . $userCredentials->username . "' AND password='" . $userCredentials->password . "'";
        if($result = $userInfoDB->query($query))
        {
            if($result->num_rows == 1)
            {
                $loginResult = "Success";
            }
        }
        return $loginResult;
    }
}
?>

Classes/UserInfo.php:
<?php
class UserInfo
{
    public $username;
    public $password;
    public $firstname;
    public $lastname;
    public $email;
}
?>

Classes/UserCredentials.php:
<?php
class UserCredentials
{
    public $username;
    public $password;
}
?>



Website Designed and Developed by Pablo Varando.