VectorSix Posted June 6, 2007 Posted June 6, 2007 I have asked this before unsuccessfully and was hoping someone new would see it and know the answer. This has been asked before, but I have not seen a solution. What I want to do is offer a login link from product_info.php (or any other page) and allow the customer to login and then be redirected to the page/search/etc. that they were on originally. Constantly being sent back to index.php is pretty much pointless in my opinion as it forces the user to refind/reserach what they were originally looking at. Thanks.
avatech Posted June 6, 2007 Posted June 6, 2007 I have asked this before unsuccessfully and was hoping someone new would see it and know the answer. This has been asked before, but I have not seen a solution. What I want to do is offer a login link from product_info.php (or any other page) and allow the customer to login and then be redirected to the page/search/etc. that they were on originally. Constantly being sent back to index.php is pretty much pointless in my opinion as it forces the user to refind/reserach what they were originally looking at. Thanks. Actually, I have the same problem and needing an answer. You were better at asking the question. I am a novice. I want for the customer to click on the top of the page to revert back to the home page.
germ Posted June 7, 2007 Posted June 7, 2007 This might work.... Look in "login.php" There will be code that looks about like this: if(MODULE_PAYMENT_PAYPAL_EC_STATUS == 'True' || MODULE_PAYMENT_PAYPAL_WPP_STATUS == 'True') { tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING)); } else { tep_redirect(tep_href_link(FILENAME_DEFAULT));} Change it to: $ref = getenv('HTTP_REFERER');if(MODULE_PAYMENT_PAYPAL_EC_STATUS == 'True' || MODULE_PAYMENT_PAYPAL_WPP_STATUS == 'True') { tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING)); } else { tep_redirect(tep_href_link($ref));} The added, or modified code is in red. BEFORE ALTERING ANYTHING MAKE BACKUPS SO YOU CAN PUT THINGS BACK THE WAY THEY WERE IF NECESSARY!!! I can't say that I've actually tested this, but I think it will work... :blush: 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 >
shooter-boy Posted June 8, 2007 Posted June 8, 2007 You can also just put a if(tep_session_is_registered('customers_id')) { *page data* } else { *script to include login form* } or something like that to call the form if the user is not logged in. The form would be simply calling itself, so the page basically "resets". This ensures that the page reload is accurate, and there are no problems with the HTTP_REFERER or anything. Rob Rob Bell - Inspired Graphix Customising osCommerce in Australia, and the world! View my profile for web and email links. I'm sorry, but i cannot offer Free support via PM etc, and osCommerce forums prohibit me from putting any reference to paid support in my signauture. However viewing my profile may provide links to my website or something like that which you may find useful.
VectorSix Posted June 11, 2007 Author Posted June 11, 2007 This might work.... Look in "login.php" There will be code that looks about like this: Change it to: The added, or modified code is in red. BEFORE ALTERING ANYTHING MAKE BACKUPS SO YOU CAN PUT THINGS BACK THE WAY THEY WERE IF NECESSARY!!! I can't say that I've actually tested this, but I think it will work... :blush: This give me an error: Error! Unable to determine the page link!
germ Posted June 11, 2007 Posted June 11, 2007 I stand corrected. What I posted won't work. :blush: Sorry................ 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 >
VectorSix Posted June 11, 2007 Author Posted June 11, 2007 This is what I get from phpinfo(): _SERVER["ALL_HTTP"] HTTP_CONNECTION:Keep-Alive HTTP_ACCEPT:image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */* HTTP_ACCEPT_ENCODING:gzip, deflate HTTP_ACCEPT_LANGUAGE:en-us HTTP_COOKIE:__utma=259138584.574289906.1160051833.1181576819.1181584984.57; __utmz=259138584.1176221788.27.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none); __utmc=259138584; __utmb=259138584; __utma=197847975.1636141787.1160499457.1181574871.1181576816.30; __utmz=197847975.1176297055.20.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none); __utmc=197847975 HTTP_HOST:mysite.com HTTP_REFERER:http://mysite.com/product_info.php?cPath=162_173&products_id=207391 HTTP_USER_AGENT:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727) HTTP_UA_CPU:x86 Can't I use the HTTP_REFERER portion as you suggested, or some other manner of coding to use this field?
VectorSix Posted June 11, 2007 Author Posted June 11, 2007 This is what I get from phpinfo(): _SERVER["ALL_HTTP"] HTTP_CONNECTION:Keep-Alive HTTP_ACCEPT:image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */* HTTP_ACCEPT_ENCODING:gzip, deflate HTTP_ACCEPT_LANGUAGE:en-us HTTP_COOKIE:__utma=259138584.574289906.1160051833.1181576819.1181584984.57; __utmz=259138584.1176221788.27.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none); __utmc=259138584; __utmb=259138584; __utma=197847975.1636141787.1160499457.1181574871.1181576816.30; __utmz=197847975.1176297055.20.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none); __utmc=197847975 HTTP_HOST:mysite.com HTTP_REFERER:http://mysite.com/product_info.php?cPath=162_173&products_id=207391 HTTP_USER_AGENT:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727) HTTP_UA_CPU:x86 Can't I use the HTTP_REFERER portion as you suggested, or some other manner of coding to use this field?
germ Posted June 11, 2007 Posted June 11, 2007 I read when I researched your dilemma that HTTP_REFERER may not be available in all PHP configurations. Usually, "where there's a will, there's a way". I'll look into it further - I just can't say when I'll have another angle of attack. :blink: 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 >
VectorSix Posted June 11, 2007 Author Posted June 11, 2007 What sux here is that even if I hard code the HTTP_REFERER link, it still does not act as though the user is logged in if it does not go to the index.php page. It seems this is where the osCsid is assigned (index.php). Apparently I need to send the osCsid back to the products page to show that the user is actually logged in. This is getting more complicated and frustrating as time goes on. I know there are a bunch of people that have needed this as time has gone on, but I have never found a solution. There must be a way. Where is the oscsid stored, as a session variable? I may be able to craft the redirect statement to include it back to the product_info page, and send the referring page in as as hidden field or something. Ugggh. :sweating:
germ Posted June 11, 2007 Posted June 11, 2007 What happens if you change: $ref = getenv('HTTP_REFERER'); To: $ref = $_SERVER['REQUEST_URI']; :unsure: 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 >
VectorSix Posted June 12, 2007 Author Posted June 12, 2007 It doesn't seem to like that either. I can't even get it show the REFERER page even when I try to echo it. It is as if it is being blocked, even though if I change the login link to phpinfo, it shows the referer as product_info.php.....etc., where I linked from. If you want to check it out, feel free. I change login.php back to FILENAME_DEFAULT so it goes to index.php after login. Young Supply Company
germ Posted June 12, 2007 Posted June 12, 2007 So much for using so called "global" variables.... <_< I'm stumped..... The only other way I can think of would be to create some "global variable", and edit each page and set the variable equal to that page name. That sounds like it would work, but would take a lot of editing. There may be other ways that I'm not aware of. :huh: It is beginning to look like the reason no one has done this is because there just isn't an "easy" way to accomplish what you seek. :blink: 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 >
VectorSix Posted June 13, 2007 Author Posted June 13, 2007 This would just capture the page itself (i.e. product_info.php), or is there a way to stick the entire url to include the products_id and everything intoa varaible, then I could just put the code in application_top. I am stumbling into unfamilar ground here, but I am willing to give it a try if you have input on it, or anyone else? Thanks for all the help thusfar.
germ Posted June 13, 2007 Posted June 13, 2007 I've spent a few hours researching this, and trying various things. Then, I made two PHP files. I put a link in call1.php to link to call2.php. In call2.php, I had this bit of code (which you have already tried): $REQUEST_URI = getenv('HTTP_REFERER');echo $REQUEST_URI; call2.php correctly outputs the URL of the "calling" page as: http://www.xyz.com/call1.php ("xyz.com" isn't the domain name, but you get the idea. I altered it for security reasons.). There must be something in your server, or individual site configuration stopping this from working. In which case, I think you're "up the proverbial creek without a paddle", unless someone else has ideas for you to try. I'm out of cards to play. :blush: 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 >
VectorSix Posted June 20, 2007 Author Posted June 20, 2007 I believe you are on the right track, and what I have found is that MANY security suites (Norton, McAfee, etc.) this informaiton is being blocked to protect privacy, which may be my own firewall blocking it (from LAN to DMZ), however, enabling this is just for myself is not the solution. I believe the solution would be to somehow pass the referer in the query string to login.php. Come up with a condition in the login page that if the string is blank, then send to FILENAME_DEFAULT (index.php) in the case that a customer just clicks on the login link on the home page. Otherwise, I can change my link on my products page to send the string to login.php. I am not sure how yet, but you can bet I will post it when I get the code correct. This may just kill me yet. This is pretty much my last big hurdle in this development and of course is taking the longest to solve. Sory I didn't get right back, I was on vacation for a couple of days for some MUCH needed R&R. Thanks again for all your help. J
VectorSix Posted June 20, 2007 Author Posted June 20, 2007 I believe I have figured it out using the server variable $_SERVER["URL"]. I changed the link in my product_info.php page to: <a href="./login.php?url='. $_SERVER['URL'] .'"><u><b>Login</b></u></a> And it passes the string to login.php. Now all I have to do is _GET it in login and then build a condition to send it back to $url if $url is not blank, else send it to FILENAME_DEFAULT. Testing 1 2 3...
VectorSix Posted June 21, 2007 Author Posted June 21, 2007 Finally figured it out after about 10 hours of beating my head. All I can say is, "WOW". This started out by wanting to have customers that have their own prices, so I added a table to allow for that (customers_id, products_id, products_price). Then I had to change code to reflect those prices when a customer was logged in. If a customer was not logged in, they could not see price. They were presented with the following: If a customer was logged in and did not have a "special price", then they receieved the list price. That was days and days of development. Then it was time to get the Login link to work properly and return the customer to the product they were looking at instead of index.php. With some help from 'germ', we were able to figure out that the REFERER idea was flawed so I moved in a different direction. When a customer visits the products_info.php page, I had to set a variable ($url) which stores the url including the category and products_id of the page that is being viewed. The Login url had to be crafted so that it passed $url to the login.php page. The login page then uses $_GET to get the string. I had to build a condiiton that if someone logs on and the $url variable is set, then redirect back to $url once authenticated. If the $url is not set, then send to DEFAULT_FILENAME (index.php). Long story and many many many changes later it works. I can now die happy.
VectorSix Posted July 15, 2007 Author Posted July 15, 2007 Umm, no. I don't remember. Really, which part are you actually trying to do? The login and redirect back to the page that was being viewed? I am actually working on putting this into a contrib, but findong the time to do it has been difficult. What happens is that even if you can direct the page back, it appears as though they are not logged in because it does not carry the osCsid. This is key. Let me put it into a nice little package and I will post back. The problem is that my site is so customized that I don't even remember what the original looks like anymore. Let me load a test site and I'll get back.
eastboy301 Posted July 16, 2007 Posted July 16, 2007 Thanks Vector, I will definitely be waiting. I was wrecking my brain trying to come up with a solution...
eastboy301 Posted August 1, 2007 Posted August 1, 2007 Hey Vector, did you ever come up with a solution?
germ Posted February 13, 2008 Posted February 13, 2008 I realize the other people that have posted in this thread have lost their ability to get email notifications for replies to this thread, but maybe they will see this eventually. Anyway, I found a contribution that does this: Return to Referring Page After Login I tried it and it worked on my site. I hope someone benefits from this. 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 >
Recommended Posts
Archived
This topic is now archived and is closed to further replies.