Convert line endings from MAC to UNIX
[php-addressbook.git] / register / auth_check_header.php
index 21cdf6d..f893170 100644 (file)
-<? \r\r
-\r\r
-include"master_inc.php";\r\r
-\r\r
-$username_from_cookie = $_COOKIE[$cookiename]; //retrieve contents of cookie \r\r
-\r\r
-if($permission_level==''){\r\r
-\r\r
-$sql="SELECT * FROM users WHERE username='$username_from_cookie'";\r\r
-\r\r
-}else{\r\r
-\r\r
-$threshold = $permission_level-1;\r\r
-\r\r
-$sql="SELECT * FROM users WHERE username='$username_from_cookie' AND permissions>'$threshold'";\r\r
-\r\r
-}\r\r
-\r\r
-$result=mysqli_query($db,$sql);\r\r
-\r\r
-// mysqli_num_row is counting table rows\r\r
-\r\r
-$count=mysqli_num_rows($result);\r\r
-\r\r
-// If result matches $myusername and $mypassword, table row must be 1 row\r\r
-\r\r
-if($count==0){\r\r
-\r\r
-{\r\r
-\r\r
-header("location:login.php");\r\r
-\r\r
-}\r\r
-\r\r
-}\r\r
-\r\r
-$query = "SELECT * FROM users WHERE `username`='$username_from_cookie'"; \r\r
-\r\r
-$numresults=mysqli_query($db, $query);\r\r
-$numrows=mysqli_num_rows($numresults); \r\r
-\r\r
-// get results\r\r
-$result = mysqli_query($query) or die("Couldn't execute query");\r\r
-\r\r
-// now you can display the results returned\r\r
-while ($row= mysqli_fetch_array($result)) {\r\r
-\r\r
-$permissions= $row["permissions"];\r\r
-\r\r
-}\r\r
-\r\r
-//end Chris Carr Auth Check Header\r\r
-\r\r
-$username = $username_from_cookie;\r\r
-\r\r
+<? 
+\r
+
+\r
+include"master_inc.php";
+\r
+
+\r
+$username_from_cookie = $_COOKIE[$cookiename]; //retrieve contents of cookie 
+\r
+
+\r
+if($permission_level==''){
+\r
+
+\r
+$sql="SELECT * FROM users WHERE username='$username_from_cookie'";
+\r
+
+\r
+}else{
+\r
+
+\r
+$threshold = $permission_level-1;
+\r
+
+\r
+$sql="SELECT * FROM users WHERE username='$username_from_cookie' AND permissions>'$threshold'";
+\r
+
+\r
+}
+\r
+
+\r
+$result=mysqli_query($db,$sql);
+\r
+
+\r
+// mysqli_num_row is counting table rows
+\r
+
+\r
+$count=mysqli_num_rows($result);
+\r
+
+\r
+// If result matches $myusername and $mypassword, table row must be 1 row
+\r
+
+\r
+if($count==0){
+\r
+
+\r
+{
+\r
+
+\r
+header("location:login.php");
+\r
+
+\r
+}
+\r
+
+\r
+}
+\r
+
+\r
+$query = "SELECT * FROM users WHERE `username`='$username_from_cookie'"; 
+\r
+
+\r
+$numresults=mysqli_query($db, $query);
+\r
+$numrows=mysqli_num_rows($numresults); 
+\r
+
+\r
+// get results
+\r
+$result = mysqli_query($query) or die("Couldn't execute query");
+\r
+
+\r
+// now you can display the results returned
+\r
+while ($row= mysqli_fetch_array($result)) {
+\r
+
+\r
+$permissions= $row["permissions"];
+\r
+
+\r
+}
+\r
+
+\r
+//end Chris Carr Auth Check Header
+\r
+
+\r
+$username = $username_from_cookie;
+\r
+
+\r
 ?>
\ No newline at end of file