Hello everyone,
i am new to codeigniter and Facebook App. I went through one tutorial for the Facebook App with codeigniter. I did all the settings and everything but when i load the application, it throws me this error "An Error Was Encountered.
The action you have requested is not allowed.".
I am using the default welcome.php page which have the echo statement.
class Welcome extends CI_Controller {
function __construct(){
parent::__construct();
}
function index(){
echo 'checking';
}
}
Thanks for helping in advance..
i figured out the problem. The problem was with the Cross Site Request Forgery settings in config file. when $config['csrf_protection'] was enabled, i was not able to access the app. But when i setted the $config['csrf_protection']=FALSE. it started working.
Two things that can be your problems, your FB app configuration and your permission setting either in htaccess or file permission
Related
I host my web application on Debian 10 using symfony 5.4.
Users must authenticate to access my application.
I would like to know if it is possible to generate a 403 error in the Debian logs (/var/log/apache/access.log or elsewhere) in case of bad credentials ?
For the moment, the logs show a 'POST 302' error which does not suit me.
For symfony experts, I use loginFormAuthenticator extends AbstractLoginFormAuthenticator.
I don't know where I should do this. If it's on the server or in my application?
here is what i tried
namespace Symfony\Component\Security\Http\Authenticator;
abstract class AbstractLoginFormAuthenticator extends AbstractAuthenticator implements AuthenticationEntryPointInterface, InteractiveAuthenticatorInterface{
...
public function onAuthenticationFailure(Request $request, AuthenticationException $exception): Response{
...
return new RedirectResponse($url, 403, ['HTTP/1.0 403 Forbidden']);
Thanks for your feedback.
You cannot redirect with a code, the code is ignored because the redirection itself relies on a code in the 300 range (302 in this case).
If you want to give an error response, you can just throw $exception;, but there will be no redirect.
However, the application log should already contain the authentication failure. It's located in /path/to/app/var/log/prod.log or whatever environment you happen to be running instead of prod.
If you do want to log to the system logs, you can use php error_log function.
I tried to implement the simplesamlphp library into my web application. But when I call the requireAuth() function I get a PHP fatal error message. Uncaught Exception: Loader: Illegal character in filename.....
It seems like he can't resolve the Class SimpleSAML\Module\saml\Auth\Source\SP
But I don't know why.
Does anyone have a idea how to fix this?
I already deleted the whole simplesamlphp installation and reinstalled it.
I use the following code:
require 'var/www/simplesamlphp/lib/_autoload.php';
$lAuthSrc = new \SimpleSAML\Auth\Simple('default-sp');
if (!$lAuthSrc->isAuthenticated()) {
$lAuthSrc->requireAuth();
}
$lAttributes = $lAuthSrc -> getAttributes();
foreach($lAttributes as $lAttribute) {
print_r($lAttribute);
}
Some additional informations:
The configured authentication source test works fine. If I login via the configured authentication source, everything works fine and I don't get any error messages (the requireAuth() function don't get called in this case).
I use the latest version of simplesamlphp v.1.18.3
If you need any more information, please let me know.
Honestly it looks like your path is messed up on the require... are you sure you should be using:
require 'var/www/simplesamlphp/lib/_autoload.php';
and not
require '/var/www/simplesamlphp/lib/_autoload.php';
Do you really have a 'var/www' subdirectory relative to the location of the script? That looks wrong to me. If you include that first / before var it makes that path absolute to the typical install location for SSP.
Thank you all for your help. I discovered this morning the issue. The issue was the autoloader which I use for my own application. I registered the application autoloader in another file which gets executed before the code you see above. And simplesamlphp uses some conditions like:
if (!class_exists($className))
And beacuse I registered my application autoloader before the function class_exists checked if the class exists in my application. In my application I don't use namespaces and this was the issue.
To fix this issue, I unregistered my application autoloader before using the simplesamlphp code and registered the autoloader again after the simplesamlphp code.
I hope this will save some of you headaches.
I have installed wamp server on localhost. And created application using codeigniter framework.
I am using redirect(url) method in controller. If any error found in same controller, page redirects to that url. But on server it does not redirect and showing error.
Same functionality I want on localhost.
How to achieve it?
controller Appointments extends CI_COntroller
{
function index()
{
load view
}
function save()
{
$customer_id=$c_id; //accessing undeclared variable $c_id which is error
redirect(base_url("appointments"))
}
}
in above code error as been occured at $customer_id=$c_id; so rediection should be prevented and error should be shown. error shows when files are on server but not showing error on localhost.
i got answer
set output_buffering = off in php.ini file
refere link PHP header location - not displaying error?
I have just installed YII without any problems, but I cannot get into GII. I have uncommented the specific lines in mywebapp/protected/config/main.php to enable GII.
When I try to go to: localhost/myapp/index.php?r=gii I am redirected to localhost/myapp/index.php?r=gii/default/login.
I don't have the URL manager enabled it is a fresh installation on Wamp.
The error I get is this:
Fatal error: Cannot redeclare class CLogRouter in C:\wamp\www\yii\framework\logging\CLogRouter.php on line 53
The yii folder is the installation folder (did not know that the app is still using it).
What could be causing the trouble and how to get GII working? Thanks for your replies!
It is not clear what your problem is.
Getting redirected to /gii/default/login is good. This is where you log in with a password.
Your error "Cannot redeclare class CLogRouter" indicates that you are declaring CLogRouter twice. This probably happens in your protected/config/main.php.
However, I am under the impression that this error is not related to gii. Why don't your turn logging off (for now)?
I really need some guidance here as this issue is pretty confusing and extremely different to understand for a beginner like myself.
I am running a WAMP server with the latest CI version.
In core/MY_Controller.php I have:
public GeneralController extend CI_Controller {
public GeneralController() {
parent::__construct();
// Does some stuff
}
}
public AuthenticatedController extend GeneralController {
public AuthenticatedController() {
parent::__construct();
if(!loggedIn()) redirect("/login");
// Does some stuff
}
}
public UnauthenticatedController extend GeneralController {
public UnauthenticatedController() {
parent::__construct();
if(loggedIn()) redirect("/home");
// Does some stuff
}
}
My login controller is:
class Login extends UnauthenticatedController {
So basically if they are logged in and load "/login" they will be routed to "/home".
This works perfectly on my local environment.
Once I upload it to my server and navigate to "/login" I get an infinite loop. After debugging I figured out that the Login controller loads AuthenticatedController instead of UnauthenticatedController so it keeps redirecting back to "/login" infinitely.
Well, now the inheritance is broken for some reason so I need to check if it calls both Auth and Unauth controllers. Nope. Just calls Auth even though it extends UnauthenticatedController.
I am at a loss here, I've tried everything I can imagine but as a new php programmer I thought I would pick some of your brains on things to try!
Thank you!
Solution:
Check your production server php version vs. local
I also had this problem with extending core classes. My problem was that is was working on my local server, but not on my production server. I was receiving the 404 error in production, and only on my controllers that used the class extensions. After some research I noticed that my local server was running php version 5.3.x, while my production server was running 5.2.x. To fix this I had to upgrade my production server to 5.3.
To find out what version of php your site is using, place this command in your view:
<?php echo phpversion() ?>