Created
April 14, 2021 15:15
-
-
Save Andy-Knight/c1021f5fd09fb45a52d95114b3eb183d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python | |
import cgi | |
import sqlite3 | |
conn=sqlite3.connect('/var/www/db/directory.db') | |
curs=conn.cursor() | |
print "Content-type:text/plain\n\n"; | |
form = cgi.FieldStorage() | |
querystring = form.getvalue("querystring") | |
if querystring != None: | |
queryval = "%" + querystring + "%" | |
select = "SELECT * FROM directory WHERE name LIKE '" + queryval + "'" | |
else: | |
select = "SELECT * FROM directory" | |
for row in curs.execute(select): | |
if len(row) == 4: | |
for item in row: | |
print item,'|' | |
print "#" | |
conn.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment