|
That's great. Seriously, why ask a question like that if you're not going to tell us anything else? Are you trying to do it client-side or server-side? And if server-side, what scripting language are you using? How's the file formatted? Why are you trying to fill it from a file? Please remember that noone on this forum is psychic (I think) and that you'll need to be slightly more specific than you were in your question if you expect any kind of helpful response.
NATHAN RIDLEY
Web Application Developer
generalgherkin@yahoo.com
|
|
|
|
|
Client-side using Javascript???
AFAIK it's next to impossible...you can't access files using JScript...however maybe you could use the following hack...if it would work I dunno i'll leave the details to you...
1) have an IFRAME (preferably hidden if you can do this with IFRAME's using it's visible: hidden inside style attribute.
2) This IFRAME's SRC should point at the file your going to use to load the form fields.
3) In the main main window's onLoad() you would then have to somehow extract the contents the IFRAME referred too using innerHTML or some method of IFRAME's.
4) Parse the data file and set the form fields using document.forms(0).control.value=test
Thats all I can think of as far as client side...server side....thats easy when using PHP/ASP
<?
fopen('mydatafile.dat');
echo '<input type='text' value='\''.$parsed_value.'\''>';
?>
Thats all she wrote...
Cheers
I'm drinking triples, seeing double and acting single
|
|
|
|
|
Hello,
I'm trying to count the visits that my web page is receiving, but it seems impossible... I've been using some codes that I've found in the internet, but no one works...
here are the samples:
******************************************
SAMPLE 1
******************************************
<?
$ar = "contador.txt";
$fp = fopen($ar,"r");
$visitas = fgets($fp, 26);
fclose($fp);
$visitas = $visitas+1;
$fp = fopen($ar,"w+");
fwrite($fp, $visitas, 26);
fclose($fp);
echo $visitas;
?>
******************************************
SAMPLE 2
******************************************
<CFPARAM NAME="attributes.file" DEFAULT="contador.txt">
<cfset sPath = #GetDirectoryFromPath(CGI.PATH_TRANSLATED)#>
<cfif NOT FileExists("#sPath#\#attributes.file#")>
<cffile action="WRITE" file="#sPath#\#attributes.file#" output="0" addnewline="No">
</cfif>
<cffile action="READ" file="#sPath#\#attributes.file#" variable="Mostrar">
<cffile action="DELETE" file="#sPath#\#attributes.file#">
<cfset Mostrar = #Mostrar# + 1>
<cffile action="WRITE" file="#sPath#\#attributes.file#" output="#Mostrar#" addnewline="No">
******************************************
SAMPLE 3
******************************************
<?
$counterFile = "contador.txt";
function displayCounter($counterFile)
{
$fp = fopen($counterFile,rw);
$num = fgets($fp,5);
$num = 1;
echo "$num";
exec( "rm -rf $counterFile");
exec( "echo $num > $counterFile");
}
if (!file_exists($counterFile))
{
exec( "echo 1 > $counterFile");
}
displayCounter($counterFile);
?>
******************************************
END OF SAMPLES...
******************************************
PS:
In order to make the samples in PHP, I've changed the *.htm extension of the files to *.php; all this samples are placed in the head...
could you help me?
Thank you in advance
|
|
|
|
|
Does your server support PHP scripts? Are your scripts running in SAFE mode?
AT quick glance the code in example one seems fine.
I'm drinking triples, seeing double and acting single
|
|
|
|
|
I want to develop a payroll application, but we aren't so sure how to integrate our ASP.NET app with the bank. Database on hosted on our own server. Database 'employee' table resmeble this:
employeeID
salary
employee_payroll_account_num
... other things...
We want to automate this process. How can we hook up our system with the bank so money can be debted from our company account and transferred to employee account automatically? Can we find relevant information from bank's website directly? Do we need to setup a merchant account, similar to credit card processing? Payment gateway? But this is not credit card processing. It's transfer from one bank account to another. What if company's bank is different from employee's bank?
|
|
|
|
|
Wow... that's a sticky mess you have gotten yourselves in. First of all, toying with people's accounts with code is not something to be taken lightly. If you are developing software which interacts with bank accounts, you're going to have to work closely with the bank. Have you contacted the powers that be at the banks in question and asked for advice? Do you have coders who have any experience writing ecommerce/banking software? I haven't personally done anything related to banking software, but you might be able to organise something with the banks where you automatically request an interbank transfer from your company's account to an employees account, but again, I find it highly unlikely that you won't have to work closely with the bank to accomplish this. I would suggest calling the bank that your company has an account with and working from there.
NATHAN RIDLEY
Web Application Developer
generalgherkin@yahoo.com
|
|
|
|
|
A company I worked for do this offline. Serialize all payment request into XML file. I think it's then put on a CD - can't be more secured than that.
norm
|
|
|
|
|
I have to agree with Nathan here. This is not something you want to be taking lightly.
I did a project with a bank 2 years ago where we wanted to notify them when we had funds that needed to go to the fedwire and it is and always will be a hassle dealing with a bank. For many reasons not limited to , if your software screws up, where does that money come form, go to and how do you know. no bank in there right mind is going to let you programatically move money around.
The XML file situation is different and sounds more like the approach we took were as, the bank logged onto our website, printed documents reflecting the information needed for a trasnfer, then they went and did the trasnfer, then returned to our site and input fedWire tracking numbers for each individual trasnfer they did. so in the end, it is a totally disconnected process and when things go wrong, it is easy to figure out where the problem was (and there have not been any problems either)
Anyway, instead of ranting, here is a suggestion. Get payChex .. they offer APIs and other transport means for you to get the needed info to a company that can and will deposit money in the proper accounts. There are other payroll companies out there to choose from, but they are one of the larger and more stable (as well as integrated).
While building your own payroll system is a great idea, dont reinvent the wheels that work and have already been rolling for some time.
|
|
|
|
|
I want to post information to many asp pages but it doesn't work correctly. To test, I created 2 pages: the first page is the "poster" and the second page is the "receiver"
The first page:
<script language=JavaScript>
function do_submit()
{
var i;
var count = 10;
for (i = 0; i < count; i++)
{
document.frmMain.Index.value = i;
document.frmMain.submit();
}
}
</script>
<form name=frmMain action="http://pcproject/multipost/destination.asp">
<input type=hidden name=Index>
<input type=button value=Test onclick="do_submit();">
</form>
The second page: Written in ASP, To monitor the result
Dim Index
Index = Request("Index")
Dim fs
Set fs = Server.CreateObject("Scripting.FileSystemObject")
fs.CreateTextFile Server.MapPath(Index)
Set fs = Nothing
'Do not return result
Response.Status = 204
I expected that after running the test, the second page would create 10 files named from 0 to 9 but sometimes the file names are from 1 to 9, sometimes from 2 to 9.
It seem that the first post and the second post take no effect.
The amazing thing is if I put the statement alert("something"); next to the statement document.frmMain.submit(); in the JavaScript code of the poster, the test is OK. May it need a delay time???
I'm so confuse, please help me.
|
|
|
|
|
I'm sure there's some sort of inherant design problem with what you're doing here. You should only need to post one form. Do all your processing on the server side. Why are you trying to post an arbvitrary number of times to the server? Why not just send that number to the server in a hidden field and get the server to do it?
NATHAN RIDLEY
Web Application Developer
generalgherkin@yahoo.com
|
|
|
|
|
Thanks for your soon reply.
The given example is only for illustrating my problem, it is not all I want to do. The story is:
My company has some offices in some countries which are connected to each other through leasedline.
I understand your idea, but in fact I'm developing an web application which is installed on several servers (each office has it own server). All that I want is when users login a website on a webserver, the login information will be dispatched to another websites on another webservers for handling user login session. So that, users do not need to login again when reaching to another websites because all of web applications are the same. The reason of installing the web applications on many servers is the leasedline is not reliable, frequently down. In addition, the essential task of the web application is to serve office-work and to share information with other offices.
I can send user login information to another website through my COM object at server side but not at client side. When sending from server side, the user session newly created in another webserver is not the same with the current user session (browser).
Please help me if you know my problem.
Thanks in advance.
|
|
|
|
|
I think your problem is that you have one form that you are trying to submit to multiple locations. This is not something you can do because it is essentially the same as trying to click five different links on the same page. Your page can only ever go to one place after you click a link, and it's the same with a form. Perhaps you could so something like dynamically constructing an iframe with form code and hidden fields inside it, submitting that form with javascript, and waiting for the process to be confirmed before you continue. It's a bit of a dodgy way to do it, but it might work. Alternatively, and this is the solution I'd be more inclined to try, do as I suggested earlier and submit your form to one ASP script, then in that script, create an XMLHTTP object and post details to the other pages on the other servers. This way you're not relying on your users' browsers to correctly submit forms, when they could well behave unexpectedly.
NATHAN RIDLEY
Web Application Developer
generalgherkin@yahoo.com
|
|
|
|
|
Thanks NATHAN.
I think it is not the same as trying to click multiple links.
As I know, the process is:
After each submission, the browser waits for the result processed from the server. But the second page (the processing page) return the status code 204 which indicates that no result will be sent back to the browser. So that the browser remains the original html content, nothing has changed, the next submission is a normal submission.
I've tried to use XMLHTTP but there are some constraints.
Firstly it bases on Microsoft component, secondly it cannot open more than one connection at a time, only one connection.
If you have any examples on this, please show me more.
|
|
|
|
|
why not create as many XMLHTTP components as you need?
NATHAN RIDLEY
Web Application Developer
generalgherkin@yahoo.com
|
|
|
|
|
Not simple as you thought. To test the XMLHTTP object I created 2 pages:
1. Destination page : destination.asp
This page is for testing the result, the result is file with numeric name increased one by one. i.e.: 0, 1, 2...
<CODE>
Response.Buffer = True
Dim Index
if Trim(Session("Index")) = "" then
Index = 0
Session("Index") = 0
else
Index = CLng(Session("Index"))
Index = Index + 1
Session("Index") = Index
end if
Dim fs
Set fs = Server.CreateObject("Scripting.FileSystemObject")
fs.CreateTextFile Server.MapPath(Index)
Set fs = Nothing
Response.Status = 204
</CODE>
2.The source page : source.asp
<CODE>
<html>
<head>
<script language=VBScript>
Function xmlhttp_test_single()
Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
xmlhttp.open "GET", "http://pcproject/multipost/destination.asp", false
xmlhttp.send
Set xmlhttp = Nothing
End Function
<br>
<font color=000000>
Function xmlhttp_test_double()
xmlhttp_test_single
xmlhttp_test_single
end function
</font>
</script>
</head>
<body>
<form name=frmMain action="http://pcproject/multipost/destination.asp">
<input type=button value=Single onclick="xmlhttp_test_single()">
<input type=button value=Double onclick="xmlhttp_test_double()">
</form>
</body>
</html>
</CODE>
If I click the Single button, one file is created, if loop this step many times, many files are created, one file for one click.
But if I click the Double button, only one file is created.
The Double function looks like creating many XMLHTTP objects.
Could you please explain me why.
|
|
|
|
|
so if I understand this correctly, there are multiple web servers in multiple locations.
firstly, if you are hosting a server on an unreliable leased line circuit, and POSTING some semi-critical data to it, then what do you expect to happen IF you get your form posting to multiple locations BUT one of those locations is down? Seems to me that you app falls flat right there.
Why not go this route......
is there any one server that is not on a leasedline? IE, Fully reliable?
If so, when the form posts and you create your "session" file, create the file on the reliable server, say, as an XML file....
Then, reference this file from your "slave" servers when checking "session"..
These servers would check the "session" using something like this...
set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
objHttp.open "GET", "http://www.cdsgrants.com/Content/user.txt", false
objHttp.Send ""
if objHttp.status <> "200" then
Response.write "File Not Retrieved " & sResponse
Else
Response.Write objHTTP.ResponseTEXT & "
"
end if
set objHttp = nothing
|
|
|
|
|
your code should wait for the page to finish loading (after
document.frmMain.submit();<br />
while (document.frmMain.readyState != "complete")<br />
;
though you may have to put this check into a timer, otherwise you will yield no cpu time to the other window, and therefore the document will never finish loading...
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Thanks Philip.
I've tried it but cannot, the readySate is always "complete"
The code look like that:
<br />
var sState = "";<br />
for(var i = 0; i<10; i++)<br />
{<br />
sState = sState + i + document.frmMain.readyState;<br />
frmMain.submit();<br />
sState += document.frmMain.readyState;<br />
}<br />
alert(sState);<br />
I can not resolve my problem till now.
|
|
|
|
|
but do not have a wait loop after the submit checking the state of the document!
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Hi,
I don't know if this is the good board but anyway.
I've created a simple webService that I use in a Windows Application.
I can read data from my database, and I can add or update datas.
Is there a way to allow delete data from a webService. If yes can someone can help me to implement this.
Thx
Sybux
|
|
|
|
|
Your ability to add/edit/delete information from your database shouldn't have anything to do with your webservice. If you're having a problem with deleting, it's most likely a rights problem (as in the process you are running the web service in - likely the ASP.NET default account) needs to have the appropriate rights against your database.
Good Luck
David
|
|
|
|
|
Hi,
the problem is not in regards of rights...
The problem is how to implement a solution
Thx
Sybux
|
|
|
|
|
How can I put value into the ?
did not display the "image.jgp" in the textbox. How can I solve this?
thanks.
|
|
|
|
|
The standard says about file controls: "User agents may use the value of the value attribute as the initial file name." So the browser isn't required to do anything with the value attribute.
|
|
|
|
|
And generally they don't, because otherwise you could write a web page that uploads arbitrary files without the user's consent by simply including a hidden form that is auto submitted via javascript. This would be bad.
--
-Blake (com/bcdev/blake)
|
|
|
|