<?php
include("global-settings.php");
session_start();
mysql_connect($dbhost, $dbuser, $dbpass)or die("Could Not Connect: " . mysql_error());
mysql_select_db($dbname) or die(mysql_error());
$email = mysql_real_escape_string(strip_tags($_POST['email']));
$password = mysql_real_escape_string(strip_tags(sha1($_POST['password'])));
$result = mysql_query("SELECT * FROM users WHERE username='$email' AND password='$password'");
if(mysql_num_rows($result) > 0) {
$row = mysql_fetch_array($result);
$_SESSION['user_pid'] = $row['user_pid'];
$_SESSION['firstname'] = $row['first_name'];
header("Location: ../protected/home.php");
} else {
$row = mysql_fetch_array($result);
$userid_generator = uniqid(rand(), false);
$date = date("Y/m/d");
mysql_query("INSERT INTO users (user_pid, username, password, datetime_registered)
VALUES('$userid_generator', '$email', '$password', '$date')") or die(mysql_error());
$_SESSION['userid'] = $userid_generator;
mysql_query("SELECT * FROM leaders");
$id = $row['id'];
mysql_query("INSERT IGNORE INTO friends (node1id, node2id, is_leader, friends_since, friend_type)
VALUES('$id', '$userid_generator', 'Yes', '$date', 'full')") or die(mysql_error());
}
?>
Okay so I've worked on the code a little bit, and it still returns a blank screen. But when I refresh the page it headers out. I've also checked my php.ini file and below is what's set:
; display_errors
; Default Value: On
; Development Value: On
; Production Value: on
; error_reporting
; Default Value: E_ALL & ~E_NOTICE
; Development Value: E_ALL | E_STRICT
; Production Value: E_ALL & ~E_DEPRECATED
And with the SELECT * Leaders statement, I'm trying to pull all the rows from the Leaders table and insert them into the friends table.