Forked from anonymous/gist:2f65ffc69fec954555a7ec759b715836
Last active
July 10, 2016 02:58
-
-
Save sigmaprojects/6fde582502cfedde31dd76e076c990b7 to your computer and use it in GitHub Desktop.
2 minute poc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
function boolean is_authorized(username, password) { | |
if(username == "admin" && password == "password"){ | |
return true; | |
} | |
else | |
return false; | |
} | |
function deleteRecord(id) { | |
// delete query | |
} | |
function updateRecord(id,firstname,lastname,location) { | |
// update query | |
} | |
function createRecord(firstname,lastname,location) { | |
// create query | |
} | |
param name="action" default=""; | |
switch(action) { | |
case "update": | |
updateRecord(argumentCollection=form); | |
break; | |
case "delete": | |
updateRecord(argumentCollection=url); | |
break; | |
case "create": | |
// TODO | |
break; | |
default: | |
// do nothing | |
break; | |
} | |
</cfscript> | |
<html> | |
<head> | |
</head> | |
<body> | |
<table> | |
<tr> | |
<th>ID</th> | |
<th>First</th> | |
<th>Last</th> | |
<th>Location</th> | |
</tr> | |
<cfif is_authorized("admin", "password")> | |
<cfquery name="showAll" datasource="accounts"> | |
SELECT id,firstname,lastname FROM proctors | |
</cfquery> | |
<cfoutput query="showall"> | |
<form method="post" action="file.cfm?action=update"> | |
<input type="hidden" name="id" value="#id#" /> | |
<tr> | |
<td>#id#</td> <td><input type="text" name="firstname" value="#firstname#" /></td> <td> <input type="text" name="lastname" value="#lastname#" /></td> | |
<td><select name="location"> | |
<option value="Seattle">Seattle</option> | |
<option value="New York">New York</option> | |
</select></td> | |
<td><a href="file.cfm?action=delete&id=#URLEncodedFormat(id)#">Delete</a></td> | |
<td><button type="submit">Update</button></td> | |
</tr> | |
</form> | |
</cfoutput> | |
</cfif> | |
</table> | |
New Record <!--- make a form or something ---> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment