Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

new admin link always ask for login


GLime

Recommended Posts

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

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

Link to comment
Share on other sites

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

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

<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

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

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

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

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

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...