<%@ Language=VBScript %> CMS Traffic Systems Ltd. - Traffic Solutions <% if session("userid1")="" then Response.Redirect "Login.asp?page=uploadnews" 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") news_head=Request.Form("news_head") news_shorttxt=Request.Form("news_short") 'news_shorttxt=replace(news_shorttxt,"'","/") news_text=Request.Form("news_matter") 'news_text=replace(news_text,"'","/") news_img=Request.Form("news_img") news_flag=Request.Form("display") 'Response.Write(prod_display) end if if mode="Add" then flag="Y" strsql="insert into news_mast(news_head,news_shorttxt,news_text,news_img,news_flag" strsql=strsql&") values " strsql=strsql&"('"&ReplaceName(news_head)&"',"&"'"&ReplaceName(news_shorttxt)&"','"&ReplaceName(news_text)&"','"&news_img&"','"&news_flag&"')" end if if mode="Modify" then flag="Y" strsql="update news_mast set news_head='"&ReplaceName(news_head)&"',news_shorttxt='"&ReplaceName(news_shorttxt) strsql=strsql&"',news_text='"&ReplaceName(news_text)&"',news_img='"&news_img&"',news_flag='"&news_flag strsql=strsql&"'" strsql=strsql&" where cat_id="&cat_id end if if mode="Delete" then flag="Y" strsql="Delete from news_mast where cat_id="&cat_id end if if flag="Y" then conn1.Execute strsql end if %>
CMS Traffic - Administrator Console
Upload News
Back to Admin page  
 
News Heading

 

News Short Matter
News Matter
News Image
News Display
 
<% if mode="Query" then 'cat_id=Request.QueryString("cat_id") set prodrs=server.createobject("adodb.recordset") prodquery="select * from news_mast" prodrs.Open prodquery,conn1,3,3 if prodrs.RecordCount > 0 then if not prodrs.EOF then %> Select News <% else Response.Write("No product found") end if end if %>