-1

I am getting error message while execute PHP scripts

Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0

Fatal error: Unknown: Failed opening required 'C:/wamp/www/injection/main_login_injection.php' (include_path='.;C:\php\pear') in Unknown on line 0

The codes are as follows:

<?php

include "database_injection.php";

if(isset($_GET['myusername'])){
    if(isset($_GET['mypassword'])){
        
        $password = $_GET['mypassword'];
        
        $sql = "SELECT * FROM registration WHERE password = {$mypassword} LIMIT 1";
        
        $query = $dbConn->query($sql);
        
        if($query){
            $_SESSION['username']= "myusername";
            $_SESSION['password']= "mypassword";
            header("location:login_success.php");
        }
        else{
            echo "Failure";
        }
    }
}
?>
Community
  • 1
  • 1
  • 1
    Better to post your code. first error means you don't have enough permission. check the files that you are trying to open. – artsylar Oct 09 '15 at 02:12
  • as @artsylar says, the warning and fatal error show the original issue, but is necessary that you show to us the way you are trying to access to file, because, another cause is the path is not correctly typed, for example on Windows the best way to use path is using backslashes – David Aguilar Oct 09 '15 at 02:16
  • Thanks for your reply checked everything possible can't think what's wrong. – Hemlata Bhundhoo Oct 09 '15 at 02:18
  • I see the problem isn't there, the problem is in the file that you are including. It seems there is a call of a file called `main_login_injection.php` that does not exist in folder. – David Aguilar Oct 09 '15 at 02:26
  • 1
    thanks guys, i have retyped the file with .php and its working – Hemlata Bhundhoo Oct 09 '15 at 02:28
  • Possible duplicate of [require\_once failed to open stream permission denied](http://stackoverflow.com/questions/1197493/require-once-failed-to-open-stream-permission-denied) – Elias Nicolas Oct 09 '15 at 04:49

1 Answers1

0

Its obvious from this error that the exact main_login_injection.php is not in the current path nor in the include path. Check things twice.

Charlie
  • 22,886
  • 11
  • 59
  • 90