小编Nam*_*man的帖子

在URL中使用哈希(#)

我想知道除了URL中的锚点之外是否有任何哈希的使用.我在这里读到它, 获取完整的url,包括hash之后的查询字符串.什么是客户的州信息?请帮忙.

javascript browser url

17
推荐指数
2
解决办法
4万
查看次数

创建XSS易受攻击的网页

我想创建一个XSS易受攻击的网页,它执行在输入框中输入的脚本.在这里我写了这段代码,但每当我输入脚本时都没有任何反应.

<html>

<head>
</head>

<body>
<script type="text/javascript">
function changeThis(){
    var formInput = document.getElementById('theInput').value;
    document.getElementById('newText').innerHTML = formInput;
    localStorage.setItem("name","Hello world!!!");
}
</script>

<p>You wrote: <span id='newText'></span> </p> 

<input type='text' id='theInput' value='Write here' />
<input type='button' onclick='changeThis()' value='See what you wrote'/>
</body>

</html>
Run Code Online (Sandbox Code Playgroud)

请帮忙.我该如何修改代码?
更新:我试图反映XSS.据我说,如果我在输入中输入一个脚本它应该执行.只有当我没有检查用户是否输入了有效输入并采取不执行脚本的操作时,才会发生这种情况.
这是一个www.insecurelabs.org/task/Rule1XSS易受攻击的网页,当我输入如下脚本时:<script> alert("hell"); </script>输入字段脚本执行.
我想知道那和我在做什么之间的主要区别是什么?

html javascript security html5

7
推荐指数
1
解决办法
508
查看次数

SQL查询里面的一个函数

我在PostGis上使用PostgreSQL.我正在执行这样的查询:

select st_geomfromtext('point(22 232)',432)
Run Code Online (Sandbox Code Playgroud)

它工作正常.但现在我想通过查询获取值.例如:

select st_geomfromtext('point((select x from data_name where id=1) 232)' , 432)
Run Code Online (Sandbox Code Playgroud)

data_name是我正在使用的一些表并x存储一些值.现在,查询内部被视为字符串,并且不返回任何值.
请帮忙.

ERROR: syntax error at or near "select"
Run Code Online (Sandbox Code Playgroud)

sql database postgresql geospatial

6
推荐指数
1
解决办法
212
查看次数

运行时错误:Singly Link List程序插入一个值

我在C中为"单一链接列表"编写了一个代码.在这段代码中,我想在列表的末尾插入元素.它汇编得很好.但是在运行时期间,预期的输出不会到来.我gcc用作编译器.每当我./a.out在终端做的时候,它就被绞死了.
这是代码:

#include<stdio.h>
#include<stdlib.h>
struct list
{
    int node;
    struct list *next; 
};

void insert(struct list *, int);
void print(struct list *);

int main()
{
    struct list *mylist;

    insert(mylist, 10);
    insert(mylist, 20);
    insert(mylist, 30);
    insert(mylist, 40);
    insert(mylist, 50);
    insert(mylist, 60);

    print(mylist);
    return 0;
}

void print(struct list *head)
{
    if(head==NULL)
        return;
    else
    {
            while(head->next!=NULL)
            {
             printf("%d\t",head->node);
             head=head->next;       
        }
    }
}


void insert(struct list *head, int value)
{   
    struct list *new_node;
    new_node = (struct list *)malloc(sizeof(struct list)); …
Run Code Online (Sandbox Code Playgroud)

c algorithm data-structures

4
推荐指数
1
解决办法
1075
查看次数

编译时间C代码中的错误[从函数返回数组指针]

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<conio.h>

int main()
{
    int i, *ptr; 
    ptr = func();
    for(i=0;i<20;i++)
    {
        printf("%d", ptr[i]);
    }
    return 0;
}

int * func()
{
    int *pointer;
    pointer = (int*)malloc(sizeof(int)*20);
    int i;
    for(i=0;i<20;i++)
    {
        pointer[i] = i+1; 
    }
    return pointer;
}
Run Code Online (Sandbox Code Playgroud)

错误:func的冲突类型.警告:赋值使得指针来自整数而没有强制转换[默认情况下启用]

为什么我收到此错误?

c pointers

3
推荐指数
1
解决办法
118
查看次数

在haskell中的二叉树上应用FOLD

我有一个小的haskell代码实现二叉树.我想在树上应用折叠功能.这是代码 -

data Btree a = Tip a | Bin (Btree a) (Btree a) deriving Show

foldbtree :: (a->a->a) -> Btree a-> a
foldbtree f (Tip x) = x
foldbtree f (Bin t1 t2) = (foldbtree f t1) f (foldbtree f t2)
Run Code Online (Sandbox Code Playgroud)

但我收到编译错误 -

 Occurs check: cannot construct the infinite type:
      t2 = t0 -> t1 -> t2
    In the return type of a call of `foldbtree'
    Probable cause: `foldbtree' is applied to too many arguments
    In the expression: (foldbtree …
Run Code Online (Sandbox Code Playgroud)

binary-tree haskell functional-programming

3
推荐指数
1
解决办法
1480
查看次数