コード例 #1
0
 /**
  * 初始化方法
  */
 public function _initialize()
 {
     // 检测用户登录状态
     $this->uid = 0;
     //是否是管理员
     if ($uid) {
         $this->assign('isManager', UserLogic::isManager());
         if ($cityInfo['sourceID']) {
             $roleInfo = D('UserRole')->getRoleByInfo($uid, $cityInfo['sourceID']);
             if ($roleInfo) {
                 $this->assign('role', '【' . $roleInfo['role_name'] . '】');
             }
         }
     }
     // 某些操作需要用户登录后才能执行,未登录则跳转到登录页面
     $this->checkLogin();
     $this->assign($data);
 }
コード例 #2
0
ファイル: eprofile.php プロジェクト: ArslanAle/eVeiling
<?php

session_start();
if (!isset($_SESSION['user'])) {
    echo "You are not authorized to see this content.<br /> Please <a href='#' onclick='signin()'>Sign In</a> to view the contents.";
} else {
    require 'Value_Object/User.php';
    require 'Logic/UserLogic.php';
    $user = new User();
    $userlogic = new UserLogic();
    $user = $userlogic->GetUser($_SESSION['user']);
    ?>


<div id="profile"  >

  <form id="editPro" name="editPro" method="post" action="editProfile.php"  onkeydown="keyeProfile(event)">
    <table width="70%" height="339" border="1">
      <tr>
        <td class="vtop centered" width="27%">
            <span id="pic">
                <img src="<?php 
    echo $user->picpath;
    ?>
" alt="Not Available" name="profilepic" 
                width="160" height="155" id="profilepic" style="background-color: #999999" />
            </span>
        	
        </td>
        
        <td class="vtop lta" width="73%">
コード例 #3
0
ファイル: AutoDao.php プロジェクト: ArslanAle/eVeiling
    function autoMail()
    {
        global $database;
        //$itemsArr = array();
        $today = date("Y-m-d");
        $this->query = "select * from  items where BidEndOn ='{$today}' AND highest_bid!=0 AND status != 'sold'";
        $result = mysql_query($this->query);
        while ($row = mysql_fetch_array($result)) {
            $item = new Item();
            $item->setItemId($row["ItemID"]);
            $item->setTitle($row["Title"]);
            $item->setMinPrice($row["min_price"]);
            $item->setCategory($row["Category"]);
            $item->setOwnerId($row["OwnerID"]);
            $ad = date("Y-m-d H:i:s", strtotime($row['addedOn']));
            $item->setHighestBid($row["highest_bid"]);
            $item->setAddedOn($ad);
            $item->setBiddingEndOn($row["BidEndOn"]);
            $item->setDesc($row["Description"]);
            $item->setStatus($row["Status"]);
            print_r($item);
            $this->query = "SELECT PicDate,PicPath FROM itempics WHERE OwnId = " . $item->ownerId . " AND PicDate = '" . $ad . "'";
            $res = mysql_query($this->query);
            $r = mysql_fetch_array($res);
            $item->setPicPath($r['PicPath']);
            $this->query = "select email from user where UserID={$item->ownerId}";
            $res = mysql_query($this->query);
            $r = mysql_fetch_row($res);
            $OwnerEmail = $r[0];
            $ul = new UserLogic();
            $ownuser = $ul->getUser($item->ownerId);
            $this->query = "select bids.BidderID from items INNER JOIN bids ON items.highest_bid=bids.amount where bids.ItemID ={$item->itemId}";
            $res = mysql_query($this->query);
            $r = mysql_fetch_row($res);
            $bidderId = $r[0];
            echo $bidderId;
            $winuser = $ul->getUser($r[0]);
            $this->query = "select email from user where UserID={$bidderId}";
            $res = mysql_query($this->query);
            $r = mysql_fetch_row($res);
            $WinnerEmail = $r[0];
            echo "\nOwner email:" . $OwnerEmail . "\n";
            echo "\nWinner email:" . $WinnerEmail . "\n";
            require "fbmain.php";
            if ($facebook) {
                if ($ownuser->fb_id) {
                    try {
                        $wallpostpage = $facebook->api('/' . $ownuser->fb_id . '/feed', 'post', array('message' => 'Your item ' . $item->title . '. has been sold at price ' . $item->highestBid . '$. ', 'picture' => 'http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs1324.snc4/161996_166764056682774_6216247_q.jpg

', 'link' => 'http://www.facebook.com/apps/application.php?id=166764056682774', 'name' => 'eVeiling.com', 'cb' => ''));
                    } catch (FacebookApiException $e) {
                        print_r($o);
                    }
                }
                if ($winuser->fb_id) {
                    try {
                        $wallpostpage = $facebook->api('/' . $winuser->fb_id . '/feed', 'post', array('message' => 'You have won the auction of ' . $item->title . ' at ' . $item->highestBid . '$.', 'picture' => 'http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs1324.snc4/161996_166764056682774_6216247_q.jpg

', 'link' => 'http://www.facebook.com/apps/application.php?id=166764056682774', 'name' => 'eVeiling.com', 'cb' => ''));
                    } catch (FacebookApiException $e) {
                        print_r($o);
                    }
                }
            }
            $this->query = "update account set balance=balance+{$item->highestBid} where UserID={$item->ownerId}";
            mysql_query($this->query);
            $this->query = "delete from bids where ItemID={$item->itemId}";
            mysql_query($this->query);
            $this->query = "update items set OwnerId ={$bidderId}, status='sold' where ItemID={$item->itemId}";
            mysql_query($this->query);
            $this->query = "insert into WonItems (winnerId,ownerId,ItemId) values ({$bidderId}, {$item->ownerId},{$item->itemId} )";
            mysql_query($this->query);
            mailForOwner($OwnerEmail, $item);
            mailForWinner($WinnerEmail, $item);
        }
    }
コード例 #4
0
ファイル: picupload.php プロジェクト: ArslanAle/eVeiling
<?php

session_start();
if (!isset($_SESSION['user'])) {
    echo "You are not authorized to see this content.<br /> Please <a href='#' onclick='signin()'>Sign In</a> to view the contents.";
} else {
    $uploaddir = 'upload/profile/';
    $uploadfile = $uploaddir . uniqid('file-') . basename($_FILES['Filedata']['name']);
    if (move_uploaded_file($_FILES['Filedata']['tmp_name'], $uploadfile)) {
        require_once 'Logic/UserLogic.php';
        $ul = new UserLogic();
        $ul->UpdatePic($_SESSION['user'], $uploadfile);
    } else {
        echo 'You pic is not uploaded. Plz try again.';
    }
}
コード例 #5
0
ファイル: FbMap.php プロジェクト: ArslanAle/eVeiling
}
//fql query example using legacy method call and passing parameter
try {
    //get user id
    $uid = $facebook->getUser();
    //or you can use $uid = $fbme['id'];
    $fql = "select pic_square from user where uid=" . $uid;
    $param = array('method' => 'fql.query', 'query' => $fql, 'callback' => '');
    $fqlResult = $facebook->api($param);
} catch (Exception $o) {
    d($o);
}
require_once 'Value_Object/User.php';
require_once 'Logic/UserLogic.php';
$user = new User();
$ulogic = new UserLogic();
//$user->setFbId($fbme['id']);
if ($fbme) {
    $user->setFbId($fbme['id']);
    $user->setFname($fbme['first_name']);
    $user->setLname($fbme['last_name']);
    $user->setEmail($fbme['email']);
    $user->setSex($fbme['gender']);
    $address = $userInfo[0];
    $address = $address['current_location'];
    $user->setAddress('Not specified.');
    $user->setCountry($address['country']);
    $datte = $fbme['birthday'];
    $user->setBday(date("Y-m-d", $datte));
    $user->setCity($address['city']);
    $user->setUsername($_POST['uid']);
コード例 #6
0
 public static function run()
 {
     $miLogic = new Controlador();
     $view = isset($_GET['view']) ? $_GET['view'] : 'default';
     switch ($view) {
         case 'default':
             $productos = $miLogic->getProductos();
             break;
         case 'agregar':
             $miLogic->agregarProductos($_GET['id']);
             header('location:ViewPHP.php');
             break;
         case 'update':
             $miLogic->actualizarCarrito();
             header('location:ViewPHP.php?view=detalle');
             break;
         case 'cerrar':
             $miLogic->cerrarSesion();
             break;
         case 'detalle':
             $productos = $miLogic->getProductos();
             break;
         case 'presentar':
             $name = $_POST['name'];
             $address = $_POST['address'];
             $city = $_POST['city'];
             $province = $_POST['province'];
             $email = $_POST['email'];
             $country = $_POST['country'];
             $shippingMethod = $_POST['shippingMethod'];
             $paymentMethod = $_POST['paymentMethod'];
             $zipCode = $_POST['zipCode'];
             $phone = $_POST['phone'];
             $orden = $miLogic->crearOrden($name, $address, $city, $province, $email, $country, $shippingMethod, $paymentMethod, $zipCode, $phone);
             break;
         case 'imagen':
             $imagen = $miLogic->loadImage($_GET['id']);
             header('Content-type:image/png');
             echo $imagen->getBytes();
             break;
         case 'login':
             if (isset($_POST['username']) && isset($_POST['pwd'])) {
                 if ($_POST['username'] != null && $_POST['pwd'] != null) {
                     $r_username = $_POST['username'];
                     $r_pwd = $_POST['pwd'];
                     $userLogic = new UserLogic();
                     $rs = $userLogic->auth($r_username, $r_pwd);
                     header('location:ViewPHP.php');
                 }
             }
             break;
         case 'register':
             echo $username = $_POST['username'];
             echo $pwd = $_POST['pwd'];
             echo $role = 'customer';
             $userLogic = new UserLogic();
             $created = $userLogic->create($username, $pwd, $role);
             $rs = $userLogic->auth($username, $pwd);
             echo var_dump($rs);
             //                $username = $_POST['username'];
             //                $pwd = $_POST['pwd'];
             //                $role = 'customer';
             //                $userLogic = new UserLogic();
             //                $created = $userLogic->create($username, $pwd, $role);
             //                echo $created;
             //                if ($created) {
             //                    $rs = $userLogic->auth($username, $pwd);
             //                    header('location:ViewPHP.php');
             //                } else {
             //                    // TODO: handle errors
             //                    header('location:ViewPHP.php');
             //                }
             break;
         case 'addProduct':
             if (isset($_POST['name'])) {
                 if ($_POST['name'] != null && $_POST['description'] != null && $_POST['price'] != null && $_FILES['img'] != null) {
                     $name = $_POST['name'];
                     $description = $_POST['description'];
                     $price = $_POST['price'];
                     $img = $_FILES['img'];
                     $nameimg = $_FILES['img']['name'];
                     $path = getcwd();
                     $path = substr($path, 0, 35);
                     $mvpath = '../imagenes/' . $nameimg;
                     $tmp_name = $_FILES['img']['tmp_name'];
                     move_uploaded_file($tmp_name, $mvpath);
                     $status = $miLogic->inserProduct($name, $description, $price, $mvpath);
                     header('location:ViewPHP.php?view=default');
                 }
             }
             break;
         case 'deleteProduct':
             if (isset($_POST['id'])) {
                 if ($_POST['id'] != null) {
                     $status = $miLogic->deleteProduct($_POST['id']);
                     header('location:ViewPHP.php');
                 }
             }
             break;
         default:
             break;
     }
     require_once 'generalView.html';
 }
コード例 #7
0
ファイル: PayPal.php プロジェクト: ArslanAle/eVeiling
<?php

session_start();
require_once 'Value_Object/User.php';
require_once 'Logic/UserLogic.php';
$user = new User();
$ul = new UserLogic();
$user = $ul->GetUser($_SESSION['user']);
$ul->addAmount($_POST['amount'], $_SESSION['user']);
?>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" name="paypalForm" id="paypalForm"> 
	<input type="hidden" name="cmd" value="_xclick">
	<input type="image" src="images/paypallogo.gif" border="0" name="submit" alt="Make payments with PayPal - its fast, free and secure! CLICK HERE">
	<input type="hidden" name="business" value="<?php 
echo $user->email;
?>
">
	<input type="hidden" name="return" value="localhost/eveiling/payPalacc.php">
	<input type="hidden" name="amount" value="500">
	<input type="hidden" name="item_name" value="Payment">
	<input type="hidden" name="item_number" value="id">
	<input type="hidden" name="no_shipping" value="0">
	<input type="hidden" name="shipping" value="0">
	<input type="hidden" name="cancel_return" value="http://localhost/eveiling/index.php">
	<input type="hidden" name="notify_url" value="notification url">
	<input type="hidden" name="no_note" value="0">( Are you sure u want to credit your accounr? )
	<center><input type="submit" value="Click To Proceed"></center>
</form>
<div id="eee"></div>

コード例 #8
0
 /**
  * 注册用户
  * @param $username
  * @param $nickname
  * @param $password
  * @param $email
  * @return string
  */
 public function register($username, $nickname, $password, $email)
 {
     $new_user_role = get_opinion('new_user_role', true, 5);
     $new_user_statue = get_opinion('new_user_statue', true, 1);
     $User = new UserLogic();
     $userDetail = $User->where(array('user_login' => $username))->select();
     if ($userDetail != '') {
         return $this->jsonResult(0, "用户名已存在");
     } else {
         // 组合用户信息并添加
         $newUserDetail = array('user_login' => $username, 'user_nicename' => $nickname, 'user_pass' => encrypt($password), 'user_email' => $email, 'user_status' => $new_user_statue);
         // 添加用户与角色关系
         $newUserDetail['user_level'] = $new_user_role;
         $Role_users = D('Role_users');
         if ($new_id = $User->add($newUserDetail)) {
             $role = array('role_id' => $new_user_role, 'user_id' => $new_id);
             if ($Role_users->add($role)) {
                 return $this->jsonResult(1, "注册成功!", U('Admin/Access/index'));
             } else {
                 return $this->jsonResult(0, "注册成功,添加用户权限失败!");
             }
         } else {
             return $this->jsonResult(0, "注册用户失败");
         }
     }
 }
コード例 #9
0
ファイル: FBsignin.php プロジェクト: ArslanAle/eVeiling
<?php

session_start();
require "fbmain.php";
// Session based graph API call.
require_once 'Value_Object/User.php';
require_once 'Logic/UserLogic.php';
$user = new User();
$ulogic = new UserLogic();
//$user->setFbId($fbme['id']);
if ($fbme) {
    $user = $ulogic->fbSignIn($fbme['id']);
    if ($user->id) {
        $_SESSION['user'] = $user->id;
        ?>
		<script type="text/javascript">
			setTimeout("updateDiv('init.php','content','get')",0);
			setTimeout("updateDiv('topnav.php','tnav','get')",0);
		</script>
			<?php 
    } else {
        if ($user == 0) {
            ?>
		<script type="text/javascript">
			setTimeout("updateDiv('FbReg.php','content','get')",0);
			
		</script>
			<?php 
        } else {
            echo $user;
        }
コード例 #10
0
ファイル: register.php プロジェクト: ArslanAle/eVeiling
$user = new User();
$user->setUsername($username);
$user->setPassword($password);
$user->setFname($f_name);
$user->setLname($l_name);
$user->setNick($nick);
$user->setCountry($country);
$user->setCity($city);
$user->setAddress($address);
$user->setPhone($phone);
$user->setEmail($email);
$user->setSex($sex);
$user->setBday($dob);
$today = date("y-m-d");
$user->setJoinedOn($today);
$userlogic = new UserLogic();
$isExist = $userlogic->InsertUser($user);
if ($isExist == 13) {
    echo 'Username Already Exists. Plz try something else.';
} else {
    if ($isExist == 1) {
        ?>
	
		<script type="text/javascript"> 
				updateDiv("verify.php","content","get"); 
        </script>
		
	<?php 
    } else {
        echo "Error : " . $isExist;
    }
コード例 #11
0
ファイル: activate.php プロジェクト: ArslanAle/eVeiling
<?php

session_start();
if (!isset($_REQUEST['code'])) {
    header("Location: index.php");
}
$code = $_REQUEST['code'];
require_once "Logic/UserLogic.php";
$UL = new UserLogic();
$status = $UL->ActivateUser($code);
if ($status != 0 && $status != false) {
    $_SESSION['user'] = $status;
    ?>
		<script type="text/javascript">
			setTimeout("updateDiv('init.php','content','get')",0);
			setTimeout("updateDiv('topnav.php','tnav','get')",0);
		</script>
			<?php 
} else {
    echo "Activation code is not valid or Try again.";
}
コード例 #12
0
ファイル: login.php プロジェクト: ArslanAle/eVeiling
<?php

session_start();
require_once 'Value_Object/User.php';
require_once 'Logic/UserLogic.php';
$username = $_POST['uid'];
$password = $_POST['pass'];
$User = new User();
$UserLogic = new UserLogic();
$User->setUsername($username);
$User->setPassword($password);
$status = $UserLogic->loginUser($User);
if ($status != 0 && $status != false) {
    $_SESSION['user'] = $status;
    ?>
		<script type="text/javascript">
			setTimeout("updateDiv('init.php','content','get')",0);
			setTimeout("updateDiv('topnav.php','tnav','get')",0);
		</script>
	<?php 
} else {
    echo "Wrong Username and Password! Or currently Inactive.";
}
コード例 #13
0
ファイル: editProfile.php プロジェクト: ArslanAle/eVeiling
<?php

session_start();
require_once 'Value_Object/User.php';
require_once 'Logic/UserLogic.php';
$User = new User();
$UserLogic = new UserLogic();
$uid = $_SESSION['user'];
$User->f_name = $_POST['fname'];
$User->l_name = $_POST['lname'];
$User->email = $_POST['email'];
$User->phone = $_POST['fname'];
$User->sex = $_POST['sex'];
$User->b_day = $_POST['bday'];
$User->nick = $_POST['nick'];
$User->country = $_POST['con'];
$User->city = $_POST['city'];
$User->address = $_POST['add'];
$status = $UserLogic->UpdateUser($uid, $User);
if ($status != 0) {
    ?>
        <script type="text/javascript">
			setTimeout("updateDiv('profile.php','content','get')",0);
			setTimeout("updateDiv('topnav.php','tnav','get')",0);
		</script>
		
	<?php 
} else {
    echo "Sorry your profile is not updated.";
}
コード例 #14
0
ファイル: FbUpdate.php プロジェクト: ArslanAle/eVeiling
}
//fql query example using legacy method call and passing parameter
try {
    //get user id
    $uid = $facebook->getUser();
    //or you can use $uid = $fbme['id'];
    $fql = "select pic_square from user where uid=" . $uid;
    $param = array('method' => 'fql.query', 'query' => $fql, 'callback' => '');
    $fqlResult = $facebook->api($param);
} catch (Exception $o) {
    d($o);
}
require_once 'Value_Object/User.php';
require_once 'Logic/UserLogic.php';
$user = new User();
$ulogic = new UserLogic();
//$user->setFbId($fbme['id']);
if ($fbme) {
    $user->setFbId($fbme['id']);
    $user->setFname($fbme['first_name']);
    $user->setLname($fbme['last_name']);
    $user->setEmail($fbme['email']);
    $user->setSex($fbme['gender']);
    $address = $userInfo[0];
    $address = $address['current_location'];
    $user->setAddress('Not specified.');
    $user->setCountry($address['country']);
    $datee = $fbme['birthday'];
    $user->setBday(date("Y-m-d", $datee));
    $user->setCity($address['city']);
    $user->setUsername($_POST['uid']);