我有5个PHP页面是问题文件(MCQ的).
用户提供了1篇论文...他回答并提交......然后转到AnsCheck.php ...在AnsCheck.php中我需要了解从哪个页面,即5篇论文中的哪一篇请求收到以便我可以继续检查...如何获得我收到请求的页面?
---- ---- 1.PHP
<?php
(E_ALL & ~E_NOTICE);
session_start();
// is the one accessing this page logged in or not?
if (!isset($_SESSION['db_is_logged_in'])
|| $_SESSION['db_is_logged_in'] !== true) {
// not logged in, move to login page
header('Location: login.php');
exit;
}
?>
<html>
<head>
<title>My Page</title>
</head>
<body>
<form name="1" action="/NewDir/AnsCheck.php" method="POST">
1.Name the owl of harry potter.
<div align="left"><br>
<input type="radio" name="paper1" value="op1">Mr Barnesr<br>
<input type="radio" name="paper1" value="op2" checked> Wighed<br>
<input type="radio" name="paper1" value="op3"> Hedwig<br>
<input type="radio" name="paper1" …
Run Code Online (Sandbox Code Playgroud) 服务器
import socket
import sys
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
host= 'VAC01.VACLab.com'
port=int(2000)
s.bind((host,port))
s.listen(1)
conn,addr =s.accept()
data=s.recv(100000)
s.close
Run Code Online (Sandbox Code Playgroud)
客户
import socket
import sys
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
host="VAC01.VACLab.com"
port=int(2000)
s.connect((host,port))
s.send(str.encode(sys.argv[1]))
s.close()
Run Code Online (Sandbox Code Playgroud)
我希望服务器接收客户端发送的数据.
我尝试这个时收到以下错误
客户端
回溯(最近一次调用最后一次):文件"Client.py",第21行,在s.send(sys.argv [1]中)TypeError:'str'不支持缓冲区接口
服务器端
文件"Listener.py",第23行,在data = s.recv(100000)中socket.error:[Errno 10057]由于套接字未连接而且(在数据报上发送时)不允许发送或接收数据的请求使用sendto调用的套接字)没有提供地址
#include <stdio.h>
#define MAX 5
int stk[MAX];
int top=-1;
main()
{
char ch;
void push();
void pop();
void display();
do
{
printf("1. Push\n");
printf("2. Pop\n");
printf("3. Display\n");
ch=getchar();
if(ch=='1')
push();
if(ch=='2')
pop();
if(ch=='3')
display();
printf("Do u want to continue y/n");
ch=getchar();
}while(ch=='y'||ch=='Y');
}
void push()
{
}
void pop()
{
}
void display()
{
}
Run Code Online (Sandbox Code Playgroud)
我完成推送操作的那一刻...程序打印""你想继续y/n"并退出....不等待用户输入""y/Y"
请帮忙
该程序是打开一个目录,并显示文件的名称...即,如果有一个文件..应该说FILE .... else DIRECTORY ..但程序显示所有文件作为目录..
任何人都可以检查代码是否有任何错误.... thnx
#include<stdio.h>
#include<dirent.h>
#define DIR_path "root/test"
main()
{
DIR *dir;
dir=opendir(DIR_PATH);
printf("THe files inside the directory :: \n");
struct dirent *dent;
if(dir!=NULL)
{
while((dent=readdir(dir)))
{
FILE *ptr;
printf(dent->d_name);
if(ptr=fopen(dent->d_name,"r"))
{
print("\tFILE\n");
fclose(ptr);
}
else
printf("\t DIRECTORY\n");
}
close(dir);
}
else
printf("ERROR OPENIN DIRECTORY");
}
Run Code Online (Sandbox Code Playgroud) 我必须有一个表单作为gui,但我还需要使用win32 API编写,因为我需要在应用程序启动时创建另一个进程...
我创建了Win32控制台 - >空项目..然后有一个选项将Windows窗体添加为UI ...是否可能???? ...因为我选择了基础项目为win32控制台应用程序.
但我真的需要应用程序中的表单.
for i in range (0,len(list4)):
ws.write(1, 0, datetime.now(), style1)
ws.write(2, 1, 1)
ws.write(2, 2, xlwt.Formula("A3+B3"))
wb.save('example.xls')
Run Code Online (Sandbox Code Playgroud)
我如何概括(A3 + B3)?
'"A" + i' + '"B" + i'
Run Code Online (Sandbox Code Playgroud)
它是否正确???
我有以下代码,但它遍历它找到并停止的第一个目录.我觉得我有递归功能,应该给其他目录.任何人都可以指出这个代码有什么问题.
def func(path,no):
no=no+2
for item in os.listdir(path):
if os.path.isfile(path+"\\"+item):
print no * "-" + " " + item
if os.path.isdir(path+"\\"+item):
path=path + "\\" + item
print no * "-" + " " + item
func(path,no)
path="D:\\Hello"
no=0
func(pah,no)
Run Code Online (Sandbox Code Playgroud)
输出:
-- 1.txt
-- 2.txt
-- 3.txt
-- blue
---- 33.txt
---- 45.txt
---- 56.txt
---- Tere
Run Code Online (Sandbox Code Playgroud)
"blue"和"tere"是目录."HELLO"文件夹中有更多目录未打印.
<?php
(E_ALL & ~E_NOTICE);
session_start();
// is the one accessing this page logged in or not?
if (!isset($_SESSION['db_is_logged_in']) || $_SESSION['db_is_logged_in'] !== true) {
// not logged in, move to login page
header('Location: login.php');
exit;
}
else {
echo "Welcome To The Test Page:";
echo $_SESSION['logname'];
}
if (isset($_POST['submit'])) {
test();
}
function test()
{
$var = rand(1, 5);
header("Location:{$var}.html");
exit;
}
<html>
<body>
<form action="<?=$_SERVER['PHP_SELF'];?>" method="post">
<input type="submit" name="submit" value="Take Test">
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
当点击"take test"按钮时,我需要5个html页面中的1个,即(在这种情况下为问题文件)显示给用户.因为我已经创建了从1到5的随机数.这些页面的名称是1.html,2.html等等......
谁能调试这段代码?
我有一个表单页面,我想将表单详细信息提交给我的服务器,并将详细信息存储在服务器中.
我需要一个脚本将客户端的请求发送到服务器,我想使用JavaScript.
我在搜索时遇到了XMLHttpRequest.
有谁能请我指出正确的方向?