function Random_Password() { $chars = "abcdefghijkmnopqrstuvwxyz0123456789"; srand((double) microtime() * 1000000); $i = 0; $pass = ''; while ($i <= 5) { $num = rand() % 33; $tmp = substr($chars, $num, 1); $pass = $pass . $tmp; $i++; } return $pass; } $user_type = $user_type + 1; $password = Random_Password(); $ID = $_POST['ID']; $First_Name = $_POST['First_Name']; $Last_Name = $_POST['Last_Name']; $Contact = $_POST['Contact']; $Address = $_POST['Address']; $Email = $_POST['Email']; $Email = mysql_real_escape_string($Email); $status = "OK"; if (strlen($ID) != 10 || !is_numeric($ID) || $ID == NULL || $ID <= 0 || $ID >= 1999999999) { echo '<meta HTTP-EQUIV="REFRESH" content="3; url=Add-Advisor.php">'; echo "<center><font face='Verdana' size='3' color=red>\n The advisor ID should be a number and exactly 10 digits length between 0 and 1999999999 !!!\n <br> <br> <br>\n Wait!!! You will be redirected in 3 seconds ...</font></center>"; exit; $status = "NOTOK"; } if ($First_Name == NULL || $Last_Name == NULL) {
function addlinkmain($linkurl, $tag = '0', $date = '0', $count = '0', $last = '0') { if ($date == '0') { $date = date("Y.m.d"); } $last = $count == '0' || $count == '-' ? "-" : date("Y.m.d"); $contents = "{$linkurl};{$date};{$count};{$last}"; if ($tag == '0') { $shortcut = Random_Password(50); while (file_exists("content/{$shortcut}")) { $shortcut = Random_Password(50); } $short_url = curPageURL() . $shortcut; $sysinfo = file_put_contents("content/{$shortcut}", $contents) ? "Created new url: <a href=\"{$short_url}\" target=\"_blank\">{$short_url}</a>" : "Can't write your URL, please check CHMOD!"; } else { if (preg_match("/^[a-zA-Z0-9]+\$/", $tag)) { if (file_exists("content/{$tag}")) { $sysinfo = "Alias already taken!"; } else { $short_url = curPageURL() . $tag; $sysinfo = file_put_contents("content/{$tag}", $contents) ? "Created new url: <br /><a href=\"{$short_url}\">{$short_url}</a>" : "Can't write your URL, please check CHMOD!"; } } else { $sysinfo = "Illegal chars in shortcut name!"; } } return $sysinfo; }