Security problems is more and more important on the internet today. You can see the problems .

This chapter is really exciting, you can learn serveral ways of attacking the web application and the method to

protecting the websites. Somehow, you can be a hacker after studying.

1. Attack on the Admin page.

The last project, we can easy control to the admin user by accessing the admin page by URLs.

Thats the problem, if a hack can have the access to the admin user, it must be very bad.

Its also very simple to solve this problem. Using HTTP authentication to password  protect the Admin page.

When a page is secured using HTTP authentication. a window pops up requesting the user name and password

before access is allowed to the protected page. we can limit access to the Admin page to a few peple as you

want.

you need to insert authorize.php script before you can visit the admin page.

/***      authorize.php      ***/

  1. <?php
  2. // User name and password for authentication
  3. $username = 'rock';
  4. $password = 'roll';
  5.  
  6. if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) ||
  7. ($_SERVER['PHP_AUTH_USER'] != $username) || ($_SERVER['PHP_AUTH_PW'] != $password)) {
  8. // The user name/password are incorrect so send the authentication headers
  9. header('HTTP/1.1 401 Unauthorized');
  10. header('WWW-Authenticate: Basic realm="Guitar Wars"');
  11. exit('<h2>Guitar Wars</h2>Sorry, you must enter a valid user name and password to access this page.');
  12. }
  13. ?>

2. The URL attacks

If the hacker has remembered the URLS of the removescore.php , he doesnt need to visit this page through

the admin Page, he can visit it directly by the URLs. so to avoid this happening, you just need to add the

authorize.php script to every page you want to protect. Just a little change can be done.

  1. <?php
  2. require_once('authorize.php');
  3. ?>

add the codes at the front of each page you want to protect .

3. Attack on the high socres clones

this requires the humans to get all the datas available. we need to change the database and add some authorize

to the adminstrator. so he can decides if the data is valuable or not.

4. SQL injection.

This is really cool tech in hacks. You can even attack some websites that didnt have a protection. Lets see how

to do the SQL injection. I think this is really interesting. So I trace the code by PHP debug, you can see more clearly :

1) at first, the index page looks just right :

2) you can click the link to add your score :

3) we use the PHP debug to see what is going on here : what was posted to the server just as follows :

4) the query just looks like this :

5) then quering this query , and bad things just happened :

check the database , you will see the record was insert into the database susccess.

6) lets go back to the index.php, you will see the bad results : this is what SQL injection doing :

It is also quite easy to avoid the SQL Injection using PHP, you can use the trim() function

to gets rid of leading and trailing spaces in the form data.

just ran all form data through the trim() function before using it in an SQL query.

And you also need another built-in function, mysqli_real_escape_string()

this function converts dangerous characters into an escaped format that wont adversely affect SQL queries.

the project files as follows :

/***      index.php      ***/

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>Guitar Wars - High Scores</title>
  7. <link rel="stylesheet" type="text/css" href="style.css" />
  8. </head>
  9. <body>
  10. <h2>Guitar Wars - High Scores</h2>
  11. <p>Welcome, Guitar Warrior, do you have what it takes to crack the high score list? If so, just <a href="addscore.php">add your own score</a>.</p>
  12. <hr />
  13.  
  14. <?php
  15. require_once('appvars.php');
  16. require_once('connectvars.php');
  17.  
  18. // Connect to the database
  19. $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
  20.  
  21. // Retrieve the score data from MySQL
  22. $query = "SELECT * FROM guitarwars WHERE approved=1 ORDER BY score DESC, DATE ASC";
  23. $data = mysqli_query($dbc, $query);
  24.  
  25. // Loop through the array of score data, formatting it as HTML
  26. echo '<table>';
  27. $i = 0;
  28. while ($row = mysqli_fetch_array($data)) {
  29. // Display the score data
  30. if ($i == 0) {
  31. echo '<tr><td colspan="2" class="topscoreheader">Top Score: ' . $row['score'] . '</td></tr>';
  32. }
  33. echo '<tr><td class="scoreinfo">';
  34. echo '<span class="score">' . $row['score'] . '</span><br />';
  35. echo '<strong>Name:</strong> ' . $row['name'] . '<br />';
  36. echo '<strong>Date:</strong> ' . $row['date'] . '</td>';
  37. if (is_file(GW_UPLOADPATH . $row['screenshot']) && filesize(GW_UPLOADPATH . $row['screenshot']) > 0) {
  38. echo '<td><img src="' . GW_UPLOADPATH . $row['screenshot'] . '" alt="Score image" /></td></tr>';
  39. }
  40. else {
  41. echo '<td><img src="' . GW_UPLOADPATH . 'unverified.gif' . '" alt="Unverified score" /></td></tr>';
  42. }
  43. $i++;
  44. }
  45. echo '</table>';
  46.  
  47. mysqli_close($dbc);
  48. ?>
  49.  
  50. </body>
  51. </html>

/***      addscore.php      ***/

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>Guitar Wars - Add Your High Score</title>
  7. <link rel="stylesheet" type="text/css" href="style.css" />
  8. </head>
  9. <body>
  10. <h2>Guitar Wars - Add Your High Score</h2>
  11.  
  12. <?php
  13. require_once('appvars.php');
  14. require_once('connectvars.php');
  15.  
  16. if (isset($_POST['submit'])) {
  17. // Connect to the database
  18. $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
  19.  
  20. // Grab the score data from the POST
  21. $name = mysqli_real_escape_string($dbc, trim($_POST['name']));
  22. $score = mysqli_real_escape_string($dbc, trim($_POST['score']));
  23. $screenshot = mysqli_real_escape_string($dbc, trim($_FILES['screenshot']['name']));
  24. $screenshot_type = $_FILES['screenshot']['type'];
  25. $screenshot_size = $_FILES['screenshot']['size'];
  26.  
  27. if (!empty($name) && is_numeric($score) && !empty($screenshot)) {
  28. if ((($screenshot_type == 'image/gif') || ($screenshot_type == 'image/jpeg') || ($screenshot_type == 'image/pjpeg') || ($screenshot_type == 'image/png'))
  29. && ($screenshot_size > 0) && ($screenshot_size <= GW_MAXFILESIZE)) {
  30. if ($_FILES['screenshot']['error'] == 0) {
  31. // Move the file to the target upload folder
  32. $target = GW_UPLOADPATH . $screenshot;
  33. if (move_uploaded_file($_FILES['screenshot']['tmp_name'], $target)) {
  34. // Write the data to the database
  35. $query = "INSERT INTO guitarwars (date, name, score, screenshot) VALUES (NOW(), '$name', '$score', '$screenshot')";
  36. mysqli_query($dbc, $query);
  37.  
  38. // Confirm success with the user
  39. echo '<p>Thanks for adding your new high score! It will be reviewed and added to the high score list as soon as possible.</p>';
  40. echo '<p><strong>Name:</strong> ' . $name . '<br />';
  41. echo '<strong>Score:</strong> ' . $score . '<br />';
  42. echo '<img src="' . GW_UPLOADPATH . $screenshot . '" alt="Score image" /></p>';
  43. echo '<p><a href="index.php">&lt;&lt; Back to high scores</a></p>';
  44.  
  45. // Clear the score data to clear the form
  46. $name = "";
  47. $score = "";
  48. $screenshot = "";
  49.  
  50. mysqli_close($dbc);
  51. }
  52. else {
  53. echo '<p class="error">Sorry, there was a problem uploading your screen shot image.</p>';
  54. }
  55. }
  56. }
  57. else {
  58. echo '<p class="error">The screen shot must be a GIF, JPEG, or PNG image file no greater than ' . (GW_MAXFILESIZE / 1024) . ' KB in size.</p>';
  59. }
  60.  
  61. // Try to delete the temporary screen shot image file
  62. @unlink($_FILES['screenshot']['tmp_name']);
  63. }
  64. else {
  65. echo '<p class="error">Please enter all of the information to add your high score.</p>';
  66. }
  67. }
  68. ?>
  69.  
  70. <hr />
  71. <form enctype="multipart/form-data" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
  72. <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo GW_MAXFILESIZE; ?>" />
  73. <label for="name">Name:</label>
  74. <input type="text" id="name" name="name" value="<?php if (!empty($name)) echo $name; ?>" /><br />
  75. <label for="score">Score:</label>
  76. <input type="text" id="score" name="score" value="<?php if (!empty($score)) echo $score; ?>" /><br />
  77. <label for="screenshot">Screen shot:</label>
  78. <input type="file" id="screenshot" name="screenshot" />
  79. <hr />
  80. <input type="submit" value="Add" name="submit" />
  81. </form>
  82. </body>
  83. </html>

/***      authorize.php      ***/

  1. <?php
  2. // User name and password for authentication
  3. $username = 'rock';
  4. $password = 'roll';
  5.  
  6. if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) ||
  7. ($_SERVER['PHP_AUTH_USER'] != $username) || ($_SERVER['PHP_AUTH_PW'] != $password)) {
  8. // The user name/password are incorrect so send the authentication headers
  9. header('HTTP/1.1 401 Unauthorized');
  10. header('WWW-Authenticate: Basic realm="Guitar Wars"');
  11. exit('<h2>Guitar Wars</h2>Sorry, you must enter a valid user name and password to access this page.');
  12. }
  13. ?>

/***      approvescore.php      ***/

  1. <?php
  2. require_once('authorize.php');
  3. ?>
  4.  
  5. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  6. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  7. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  8. <head>
  9. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  10. <title>Guitar Wars - Approve a High Score</title>
  11. <link rel="stylesheet" type="text/css" href="style.css" />
  12. </head>
  13. <body>
  14. <h2>Guitar Wars - Approve a High Score</h2>
  15.  
  16. <?php
  17. require_once('appvars.php');
  18. require_once('connectvars.php');
  19.  
  20. if (isset($_GET['id']) && isset($_GET['date']) && isset($_GET['name']) && isset($_GET['score'])) {
  21. // Grab the score data from the GET
  22. $id = $_GET['id'];
  23. $date = $_GET['date'];
  24. $name = $_GET['name'];
  25. $score = $_GET['score'];
  26. $screenshot = $_GET['screenshot'];
  27. }
  28. else if (isset($_POST['id']) && isset($_POST['name']) && isset($_POST['score'])) {
  29. // Grab the score data from the POST
  30. $id = $_POST['id'];
  31. $name = $_POST['name'];
  32. $score = $_POST['score'];
  33. }
  34. else {
  35. echo '<p class="error">Sorry, no high score was specified for approval.</p>';
  36. }
  37.  
  38. if (isset($_POST['submit'])) {
  39. if ($_POST['confirm'] == 'Yes') {
  40. // Connect to the database
  41. $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
  42.  
  43. // Approve the score by setting the approved column in the database
  44. $query = "UPDATE guitarwars SET approved = 1 WHERE id = $id";
  45. mysqli_query($dbc, $query);
  46. mysqli_close($dbc);
  47.  
  48. // Confirm success with the user
  49. echo '<p>The high score of ' . $score . ' for ' . $name . ' was successfully approved.';
  50. }
  51. else {
  52. echo '<p class="error">Sorry, there was a problem approving the high score.</p>';
  53. }
  54. }
  55. else if (isset($id) && isset($name) && isset($date) && isset($score)) {
  56. echo '<p>Are you sure you want to approve the following high score?</p>';
  57. echo '<p><strong>Name: </strong>' . $name . '<br /><strong>Date: </strong>' . $date .
  58. '<br /><strong>Score: </strong>' . $score . '</p>';
  59. echo '<form method="post" action="approvescore.php">';
  60. echo '<img src="' . GW_UPLOADPATH . $screenshot . '" width="160" alt="Score image" /><br />';
  61. echo '<input type="radio" name="confirm" value="Yes" /> Yes ';
  62. echo '<input type="radio" name="confirm" value="No" checked="checked" /> No <br />';
  63. echo '<input type="submit" value="Submit" name="submit" />';
  64. echo '<input type="hidden" name="id" value="' . $id . '" />';
  65. echo '<input type="hidden" name="name" value="' . $name . '" />';
  66. echo '<input type="hidden" name="score" value="' . $score . '" />';
  67. echo '</form>';
  68. }
  69.  
  70. echo '<p><a href="admin.php">&lt;&lt; Back to admin page</a></p>';
  71. ?>
  72.  
  73. </body>
  74. </html>

/***      appvars.php      ***/

  1. <?php
  2. // Define application constants
  3. define('GW_UPLOADPATH', 'images/');
  4. define('GW_MAXFILESIZE', 32768); // 32 KB
  5. ?>

/***      connectvars.php      ***/

  1. <?php
  2. // Define database connection constants
  3. define('DB_HOST', 'localhost');
  4. define('DB_USER', 'root');
  5. define('DB_PASSWORD', 'root');
  6. define('DB_NAME', 'gwdb');
  7. ?>

/***      admin.php      ***/

  1. <?php
  2. require_once('authorize.php');
  3. ?>
  4.  
  5. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  6. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  7. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  8. <head>
  9. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  10. <title>Guitar Wars - High Scores Administration</title>
  11. <link rel="stylesheet" type="text/css" href="style.css" />
  12. </head>
  13. <body>
  14. <h2>Guitar Wars - High Scores Administration</h2>
  15. <p>Below is a list of all Guitar Wars high scores. Use this page to remove scores as needed.</p>
  16. <hr />
  17.  
  18. <?php
  19. require_once('appvars.php');
  20. require_once('connectvars.php');
  21.  
  22. // Connect to the database
  23. $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
  24.  
  25. // Retrieve the score data from MySQL
  26. $query = "SELECT * FROM guitarwars ORDER BY score DESC, date ASC";
  27. $data = mysqli_query($dbc, $query);
  28.  
  29. // Loop through the array of score data, formatting it as HTML
  30. echo '<table>';
  31. echo '<tr><th>Name</th><th>Date</th><th>Score</th><th>Action</th></tr>';
  32. while ($row = mysqli_fetch_array($data)) {
  33. // Display the score data
  34. echo '<tr class="scorerow"><td><strong>' . $row['name'] . '</strong></td>';
  35. echo '<td>' . $row['date'] . '</td>';
  36. echo '<td>' . $row['score'] . '</td>';
  37. echo '<td><a href="removescore.php?id=' . $row['id'] . '&amp;date=' . $row['date'] .
  38. '&amp;name=' . $row['name'] . '&amp;score=' . $row['score'] .
  39. '&amp;screenshot=' . $row['screenshot'] . '">Remove</a>';
  40. if ($row['approved'] == '0') {
  41. echo ' / <a href="approvescore.php?id=' . $row['id'] . '&amp;date=' . $row['date'] .
  42. '&amp;name=' . $row['name'] . '&amp;score=' . $row['score'] . '&amp;screenshot=' .
  43. $row['screenshot'] . '">Approve</a>';
  44. }
  45. echo '</td></tr>';
  46. }
  47. echo '</table>';
  48.  
  49. mysqli_close($dbc);
  50. ?>
  51.  
  52. </body>
  53. </html>

/***      removescore.php      ***/

  1. <?php
  2. require_once('authorize.php');
  3. ?>
  4.  
  5. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  6. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  7. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  8. <head>
  9. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  10. <title>Guitar Wars - Remove a High Score</title>
  11. <link rel="stylesheet" type="text/css" href="style.css" />
  12. </head>
  13. <body>
  14. <h2>Guitar Wars - Remove a High Score</h2>
  15.  
  16. <?php
  17. require_once('appvars.php');
  18. require_once('connectvars.php');
  19.  
  20. if (isset($_GET['id']) && isset($_GET['date']) && isset($_GET['name']) && isset($_GET['score']) && isset($_GET['screenshot'])) {
  21. // Grab the score data from the GET
  22. $id = $_GET['id'];
  23. $date = $_GET['date'];
  24. $name = $_GET['name'];
  25. $score = $_GET['score'];
  26. $screenshot = $_GET['screenshot'];
  27. }
  28. else if (isset($_POST['id']) && isset($_POST['name']) && isset($_POST['score'])) {
  29. // Grab the score data from the POST
  30. $id = $_POST['id'];
  31. $name = $_POST['name'];
  32. $score = $_POST['score'];
  33. }
  34. else {
  35. echo '<p class="error">Sorry, no high score was specified for removal.</p>';
  36. }
  37.  
  38. if (isset($_POST['submit'])) {
  39. if ($_POST['confirm'] == 'Yes') {
  40. // Delete the screen shot image file from the server
  41. @unlink(GW_UPLOADPATH . $screenshot);
  42.  
  43. // Connect to the database
  44. $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
  45.  
  46. // Delete the score data from the database
  47. $query = "DELETE FROM guitarwars WHERE id = $id LIMIT 1";
  48. mysqli_query($dbc, $query);
  49. mysqli_close($dbc);
  50.  
  51. // Confirm success with the user
  52. echo '<p>The high score of ' . $score . ' for ' . $name . ' was successfully removed.';
  53. }
  54. else {
  55. echo '<p class="error">The high score was not removed.</p>';
  56. }
  57. }
  58. else if (isset($id) && isset($name) && isset($date) && isset($score)) {
  59. echo '<p>Are you sure you want to delete the following high score?</p>';
  60. echo '<p><strong>Name: </strong>' . $name . '<br /><strong>Date: </strong>' . $date .
  61. '<br /><strong>Score: </strong>' . $score . '</p>';
  62. echo '<form method="post" action="removescore.php">';
  63. echo '<input type="radio" name="confirm" value="Yes" /> Yes ';
  64. echo '<input type="radio" name="confirm" value="No" checked="checked" /> No <br />';
  65. echo '<input type="submit" value="Submit" name="submit" />';
  66. echo '<input type="hidden" name="id" value="' . $id . '" />';
  67. echo '<input type="hidden" name="name" value="' . $name . '" />';
  68. echo '<input type="hidden" name="score" value="' . $score . '" />';
  69. echo '</form>';
  70. }
  71.  
  72. echo '<p><a href="admin.php">&lt;&lt; Back to admin page</a></p>';
  73. ?>
  74.  
  75. </body>
  76. </html>

/***      style.css      ***/

  1. .error {
  2. font-weight: bold;
  3. color: #FF0000;
  4. }
  5.  
  6. .topscoreheader {
  7. text-align: center;
  8. font-size: 200%;
  9. background-color: #36407F;
  10. color: #FFFFFF;
  11. }
  12.  
  13. .score {
  14. font-size:150%;
  15. color: #36407F;
  16. }
  17.  
  18. .scoreinfo {
  19. vertical-align: top;
  20. padding-right:15px;
  21. }

#3 working with data stored in files && securing your application (PART II)的更多相关文章

  1. #3 working with data stored in files && securing your application

    This chapter reveals that you can use files and databases together to build PHP application that waa ...

  2. Enabling granular discretionary access control for data stored in a cloud computing environment

    Enabling discretionary data access control in a cloud computing environment can begin with the obtai ...

  3. 安装mysql时出现initialize specified but the data directory has files in in.Aborting.该如何解决

    eclipse中写入sql插入语句时,navicat中显示的出现乱码(???). 在修改eclipse工作空间编码.navicate中的数据库编码.mysql中my.ini中的配置之后还是出现乱码. ...

  4. The multi-part request contained parameter data (excluding uploaded files) that exceeded the limit for maxPostSize set on the associated connector.

    springboot 表单体积过大时报错: The multi-part request contained parameter data (excluding uploaded files) tha ...

  5. Springboot 上传报错: Failed to parse multipart servlet request; nested exception is java.lang.IllegalStateException: The multi-part request contained parameter data (excluding uploaded files) that exceede

    Failed to parse multipart servlet request; nested exception is java.lang.IllegalStateException: The ...

  6. MYSQL常见安装错误集:[ERROR] --initialize specified but the data directory has files in it. Abort

    1.[ERROR] --initialize specified but the data directory has files in it. Abort [错误] -初始化指定,但数据目录中有文件 ...

  7. 启动MySQL5.7时报错:initialize specified but the data directory has files in it. Aborting.

    启动MySQL5.7时报错:initialize specified but the data directory has files in it. Aborting 解决方法: vim /etc/m ...

  8. Data caching per request in Owin application

    Data caching per request in Owin application 解答1 Finally I found OwinRequestScopeContext. Very simpl ...

  9. Fast data loading from files to R

    Recently we were building a Shiny App in which we had to load data from a very large dataframe. It w ...

随机推荐

  1. Object与封装、继承和多态性

    Object与封装.继承和多态性 在面向对象编程思想中,无论是C++,Java还是C#等,封装.继承与多态性都有着无与伦比的地位,深入理解并掌握它们是必不可少的.而我将使用C#来浅谈继承与多态性. 1 ...

  2. NeatUpload 的使用

    1 <httpModules> 2 <add name="UploadHttpModule" type="Brettle.Web.NeatUpload. ...

  3. JNI教程

    一.什么是JNI JNI(Java Native Interface ),它是Java SDK的一部分,主要用于实现Java对其他语言编写的代码和库的调用,比如C和C++.JNI提供的API也能让JV ...

  4. 爬虫基础-http请求的基础知识

    百度百科上这么介绍爬虫: 网络爬虫(又被称为网页蜘蛛,网络机器人,在FOAF社区中间,更经常的称为网页追逐者),是一种按照一定的规则,自动地抓取万维网信息的程序或者脚本. 在开发爬虫时常用的工具:ch ...

  5. linux 命令——43 killall(转)

    Linux 系统中的killall命令用于杀死指定名字的进程(kill processes by name).我们可以使用kill命令杀死指定进程PID的进 程,如果要找到我们需要杀死的进程,我们还需 ...

  6. 利用Python实现 队列的算法

    以下内容都是来自“悟空“大神的讲解,听他的视频课,利用Python实现堆栈的算法,自己做了一些小总结,可能会存在自己理解的一些误区, 1.栈的实现 队列的特征是先进先出,同我们生活中的队列具有相同的特 ...

  7. POJ-3565 Ants---KM算法+slack优化

    题目链接: https://vjudge.net/problem/POJ-3565 题目大意: 在坐标系中有N只蚂蚁,N棵苹果树,给你蚂蚁和苹果树的坐标.让每只蚂蚁去一棵苹果树, 一棵苹果树对应一只蚂 ...

  8. 将数据库数据添加到ListView控件中

    实现效果: 知识运用: ListView控件中的Items集合的Clear方法 //从listView控件的数据项集合中移除所有数据项 补充:可以使用Remove或RemoveAt方法从集合中移除单个 ...

  9. 小弟在研究CUDA时出现一个问题,求解

    这是<GPU高性能编程CUDA中文实战>中的例子,第七章,热传导模拟,但是出现下面的问题,求牛人解读.小弟跪谢... 主要问题就是关键字变白. 但是添加需要的头文件后一些系统自带的关键字也 ...

  10. 函数定义和调用 -------JavaScript

    本文摘要:http://www.liaoxuefeng.com/ 定义函数 在JavaScript中,定义函数的方式如下: function abs(x) { if (x >= 0) { ret ...