The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> get data from html form and write into a file, javascript, get data from html form and write into a file, javascript
Daralis
post Apr 25 2012, 05:47 PM
Post #1





Group: Members
Posts: 5
Joined: 25-April 12
Member No.: 16,984



Im trying to write data retrieved from html form, but can't make it work. Please help me. Iam a newbies to this.

Thanks so so much.


<script LANGUAGE="JavaScript">
function Write(input0, input1, input2)
{
var Scr = new ActiveXObject("Scripting.FileSystemObject");
var CTF = Scr.CreateTextFile("employeefile.txt", 1, true);
CTF.WriteLine(input0 + ","+ input1 + ","+ input2);
CTF.Close();
}
function validateForm()
{
var x1=document.userform.pwd.value;
var x2=document.userform.re_pwd.value;
if (x2 == x1)
{
document.write(document.userform.empname.value)
Write(document.userform.empname.value, document.userform.user.value, document.userform.pwd.value);

}
else
{
alert("Passwords are not the same, Re-enter password");

}
}
</SCRIPT>

</head>

<body>

<table width=100% border="0">
<tr>
<td style="background-image:url(http://farm8.staticflickr.com/7092/7114162767_1c07772c85.jpg); background-size:cover;">
<p style="font-family:Britannic Bold;font-size:180%;color:#3300FF;text-align:center;"> <br /><br /> REGISTER </p><br />
</td>

</tr>

<tr>
<td style="background-color:#EEEEEE;height:700px;background-size:cover;text-align:center;">

<form ACTION="" NAME="userform" METHOD="GET" ONSUBMIT="return validateForm()">Create employee profile: <BR><br /><br />
Employee Name: &nbsp; &nbsp; <input type="name" name="empname" size="35"/><br /><br />
Username: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <input type="logintext" name="user" size="35"/><br /><br />
Password: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <input type="password" name="pwd" size="35"/><br /><br />
Re-enter Password: <input type="re_password" name="re_pwd" size="35"/><br /><br />

<input type="submit" value="Submit" size="35"/>
</form>
</td>
</tr>

<footer>

<tr>
<td colspan="2" style="background-color:#FFA500; width:100%; height=50px; text-align:center;">
Copyright © 2012 QGS Inc.
</td>
</tr>
</table>
</footer>

</body>
</html>

This post has been edited by Daralis: Apr 25 2012, 06:27 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
 
Reply to this topicStart new topic
Replies
Christian J
post Apr 27 2012, 12:03 PM
Post #2


.
********

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



BTW, how much do you have to lower MSIE's security settings for this to work? And can you rewrite any text based file on the user's computer?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Apr 27 2012, 12:41 PM
Post #3


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

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



I didn't lower anything, just has to OK the active-x prompt. But that could be different depending on your settings and version of IE I guess.

I guess you can overwrite any existing file since I overwrote the one I created several times.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Apr 27 2012, 02:43 PM
Post #4


.
********

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



QUOTE(pandy @ Apr 27 2012, 07:41 PM) *

I didn't lower anything, just has to OK the active-x prompt. But that could be different depending on your settings and version of IE I guess.

Do you view the HTML file with the script from your local file system? The latter's security zone seems to have low security, but can't be viewed/changed unless you make changes to the registry: http://surfthenetsafely.com/ieseczone3.htm

Can't believe scripts are allowed access to users' file system in the Internet Zone. If it was this easy to hack Windows with javascript there would be an, err, pandemic. ninja.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Apr 27 2012, 03:59 PM
Post #5


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

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



Of course it's local and didn't make any registry changes. Don't you have your own IE by the way? tongue.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Apr 28 2012, 07:52 AM
Post #6


.
********

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



QUOTE(pandy @ Apr 27 2012, 10:59 PM) *

Of course it's local and didn't make any registry changes.

You don't need any registry changes, except for examining the local system's security settings.

QUOTE
Don't you have your own IE by the way? tongue.gif

I just wanted to know how dangerous MSIE really is. With your interest in activeX you seemed like an excellent guinea pig. cool.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Apr 28 2012, 08:38 AM
Post #7


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

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



You said above that registry changes were needed, or so I thought.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic
Daralis   get data from html form and write into a file, javascript   Apr 25 2012, 05:47 PM
Brian Chandler   Are you really trying to write this to a file on t...   Apr 26 2012, 04:33 AM
Daralis   Are you really trying to write this to a file on ...   Apr 26 2012, 10:54 AM
Brian Chandler   Are you really trying to write this to a file on...   Apr 26 2012, 11:50 PM
pandy   A couple of things. I can't get this to work w...   Apr 27 2012, 02:07 AM
Christian J   What does the second parameter (1) in the CreateT...   Apr 27 2012, 07:39 AM
pandy   Could it be because document.write(documen...   Apr 27 2012, 07:47 AM
Christian J   IE seems to require double slashes in the path (c...   Apr 27 2012, 10:13 AM
pandy   Yes, from the page I linked to.   Apr 27 2012, 10:17 AM
Christian J   A more traditional approach might be to write the ...   Apr 26 2012, 07:12 AM
Daralis   A more traditional approach might be to write the...   Apr 26 2012, 10:56 AM
Christian J   See for example http://www.quirksmode.org/js/cooki...   Apr 26 2012, 11:54 AM
Christian J   For example, if the first character in the filen...   Apr 27 2012, 10:20 AM
pandy   Nope. I named my test files 1.txt, 2.txt and so on...   Apr 27 2012, 11:20 AM
Christian J   BTW, how much do you have to lower MSIE's secu...   Apr 27 2012, 12:03 PM
pandy   I didn't lower anything, just has to OK the ac...   Apr 27 2012, 12:41 PM
Christian J   I didn't lower anything, just has to OK the a...   Apr 27 2012, 02:43 PM
pandy   Of course it's local and didn't make any r...   Apr 27 2012, 03:59 PM
Christian J   Of course it's local and didn't make any ...   Apr 28 2012, 07:52 AM
pandy   You said above that registry changes were needed, ...   Apr 28 2012, 08:38 AM


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: 23rd April 2024 - 03:03 AM