function random_string($length){
    $chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
    $string = '';

    for($i=0;$i<$length; $i++){
        $string .= $chars[rand(0,strlen($chars)-1)];
    }

    return $string;
}