V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
older
V2EX  ›  程序员

看看以前的同事写的代码

  •  
  •   older · 2013-07-05 14:18:18 +08:00 · 5782 次点击
    这是一个创建于 3919 天前的主题,其中的信息可能已经有所发展或是发生改变。
    <!--#include file="header.asp" -->
    <div id="content">
    <MARQUEE onmouseover=this.stop() onmouseout=this.start() scrollAmount=1 direction=up width=1 height=1 delay="1">
    <div class="content-top"><img src="images/content-top.jpg" width="938" height="4" /></div>
    <div class="content-zhong">
    <div class="con-left">
    <p class="font">About us</p>
    <p class="neirong"><%=left(rs4("eabout"),600)%>...</p>
    <p class="font">Products Categories</p>
    <div style="margin-top:10px; padding-left:20px;">
    <% set rs=server.CreateObject("adodb.recordset")
    sql="select * from product where audit=1 order by id desc"
    rs.open sql,conn,1,3%>
    <%
    do while not rs.eof
    %>
    <p style="width:106px; float:left; padding:5px; line-height:34px; height:130px; background:url(images/cp-bg.jpg) no-repeat;">
    <span><a href="products.asp?sort_id=<%=rs("sort_id")%>"><img src="../pic/<%=rs("pic")%>" width="96" height="88" border="0"/></a></span><br />
    <a style="color:#000;" href="products.asp?sort_id=<%=rs("sort_id")%>"><%=rs("ecpmc")%></a></p>
    <%
    rs.movenext
    loop
    rs.close
    %>
    </div>

    </div>
    <div class="con-right">
    <!--#include file="right.asp" -->
    </div>

    <div class="content-buttom"><img src="images/content-buttom.jpg" width="938" height="4" /></div>
    </div>
    <!--#include file="footer.asp" -->
    </body>
    </html>
    48 条回复    1970-01-01 08:00:00 +08:00
    d0a1ccec
        1
    d0a1ccec  
       2013-07-05 14:22:02 +08:00
    我和我的小伙伴们都惊呆了.asp
    66beta
        2
    66beta  
       2013-07-05 14:27:48 +08:00
    玩asp的就这水平了,当年我也这样,~~呵呵呵呵呵
    thinkif
        3
    thinkif  
       2013-07-05 14:28:04 +08:00
    这得看是多久以前。。。
    refresh
        4
    refresh  
       2013-07-05 14:29:05 +08:00
    asp居然还在人间
    yibin001
        5
    yibin001  
       2013-07-05 14:32:50 +08:00
    我和我的小伙伴们都惊呆了
    Ricepig
        6
    Ricepig  
       2013-07-05 14:34:06 +08:00
    写的不错,快速直接满足需求,哈哈
    solo7net
        7
    solo7net  
       2013-07-05 14:34:34 +08:00
    asp亮了
    older
        8
    older  
    OP
       2013-07-05 14:34:48 +08:00
    很难想象他当时是在什么状态写下这样的代码
    Feobe
        9
    Feobe  
       2013-07-05 14:41:02 +08:00
    这是几年前的代码了?
    四五年前的话,勉强情有可原。
    takwai
        10
    takwai  
       2013-07-05 14:42:06 +08:00
    当年写的ASP,不都是差不多一样嘛。
    timothyye
        11
    timothyye  
       2013-07-05 15:21:50 +08:00
    ASP.... 古董级别的代码了
    ninjai
        12
    ninjai  
       2013-07-05 15:29:14 +08:00
    没看出来多大问题,asp就这样了
    fangzhzh
        13
    fangzhzh  
       2013-07-05 15:30:49 +08:00
    我是web外行, 但是:
    1 我在网页里看到了select *, 难道不是 写select* 都要拖出去TJJTDS吗?

    2 逐条操作的代码, 这页面, 估计sql server经不起上千的访问
    CoX
        14
    CoX  
       2013-07-05 15:37:16 +08:00
    看到这个,忍不住贴下我们公司官方网站的一个文件,忍不住想给重写了

    http://gist.github.com/bjjay/41bfd1aa8b3a77f7b345.js
    CoX
        15
    CoX  
       2013-07-05 15:37:45 +08:00   ❤️ 1
    CoX
        16
    CoX  
       2013-07-05 15:38:02 +08:00
    yibin001
        17
    yibin001  
       2013-07-05 15:38:31 +08:00
    CoX
        18
    CoX  
       2013-07-05 15:38:34 +08:00
    yibin001
        19
    yibin001  
       2013-07-05 15:38:53 +08:00
    呃。。本想帮一下楼上。。。结果发现我也不会。。
    @CoX
    CoX
        20
    CoX  
       2013-07-05 15:40:19 +08:00
    又不会帖gist的代码了,不折腾了
    CoX
        21
    CoX  
       2013-07-05 15:41:47 +08:00
    @yibin001 呵呵,很久以前帖成功过,现在又不记得了
    subpo
        22
    subpo  
       2013-07-05 15:43:49 +08:00
    Hyperion
        23
    Hyperion  
       2013-07-05 15:44:26 +08:00
    看到"MARQUEE", 我就颤抖了... 这是啥年代的标签了...
    yibin001
        24
    yibin001  
       2013-07-05 15:44:49 +08:00
    @CoX
    是不是因为这个gist是私有的原因?我看文件名是一个hash值啊
    refresh
        25
    refresh  
       2013-07-05 15:53:59 +08:00 via iPad
    @CoX 牛逼的代码
    binjoo
        26
    binjoo  
       2013-07-05 16:20:32 +08:00
    凑合着用吧。
    Sunyanzi
        27
    Sunyanzi  
       2013-07-05 16:31:39 +08:00
    顶楼的 ASP 没有任何问题 ..? 换言之 ... 如果不这么写还能怎么写 ..?

    那段 js 虽然难看点 ... 但感觉问题也不大 ...

    能用 ... 效率不低 ... 且重构复杂 ... 只是无法维护罢了 ...
    manoon
        28
    manoon  
       2013-07-05 16:50:32 +08:00
    很有我的风格,一直这样写,从未被超越
    现在不知道,反正对于ASP来说,以前。
    很少会有MVC相关的概念,也没有一些简单易用类似于SMARTY之类的框架。
    workaholic
        29
    workaholic  
       2013-07-05 17:00:29 +08:00
    我和我的小伙伴们都惊呆了
    CoX
        30
    CoX  
       2013-07-05 17:32:14 +08:00
    @yibin001 不是私有gist,可以直接查看的啊

    @refresh 我估计我们公司这个官网是找某个个人做的,具体做了多久不知道了。我贴的那堆代码就是为了实现在一个表里做个简单查询。另外,整个数据库的表设计的是一塌糊涂。公司想让改版,我就建议重写。
    sarices
        31
    sarices  
       2013-07-05 17:33:27 +08:00
    asp不是这样写的,我当年是用jscript写asp,然后用xsl做模板 ,封装好类库,尽量用MVC结构实现,这样后面接手的根据文档能很方便修改。
    raptor
        32
    raptor  
       2013-07-05 17:58:01 +08:00
    不错了。我以前同事写过用拼音首字母缩写做变量名的…比如:时间是SJ…
    icoder
        33
    icoder  
       2013-07-05 18:00:15 +08:00
    代码咋样无所谓的,运行没毛病就行了
    hellmash
        34
    hellmash  
       2013-07-05 18:10:55 +08:00
    看到这段代码就想起00年用asp做基于exchange5.5的公文流转,那时候多羡慕那些基于LotusNotes/Domino做的公文流转
    VYSE
        35
    VYSE  
       2013-07-05 18:16:47 +08:00
    asp页面这样再正常不过,嘲笑早期开发者的工作想想以后会不会有人嘲笑现在人的工作
    qingfeng
        36
    qingfeng  
       2013-07-05 18:50:58 +08:00
    quick and dirty风格,我喜欢!
    013231
        37
    013231  
       2013-07-05 19:01:45 +08:00
    @CoX V2EX只能貼Public Gist, 你那個是Secret Gist. 創建一個Gist時底下有兩個按鈕可選的.
    haichong520
        38
    haichong520  
       2013-07-05 20:13:41 +08:00
    Beautiful Code
    holy_sin
        39
    holy_sin  
       2013-07-05 20:24:18 +08:00
    好恶心啊
    wtser
        40
    wtser  
       2013-07-05 20:42:41 +08:00
    强迫症来了,想重构的冲动!!!
    infong
        41
    infong  
       2013-07-05 22:24:40 +08:00
    好喜欢这样的风格。XD。
    Kvm
        42
    Kvm  
       2013-07-06 04:45:26 +08:00
    10年前php也基本这个样吧
    ASP的MVC概念还没起来就已经被抛弃了。。。
    看到过ASP写得很好的,但是局限于ASP本身的问题最后也随波逐流了。。。。。
    Perry
        43
    Perry  
       2013-07-06 06:36:47 +08:00 via iPhone
    Perry
        44
    Perry  
       2013-07-06 06:37:24 +08:00 via iPhone
    daoluan
        45
    daoluan  
       2013-07-06 11:49:20 +08:00
    恩,小伙伴们都惊呆了。
    xdeng
        46
    xdeng  
       2013-07-06 12:18:50 +08:00
    楼主敢 秀你自己的代码么??? 再怎么完美也会有人吐槽的
    older
        47
    older  
    OP
       2013-07-06 15:29:47 +08:00
    @xdeng
    <!--#INCLUDE FILE="inc/conn.asp"-->
    <!--#INCLUDE FILE="inc/sub.asp"-->
    <!--#INCLUDE FILE="inc/companyData.asp"-->
    <!--#INCLUDE FILE="inc/Xdownpage.asp"-->
    <%
    language = "cn"

    productsPartID = request("ProductsPartID")
    dim strSql , strWhere, strTitle
    strSql = " SELECT Productsid,pics,pic,ProductsText,ProductsName,ProductsPartID FROM RF_Products WHERE DisplayLevel > 0 AND productsName <> '' "

    if productsPartID <> "" then ' 类别ID是否为空
    ProductsPartID = clng(productsPartID)
    StrSqlPart="select ProductsPartName from RF_ProductsPart where ProductsPartID= " & ProductsPartID
    Set rsPart=conn.execute(StrSqlPart)
    strTitle = rsPart("ProductsPartName")
    else
    ProductsPartID = 0
    strTitle = "产品展示"
    end if
    if request("q") <> "" then '搜索关键字不空
    strWhere=" AND ProductsName like '%"&request("q")&"%' OR ProductsText like '%"&request("q")&"%'"
    end if
    if ProductsPartID <> 0 then strWhere = strWhere &" AND ProductsPartID ="&ProductsPartID
    strSql = strSql & strWhere & " order by DisplayLevel DESC , ProductsName ASC"
    'Response.Write(strSql)

    if sm ="" then
    sm=0
    else
    sm=sm-1
    end if

    %>
    <!DOCTYPE HTML>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title><%=strTitle%>--<%=WebTitle%></title>
    <META name="description" content="<%=Description%>">
    <meta name="keywords" content="<%=Keywords%>">
    <link rel="stylesheet" type="text/css" href="css/_main.css"/>
    <!--二级菜单-->
    <script type="text/javascript" src="js/subMenu.js"></script>
    </head>

    <body>
    <!--#INCLUDE FILE="inc_header.asp"-->
    <div class="wrap">
    <div class="side">
    <ul class="sideMenu">
    <%=productClassNavBig (language,productsPartID) %>
    </ul>
    </div>
    <div class="content">
    <div class="content-head"><a href="index.asp">首页</a><span>>></span><a href="productIndex.asp">产品中心</a><span>>></span><%=strTitle%></div>

    <ul class="productList">
    <%
    Set mypage=new xdownpage '创建对象
    mypage.getconn=conn '得到数据库连接

    mypage.getsql=strSql
    mypage.pagesize=15 '设置每一页的记录条数据为5条
    set rs=mypage.getrs() '返回Recordset

    for i=1 to mypage.pagesize '接下来的操作就和操作一个普通Recordset对象一样操作
    if not rs.eof then '这个标记是为了防止最后一页的溢出
    response.write"<li><a href=""ProductShow.asp?ProductsPartID="&rs("ProductsPartID")&"&sm="&sm+1&"&ProductsID="&rs("Productsid")&""" target=""_blank"" ><img src=""pics/"&rs("pics")&""" alt="""&rs("ProductsName")&""" /></a><dl><dt><a href=""ProductShow.asp?ProductsPartID="&rs("ProductsPartID")&"&sm="&sm&"&ProductsID="&rs("Productsid")&""" target=""_blank"" >"&rs("ProductsName")&"</a></dt></dl></li>"& chr(10)

    rs.movenext
    else
    exit for
    end if
    next
    %>
    </ul>
    <div class="cb pl20">
    <%
    mypage.showpage()
    %>
    </div>

    </div>
    </div>
    <!--#INCLUDE FILE="inc_footer.asp"-->
    </body>
    </html>
    xdeng
        48
    xdeng  
       2013-07-06 15:41:45 +08:00
    @older 其实我我看不懂。。。。^o^
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1106 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 18:50 · PVG 02:50 · LAX 11:50 · JFK 14:50
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.