rohithreddyk Posted May 26, 2009 Share Posted May 26, 2009 hi..im building a website based on PHP as part of my curriculum..it is for an academic department.. first page contains a list of courses offered(as hyperlinks)...each course contains an access key.. When student clicks on any course new page lists all the assignments given for that course. when student clicks on assignment new page displays assignment problem and a "view grades & key " button..when student clicks on view grade button he should be prompted for accesskey... at present im doing it using javascript.. I have a hidden variable(ackey) in the form..$ackey is obtained from databse using a query <input type="hidden" value="<?php print($ackey);?>" name="ackey" id="ackey"> and in javascript.. function checkkey(){ var accesskey=document.getElementById('ackey').value; var access=prompt("Please enter access Key",""); if(accesskey==access){ return true; } else{ alert('Wrong access key'); return false; } } so as per now all is well..........but i hav read many places that javascript is not that secure and it can be easily compromised...so I am wondering if there is any way to do this without using javascript...and the requirement is clear.."there should be a prompt box" Link to comment https://forums.phpfreaks.com/topic/159634-is-there-a-prompt-box-in-php/ Share on other sites More sharing options...
lonewolf217 Posted May 26, 2009 Share Posted May 26, 2009 inputs are "hidden" from the form but can still be seen when right clicking and View Source, so it would not be a good place to put anything meant to be secure Link to comment https://forums.phpfreaks.com/topic/159634-is-there-a-prompt-box-in-php/#findComment-841996 Share on other sites More sharing options...
rohithreddyk Posted May 26, 2009 Author Share Posted May 26, 2009 yeah..forgot to mention that in the post....wanted to ask for a solution for that problem also...... do you think of any possible solution for that Link to comment https://forums.phpfreaks.com/topic/159634-is-there-a-prompt-box-in-php/#findComment-841998 Share on other sites More sharing options...
trq Posted May 26, 2009 Share Posted May 26, 2009 Seeing as php runs on the server, there is no logical way it can interact with a browser. Link to comment https://forums.phpfreaks.com/topic/159634-is-there-a-prompt-box-in-php/#findComment-842131 Share on other sites More sharing options...
rohithreddyk Posted May 26, 2009 Author Share Posted May 26, 2009 thanks..So it means there is no way but to use javascript? and what can I do regarding "hidden" element in the form..is there any other way to send the accesskey to javascript prompt box? thanks in advance Link to comment https://forums.phpfreaks.com/topic/159634-is-there-a-prompt-box-in-php/#findComment-842511 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.