|
You will be fighting a loosing battle if you stick to HTML and JavaScript. You are going to have to go with a Java Applet or an ActiveX control of your own making for total control.
Sounds like one heck-of-a serious typing course though
regards,
Paul Watson
Bluegrass
South Africa
Brian Welsch wrote:
"blah blah blah, maybe a potato?" while translating my Afrikaans.
Crikey! ain't life grand?
|
|
|
|
|
Paul Watson wrote:
You will be fighting a loosing battle
I like this!!!
I was born intelligent Education ruined me!.
|
|
|
|
|
look up the "onpaste" and "onbeforepaste" javascript events in the msdn library. you can basically cancel the paste before it occurs with a few simple lines of script.
NATHAN RIDLEY
Web Application Developer
email: nathan @ netlab.com.au
[remove the spaces before and after the @ symbol]
|
|
|
|
|
Another thought just occured to me. Nathan Ripley's reply is useful, except that as you say kids can disable JavaScript.
But what if you make JavaScript mandatory?
Now I would not normally recommend this for the public web but in this case you have a specific environment; You could code the onsubmit of the form to only work from a JavaScript call. i.e. The only way they can run the test and submit the results is if they have JavaScript enabled, and then you can use the much simpler methods Nathan suggest.
On second though I also wonder how you are timing this test? Surely you must be using JavaScript as you could never rely on a server-side performance monitor of some sort as it would depend totally on their connection speed.
So it seems to me that you have to have JavaScript in which case you can keep the kids from cheating.
regards,
Paul Watson
Bluegrass
South Africa
Brian Welsch wrote:
"blah blah blah, maybe a potato?" while translating my Afrikaans.
Crikey! ain't life grand?
|
|
|
|
|
Yes that's exactly what I was thinking. Now I haven't got very much experience in these matters but would it be possible for the users to start their test, disable javascript, copy/paste the code, re-enable javascript and finally submit their results? In that case I was thinking what if there existed a custom text area that isn't a text area at all but rather a custom div or whatever that takes care of character insertion itself - through javascript (would handle onkeydown events, caret positioning etc.). Then there would be no way to insert anything at all unless javascript was enabled and in that case I can control almost anything.
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
What you could do is from tick to tick check the time of the client. If your tick is every second and the last recorded tick was more than one second ago, then it has been tampered with. You could have a counter running which ensures an unbroken time span, it would be done in JavaScript so turning off JS would throw up a flag. You can then just inform the user that they were being naughty and not accept the results.
Technically they could write an app to carefully control their client clock to match your tamper proofing, but really, are typists going to go to that trouble?
Otherwise, go with the Java Applet/ActiveX control route.
regards,
Paul Watson
Bluegrass
South Africa
Brian Welsch wrote:
"blah blah blah, maybe a potato?" while translating my Afrikaans.
Crikey! ain't life grand?
|
|
|
|
|
HI all
any body know how asp.dll work (how it gunrate html code)
if any body have any idea about it
pleas please reply me.
thanks in advance
ND
|
|
|
|
|
From what I remember about asp.dll, It does not generate HTML code, it interprets vbscript within an asp page. The HTML code is interpreted by the client side browser.
HTH
Tony
|
|
|
|
|
may you are right
actulay I want to trace out how it all procedure work.
its all steps. can you help plz
ND
|
|
|
|
|
Check out NullScript[^]. It should give you an idea about how it works...
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
Hello,
I'm very new to web development. Recently I started building my first web application. I'm building a database,..., in php,.... and now I want to display some text in a message box or something.
but,
I can't find any function, class or whatever that creates such a dialog! My frustrations are getting more and more intense!
Does any1 know where to look or know HOW to do this?
thanks.
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
Bob, PHP is a server side language. That means it runs on the server and not the client.
What you want is a dialog box on the client side and so you need a client side language.
In this case, use JavaScript, specifically alert("'tators... ... Poh-ta-toe!"); .
regards,
Paul Watson
Bluegrass
South Africa
Brian Welsch wrote:
"blah blah blah, maybe a potato?" while translating my Afrikaans.
Crikey! ain't life grand?
|
|
|
|
|
I'm getting a headache right now Guess that I need to work around something...
Thanks for your answer
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
No worries Bob, we all have to start somewhere. Feel free to ask all the questions you need, plenty of others out there in the same situation.
regards,
Paul Watson
Bluegrass
South Africa
Brian Welsch wrote:
"blah blah blah, maybe a potato?" while translating my Afrikaans.
Crikey! ain't life grand?
|
|
|
|
|
Like Paul said PHP being a server side language won't intrinsically let you display a dialog box, so you have to use this little work around
<?
$res = mysql_query('SELECT * from myTable');
if(mysql_num_rows($res)==0){
echo '<html>';
echo '<body onLoad="alert(\"There are no records available\");">';
echo '<b>This is a simple web page that displays a dialog box</b>';
echo '</body>';
echo '</html>';
}
else{
echo 'Start generating a more complete web page from database records';
}
?>
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|
|
Thanks,I guess I'll never stop learning...
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
Within your PHP code you need to invoke a javascript function to display the message box. PHP itself can't generate client message boxes.
|
|
|
|
|
Hello,
Thanks, this function does the trick for me:
<br />
function MessageBox($Message)<br />
{<br />
echo"<SCRIPT LANGUAGE=\"JAVASCRIPT\">window.alert(\"$szMessage\")</SCRIPT>";<br />
}<br />
Let's just pray that the user's browser supports JavaScript
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
I have a ASP web form I need to e-mail.
Every time a user fills in the form it must mail the whole web page (or even all of it's details) to a consultant. What would be the best way to do this? I can probably just take all the details off the page and put them into an email and send it via SMTP but it's gonna take a lot of time to do as the form is quite big. It would be easier if I could just send the whole page (and all of it's textboxes and selected combo boxes).
Is it even possible to do it this way or I'm I just being overly optimistic?
Any input would be appreciated.
Thanks
Nick R
The man who smiles when things go wrong has thought of someone he can blame it on.
If you tell a man there are 300 billion stars in the universe, he'll believe you. But if you tell him a bench has just been painted, he'll have to touch it to be sure.
|
|
|
|
|
From what I know, I think that you are a bit optimistic.
You will have to build the body of the email with all the information.
theJazzyBrain
Wise is he who asks good questions, not he who gives good answers
|
|
|
|
|
I'm going to copy/paste the contents of a sendmail script I wrote here for you to use. If you want to send an html email with it, simply make a an html file and put it in the same directory as the form. All the elements of the form should be marked in the html email like this: [$formfieldname$]
The sendmail script will load the email template, replace all of the [$xxx$] keys with the contents from the submitted form, where xxx is the name of the submitted form field. You don't have to use an email template, and if you don't, the script will generate a plain-text email for you. Let me know if anything doesn't seem to function correctly.
<%
'---------------------------------------------------------------------------------------------------
'FORM MAIL SCRIPT
'----------------
'usage:
'<form ACTION="sendmail.asp" ...>
'
'hidden fields:
' redirect - the url to redirect to when the mail has been sent (REQUIRED)
' mailto - the email address of the recipient (separate multiple recipients with commas) (REQUIRED)
' cc - the email address of the cc recipient (separate multiple recipients with commas) (OPTIONAL)
' bcc - the email address of the bcc recipient (separate multiple recipients with commas) (OPTIONAL)
' mailfrom - the email address of the sender (REQUIRED)
' subject - the subject line of the email (REQUIRED)
' message - the message to include in the email above the field values. not used when a template is being used. (OPTIONAL)
' template - specifies a text or html file to use as the email template, relative to the location of the sendmail script. (e.g. ../email.txt)
' A template should reference form fields like this: [$Field Name$]
' html - if this has the value "yes", the email will be sent as an html email. only used if a template is supplied.
' testmode - if this is set to "yes", the email contents will be written to the screen instead of being emailed.
'---------------------------------------------------------------------------------------------------
option explicit
function getTextFromFile(path)
dim fso, f, txt
set fso = createobject("Scripting.FileSystemObject")
if not fso.fileexists(path) then
getTextFromFile = ""
exit function
end if
set f = fso.opentextfile(path,1)
if f.atendofstream then txt = "" else txt = f.readall
f.close
set f = nothing
set fso = nothing
getTextFromFile = txt
end function
dim redir, mailto, mailfrom, subject, item, body, cc, bcc, message, html, template, usetemplate, testmode
redir = request.form("redirect")
mailto = request.form("mailto")
cc = request.form("cc")
bcc = request.form("bcc")
mailfrom = request.form("mailfrom")
subject = request.form("subject")
message = request.form("message")
template = request.form("template")
testmode = lcase(request.form("testmode"))="yes"
if len(template) > 0 then template = getTextFromFile(server.mappath(template))
if len(template) > 0 then usetemplate = true else usetemplate = false
dim msg : set msg = server.createobject("CDONTS.NewMail")
if usetemplate and lcase(request.form("html")) = "yes" then
msg.bodyformat = 0 '(html)
msg.mailformat = 0 '(mime)
end if
msg.subject = subject
msg.to = mailto
msg.from = mailfrom
if len(cc) > 0 then msg.cc = cc
if len(bcc) > 0 then msg.bcc = bcc
if not usetemplate then
body = body & message & vbcrlf & vbcrlf
else
body = template
end if
for each item in request.form
select case item
case "redirect", "mailto", "cc", "bcc", "subject", "message", "template", "html", "testmode"
case else
if not usetemplate then
if item <> "mailfrom" then body = body & item & ": " & request.form(item) & vbcrlf & vbcrlf
else
body = replace(body, "[$" & item & "$]", replace(request.form(item),vbcrlf,"<br>"))
end if
end select
next
if usetemplate then 'remove any leftover placeholders
dim rx : set rx = new regexp
rx.pattern = "\[\$.*\$\]"
rx.global = true
body = rx.replace(body, "")
end if
msg.body = body
if testmode then
if lcase(request.form("html")) = "yes" then
response.write "<pre>" & vbcrlf
response.write "Mail to: " & mailto & vbcrlf
response.write "Mail from: " & mailfrom & vbcrlf
if len(cc) > 0 then response.write "Cc: " & cc & vbcrlf
if len(bcc) > 0 then response.write "Bcc: " & bcc & vbcrlf
response.write "Subject: " & subject & vbcrlf & string(80,"-") & "</pre>"
response.write body
else
response.write "<html><head><title>Sendmail.asp Test Mode</title></head><body><pre>" & vbcrlf
response.write "Mail to: " & mailto & vbcrlf
response.write "Mail from: " & mailfrom & vbcrlf
if len(cc) > 0 then response.write "Cc: " & cc & vbcrlf
if len(bcc) > 0 then response.write "Bcc: " & bcc & vbcrlf
response.write "Subject: " & subject & vbcrlf & vbcrlf
response.write string(80,"-") & vbcrlf & vbcrlf & "<span style=""color:blue;"">"
response.write body & "</span>" & vbcrlf & vbcrlf
response.write string(80,"-") & vbcrlf & "**END OF EMAIL**</pre></body></html>"
end if
else
msg.send
response.redirect redir
end if
set msg = nothing
%>
NATHAN RIDLEY
Web Application Developer
generalgherkin@yahoo.com
|
|
|
|
|
That's great thanks!
I'll give it a go.
The man who smiles when things go wrong has thought of someone he can blame it on.
If you tell a man there are 300 billion stars in the universe, he'll believe you. But if you tell him a bench has just been painted, he'll have to touch it to be sure.
|
|
|
|
|
What you want to do is iterate through all the forms on a field, getting their name and value.
An ex-co-worker wrote this handy script which works similarly to the sendmail script the other chap posted. It is ASP.NET but the concepts are similar in ASP.
regards,
Paul Watson
Bluegrass
South Africa
Brian Welsch wrote:
"blah blah blah, maybe a potato?" while translating my Afrikaans.
Crikey! ain't life grand?
|
|
|
|
|
Thanks Paul
I'll try it out and see how it goes.
The man who smiles when things go wrong has thought of someone he can blame it on.
If you tell a man there are 300 billion stars in the universe, he'll believe you. But if you tell him a bench has just been painted, he'll have to touch it to be sure.
|
|
|
|
|
What happens when "global.asa" (classical ASP) and "global.asax" (ASP.NET) both resides in the same folder?
|
|
|
|