letters ABCDEFGHIJKLMNOPQRST UVWXYZabcdefghijklmn opqrstuvwxyz url NUL

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
$letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
$url = NULL;
for ($i=0; $i < 9; $i++)
{
$letter = rand(0,51);
$url .= $letters[$letter];
}
$url = $id . '_' . $url;
DB::run() -> query("UPDATE downs SET url=? WHERE downs_id=?", array($url, $id));