English 中文(简体)
恢复搜索参数,将其作为独特的国际发展法
原标题:Save and restore search parameters as unique ID
  • 时间:2011-05-03 13:44:54
  •  标签:
  • php
  • hash
最佳回答

Hashes are not unique

A'h 是NOT独一无二的,可加以利用。 任何洗衣都可能产生于一定数量的str。

You don t need randomness, just a unique token

在数据库的帮助下,你只能产生一个独特的象征(甚至只是一个自动索引的背书)。 您可以创立一个在一段时期后删除旧搜索的跳板。

该表将很少包含独特的象征性加原始搜索线。

Possible implementation

  • User does a search
  • Search params are stored in database, token is returned
  • Token is given to user in some way (e.g. do you want to save this search for later)
  • When user wants to repeat search with token, search string is retrieved from db and search run
问题回答

您可在上使用诸如m加密(>)等内容。 然而,这里存在各类问题,我建议不这样做。

根据你对你因复杂的URL而正在这样做的怀疑,我建议说,仓促会使问题恶化。 如果你与URL发生错误,你现在有多个可能错的地方。

只是你在简单简便的档案数据库中发现的随机钥匙。 您可以检查URL是否已经进入数据库,然后如果是的话将钥匙退回。

该系统的另一个优势是,如果你的URL结构发生变化,那么你就可以改变数据库中的所有URLs,而短信的用户仍然工作。

最好有<条码>。 (通过你never >,,你可以让我们说微观时间(即随机时间,因为只有2个用户同时进行搜索的可能性很小),以及一些盐类,你可以使用的是 que:

例如:

$store_unique = md5(microtime().$queryID);
//the $store_unique you can save to the db with the query params
//then when anyone goes to the random url, you can check it against the db

<>>>>>

由于以下评论,我提出另一种解决办法(可增加<代码>unique):

$store_unique = microtime(). "-" .$queryID;
//the $store_unique you can save to the db with the query params
//then when anyone goes to the random url, you can check it against the db




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...