Jump to content

Requesting adjustment


lisanet

Recommended Posts

Hi,

I said I might be back. No problems though so relax our minds.

Now that you have set the htpasswd protection, I have to log in twice. So I went to the osCommerce forums to read up and found this:

 

For password protecting of your admin directory you can (hopefully) use the Password Protect feature in your web hosting control panel (see for example post 141 in this thread).

 

(YOU DID THAT FOR ME. THAT'S DONE.) So it goes on to say:

 

To avoid having to login twice (once in the "popup" screen and then again in the osC admin login) you might want to look at the code Harald Ponce de Leon wrote some time ago:

 

http://github.com/osCommerce/oscommerce2/c...caf2764ba1457c4

 

So, I like looked at the code and it just kept going and going down the page. I guess if you know what you're looking at it makes perfect sense and you'd know where to put all this stuff. I however don't. Can you help? This code could mean nothing; just like the instructions in "configuration" that tell you to delete stuff that then removes your access to your admin. If possible, I would like to have to only login once, no muss no fuss. Can you please help with this?

 

 

Link to comment
Share on other sites

If you're not familiar with what you're seeing your link shows what is called patch code. Basically it shows the file name that you are editing (example: application_top.php) and then it shows what to change in that file:

     if ($redirect == true) {
-      tep_redirect(tep_href_link(FILENAME_LOGIN));
+      tep_redirect(tep_href_link(FILENAME_LOGIN, (isset($redirect_origin['auth_user']) ? 'action=process' : '')));
     }

 

The first line in my example "if ($redirect == true) {" is unchanged and allows you to find where you are making the change. The line that starts with a minus "- tep_redirect(tep_href_link(FILENAME_LOGIN));" gets removed, and the line with the plus "+ tep_redirect(tep_href_link(FILENAME_LOGIN, (isset($redirect_origin['auth_user']) ? 'action=process' : '')));" gets added in, and then the "}" stays unchanged.

 

There are two ways to apply a patch:

 

  1. You can use the patch command to automatically make the changes http://linux.about.com/od/commands/l/blcmdl1_patch.htm
  2. You can manually read through the patch files and make changes by hand.

 

Obviously option #1 is going to be faster but it can sometimes botch your code completely if the files you have aren't exactly the same version that the patch was created from. I usually choose option #2 because I can read through the code and if something isn't exactly the way the patch file says it should be I can make decisions of how to add the new code without completely breaking the entire thing.

Link to comment
Share on other sites

If you're not familiar with what you're seeing your link shows what is called patch code. Basically it shows the file name that you are editing (example: application_top.php) and then it shows what to change in that file:

     if ($redirect == true) {
-      tep_redirect(tep_href_link(FILENAME_LOGIN));
+      tep_redirect(tep_href_link(FILENAME_LOGIN, (isset($redirect_origin['auth_user']) ? 'action=process' : '')));
     }

 

The first line in my example "if ($redirect == true) {" is unchanged and allows you to find where you are making the change. The line that starts with a minus "- tep_redirect(tep_href_link(FILENAME_LOGIN));" gets removed, and the line with the plus "+ tep_redirect(tep_href_link(FILENAME_LOGIN, (isset($redirect_origin['auth_user']) ? 'action=process' : '')));" gets added in, and then the "}" stays unchanged.

 

There are two ways to apply a patch:

 

  1. You can use the patch command to automatically make the changes http://linux.about.com/od/commands/l/blcmdl1_patch.htm
  2. You can manually read through the patch files and make changes by hand.

 

Obviously option #1 is going to be faster but it can sometimes botch your code completely if the files you have aren't exactly the same version that the patch was created from. I usually choose option #2 because I can read through the code and if something isn't exactly the way the patch file says it should be I can make decisions of how to add the new code without completely breaking the entire thing.

 

 

Well. That was a brainful. This'll take me a minute to digest but wow, the way you explained it I actually understood. I even got a concept of how php works too. If only you could have been my 9th grade algebra teacher too. Thanks much. Believe it or not, option 2 sounds simpler to me. (I checked the link.).

Link to comment
Share on other sites

wow, the way you explained it I actually understood.

Great!

If only you could have been my 9th grade algebra teacher too. Thanks much.

Haha, algebra is easy too. Most things are if you discard any preconceived notions that you won't be able to understand it and just work through it logically and slowly.

Believe it or not, option 2 sounds simpler to me. (I checked the link.).

Cool, just make sure you keep plenty of backups of your code in case something goes wrong you can restore back to where it was still working.

Link to comment
Share on other sites

wow, the way you explained it I actually understood.

Great!

If only you could have been my 9th grade algebra teacher too. Thanks much.

Haha, algebra is easy too. Most things are if you discard any preconceived notions that you won't be able to understand it and just work through it logically and slowly.

Believe it or not, option 2 sounds simpler to me. (I checked the link.).

Cool, just make sure you keep plenty of backups of your code in case something goes wrong you can restore back to where it was still working.

 

Ha! Figured you'd think algebra is easy. My quirky brain can do algebra but would really prefer not to, making that clear when I try. Unfortunately I did not understand this quirk until adulthood.

Anyway, I did the patch! Apparently I got it all right except for (What is?) a parsing error on line 26 (see below):

 

Parse error: syntax error, unexpected T_IF in /home1/admin2li/public_html/emporium/admin/login.php on line 26

 

I checked this line character by character against the patch code and it is identical. I don't know what to do now and this is driving me crazy.

 

ps. Cool pic. What is it of?

Link to comment
Share on other sites

Anyway, I did the patch! Apparently I got it all right except for (What is?) a parsing error on line 26 (see below):

 

Parse error: syntax error, unexpected T_IF in /home1/admin2li/public_html/emporium/admin/login.php on line 26

 

I checked this line character by character against the patch code and it is identical. I don't know what to do now and this is driving me crazy.

Syntax errors often don't report the line number correctly. Line 26 is when the parser realized that something was seriously wrong. Look at line 25 though. You lost your colon.

24     switch ($action) {
25       case 'process'
26  if (tep_session_is_registered...

Here is what it should look like.

24     switch ($action) {
25       case 'process':
26  if (tep_session_is_registered...

ps. Cool pic. What is it of?

If you're asking about my avatar picture it's an alchemical circle from FMA.

Link to comment
Share on other sites

Anyway, I did the patch! Apparently I got it all right except for (What is?) a parsing error on line 26 (see below):

 

Parse error: syntax error, unexpected T_IF in /home1/admin2li/public_html/emporium/admin/login.php on line 26

 

I checked this line character by character against the patch code and it is identical. I don't know what to do now and this is driving me crazy.

Syntax errors often don't report the line number correctly. Line 26 is when the parser realized that something was seriously wrong. Look at line 25 though. You lost your colon.

24     switch ($action) {
25       case 'process'
26  if (tep_session_is_registered...

Here is what it should look like.

24     switch ($action) {
25       case 'process':
26  if (tep_session_is_registered...

ps. Cool pic. What is it of?

If you're asking about my avatar picture it's an alchemical circle from FMA.

 

 

I came. I went back. I saw. I changed the colon. All I got was another error message for line 27 :

 

Parse error: syntax error, unexpected ')' in /home1/admin2li/public_html/emporium/admin/login.php on line 27

 

I checked the line and the ones above and below it this time. All the characters are in place. So now I'm really like...

This circle, this may come in handy when I get to line 28, okay? What happened now?

Link to comment
Share on other sites

The reason was you had an extra parentheses:

 

$username = tep_db_prepare_input($redirect_origin['auth_user']));

It should have been:

 

$username = tep_db_prepare_input($redirect_origin['auth_user']);

Link to comment
Share on other sites

This circle, this may come in handy when I get to line 28, okay?

It's been a few years since I looked at it, but I think that circle was the one that Edward and Alphonse used to try to resurrect their dead mother. So maybe it will serve to resurrect your dead code. :lol:

Link to comment
Share on other sites

This circle, this may come in handy when I get to line 28, okay?

It's been a few years since I looked at it, but I think that circle was the one that Edward and Alphonse used to try to resurrect their dead mother. So maybe it will serve to resurrect your dead code. :lol:

 

More like my dead sanity... It is quite beautiful. It resembles a type of art I make and I actually have a similar piece. I'm not sure either will help this code though. I found those double parentheses throughout the file. Should I try correcting them all? (I am up to line 28 now. If that ain't the answer I will seek professional help for me and the code.) I thought that looked kinda strange but since to my untrained eye php resembles an interplanetary language with many obscure references to money, I didn't question it.

 

By the way, what is FAM and how did you come upon it and the circle?

 

 

Link to comment
Share on other sites

Should I try correcting them all? (I am up to line 28 now. If that ain't the answer I will seek professional help for me and the code.)

 

Did you edit that file? I had it working earlier.

 

I thought that looked kinda strange but since to my untrained eye php resembles an interplanetary language with many obscure references to money, I didn't question it.

 

Actually, PHP is (in my opinion) probably one of the ugliest languages in use today, but I still learned it because it works on any server.

Link to comment
Share on other sites

Should I try correcting them all? (I am up to line 28 now. If that ain't the answer I will seek professional help for me and the code.)

 

Did you edit that file? I had it working earlier.

 

I thought that looked kinda strange but since to my untrained eye php resembles an interplanetary language with many obscure references to money, I didn't question it.

 

Actually, PHP is (in my opinion) probably one of the ugliest languages in use today, but I still learned it because it works on any server.

 

Yes. I did edit the file. BUT I try to log in first each time before I do anything. The last message I got after I removed all the double parentheses was a 500 server error. When I came back later (now) I was back to line 21 with another parse error. This is getting crazy now and I don't have time for this. Can you guys fix this or should I just put the page back the way it was and resign myself to logging in twice? I have really tried as hard as I could to get this right but I don't know enough and it just isn't working. Logging in twice is starting to seem like far less trouble.

 

ps. PHP looks more mysterious to me than ugly. (What are all those strange references to money anyway?)

Link to comment
Share on other sites

Ugh; Now I have to put back all the parentheses you removed.

 

Okay, I've fixed all the errors. Please don't edit that file, or I'll have to go back and re-fix the problems again.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...