function db_insert_user($user, $mysqli) { //if user exists if (db_query_user($user['username'], $mysqli) != null) { return "User_Exists"; } $query = "INSERT INTO RushUser(`username`, `password`, `email`) VALUES (?,?,?)"; if ($stmt = $mysqli->prepare($query)) { //die("before"); $stmt->bind_param("sss", $user['username'], hash('sha512', $user['password']), $user['email']); //die("OK"); if ($stmt->execute()) { return "OK"; } else { return "Database_Error"; } } else { return "Database_Query_Error"; } }
<?php include 'prefix_user.php'; ?> <root> <?php include_once 'includes/db_connect.php'; include_once 'includes/functions.php'; sec_session_start(); if (login_check($mysqli) == true) { $to_present = "<usercatalog>"; $user_id = $_SESSION["user_id"]; if ($user_id == "admin") { header("Location: admin.php?"); } $to_present .= db_query_user($mysqli, $user_id, ""); $to_present .= "</usercatalog>"; $to_present .= "<seriescatalog>"; $to_present .= db_query_user_subscription_series($mysqli); $to_present .= "</seriescatalog>"; print utf8_encode($to_present); } else { header("Location: index.php?"); } ?> </root> <?php include 'postfix_user.php';
<?php include 'prefix_all_series.php'; ?> <root> <?php include_once 'includes/db_connect.php'; include_once 'includes/functions.php'; sec_session_start(); if (login_check($mysqli)) { $user = $_SESSION["user_id"]; if ($user == "admin") { header("Location: admin.php?"); } $to_print = db_query_user($mysqli, $user, "logged_in"); print $to_print; } else { $to_print = "<user status ='logged_off'> </user>"; print $to_print; } ?> <seriescatalog> <?php $to_present = db_query_series($mysqli, ""); // $to_present = db_query_series_whats_trending($mysqli,""); print utf8_encode($to_present); ?> </seriescatalog> </root> <?php
function edit_user_profile($mysqli, $user_id) { print db_query_user($mysqli, $user_id, ""); }
function user_query_complete($username, $mysqli) { $user = db_query_user($username, $mysqli); //TODO: add $user["skills"] = array(), $user["items"] = array(), $user["score"] = array() return $user; }