예제 #1
0
function checkIfExists($user, $pass)
{
    $pass = hash("sha256", $pass);
    echo "{$user} {$pass} </br>";
    if (($result = doInDatabase("SELECT IDu FROM USERS WHERE NICKNAME = \"{$user}\" AND PASSWORD  = \"{$pass}\" AND TEMP_RAND = 0")) !== null) {
        $resultk = mysql_fetch_assoc($result);
        return $resultk["IDu"];
    } else {
        echo "Nie mozna polaczyc sie z baza </br>";
        return 0;
    }
}
예제 #2
0
function signup()
{
    $user = $_GET['username'];
    $password = $_GET['password'];
    $mail = $_GET['mail'];
    if (check($user)) {
        return "JEST JUŻ TAKI";
    }
    $password = hash("sha256", $password);
    $random = generateRandomString(64);
    doInDatabase("INSERT INTO USERS (NICKNAME, PASSWORD, MAIL, CLASS, TEMP_RAND) VALUES (\"{$user}\", \"{$password}\",  \"{$mail}\", \"user\", \"{$random}\")");
    mail($mail, "Nowe konto", "Musisz aktywować nowe konto, aby to zrobić wejdź w link:</br>\n             <a href=\"localhost/my/index.php?action=activate&code={$random}&user={$user}\"> Link </a></br>\n             Dziękujemy za rejestrację :P");
    return "wysłano wiadomość. sprawdź pocztę";
}
예제 #3
0
<?php

include "managing_base.php";
echo $_GET['code'];
if (doInDatabase("UPDATE USERS SET TEMP_RAND=\"0\" WHERE TEMP_RAND=\"" . $_GET["code"] . "\"")) {
    $user = $_GET['user'];
    $result = doInDatabase("SELECT IDu FROM USERS WHERE NICKNAME = \"{$user}\"");
    $result2 = mysql_fetch_assoc($result);
    $id = $result2["IDu"];
    echo "Udało się. Przekierowanie na homepaga <a href=\"{$user}.mypage.com\"> Link </a></br>";
    mkdir("users/{$id}");
    doInDatabase("CREATE TABLE " . $id . "_ARTICLES_DETAILS\n                        (\n                                IDa INT AUTO_INCREMENT, \n                                ARTICLE_TEXT TEXT, \n                                TITLE VARCHAR(256), \n                                CREATE_DATE TIMESTAMP, \n                                LAST_EDIT TIMESTAMP, \n                                COUNTER INT, \n                                LINKS TEXT, \n                                PRIVATE ENUM('yes',  'no'), \n                                PRIMARY KEY (IDa), \n                                INDEX TITLE(TITLE)\n\n                        )ENGINE=InnoDB");
    doInDatabase("CREATE TABLE " . $id . "_ARTICLES_TITLES\n                        (\n                                IDa INT AUTO_INCREMENT, \n                                TITLE VARCHAR(256),  \n                                PRIMARY KEY (TITLE), \n                                INDEX IDa(IDa)\n                        )ENGINE=InnoDB");
    doInDatabase("ALTER TABLE " . $id . "_ARTICLES_TITLES ADD CONSTRAINT TD_IDa FOREIGN KEY (IDa) REFERENCES " . $id . "_ARTICLES_DETAILS(IDa) ON UPDATE CASCADE ON DELETE CASCADE");
    doInDatabase("ALTER TABLE " . $id . "_ARTICLES_DETAILS ADD CONSTRAINT TD_TITLE FOREIGN KEY (TITLE) REFERENCES " . $id . "_ARTICLES_TITLES(TITLE) ON UPDATE CASCADE ON DELETE CASCADE");
} else {
    echo "Nie udało się";
}
예제 #4
0
<?php

require_once "managing_base.php";
require_once "managing_sesion.php";
echo $_GET['code'];
if (doInDatabase("UPDATE USERS SET TEMP_RAND=\"0\" WHERE TEMP_RAND=\"" . $_GET["code"] . "\"")) {
    $user = $_GET['user'];
    $result = doInDatabase("SELECT IDu FROM USERS WHERE NICKNAME = \"{$user}\"");
    $result2 = mysql_fetch_assoc($result);
    $id = $result2["IDu"];
    mkdir("users/{$id}");
    doInDatabase("CREATE TABLE " . $id . "_ARTICLES_DETAILS\n                        (\n                                IDa INT AUTO_INCREMENT, \n                                ARTICLE_TEXT TEXT, \n                                TITLE VARCHAR(256), \n                                CREATE_DATE TIMESTAMP, \n                                LAST_EDIT TIMESTAMP, \n                                COUNTER INT, \n                                LINKS TEXT, \n                                PRIVATE ENUM('yes',  'no'), \n                                PRIMARY KEY (IDa), \n                                INDEX TITLE(TITLE)\n\n                        )ENGINE=InnoDB");
    doInDatabase("CREATE TABLE " . $id . "_ARTICLES_TITLES\n                        (\n                                IDa INT AUTO_INCREMENT, \n                                TITLE VARCHAR(256),  \n                                PRIMARY KEY (TITLE), \n                                INDEX IDa(IDa)\n                        )ENGINE=InnoDB");
    doInDatabase("ALTER TABLE " . $id . "_ARTICLES_TITLES ADD CONSTRAINT TD_IDa FOREIGN KEY (IDa) REFERENCES " . $id . "_ARTICLES_DETAILS(IDa) ON UPDATE CASCADE ON DELETE CASCADE");
    doInDatabase("ALTER TABLE " . $id . "_ARTICLES_DETAILS ADD CONSTRAINT TD_TITLE FOREIGN KEY (TITLE) REFERENCES " . $id . "_ARTICLES_TITLES(TITLE) ON UPDATE CASCADE ON DELETE CASCADE");
    checkSession();
    if (!isset($_SESSION['id'])) {
        doInDatabase("SELECT IDu FROM USERS WHERE NICKNAME = \"{$user}\"");
        $resultk = mysql_fetch_assoc($result);
        $_SESSION['id'] = $resultk["IDu"];
        echo "Udało się. Przekierowanie na homepaga <a href=\"{$user}.blogging.pl\"> Link </a></br>";
    }
} else {
    echo "Nie udało się";
}
예제 #5
0
<?php

session_start();
require_once "drop_tables.php";
//include("managing_HTML.php");
require_once "managing_base.php";
require_once "managing_files.php";
require_once "managing_session.php";
if (!isset($_GET['user'])) {
    showPage("delete_user_form");
} else {
    $user = $_GET['user'];
    $result = doInDatabase("SELECT IDu FROM USERS WHERE NICKNAME = \"{$user}\"");
    $resultk = mysql_fetch_assoc($result);
    $id = $resultk["IDu"];
    echo "IDu: {$id} </br>";
    if ($id) {
        dropTables($id);
        deleteDir("users/{$id}");
        doInDatabase("DELETE FROM USERS WHERE NICKNAME = \"{$user}\"");
        echo "Usunięto użytkownika: {$user},  ID: {$id} </br>";
    }
    destroySession();
}
예제 #6
0
$count_all = 0;
while ($rec = mysql_fetch_array($result)) {
    $count_all++;
    $idTable[$count_all] = $rec['IDu'];
    //echo $idTable[$count_all]." ".$count_all."N </br>";
    //echo $rec['IDu']."</br>";
}
$randomTable = generateRandomTable($count_all, $idTable);
for ($i = 0; $i < NUMBER_OF_CELLS; $i++) {
    //echo "I: $i,  rt: $randomTable[$i] </br>";
    if ($randomTable[$i] != 0) {
        $img[$i] = "users/" . $randomTable[$i] . "/" . manageIt(doInDatabase("SELECT IMAGE FROM USERS_BLOGS WHERE IDu = " . $randomTable[$i] . ""), "IMAGE");
        //$site[$i] = manageIt(doInDatabase("SELECT ADRESS FROM USERS_BLOGS WHERE IDu = '".$randomTable[$i]."'"),  "ADRESS").HOMEPAGE;
        $site[$i] = "index.php?blog=" . $randomTable[$i];
        $title[$i] = manageIt(doInDatabase("SELECT TITLE FROM USERS_BLOGS WHERE IDu = " . $randomTable[$i] . ""), "TITLE");
        $author[$i] = manageIt(doInDatabase("SELECT NICKNAME FROM USERS WHERE IDu = " . $randomTable[$i] . ""), "NICKNAME");
    } else {
        $title[$i] = "Without title";
        $author[$i] = "Gall Anonim";
        $img[$i] = "images/gallery_standard.jpeg";
        $site[$i] = HOMEPAGE;
    }
}
function createImageFrame()
{
}
function createBackground()
{
    echo "<div id = background>";
    for ($i = 0; $i < 1000000; $i++) {
        echo "A ";