Skip to content

Commit

Permalink
Updated some code based of feedback
Browse files Browse the repository at this point in the history
fixed some small stuff
  • Loading branch information
maxemiliang committed May 19, 2015
1 parent b499572 commit 4462451
Show file tree
Hide file tree
Showing 17 changed files with 19 additions and 46 deletions.
1 change: 0 additions & 1 deletion assign_id.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
require_once("require/start_session.php");
require_once("require/database.php");

$username = $_SESSION["username"];
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
require_once("require/start_session.php");
require_once("require/database.php");

error_reporting(E_ALL & ~E_WARNING);
Expand Down Expand Up @@ -28,6 +27,7 @@
<?php
if (isset($_SESSION["db_error"])) {
echo '<nav class="menu"><h1>You have an error with the database! If this is the first time starting this webapp run <a href="install/install.php">install.php</a></h1></nav>';
unset($_SESSION["db-error"]);
}
if (isset($_SESSION["installed"])) {
echo "<strong>IMPORTANT!!!!</strong> INSTALLATION DONE! PLEASE REMOVE THE INSTALL FOLDER!!!";
Expand Down
8 changes: 1 addition & 7 deletions install/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,12 @@
<h1 class="Name">Installation</h1>
<li> <a href="../index.php">Back to homepage</a> </li>
</nav>
<h3><strong>IMPORTANT!</strong> Add this to your htaccess file for:<br/></h3>
<?php
echo '<p>&lt; Files *.inc&gt;
Order deny,allow
Deny from all
&lt;/Files&gt;</p><br/>';
if (isset($_SESSION["dberror"])) {
echo "<h4>There was an error creating the database:"; print_r($_SESSION["dberror"]); echo "<h4>";
}
?>
<br/>
<p>next go edit the config.ini file in require/conf/ with your database info!</p>
<p>next go edit the configinst.php file in require/with your database info!</p>
<br/>
<a href="setupdata.php"><button class="uploads">Next</button></a>
</body>
Expand Down
1 change: 0 additions & 1 deletion ladda.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
require_once("require/start_session.php");
require_once("require/database.php");
?>
<html>
Expand Down
1 change: 0 additions & 1 deletion like.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
require_once("require/start_session.php");
require_once("require/database.php");

$user = mysqli_real_escape_string($conn, $_SESSION["user_id"]);
Expand Down
2 changes: 1 addition & 1 deletion login.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
header("location: index.php");
} else {
$_SESSION["userorpass"] = 1;
header("location: index.php");
header("location: signin.php");
}
} else {
$_SESSION["error"] = 1;
Expand Down
11 changes: 0 additions & 11 deletions require/conf/config.ini

This file was deleted.

16 changes: 7 additions & 9 deletions require/confinst.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<?php
var_dump($_POST);
$conf["dbhost"] = $_POST["db-host"];
$conf["dbuser"] = $_POST["db-user"];
$conf["dbpass"] = $_POST["db-password"];
$file = "../require/conf/config.ini";
var_dump($conf);
$conf = array(
"db-host" => "localhost",
"db-username" => "root",
"db-password" => "",
"db-name" => "img"
);


file_put_contents($file, str_ireplace("Array","",print_r($conf, TRUE)), FILE_APPEND | LOCK_EX);
header("location: ../index.php");

?>
11 changes: 6 additions & 5 deletions require/database.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php
require_once("parse.php");
$servername = $conf["db_host"];
$username = $conf["db_username"];
$password = $conf["db_password"];
$dbname = $conf["db_database"];
require("confinst.php");
require("start_session.php");
$servername = $conf["db-host"];
$username = $conf["db-username"];
$password = $conf["db-password"];
$dbname = $conf["db-name"];

$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
Expand Down
4 changes: 0 additions & 4 deletions require/parse.php

This file was deleted.

1 change: 0 additions & 1 deletion signin.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
require_once("require/start_session.php");
require_once("require/database.php");
?>
<html>
Expand Down
1 change: 0 additions & 1 deletion signup.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
require_once("require/start_session.php");
require_once("require/database.php");

if(empty($_POST['signuser'])){
Expand Down
5 changes: 3 additions & 2 deletions upload.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
require_once("require/start_session.php");
require_once("require/database.php");


Expand Down Expand Up @@ -33,6 +32,8 @@
$_SESSION["img_error"] = 1;
} else {
$desc = mysqli_real_escape_string($conn ,$_POST["desc"]);
$desc_fix = trim($desc);
$desc_inp = filter_input(INPUT_POST, $desc_fix, FILTER_SANITIZE_SPECIAL_CHARS);
if (strlen($desc) > 1000) {
$_SESSION["descerr"] = 1;
} else {
Expand All @@ -45,7 +46,7 @@
echo "The file has been uploaded.";
$useruploading = $_SESSION["user_id"];
$date = date("Y-m-d");
$sql = "INSERT INTO imgs (images, date, description, userid) VALUES ('$file', '$date', '$desc', '$useruploading')";
$sql = "INSERT INTO imgs (images, date, description, userid) VALUES ('$file', '$date', '$desc_input', '$useruploading')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
Expand Down
Binary file added uploads/img625E
Binary file not shown.
Binary file added uploads/img91D9
Binary file not shown.
Binary file added uploads/imgBE51
Binary file not shown.
1 change: 0 additions & 1 deletion user_panel.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
require_once("require/database.php");
require_once("require/start_session.php");

$user_info = array($_SESSION["username"], $_SESSION["user_id"]);
Expand Down

0 comments on commit 4462451

Please sign in to comment.