function shortenLink() { $arraySize = 69; $short = ""; $dbc = new dbc(); $res = $dbc->query("SELECT url FROM Links WHERE (SELECT MAX(IDlink) FROM Links) = IDlink"); if ($res != 0) { //var_dump($dbc->getResult()); $res = decodeLink($dbc->getResult()); //exit; $latestURL = explode(",", $res); if ($latestURL[2] == 68) { $latestURL[2] = "0"; if ($latestURL[1] == 68) { $latestURL[1] = "0"; if ($latestURL[0] == 68) { echo "S**t på URL:er!!!"; exit; } else { $latestURL[0]++; } } else { $latestURL[1]++; } } else { $latestURL[2]++; } $short = $latestURL[0] . "," . $latestURL[1] . "," . $latestURL[2]; } else { $short = "0,0,0"; } return encodeLink($short); }
*/ header('Content-Type: text/html; charset=utf-8'); require_once '../signinCheck.php'; //require_once '../dbc_class.php'; //Check if user is signed in if (!$signedin) { header("Location: http://www.arbr.se/signin/?misc=" . "To view your profile, you must be signed in!"); } $error = $_GET["error"]; $success = $_GET["success"]; $misc = $_GET["misc"]; //Databas connection $dbc = new dbc(); $dbcData = array('uName' => $uName); $dbc->query("SELECT * FROM Users WHERE uName = :uName", $dbcData); $res = $dbc->getResult(); //Variables $uName = $_SESSION["user"]; $signUp = $res["signUp"]; //$IDuser = $res["IDuser"]; $eMail = $res["eMail"]; $bio = utf8_encode($res["bio"]); $permissions = $res["permissions"]; //$nrLinks = $res["nrLinks"]; //Gravatar $default = "http://www.arbr.se/img/default.jpg"; $size = 170; $gravatar = "http://www.gravatar.com/avatar/" . md5(strtolower(trim($eMail))) . "?d=" . urlencode($default) . "&s=" . $size; $createdLinks; $dump; $res;
$errorString .= "<li>- The entred password has the wrong format</li>"; } if ($success == 2) { $dbc = new dbc(); $dbcData = array('uName' => $uName, 'pass' => sha1($pass . UNIQE_SALT)); $res = $dbc->query("SELECT * FROM Users WHERE uName = :uName AND pass = :pass", $dbcData); if ($res == 1) { $success++; userSignIn($uName); } $dbc = new dbc(); $dbcData = array('uName' => $uName, 'pass' => sha1($pass . UNIQE_SALT)); $res = $dbc->query("SELECT uName FROM Users WHERE eMail = :uName AND pass = :pass", $dbcData); if ($res == 1) { $success++; $uName = $dbc->getResult(); userSignIn($uName["uName"]); } $errorString .= "<li>- Wrong password OR the account does not exsist</li>"; } if ($errorString != "") { somethingWrong(); } /*if($res == 1){ header("Location: index.php") } */ function somethingWrong() { global $errorString; header("Location: http://arbr.se/signin/?error=" . $errorString);
//echo "hej"; //REQUIRE FILES require_once '../dbc_class.php'; $eMail = $_POST['eMail']; $errorString; if (!isset($eMail)) { $eMail = $_GET['eMail']; } if (checkEmail($eMail)) { $dbc = new dbc(); $dbcData = array('eMail' => $eMail); $res = $dbc->query("SELECT * FROM Users WHERE eMail = :eMail", $dbcData); if ($res == 1) { $pass = generatePassword(); $temp = $dbc->getResult(); $uName = $temp["uName"]; $fName = $temp["fName"]; $dbcData = array('eMail' => $eMail, 'pass' => sha1($pass . UNIQE_SALT)); $dbc->query("UPDATE Users SET pass = :pass WHERE eMail = :eMail", $dbcData); email($pass, $eMail, $uName, $fName); } else { $errorString .= "<li>- You are not a part of arbr.se, but be sure to sign up!</li>"; } } else { $errorString .= "<li>- Your Username/Password has the wrong format, please try agian</li>"; } function checkEmail($eMail) { global $errorString; if (filter_var($eMail, FILTER_VALIDATE_EMAIL) && strlen($eMail) < 41) {
<?php if (($route != "" || $route != NULL) && strlen($route) == 3) { $dbc = new dbc(); $dbcData = array('url' => $route); $res = $dbc->query("SELECT urlSrc FROM Links WHERE url LIKE BINARY :url", $dbcData); if ($res == 1) { $dump = $dbc->getResult(); $dbc->query("UPDATE Links SET clicks = clicks + 1 WHERE url LIKE BINARY :url", $dbcData); header("Location: " . $dump["urlSrc"]); } } else { //echo "fail"; //header("Location: http://www.arbr.se"); }