Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Help with TNX code on ASP site
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 4

MammaRose
Starting Member

United States
32 Posts

Posted - 28 November 2007 :  15:17:46  Show Profile  Visit MammaRose's Homepage
I am trying to install some code on my snitz forum for TNX.net to display links. I installed the Site Integration MOD and I want the links to show on the left side. I have added a line of code

<!-- #include file="banner1.asp" -->

to inc_site_left.asp which calls the code given to me by TNX. File banner1.asp

<%@Language="JScript" %>
<!-- #include file="md5.asp" -->
...


However, I get an error that "The @ command must be the first command within the Active Server Page."

I have tried to contact TNX, but have gotten no answer. Anyone have any ideas?

Cross Tattoos

AnonJr
Moderator

United States
5768 Posts

Posted - 28 November 2007 :  15:43:23  Show Profile  Visit AnonJr's Homepage
The language directives should be the first declarations on a page. There is a way to switch scripting languages, but I'm a little fuzzy on the particulars... could you link to a .txt copy of banner1.asp? It may help.
Go to Top of Page

MammaRose
Starting Member

United States
32 Posts

Posted - 28 November 2007 :  17:35:14  Show Profile  Visit MammaRose's Homepage
I changed my file to banner1.txt and uploaded it.

Now the error is

banner1.txt, line 1

The @ command must be the first command within the Active Server Page.

I don't understand, the first line of code in banner1 is <%@Language="JScript" %>, it is the first command.

Cross Tattoos
Go to Top of Page

AnonJr
Moderator

United States
5768 Posts

Posted - 28 November 2007 :  18:10:29  Show Profile  Visit AnonJr's Homepage
don't use the .txt version, post a link to it here so we can see what the code is without the server trying to process it.
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 28 November 2007 :  18:11:19  Show Profile
Do you have any blank lines at the top? Is the file included by another asp page, making it's first line no longer the first line?

======
Doug G
======
Computer history and help at www.dougscode.com
Go to Top of Page

AnonJr
Moderator

United States
5768 Posts

Posted - 28 November 2007 :  18:45:56  Show Profile  Visit AnonJr's Homepage
Doug, he's got banner1.asp included in inc_site_left.asp so its not the first line of the page.

FWIW, I never really needed to switch scripting languages... I've always stuck with VBScript on the server-side. Having said that, I think all you will need to do is put the JScript code between <script runat="server" language="JScript"></script> instead of the <% %> you normally would.

Edited by - AnonJr on 28 November 2007 18:47:10
Go to Top of Page

MammaRose
Starting Member

United States
32 Posts

Posted - 28 November 2007 :  20:42:02  Show Profile  Visit MammaRose's Homepage
quote:
Originally posted by AnonJr

don't use the .txt version, post a link to it here so we can see what the code is without the server trying to process it.


Oh..oops, my bad.
Here is the file http://www.sportsforumz.net/forum/ncaa/tennessee/forum/banner1.txt
Do you need to see the code for md5.asp also? That is the page that banner1.asp includes, but the error I am getting is in banner1.asp

Cross Tattoos

Edited by - MammaRose on 28 November 2007 20:44:07
Go to Top of Page

AnonJr
Moderator

United States
5768 Posts

Posted - 28 November 2007 :  20:47:56  Show Profile  Visit AnonJr's Homepage
Is the include statement the only thing you have in inc_site_left.asp?

If it is, you can probably get away with just putting the following in inc_site_left.asp - otherwise, I'd replace the text in banner1.asp with this:


<!-- #include file="md5.asp" -->
<script language="JScript" runat="server">
var login="volsfan";
var xap_adv="";
var ru=String(Request.ServerVariables("SCRIPT_NAME"));
var site=String(Request.ServerVariables("HTTP_HOST"));
ru = ru.substring(0,ru.lastIndexOf("/")+1);
if(ru.length==0)ru="/";
if(ru.length<=180){
    if(ru=="")ru="/";
	var file=base64Encode(ru);
	site=site.replace("www.","");
	var path_code=md5(file);
	var user_pref=login.substring(0,2);
	var path=path_code.substring(0,1)+"/"+path_code.substring(1,3)+"/";
	var domain=login+".tnx.net";
	path="/users/"+user_pref+"/"+login+"/"+site+"/"+path+file+".txt";
	var xmlHttpReq = Server.CreateObject("MSXML2.XMLHTTP.3.0");
	xmlHttpReq.open("GET", "http://"+domain+path, false);
	xmlHttpReq.send();
	if(xmlHttpReq.status==200){
		var res = xmlHttpReq.responseText;
		Response.Write(res);
	}else Response.Write("Error: "+xmlHttpReq.status);
	xmlHttpReq=null;
}
function base64Encode(instr){
	var b64str='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
	var b1,b2,b3,ca,cb,cc,cd,j=0,tret=new Array();
	for(var i=0;i<instr.length;i+=3){
		b1=instr.charCodeAt(i);
		b2=instr.charCodeAt(i+1);
		b3=instr.charCodeAt(i+2);
		ca=b1>>2;
		cb=((b1&3)<<4)|(b2>>4);
		cc=((b2&15)<<2)|(b3>>6);
		cd=b3&63;
		if(isNaN(b2))cc=cd=64;else if(isNaN(b3))cd=64;
		tret[j++]=b64str.charAt(ca)+b64str.charAt(cb)+b64str.charAt(cc)+b64str.charAt(cd);
	}
	return tret.join('');
}
</script>


There may be some additional tweaking needed depending on the content of md5.asp

No guarantees... like I said earlier, I don't really mess with switching the scripting language.
Go to Top of Page

MammaRose
Starting Member

United States
32 Posts

Posted - 28 November 2007 :  20:56:35  Show Profile  Visit MammaRose's Homepage
I added that code to inc_site_left and that got rid of the @ command error, but now I am getting an error on md5.asp.

Microsoft VBScript compilation error '800a0411'

Name redefined

/forum/ncaa/tennessee/forum/md5.asp, line 2

Private Const BITS_TO_A_BYTE=8
--------------^

Here is the code for md5
http://www.sportsforumz.net/forum/ncaa/tennessee/forum/md5.txt

Cross Tattoos
Go to Top of Page

AnonJr
Moderator

United States
5768 Posts

Posted - 28 November 2007 :  22:13:30  Show Profile  Visit AnonJr's Homepage
Basically its telling you that you've already created a constant called "BITS_TO_A_BYTE" somewhere else in the program. Most likely its from including md5.asp in more than one place on the same page. If you've included md5.asp elsewhere in the forum, you won't need to add it to inc_site_left.asp
Go to Top of Page

MammaRose
Starting Member

United States
32 Posts

Posted - 29 November 2007 :  00:23:33  Show Profile  Visit MammaRose's Homepage
Now I am really confused. I made a brand new page, with nothing but the include to banner.asp

If I got to www.sportsforumz.net/test.asp - it loads properly
but if I go to www.sportsforumz.net/forum/test.asp - it gives an error
These are the same page.
Is there a way to #include to a URL?

Cross Tattoos
Go to Top of Page

AnonJr
Moderator

United States
5768 Posts

Posted - 29 November 2007 :  06:57:33  Show Profile  Visit AnonJr's Homepage
I'm seeing a "The system cannot locate the resource specified" error on both - which indicates that the page its pointing to doesn't exist. Is this the error you are referring to or is there a different one?

Also, are you including the md5.asp page in any other parts of the forum?
Go to Top of Page

MammaRose
Starting Member

United States
32 Posts

Posted - 29 November 2007 :  09:50:59  Show Profile  Visit MammaRose's Homepage
Now using the computer at my work, I don't get an error on either of the links above. I am only including md5.asp from banner1.asp

Cross Tattoos
Go to Top of Page

MammaRose
Starting Member

United States
32 Posts

Posted - 30 November 2007 :  22:36:19  Show Profile  Visit MammaRose's Homepage
What file can I use #include to include a page that has @Language used so that I do not get the error that the @Language command must be the first on the page.

I have tried to add it to default.asp, inc_site_left.asp, inc_site_header.asp.
thanks

Cross Tattoos

Edited by - MammaRose on 30 November 2007 22:37:34
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 30 November 2007 :  23:30:54  Show Profile
quote:
What file can I use #include to include a page that has @Language used so that I do not get the error that the @Language command must be the first on the page.
You can't do this include with traditional asp ssi includes. You might be able to use server.execute or server.transfer as a work-around. Easier would be to take the @Language statement out of the included page.

======
Doug G
======
Computer history and help at www.dougscode.com
Go to Top of Page

MammaRose
Starting Member

United States
32 Posts

Posted - 30 November 2007 :  23:42:26  Show Profile  Visit MammaRose's Homepage
If I take the @Language statement out, then the script on the page will not run. Banner.asp is in javascript and I think Snitz has some VBScript.

Cross Tattoos
Go to Top of Page
Page: of 4 Previous Topic Topic Next Topic  
Next Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.22 seconds. Powered By: Snitz Forums 2000 Version 3.4.07