WordPress static index page - php

I am editing a WordPress website, and I'd like to put a static page on index like "We're under construction". But when I edit the index.php file to show this page, I can't acess wp-login.php anymore, because it redirects me to index.php again.

I made a plugin just for that: WP Show Site by IP.
The advantage of using IP over login to filter your access is that sometimes you want to see your websites as an anonymous user rather than a logged in one (which could have different features/capabilities).

Related

PHP custom login Page with sessions and wordpress shortcode

I could use some help. I am a beginner with programming php. I am using PHP because my website is done using wordpress. I have a custom login page developed using PHP. I have an employee portal where the user logs in which is sessioned. Now, my issue is i have a wordpress shortcode for "Tabs" within the loggedin page. The tabs contain a bunch of absolute links for employees only. The issue now is when i click on those links and then i logout i am still able to access those links externally or bookmark it and never have to login again. How can i either session the shortcode for "tabs" or then how can i session it such a way that when a user logs out those links automatically would redirect the user to the login page. Basically if you have bookmarked or copy paste the link to the browser you should be redirected to the login page. How can i achieve this?
The shortcode is like so: do_shortcode('[ctv_ultimate_oxi id="521"]'); - This are tabs on the loggedin page. The only issue is the absolute links that open on new page. Those links are accessible when bookmarked or copied and pasted later after the user logs out.
I will really appreciate some help with a sample code.
Thank you in advance

PHP Page Access Control

I use simple access control to allow or restrict users to pages with in a site running on our LAN.
Each page has an unique UID, and the user can only access that page if the UID is in their access control list. This works well.
Users can access the required pages, pages they are not allowed access to are hidden and if they try to go to a 'hidden' page by entering the url then they are redirect back to the home page.
Currently when they log in or if logged in click on the hyper link ('/local/users') they are taken to the default page within /local/users/
The default page is defined in the the .htaccess file and is called home.php Again this is all working well.
What I'd like to do now is allow users access to a new simple home page. Within their ACL I can add a new value ('base'). If this value is set then I can redirect to the user from home.php to base.php
The issue I have is once this value is set, users can only go to base.php as home.php would detect the base value and redirect them to base.php
I'm trying to work out if it's possible when base is set that home.php redirects to base.php BUT have some way they they can also access home.php
I'm thinking..
If they login or goto a href='/users/local' and base is set then home.php will redirect to base.php
if they click on a link a href='/users/local/home.php' and base is set they are allowed access to home.php
if they are in home.php and base is set, if they refresh they stay within home.php
Is any of this possible ?
Thanks
The simplest way I can think of:
/users/local/ Landing page is set to index.php
index.php checks if it can send the user to /users/local/base.php if not, send the user to /users/local/home.php instead.
Since home.php does not do any redirect, this can be accessed by anyone who types the URL, or follow a direct link to it.

How to make Wordpress login page my home page?

I'm currently using a plugin called Members Only to restrict certain users from accessing my site by redirecting them to the wp-login.php page.
My site's login url currently looks like this:
http://localhost/home-page/login/
Every time someone accesses a page before logging in the URL changes to this:
http://localhost/home-page/login/?redirect_to=/home-page/
Is there anyway to remove the /login/ section of the URL and have the login page's URL be:
http://localhost/home-page/?
A quick way to accomplish this would be to make a .htaccess rewrite rule to make h*ttp://localhost/home-page/ actually reference http://localhost/home-page/login/ and then in the admin panel of wordpress set up a custom homepage that actually represents what you want displayed after login.

wordpress not able to find homepage

This is the website url www.iaspirant.com .
So this will redirect to 404 page. Now the strange thing is when I do a login from wordpress wp-admin and then try to open the website then homepage gets load successfully.
So this happens only when a user is not admin.
Now in order to resolve that I googled lot and tried various approach but with no success.
tried to add 301 redirection in 404 page so that it will redirect to home page but this creates a loop
Try to delete .htaccess file but no difference
Try to change the theme to ensure whether its error in code but no success
If any one can suggest me anything then it will great help.
Try goto to /wp-admin/options-reading.php
And setup Front page displays as static page or post.
Do you have installed any maintenance plugin?
Did you check the permissions? try a permissions plugin
Go to settings->reading and see if you have set Front page displays your latests posts and not a static page
You just made a mistake in Param links:
Change your home param link to http://iaspirant.com/?page_id=428 and
then it would definitely it will wok.
Check also your static page in customization
go to apperence-->themes-->customization and set static page as your home page.

Let PHP file read cookies when it it imported through readfile() function?

I'm loading my files using read file so it seems like there are like 5 pages on the index page, and arguments index the url specify what will show.
So for example, my profile site http://profile.campatet.com has 3 pages:
login page
profile page
search page.
If the url is http://profile.campatet.com/?s=something, it will load search.php into the index page and you will see a search page.
If it's http://profile.campatet.com/?user=something, it will load profile.php into the index page and it will be a user profile.
If it's just http://profile.campatet.com/, it will load login.php into the index page and it will be the login page.
Now, the my profile page is loaded into the index page when the index page uses the readfile() function. However, the my profile page needs to check a cookie to make sure the person who is accessing the my profile page actually is the account owner.
However, the page can't find the cookie when it is loaded through the readfile function for some reason. It works properly when I open it as a independent file, so I know there is nothing wrong with my code for the self profile page.
Why is this happening?
Use include or its variants require, require_once etc. instead of readfile()

Categories