User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 402,008 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,430 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 8195 | Replies: 21
Reply
Join Date: Jan 2005
Location: Slovenia
Posts: 32
Reputation: pajac is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
pajac's Avatar
pajac pajac is offline Offline
Light Poster

Re: Help with .js JAVASCRIPT file!!!!!?!!?!?

  #11  
Jan 23rd, 2005
Agree.
Mybe some other sugsestion how can I acomplish redirection?
I'm doing this beacouse I have to se if username and password mach given.And if I include this script directly in bla.htm u could see in source code view both of them (un. and pwd)?!
Reply With Quote  
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation: Comatose is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 107
Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Moderator

Re: Help with .js JAVASCRIPT file!!!!!?!!?!?

  #12  
Jan 23rd, 2005
You can do that anyway. If someone just views source, and then looks at the path to the external file, they can merely stick that in their browser as a URL, and open it or download it. Your Very best bet, is if you have server side access (for example, you can use ASP files, CGI files, PHP, or something along those lines). This way, the password is stored on the server, and never actually sent to the browser. With javascript, EVERYTHING gets sent to the browser, and is readable by it. There are TONS of free verification CGI's and ASP's, PHP's etc, etc. Also, should you need it to be custom built for some reason, let me know, and I can help with that also.
Reply With Quote  
Join Date: Jan 2005
Location: Slovenia
Posts: 32
Reputation: pajac is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
pajac's Avatar
pajac pajac is offline Offline
Light Poster

Re: Help with .js JAVASCRIPT file!!!!!?!!?!?

  #13  
Jan 23rd, 2005
Yes I know all of this, but this is just for testing purposes, since I just installed Apache and have some sites copied (done by me) on server.Now I would like to make them accessible to few people who would say their opinion.I dont wont everyone out there to see it.
I'm just learning everything and I'm doing this step by step. :mrgreen:

That is the problem. I can program in Java & C too so I know for the compabilities of CGI & PHP.But as I told, everything is for testing purposes only.
Reply With Quote  
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation: Comatose is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 107
Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Moderator

Re: Help with .js JAVASCRIPT file!!!!!?!!?!?

  #14  
Jan 23rd, 2005
Alright,

Then That seems to be the best way to go for what you are doing (sticking the password in an external JS file). If You need any other help, just let me know.
Reply With Quote  
Join Date: Jan 2005
Location: Slovenia
Posts: 32
Reputation: pajac is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
pajac's Avatar
pajac pajac is offline Offline
Light Poster

Re: Help with .js JAVASCRIPT file!!!!!?!!?!?

  #15  
Jan 23rd, 2005
Actualy this is just what I'm tending to do. Validate the username and passwd in external file (whitch is working fine) and then redirect the person from login site to the site which has links to other sites. Here sits my problem.
Reply With Quote  
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation: Comatose is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 107
Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Moderator

Re: Help with .js JAVASCRIPT file!!!!!?!!?!?

  #16  
Jan 23rd, 2005
and window.location is not working? post me the code, or link me to your site... or both.
Reply With Quote  
Join Date: Jan 2005
Location: Slovenia
Posts: 32
Reputation: pajac is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
pajac's Avatar
pajac pajac is offline Offline
Light Poster

Re: Help with .js JAVASCRIPT file!!!!!?!!?!?

  #17  
Jan 24th, 2005
*.htm file

<link rel="stylesheet" href="prva.css">
<script src="prva.js"></script>
</head>

<body>
<table  id="zacetnaTabela" width="300px" height="150px" align="center">
  <tr>
     <td>
	<table border="1" align="center">
	   <tr>
	      <td align="center">
		 <form name="myForm" onsubmit="return preveri(input.value,geslo.value);">
			UserName:<br>
			<input type="text" name="input"><br>
			Password:<br>
			<input type="password" name="geslo"><br>
			<input type="submit" value="Preveri!" size="15px">
		</form>
	      </td>
	   </tr>
	</table>
      </td>
   </tr>
</table>
</body>

prva.js file

function preveri(name,passwd){
	if((name=="test")&&(passwd=="test1")){
		alert("Pravilen vnos!");
		top.window.location = 'seznamStrani.htm';  //<---- PROBLEM
	}
	else{
		alert("NapaÄ?no geslo in/ali uporabnisko ime!");
	}
}
Reply With Quote  
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation: Comatose is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 107
Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Moderator

Re: Help with .js JAVASCRIPT file!!!!!?!!?!?

  #18  
Jan 24th, 2005
And The: alert("Pravilen vnos!"); works fine right? It just doesn't redirect the site...

something else to consider... instead of using an "onsubmit" with a submit button, consider using a regular button, with an onclick event... that way you don't have to do a "return function();" You could call the function with the button, and then do a document.formname.submit(); in the javascript...... let me know your thoughts.

Also, Have you considered trying "parent.location" (or maybe it's parent.window.location)
Reply With Quote  
Join Date: Jan 2005
Location: Slovenia
Posts: 32
Reputation: pajac is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
pajac's Avatar
pajac pajac is offline Offline
Light Poster

Re: Help with .js JAVASCRIPT file!!!!!?!!?!?

  #19  
Jan 24th, 2005
Yeah! :cheesy: :cheesy:
It works with the usual button, just like u suggested! With parent.window.location <-- :cheesy:

Thanks A LOT!
::: Ha thisone nobody has! :lol: :lol:
Reply With Quote  
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation: Comatose is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 107
Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Moderator

Re: Help with .js JAVASCRIPT file!!!!!?!!?!?

  #20  
Jan 24th, 2005
Thats Awesome! I'm glad it worked!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 9:36 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC