English 中文(简体)
PHP MVC
原标题:PHP MVC sessions
  • 时间:2012-05-15 21:20:04
  •  标签:
  • php
  • session

试图利用MVC模式中的“收益变量”来获得用户的分数和名称,然后通过一个阵列提交意见。

这是我的游戏模式。 如何从角度看待届会的变数? 当用户提交日志时,该网页将登录。 (a) 如果用户已经存在,并且如果开始举行会议,将进行核对:_SESSION[用户名称]=$_POST[用户名称]; 如果在我的SQL询问中将用户名称定为“测试”的话,则该用户名称会发挥作用。

public function game()
{
    include  connect.php ;

    //$query = "SELECT * FROM users WHERE USERNAME= "$this->$_SESSION["username"]." ";      
    $query = "SELECT * FROM users WHERE USERNAME= test ";

    $result = mysql_query($query) or die (mysql_error());
    $score = mysql_fetch_array($result) or die(mysql_error());

    $user = $score[ username ];
    $s1 = $score[ score1 ];
    $s2 = $score[ score2 ];
    $s3 = $score[ score3 ]; 

    //store values to array for view to see, extract() array so views can use 
    them as variables 
    $game_model = array( user  => $user,  s1  => $s1,  s2  => $s2,  s3  => $s3);
    return game $model;
}
问题回答

你们应该从控制者那里把它当作一种理由来履行这一职能。

public function game( $username )




相关问题
why the session in iis automatically log out?

I used iis6, and when i called a function Directory.delete(), the all the session relate this website will be logged out. and i debugged the website, i found no exception. any one have ideas on this ? ...

Check session from a view in CodeIgniter

What is the best way to check session from a view in CodeIgniter, it shows no way in their user guide, otherwise I will have to make two views on everything, which is kinda weird...still a newbie to ...

Can I get the size of a Session object in bytes in c#?

Is it possible to get the size(in bytes) of a Session object after storing something such as a datatable inside it? I want to get the size of a particular Session object, such as Session["table1"], ...

提供严格分类的出席会议物体

提供严格分类的与会机会的最佳方式是什么? 我正计划转而选择矩阵,这正在促使汇编者抱怨我的幻觉方案拟订方法......

PHP Session is not destroying after user logout

I m trying to create an authentication mechanism for my PHP Application and I m having difficulty destroying the session. I ve tried unsetting the authentication token which was previously set within ...

热门标签