z.b.
INSERT INTO key3row (`ID-Nutzer`,`ID-Kurtz`,`ID-Lang`,`Start`)
VALUES (NULL,RIGHT(PASSWORD(NOW()),10),MD5(NOW()),NOW())
ON DUPLICATE KEY
UPDATE `ID-Kurtz` = RIGHT(PASSWORD(NOW()+1),10),`ID-Lang`=MD5(NOW()+1)
ID-Nutzer int(11) auto\_increment
ID-Kurtz varchar(10)
ID-Lang varchar(32)
Start datetime
Name Typ Unique
sid BTREE Ja
Feld
ID-Nutzer
ID-Kurtz
ID-Lang
ich machs aber lieber sicher .
<?php $sql = "LOCK TABLES TABELLE WRITE";<br />if ( !$res=mysql\_query($sql)) {echo "Error -\> ".$sql; exit;}
$isdouble10 = true;
while ($isdouble10) {
$new10 = substr(md5(time()),0,10);
§sql = "SELECT ID-Kurtz FROM TABELLE WHERE ID-Kurtz = '".$new10."'";
$isdouble10 = false;
if ( !$res=mysql\_query($sql)) {echo "Error -\> ".$sql; exit;}
while ($row = mysql\_fetch\_array($res,MYSQL\_ASSOC)) {
$isdouble10 = true;
}
}
$isdouble32 = true;
while ($isdouble32) {
$new32 = md5(time());
§sql = "SELECT ID-Lang FROM TABELLE WHERE ID-Lang = '".$new32."'";
$isdouble32 = false;
if ( !$res=mysql\_query($sql)) {echo "Error -\> ".$sql; exit;}
while ($row = mysql\_fetch\_array($res,MYSQL\_ASSOC)) {
$isdouble32 = true;
}
}
$sql = "INSERT INTO TABELLE (NULL,'".$new10."','".$new32."',NOW())";
if ( !$res=mysql\_query($sql)) {echo "Error -\> ".$sql; exit;}
$sql = "UNLOCK TABLES TABELLE";
if ( !$res=mysql\_query($sql)) {echo "Error -\> ".$sql; exit;}
?\>