diff options
| author | jules <jules@okfoc.us> | 2014-02-02 18:58:46 -0500 |
|---|---|---|
| committer | jules <jules@okfoc.us> | 2014-02-02 18:58:46 -0500 |
| commit | b125e3106727e0acb627f17f4de0a1c3a1cf6f49 (patch) | |
| tree | 36a2be85ac7ee402cd78fe9d53e4dc7da8d9c023 /cgi-bin/save | |
| parent | c1e6c0c182102e5d61a8ac26b403b42c5fd40591 (diff) | |
| parent | 2c0ddba2dab715a7c81a106edcfdd9f5be0592a2 (diff) | |
Merge branch 'master' into pepper
Diffstat (limited to 'cgi-bin/save')
| -rwxr-xr-x | cgi-bin/save | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/cgi-bin/save b/cgi-bin/save index f6b0498..2bfb8c2 100755 --- a/cgi-bin/save +++ b/cgi-bin/save @@ -53,7 +53,7 @@ def strip_querystring(url): p = re.compile('^[^\?]*') return p.findall(url)[0] -def store_shader_in_db(script, shader_id=False, image_url="",username=""): +def store_shader_in_db(script, shader_id=False, image_url="",username="",name="",width="0",height="0"): conn = MySQLdb.connect(host= "127.0.0.1", user="asdfus", @@ -66,8 +66,8 @@ def store_shader_in_db(script, shader_id=False, image_url="",username=""): shader_id = conn.insert_id() conn.commit() - x.execute("""INSERT INTO shaders (script, image_url, username, time, shader_id) values (%s,%s,%s,%s,%s)""" , - (script, image_url, username, NOW, shader_id) + x.execute("""INSERT INTO shaders (script, image_url, username, name, remote_addr, time, shader_id, width, height) values (%s,%s,%s,%s,%s,%s,%s,%s,%s)""" , + (script, image_url, username, name, REMOTE_IP, NOW, shader_id, width, height) ); last_id = conn.insert_id() conn.commit() @@ -84,7 +84,7 @@ def main(): cgitb.enable() limit_test = check_limits(API_NAME, MAX_INTERVAL, REQUEST_LIMIT, REMOTE_IP, NOW) if limit_test: return error("You have exceeded the maximum number of requests, try again in %s seconds" % limit_test); - #form should contain script, shader_id, username, image_url + #form should contain script, shader_id, username, name, image_url form = cgi.FieldStorage(keep_blank_values=1) if 'script' not in form or not form['script']: error( 'script not found') @@ -97,9 +97,13 @@ def main(): error("Cannot save this shader:%s" % test_failure) shader_version_id = store_shader_in_db( - form['script'].value, form['shader_id'].value, + form['script'].value, + form['shader_id'].value, image_url, - form['username'].value); + form['username'].value, + form['name'].value, + form['width'].value, + form['height'].value); if not shader_version_id: error('DB Error') else: |
