<%@ Language=VBScript %> CMS Traffic Systems Ltd. - Traffic Solutions <% if session("userid1")="" then Response.Redirect "Login.asp?page=UploadProduct" end if Function ReplaceName(Name) Dim LeftStr , RightStr Dim SingleFound ,AtPlace AtPlace = InStr(1, Name, "'") If AtPlace > 0 Then SingleFound = True LeftStr = Left(Name, InStr(AtPlace, Name, "'") - 1) & "''" RightStr = Right(Name, Len(Name) - InStr(AtPlace, Name, "'")) While SingleFound = True If InStr(AtPlace + 1, Name, "'") > 0 Then LeftStr = LeftStr & Mid(Name, AtPlace + 1, InStr(AtPlace + 1, Name, "'") - AtPlace - 1) & "''" RightStr = Right(Name, Len(Name) - InStr(AtPlace + 1, Name, "'")) AtPlace = InStr(AtPlace + 1, Name, "'") SingleFound = True Else SingleFound = False End If Wend ReplaceName = LeftStr & RightStr Else ReplaceName = Name End If End Function %> <% set conn1 = Server.CreateObject("adodb.Connection") connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("tsl.mdb") conn1.open connstr mode=Request.QueryString("mode") if mode <>"" then cat_id=Request.QueryString("cat_id") prod_id=Request.QueryString("prod_id") prod_name=Request.Form("prod_name") prod_img=Request.Form("prod_img") prod_introduction=Request.Form("prod_introduction") prod_shortintro=Request.Form("prod_shortintro") prod_feature=Request.Form("prod_feature") prod_down=Request.Form("prod_down") prod_display=Request.QueryString("disp") end if if mode="Add" then if prod_display="Yes" then flag="Y" strsql="update product_mast set prod_homedisplay='No'" conn1.Execute strsql strsql="insert into product_mast(cat_id,prod_name,prod_img,prod_introduction,prod_shortintro,prod_feature,prod_downtech,prod_homedisplay" strsql=strsql&") values " strsql=strsql&"("&cat_id&","&"'"&ReplaceName(prod_name)&"','"&ReplaceName(prod_img)&"','"&ReplaceName(prod_introduction)&"','"&ReplaceName(prod_shortintro)&"','"&ReplaceName(prod_feature)&"','"&ReplaceName(prod_down)&"','"&ReplaceName(prod_display)&"')" else flag="Y" strsql="insert into product_mast(cat_id,prod_name,prod_img,prod_introduction,prod_shortintro,prod_feature,prod_downtech,prod_homedisplay" strsql=strsql&") values " strsql=strsql&"("&cat_id&","&"'"&ReplaceName(prod_name)&"','"&ReplaceName(prod_img)&"','"&ReplaceName(prod_introduction)&"','"&ReplaceName(prod_shortintro)&"','"&ReplaceName(prod_feature)&"','"&ReplaceName(prod_down)&"','"&prod_display&"')" end if end if if mode="Modify" then if prod_display="Yes" then flag="Y" flag="Y" strsql="update product_mast set prod_homedisplay='No'" conn1.Execute strsql strsql="update product_mast set prod_name='"&ReplaceName(prod_name)&"',prod_img='"&prod_img strsql=strsql&"',prod_introduction='"&ReplaceName(prod_introduction)&"',prod_shortintro='"&ReplaceName(prod_shortintro)&"',prod_feature='"&ReplaceName(prod_feature)&"',prod_downtech='"&ReplaceName(prod_down)&"',prod_homedisplay='"&prod_display strsql=strsql&"'" strsql=strsql&" where prod_id="&prod_id else flag="Y" strsql="update product_mast set prod_name='"&ReplaceName(prod_name)&"',prod_img='"&prod_img strsql=strsql&"',prod_introduction='"&ReplaceName(prod_introduction)&"',prod_shortintro='"&ReplaceName(prod_shortintro)&"',prod_feature='"&ReplaceName(prod_feature)&"',prod_downtech='"&ReplaceName(prod_down)&"',prod_homedisplay='"&prod_display strsql=strsql&"'" strsql=strsql&" where prod_id="&prod_id end if end if if mode="Delete" then flag="Y" strsql="Delete from product_mast where cat_id="&cat_id&" and prod_id="&prod_id end if if flag="Y" then conn1.Execute strsql end if %>
CMS Traffic - Administrator Console
Upload Product
Back to Admin page  
 
Catgeory Id

 

Catgeory
Product Id
Product Name
Product Image
Product Download
Product Introduction
Short Product Introduction
Product Features
Display on Home page <% 'set catrs=server.createobject("adodb.recordset") 'catsql="select A.prod_name, B.cat_name from product_mast as A, category_mast as B where A.cat_id=B.cat_id and A.prod_homedisplay='Yes'" 'catrs.Open catsql,conn1 'if not catrs.EOF then ' catrs.MoveFirst ' prd_nm=catrs("prod_name") ' cat_nm=catrs("cat_name") 'end if ' catrs.close ' response.write(""&prd_nm&" of category "&cat_nm&" is selected for home page") %>
 
<% if mode="Query" then cat_id=Request.QueryString("cat_id") set prodrs=server.createobject("adodb.recordset") prodquery="select * from product_mast where cat_id=" & cat_id prodrs.Open prodquery,conn1,3,3 if prodrs.RecordCount > 0 then if not prodrs.EOF then %> Select Product <% else Response.Write("No product found") end if end if %>