ok
Direktori : /home2/selectio/www/caliberembedded.com/admin/config/ |
Current File : /home2/selectio/www/caliberembedded.com/admin/config/config.php |
<?php ini_set('error_reporting', E_ALL); date_default_timezone_set('Asia/Kolkata'); $dbhost = 'localhost'; $dbname = 'selectio_caliberembedded'; $dbuser = 'selectio_caliberembedded'; $dbpass = 'caliberembedded@123'; try { $pdo = new PDO("mysql:host={$dbhost};dbname={$dbname}", $dbuser, $dbpass); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch( PDOException $exception ) { echo "Connection error :" . $exception->getMessage(); } function get_random_string($valid_chars, $length) { // start with an empty random string $random_string = ""; // count the number of chars in the valid chars string so we know how many choices we have $num_valid_chars = strlen($valid_chars); // repeat the steps until we've created a string of the right length for ($i = 0; $i < $length; $i++) { // pick a random number from 1 up to the number of valid chars $random_pick = mt_rand(1, $num_valid_chars); // take the random character out of the string of valid chars // subtract 1 from $random_pick because strings are indexed starting at 0, and we started picking at 1 $random_char = $valid_chars[$random_pick - 1]; // add the randomly-chosen char onto the end of our string so far $random_string .= $random_char; } // return our finished random string return $random_string; } // end of get_random_string() function RandomString() { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $randstring = ''; for ($i = 0; $i < 5; $i++) { $randstring.= $characters[rand(0, strlen($characters))]; } return $randstring; } ?>