we are a small website company. I make the user interface of the website while my colleague develops the admin side in asp. The admin pages alow our client to change the text and images on certain pages like products, gallery etc. i want to study code examples of such admin pages so i can also learn to make them. can you tell me where i can find such admin code along with a simple explanation of the code working and logic? i hope my requirement is clear. please ask me to clarify if what i want is unclear. i can explain further with screenshots and our code if required.
janicefernandes 0 Newbie Poster
Dani AI
Generated
— a compact, repeatable pattern will make learning classic ASP admin pages much easier. is right that the code is usually specialized, so focus on a few core concerns: authentication/role checks, a paged list UI, a prefilled edit form, safe file uploads, and robust persistence (DB schema + optimistic concurrency). Generic "table editors" are a useful reference, but tailor forms to business rules (required fields, image sizes, publish workflow).
Suggested workflow and DB ideas: keep image metadata in its own table and store only the path/ID on product/gallery records; add ModifiedBy/ModifiedAt (or a rowversion/timestamp) to detect conflicts; show a preview before publish; and run edit/save inside simple server-side validation. For authentication use a server-side role check so admin pages reject access if the user is not authorized. Design the list page with search and pagination so admins can find items quickly.
Example: parameterized update with ADO.Command (classic ASP VBScript)
<%
Dim conn, cmd, sql
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open Application("ConnString")
sql = "UPDATE Products SET Title = ?, Description = ? WHERE ProductID = ?"
Set cmd = Server.CreateObject("ADODB.Command")
With cmd
.ActiveConnection = conn
.CommandText = sql
.CommandType = 1 ' adCmdText
.Parameters.Append .CreateParameter("pTitle", 200, 1, 255, Request.Form("Title"))
.Parameters.Append .CreateParameter("pDesc", 201, 1, 4000, Request.Form("Description"))
.Parameters.Append .CreateParameter("pId", 3, 1, , CLng(Request.Form("ProductID")))
.Execute
End With
conn.Close
Set cmd = Nothing
Set conn = Nothing
%> Cautions and troubleshooting: always use parameterized queries or stored procedures to avoid SQL injection; validate file type/size on server; rename uploads to unique names and store them outside the web root or behind a delivery script; set proper folder permissions; test on a staging site and keep backups. If you hit 500 errors, check NTFS/IIS permissions and correct paths first; if updates affect zero rows, verify your WHERE clause/optimistic-concurrency fields.
mellamokb 8 Light Poster
Hi janicefernandes,
Admin code is not really anything "special," perse. Your admin site is probably going to be pretty specialized, at best. What you can search for is how to make the admin site protected so people who aren't supposed to access it can't. One method of achieving this is to have an admin login page that sets a Session variable, like 'admin_login', that can be used to identify whether or not a user should have access to a particular admin page.
Examples of logging in code can be found at http://www.asp101.com/samples/login.asp.
For the actual admin site, it's just a matter of writing HTML and ASP that accomplish changing the text and pictures in the gallery. You would need to have everything you want to be able to change to be in the database. Then simply pull a list of products or whatever out of the database and let the admin user click on one. Then list the fields and their values, and let the admin user change their values and click "Save," which should then run a query to update the table. Or even provide a form to add a new record that inserts into a table with a query.
Here are some example websites that talk about a database editing project:
http://www.4guysfromrolla.com/webtech/110999-1.shtml
http://www.2enetworx.com/dev/projects/tableeditor.asp
http://sourceforge.net/projects/ute-asp/
These projects probably have a single page that does all the work, taking QueryString parameters to identify the table that should be edited so that the code automatically determines field names and automatically builds forms and such. If you want the admin to be prettier or have specific features or fields disabled or such, you would want to build your own code, but you could use some of the scripts from the websites listed above perhaps as a starting point.
~ mellamokb
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.