Skip to content

Commit

Permalink
WIP: don't use deprecated "is_registered" and "registered"
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasRannou committed Dec 2, 2011
1 parent 92aa1a4 commit 89a31cc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
6 changes: 1 addition & 5 deletions login.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
//$_SESSION["myemail"] = $myemail;
$_SESSION["myemail"] = $myemail;
$_SESSION["myusername"] = $myusername;
session_register("myemail");
session_register("myusername");
header("location:registeredarea.php");
exit;
}
Expand All @@ -53,9 +51,7 @@
}
}

// if the session is not registered
//if(!isset($_SESSION['email']) AND !empty($_POST['email']){
if(session_is_registered("myemail") == false) {
if(!isset( $_SESSION["myemail"]) OR empty($_SESSION["myemail"]) ) {
echo "Session is not registered, please log in";
echo "<meta http-equiv='refresh' content='0;url=index.php'>";
}
Expand Down
8 changes: 4 additions & 4 deletions register.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@

$path = $thisdir . "/bank/" . $myusername;
mkdir( $path, 0777);
//$pathdata = $path . "/data";
//mkdir( $pathdata, 0777);
//$pathmodified = $path . "/modified";
//mkdir( $pathmodified, 0777);
$pathdata = $path . "/original";
mkdir( $pathdata, 0777);
$pathmodified = $path . "/modified";
mkdir( $pathmodified, 0777);


//back to main page
Expand Down
3 changes: 1 addition & 2 deletions registeredarea.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
require_once("login.php");
require("login.php");
?>

<html>
Expand Down Expand Up @@ -116,7 +116,6 @@
<?php echo 'Welcome ' ?>
<?php echo $_SESSION["myemail"] ?>
<br /></h2>

<form enctype="multipart/form-data" action="upload.php" method="POST">
Please choose a file: <input name="uploaded" type="file" /><br />
<input type="submit" value="Upload" />
Expand Down
12 changes: 9 additions & 3 deletions upload.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<?php
$target = "bank/rannou/original/";
<?php
session_start();
$image = $_SESSION["myusername"];

$target = "bank/".$image."/original/";

echo $target;

$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
Expand All @@ -9,5 +15,5 @@
else {
echo "Sorry, there was a problem uploading your file.";
}
echo "<meta http-equiv='refresh' content='3;url=registeredarea.php'>";
echo "<meta http-equiv='refresh' content='5;url=registeredarea.php'>";
?>

0 comments on commit 89a31cc

Please sign in to comment.