The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

2 Pages V  1 2 >  
Reply to this topicStart new topic
> How to get rid of viewing source code?
Arjun Dey
post May 2 2014, 01:43 PM
Post #1


Newbie
*

Group: Members
Posts: 12
Joined: 2-May 14
Member No.: 20,815



I have recently hosted a website & I am able to see a part of my source code on one of the pages.

Here's the link : http://www.taipanleather.com/enquiry.html

I have used the same coding standard for all the pages and everyother page on my website is working fine, except this page.

Please help me to fix this.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post May 2 2014, 03:58 PM
Post #2


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



Looks like the PHP isn't parsed. Have you set the server up to parse html pages?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Arjun Dey
post May 3 2014, 04:09 AM
Post #3


Newbie
*

Group: Members
Posts: 12
Joined: 2-May 14
Member No.: 20,815



QUOTE(pandy @ May 3 2014, 02:28 AM) *

Looks like the PHP isn't parsed. Have you set the server up to parse html pages?


Yes, this is the content of my .htaccess file :

RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html

FYI, I have hosted on a linux server & hence, no web.config file in my server directory.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post May 3 2014, 06:49 AM
Post #4


.
********

Group: WDG Moderators
Posts: 9,656
Joined: 10-August 06
Member No.: 7



Do you use PHP on the other pages, e.g. http://www.taipanleather.com/leather-products.html ? If so I have no idea what makes it show on the first page.

I recall seeing some web host where you couldn't use AddType for enabling PHP in .html extension files, but then it affected all pages.

What happens if you rename "enquiry.html" to "enquiry.php"?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
jimlongo
post May 3 2014, 08:33 AM
Post #5


This is My Life
*******

Group: Members
Posts: 1,128
Joined: 24-August 06
From: t-dot
Member No.: 16



missing <?php tags or maybe using short tags <? but not allowed in php.ini
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post May 3 2014, 03:30 PM
Post #6


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



The tags that are displayed aren't short tags though.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Arjun Dey
post May 4 2014, 01:03 PM
Post #7


Newbie
*

Group: Members
Posts: 12
Joined: 2-May 14
Member No.: 20,815



QUOTE(Christian J @ May 3 2014, 05:19 PM) *

Do you use PHP on the other pages, e.g. http://www.taipanleather.com/leather-products.html ? If so I have no idea what makes it show on the first page.

I recall seeing some web host where you couldn't use AddType for enabling PHP in .html extension files, but then it affected all pages.

What happens if you rename "enquiry.html" to "enquiry.php"?


No, no other page refers to a php code. All are in html.
The enquiry.html file is a html code too, but it calls a php source (email.php) to send out the email after filling that form.

Tried renaming to enquiry.php & hosted it, but it still doesn't work! Says "webpage not found".

QUOTE(jimlongo @ May 3 2014, 07:03 PM) *

missing <?php tags or maybe using short tags <? but not allowed in php.ini

Checked my code thoroughly and found no missing tags.

Will sharing the source code files here help you to identify the problem?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post May 4 2014, 01:16 PM
Post #8


.
********

Group: WDG Moderators
Posts: 9,656
Joined: 10-August 06
Member No.: 7



QUOTE(Arjun Dey @ May 4 2014, 08:03 PM) *

Tried renaming to enquiry.php & hosted it, but it still doesn't work! Says "webpage not found".

You must have uploaded the new version to another directory, at least it's not here: http://www.taipanleather.com/enquiry.php

You can also test PHP support by creating a file like "test.php", which just contains this:

CODE
<?php phpinfo(); ?>

--if PHP is supported it will produce a table listing various configurations, etc.

QUOTE
Will sharing the source code files here help you to identify the problem?

Most likely the problem is how to make the server run PHP at all. Try the tests above again.

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Arjun Dey
post May 4 2014, 02:12 PM
Post #9


Newbie
*

Group: Members
Posts: 12
Joined: 2-May 14
Member No.: 20,815



QUOTE(Christian J @ May 4 2014, 11:46 PM) *

You must have uploaded the new version to another directory, at least it's not here: http://www.taipanleather.com/enquiry.php


OK. I did a silly mistake. I uploaded enquiry.php, but didn't map it to the enquiry buttons.
However, code is vanished now. :-)
Please check : http://www.taipanleather.com/enquiry.php

Thanks for your suggestions, everyone!

Cheers!!

This post has been edited by Arjun Dey: May 4 2014, 02:55 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post May 4 2014, 02:25 PM
Post #10


.
********

Group: WDG Moderators
Posts: 9,656
Joined: 10-August 06
Member No.: 7



QUOTE(Arjun Dey @ May 4 2014, 09:12 PM) *

However, code is vanished now. :-)

Good! Wonder why the .htaccess directive didn't work for .html files, though. The following part seems correct:

CODE
AddType application/x-httpd-php .php .htm .html

but do you really need the part above:

CODE
RemoveHandler .html .htm

? What happens if you remove it?

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Arjun Dey
post May 5 2014, 02:58 PM
Post #11


Newbie
*

Group: Members
Posts: 12
Joined: 2-May 14
Member No.: 20,815



QUOTE(Christian J @ May 5 2014, 12:55 AM) *

CODE
RemoveHandler .html .htm

? What happens if you remove it?


Well, its basically to disable server-side parsing & to not show the script contents to visitors.

I have another problem now... The mail is not being sent to the hard-coded email ID after submitting the form.
Have been working for long on this, but to no success. Please help me to fix this.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post May 5 2014, 03:16 PM
Post #12


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



QUOTE(Arjun Dey @ May 5 2014, 09:58 PM) *

Well, its basically to disable server-side parsing & to not show the script contents to visitors.

It disables server side parsing alright, but that would rather let visitors view the content since it's there in the source, not being parsed.

Did you really have those two directives in the same .htacess file and in the order you posted them here? Reversed order or RemoveHandler in a directory closer to the html file in question would explain what happened.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post May 5 2014, 03:36 PM
Post #13


.
********

Group: WDG Moderators
Posts: 9,656
Joined: 10-August 06
Member No.: 7



QUOTE(Arjun Dey @ May 5 2014, 09:58 PM) *

I have another problem now... The mail is not being sent to the hard-coded email ID after submitting the form.
Have been working for long on this, but to no success. Please help me to fix this.

We'd have to see the PHP code for that (perhaps it's more practical to start a new thread in the server-side scripting forum as well).
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post May 5 2014, 04:43 PM
Post #14


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



Where this thread now resides.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Arjun Dey
post May 6 2014, 01:10 PM
Post #15


Newbie
*

Group: Members
Posts: 12
Joined: 2-May 14
Member No.: 20,815



QUOTE(Christian J @ May 6 2014, 02:06 AM) *

We'd have to see the PHP code for that (perhaps it's more practical to start a new thread in the server-side scripting forum as well).


Attached the 2 source code files for your perusal.
Looking forward to your suggestions on fixing this.


Attached File(s)
Attached File  enquiry.html ( 29.75k ) Number of downloads: 204
Attached File  email.php ( 1.05k ) Number of downloads: 183
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post May 6 2014, 02:08 PM
Post #16


Programming Fanatic
********

Group: Members
Posts: 1,981
Joined: 27-April 13
From: Edinburg, Texas
Member No.: 19,088



Is your web server setup to process .html pages with php code? If you did not do this then the file enquiry.html should be changed to enquiry.php. Maybe you should try it anyway.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Arjun Dey
post May 6 2014, 02:15 PM
Post #17


Newbie
*

Group: Members
Posts: 12
Joined: 2-May 14
Member No.: 20,815



QUOTE(CharlesEF @ May 7 2014, 12:38 AM) *

Is your web server setup to process .html pages with php code? If you did not do this then the file enquiry.html should be changed to enquiry.php. Maybe you should try it anyway.


Oops.. My bad! I attached enquiry.html instead of attaching enquiry.php.
enquiry.php is the file which is hosted on my website now : www.taipanleather.com/enquiry.php
The code is same, the extension is different.

BTW, what to edit in the .htaccess file to allow the server to process .html pages with php code in it? Let me try this too...

This post has been edited by Arjun Dey: May 6 2014, 02:16 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post May 6 2014, 02:43 PM
Post #18


.
********

Group: WDG Moderators
Posts: 9,656
Joined: 10-August 06
Member No.: 7



QUOTE
The mail is not being sent to the hard-coded email ID after submitting the form

I'm not familiar with class programming, how does the script access the submitted form data? Can extract() really do that?

Also, what do the mail() function arguments look like if you print them out?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post May 6 2014, 02:44 PM
Post #19


.
********

Group: WDG Moderators
Posts: 9,656
Joined: 10-August 06
Member No.: 7



QUOTE(Arjun Dey @ May 6 2014, 09:15 PM) *

BTW, what to edit in the .htaccess file to allow the server to process .html pages with php code in it? Let me try this too...

Try removing RemoveHandler.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Arjun Dey
post May 6 2014, 02:59 PM
Post #20


Newbie
*

Group: Members
Posts: 12
Joined: 2-May 14
Member No.: 20,815



QUOTE(Christian J @ May 7 2014, 01:14 AM) *

Try removing RemoveHandler.

Tried it. No luck. sad.gif

Tried adding all these to my .htaccess, but no luck again. sad.gif

AddType application/x-httpd-php .php .htm .html
AddType application/x-httpd-php5 .php .htm .html
AddHandler application/x-httpd-php .htm .html
AddHandler application/x-httpd-php5 .htm .html

FYI, the server is currently running on PHP 5.2.

This post has been edited by Arjun Dey: May 6 2014, 03:02 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

2 Pages V  1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 24th April 2024 - 11:19 AM