def send_usr_premission_lst(param):
    py_db.checkAccessCookie()
    py_db.checkuser(5,py_db.username)
    sqlstr = """
    SELECT 
t1.m_id,
t1.m_page_title ,


CASE
(SELECT t2.m_type_of_view 
FROM tbl_module_premission t2
WHERE t2.m_user_link = {0} AND t2.m_module_link= t1.`m_id`) 
WHEN 1 THEN "true"
ELSE "false"

END AS sss

FROM tbl_modules t1
        """.format( py_db.get_userID_from_uname(param) )
    rows = py_db.executeAndReturnRows(sqlstr)
    str = ""
    for row in rows:
        str = str+"::"+row[0].__str__()+"pp"+row[1].__str__()+"pp"+row[2].__str__()
    print 'Content-Type: text/html; charset=utf-8'
    print ''
    print str    
def sendusersum():
    py_db.checkAccessCookie()
    sqlstr = """
    SELECT COUNT(*) FROM  tbl_inbox WHERE `i_position`=1 AND `i_active_user_link`={0}
    
    """.format(py_db.user_id)
    row = py_db.executeAndReturnRows(sqlstr)
    
    print 'Content-Type: text/html; charset=utf-8'
    print ''
    print row[0][0]
def isItOkToErja(param3):
    py_db.checkAccessCookie()
    userID = py_db.user_id;
    sqlstr = """
    select i_position from tbl_inbox where i_letter_link = {0} and i_active_user_link={1} order by i_id desc limit 1
    """.format(param3,userID)
    rows = py_db.executeAndReturnRows(sqlstr)
    str = ""
    str = rows[0][0].__str__()
    print 'Content-Type: text/html; charset=utf-8'
    print ''
    print str
def updateusrprm(param,uid):
    py_db.checkAccessCookie()
    py_db.checkuser(5,py_db.username)
    __form = cgi.FieldStorage()
    sel_uid = py_db.get_userID_from_uname(uid)
    
    sd=param.split("bbb")
    py_db.executesql("delete from tbl_module_premission where m_user_link = "+sel_uid)
    for row in sd:
        s="3"
        if (row.split("=~")[1].__str__())== "true":s="1"
        py_db.executesql("""
                         insert into tbl_module_premission
                         (`m_module_link`,`m_user_link`,`m_type_of_view`)
                         values
                         ({0},{1},{2}) 
                         """.format(row.split("=~")[0].__str__(),
                                    sel_uid,s))
    print 'Content-Type: text/html; charset=utf-8'
    print ''
    print "1"      
Пример #5
0
#!c:/Python27/python.exe -u
# -*- coding: UTF-8 -*-
import MySQLdb
import cgi
import sys
import cgitb
import py_db
import py_convert_cgi_form_to_array_with_mapping
cgitb.enable()




py_db.checkAccessCookie()



print 'Content-Type: text/html; charset=utf-8'
print ''


db = py_db.GetDB()


form = cgi.FieldStorage()

dt=form.getvalue("id")
dm=form.getvalue("name")

if py_db.checkuser("10",py_db.username)[3]<>3:
    cur = db.cursor()
Пример #6
0
def logout():
    cookie = Cookie.SimpleCookie()
    cookie['uname'] = ""
    cookie['passs'] = ""
    print cookie
    print "Location: frm_login.html"
    exit



#############################################################
# this line checks security first #
# if unknown user detected then login page appears
#############################################################
if py_db.checkAccessCookie()==0:
    f=open('frm_login.html','r')
    htmlstr=""
    for line in f:
        htmlstr=htmlstr+line
### redirecting to LOGin PaGE  .    
    print 'Content-Type: text/html; charset=utf-8'
    print ''    
    print htmlstr
    exit()
###########################################################
# after true login it is to check module premission
#_________________________________________________________
form = cgi.FieldStorage()
moduleID=form.getvalue("mid","-1")
if moduleID=="--1":logout();