From: <jh...@us...> - 2008-09-15 20:06:15
|
Update of /cvsroot/aolserver/havardblog/www/admin In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv18580/www/admin Added Files: do_post.adp index.html post.adp Log Message: Initial import of Havard's Crappy Blog as seen at http://johnhavard.com/ --- NEW FILE: do_post.adp --- <% set title [ns_dbquotevalue [ns_queryget title]] set user [ns_dbquotevalue [ns_queryget username]] set pass [ns_dbquotevalue [ns_queryget password]] set date [ns_dbquotevalue [ns_queryget date]] set slug [ns_dbquotevalue [ns_queryget slug]] set lead [ns_dbquotevalue [ns_queryget lead]] set body [ns_dbquotevalue [ns_queryget body]] set qry "INSERT INTO ARTICLE VALUES ($slug, $date, now(), (SELECT ID FROM AUTHOR WHERE ID = $user and PASSWORD = $pass), $lead, $body, $title)" set hdl [ns_db gethandle pool1] if {[catch {ns_db dml $hdl $qry} res]} { ns_adp_puts "post probably failed, hit back and try again" ns_adp_puts "<pre>$res</pre> } else { ns_adp_puts "post was a success!" ns_adp_puts "<pre>$res</pre>" catch { set qry "SELECT ARTICLE.*,AUTHOR.PERSONAL_NAME FROM ARTICLE,AUTHOR WHERE AUTHOR.ID=ARTICLE.AUTHOR AND PUBDATE = ${date} AND SLUG = ${slug}" set res [ns_db 1row $hdl $qry] set slug [subst [ns_set get $res slug ]] set pubdate [subst [ns_set get $res pubdate]] set updated [subst [ns_set get $res updated]] set author [subst [ns_set get $res author ]] set title [subst [ns_set get $res title ]] set lead [subst [ns_set get $res lead ]] set body [subst [ns_set get $res body ]] set pubdate [string map {- /} $pubdate] nsv_set entries "/article/${pubdate}/${slug}/article.html" [list $slug $pubdate $updated $author $title $lead $body] ns_db releasehandle $hdl most_recent_articles 15 } } %> --- NEW FILE: index.html --- go away --- NEW FILE: post.adp --- <html> <head> <title>Post an article</title> </head> <body> <table> <form method="POST" action="do_post.adp"> <tr> <td>Title</td> <td><input name="title" size="80" value=""/></td> </tr> <tr> <td>username</td> <td><input name="username" value=""/></td> </tr> <tr> <td>password</td> <td><input type="password" name="password" value=""/></td> </tr> <tr> <td>date (YYYY/MM/DD)</td> <td><input name="date" value=""/></td> </tr> <tr> <td>slug</td> <td><input name="slug" value=""/></td> </tr> <tr> <td>lead</td> <td><textarea name="lead" cols="80" rows="5"></textarea> </tr> <tr> <td>body</td> <td><textarea name="body" cols="80" rows="12"></textarea> </tr> <tr> <td><input type="submit"></td> <td><input type="reset"></td> </tr> </form> </table> </body> </html> |