GLime Posted June 27, 2012 Share Posted June 27, 2012 Good morning everyone, I have a quick question for an experienced OSCommercer. I have made a few custom admin pages for my website which work pretty well. However, when I link these pages to my existing default admins pages OSCommerce always ask me to login a second time. I would like to know what to add to my links (<a href="..." ></a> ) in order to prevent a re-login from the administrator. Thank you, GLime Link to comment Share on other sites More sharing options...
multimixer Posted June 27, 2012 Share Posted June 27, 2012 It ask you to login a second time, because your new admin pages are probably out of the osCommerce environment, so each time you go there, you loose the session,. So you have to login when coming back To keep that info, you would need to use the tep_href_link() function of osCommerce My community profile | Template system for osCommerce - New: Responsive | Feedback channel Link to comment Share on other sites More sharing options...
GLime Posted June 27, 2012 Author Share Posted June 27, 2012 Thanks for the quick reply, I will try that and see if it works. Link to comment Share on other sites More sharing options...
multimixer Posted June 27, 2012 Share Posted June 27, 2012 You can use that function only if your pages are under the application_top.php "umbrella", so, within osCommerce My community profile | Template system for osCommerce - New: Responsive | Feedback channel Link to comment Share on other sites More sharing options...
GLime Posted June 27, 2012 Author Share Posted June 27, 2012 Can you tell me more about this "application_top.php" so called umbrella ? Dp i have to do an include, require or something else on my custom page ? I tried doing require('custom_page.php'); But it make the whole admin section work no more. By the way I am developping on a local server. Link to comment Share on other sites More sharing options...
multimixer Posted June 27, 2012 Share Posted June 27, 2012 You can open any top level file of folder admin/ to check how application_top.php is getting included Are your extra files within folder admin/ ? My community profile | Template system for osCommerce - New: Responsive | Feedback channel Link to comment Share on other sites More sharing options...
GLime Posted June 27, 2012 Author Share Posted June 27, 2012 yes they are on the root of the admin folder Link to comment Share on other sites More sharing options...
multimixer Posted June 27, 2012 Share Posted June 27, 2012 So, you can include application_top.php in the same way like it's done for the other files and use tep_href_link() for the links. You have also all other osCommerce functions available My community profile | Template system for osCommerce - New: Responsive | Feedback channel Link to comment Share on other sites More sharing options...
GLime Posted June 27, 2012 Author Share Posted June 27, 2012 I tried making a link on the products_attributes.php to my custom page like so <a href="<?php tep_href_link('custom_page.php', '', 'SSL')?>">Click here</a> And it stills ask me for a login, even worst it bring me back to the admin index. Do I have to add the custom_page somewhere else in the code for it to work? Link to comment Share on other sites More sharing options...
germ Posted June 27, 2012 Share Posted June 27, 2012 <a href="<?php echo tep_href_link('custom_page.php', '', 'SSL');?>">Click here</a> If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
GLime Posted June 27, 2012 Author Share Posted June 27, 2012 Thank you Germ !! Now my links work like a charm! Link to comment Share on other sites More sharing options...
GLime Posted June 28, 2012 Author Share Posted June 28, 2012 I have custom forms that i want the action to target self (action="#"). However doing so means the same issue, I tried doind the echo tep_href_link on those but it does not seem to work. Anyone knows the function i should use to prevent the login prompt and the bad redirection ? Link to comment Share on other sites More sharing options...
germ Posted June 28, 2012 Share Posted June 28, 2012 This works for me: action="<?php echo basename( $_SERVER['SCRIPT_FILENAME'] );?>" If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
germ Posted June 28, 2012 Share Posted June 28, 2012 Better use this instead. The other code was in a "stand-alone" PHP file not running under the osC umbrella... action="<?php echo tep_href_link(basename( $_SERVER['SCRIPT_FILENAME'] ), '', 'SSL');?>" If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
GLime Posted June 29, 2012 Author Share Posted June 29, 2012 Neither seems to work for me, they still ask me to re-enter my login info. Link to comment Share on other sites More sharing options...
germ Posted June 30, 2012 Share Posted June 30, 2012 Doesn't make a lot of sense to me. We're using the same code you said worked perfectly 3 posts ago. The only difference is it's in a <form> instead of an anchor (<a href....></a>). Unless you want to post your code or PM it to me I really don't have any idea how to "debug" something I can't see... If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
GLime Posted July 6, 2012 Author Share Posted July 6, 2012 it goes like that <form method="GET" action="<?php echo tep_href_link(basename($_SERVER['SCRIPT_FILENAME']), '', 'SSL');?>" id="frmNewModule" name="frmNewModule"> Link to comment Share on other sites More sharing options...
germ Posted July 6, 2012 Share Posted July 6, 2012 Actually I meant the code from the entire file. When I get home this evening I'll do some testing on my WAMP server with a PHP form I've written and see if I can duplicate your problem. It still doesn't make any sense to me at all why it isn't working. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
germ Posted July 6, 2012 Share Posted July 6, 2012 My test program using your code: <?php require('includes/application_top.php'); if ( $_GET[ 'fname' ] ) { echo $_GET[ 'fname' ] . '<br>'; } if ( $_GET[ 'lname' ] ) { echo $_GET[ 'lname' ] . '<br>'; } ?> <center> <br><br><br><br><br><br><br> <form method="GET" action="<?php echo tep_href_link(basename($_SERVER['SCRIPT_FILENAME']), '', 'SSL');?>" id="frmNewModule" name="frmNewModule"> First name: <input type="text" name="fname" /><br /> Last name: <input type="text" name="lname" /><br /> <input type="submit" value="Submit" /> </form> <br><br> <?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">Home' . '</a>'; ?> </center> I put a link to the PHP file containing the code above in the footer of the admin so I can click it after I login to the admin. Works great - never asks for login. Not sure what it proves other than the code you're using for the form link isn't at fault. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.