Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can still access create.php via GET method and it's adding a blank record to database #5

Open
mhusein opened this issue Oct 3, 2018 · 4 comments

Comments

@mhusein
Copy link

mhusein commented Oct 3, 2018


Notice: Trying to get property 'title' of non-object in D:\APP\xampp7\htdocs\2018\php_rest_myblog-master\api\post\create.php on line 21

Notice: Trying to get property 'body' of non-object in D:\APP\xampp7\htdocs\2018\php_rest_myblog-master\api\post\create.php on line 22

Notice: Trying to get property 'author' of non-object in D:\APP\xampp7\htdocs\2018\php_rest_myblog-master\api\post\create.php on line 23

Notice: Trying to get property 'category_id' of non-object in D:\APP\xampp7\htdocs\2018\php_rest_myblog-master\api\post\create.php on line 24

{"message":"Post Created"}

what is the function to check Access Method?

@mhusein
Copy link
Author

mhusein commented Oct 3, 2018

if i'am doing this :

if($_SERVER['REQUEST_METHOD']!="POST"){die('Method Not Allowed');}

is it still safe?

@MaxwellEnemuo
Copy link
Contributor

You may need to recheck the create function within the post model if you made changes to it and

@RiyaAgrawal17
Copy link

RiyaAgrawal17 commented Oct 26, 2020

I am also getting the same problem.

Error :


Notice: Trying to get property of non-object in C:\xampp\htdocs\my_pingo\api\create.php on line 21



Notice: Trying to get property of non-object in C:\xampp\htdocs\my_pingo\api\create.php on line 22



Notice: Trying to get property of non-object in C:\xampp\htdocs\my_pingo\api\create.php on line 23

{
"message": "Post Created"
}

@nesho84
Copy link

nesho84 commented Oct 26, 2020

Please share the code and not just the error!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants