Can anyone tell me how to add a php redirect to this?
-
This is in wordpress. Can anyone show me how to add a redirect to http://www.mydomain.com/client-page/ after someone logs in using this script? I have this login script working on the home page of my site and I need them to be redirected to another page after they log in. Any help would be great ;o) <?php if (!(current_user_can('level_0'))){ ?> <h4>Login below</h4> <form action="<?php echo get_option('home'); ?>/wp-login.php" method="post"> <input type="text" name="log" id="log" value="<?php echo wp_specialchars(stripslashes($user_login… 1) ?>" size="30" /> <input type="password" name="pwd" id="pwd" size="30" /> <input type="submit" name="submit" value="Send" class="button" /> <p> <label for="rememberme"><input name="rememberme" id="rememberme" type="checkbox" checked="checked" value="forever" /> Remember me</label> <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>" /> </p> </form> <a href="<?php echo get_option('home'); ?>/wp-login.php?action=lostpassword">Rec… password</a> <?php } else { ?> <h4>Logout below</h4> <a href="<?php echo wp_logout_url(urlencode($_SERVER['REQUES… ?>">logout</a> <?php }?>
-
Answer:
Really terrible programming and a total mess. The action of the form just needs to be a php_self, then you simply set a series of if() statements at the topof the page with re-directs or anything else useful according to whether a submit was clicked, and which one, and according to whether the correct user name and password are found. NEVER include a <php echo directly within a string. you MUST use concatenation to ad these to the first part of the string, and then add the rest of the string after. It would need to include the database check for the password match.
mjeffers... at Yahoo! Answers Visit the source
Other answers
Use the function "header": header("Location: http://www.mydomain.com/client-page%22); And, to whoever said a .htaccess redirect, NO! .htaccess is just more complicated, and may not even do what he's asking. Your best bet is the header, for you can put that in an IF statement or what-not.
Related Q & A:
- Can someone tell me how to put a backround for my psp and put pictures in it?Best solution by Yahoo! Answers
- Can anyone tell me how to select a University in Aus or NZ to study MA or MS or MBA in Communication?Best solution by Yahoo! Answers
- Can anyone tell me how to get rid of cellulite?Best solution by Yahoo! Answers
- Can someone tell me how to pick a lock?Best solution by wikihow.com
- Can anyone tell my how you can tell if your child has Apraxia of speech?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.