def user_status(self, id_user): a = db.query_select("select * from user where id_user = "******"") if a[10] == 0: stat = "Akiktif" elif a[10] == 1: stat = "Kena Blok" return stat
def view(): username = cherrypy.session.get('username') id_user = cherrypy.session.get('id_user') a = db.query_select("select * from user where id_user = "******"") return """ <div id="leftside"> <div class="user"> <img SRC="%s" width="44" height="44" class="hoverimg" alt="Avatar" /> <p>Selamat Datang:</p> <p class="admin">%s</p> <p class="userbtn"><a href="/admin/detil_admin" title="">Profile</a></p> <p class="userbtn"><a href="/libuser/logout" title="">Log out</a></p> </div> <div class="notifications"> <p class="notifycount"><a href="" title="" class="notifypop">10</a></p> <p><a href="" title="" class="notifypop">New Notifications</a></p> <p class="smltxt">(Click to open notifications)</p> </div> <ul id="nav"> <li> <a class="expanded heading">Awan</a> <ul class="navigation"> <li><a href="#" title="">Daftar Awan</a></li> <li><a href="#" title="">Daftar Pesanan Awan</a></li> <li><a href="#" title="">Buat Awan Baru</a></li> </ul> </li> <li> <a class="expanded heading">Pengguna</a> <ul class="navigation"> <li><a href="/admin/list_user" title="">Daftar Pengguna</a></li> <li><a href="#" title="">Daftarkan Pengguna Baru</a></li> <li><a href="#" title="">Pesan Dari Pengguna</a></li> </ul> </li> <li> <a class="expanded heading">Server</a> <ul class="navigation"> <li><a href="#" title="">Daftar Server</a></li> <li><a href="#" title="">Tambahkan Jenis Server</a></li> <li><a href="#" title="">Daftarkan Server Baru</a></li> </ul> </li> </ul> </div> """ % (a[7],username)
def view(): username = cherrypy.session.get('username') id_user = cherrypy.session.get('id_user') d = db.query_select("select * from user where id_user = "******"") return """ <div id="rightside"> <table > <tr><td>Nama</td><td>:</td><td>"""+d[3]+"""</td></tr> <tr><td>Email</td><td>:</td><td>"""+d[4]+"""</td></tr> <tr><td>No Telp</td><td>:</td><td>"""+d[5]+"""</td></tr> <tr><td>Alamat</td><td>:</td><td>"""+str(d[8])+"""</td></tr> <tr><td>Point</td><td>:</td><td>"""+str(d[9])+"""</td></tr> </table> <form action="/libuser/upload" method="POST" enctype="multipart/form-data"> <input type="hidden" name="id_user" value=\""""+str(id_user)+"""\">
def view(): username = cherrypy.session.get('username') id_user = cherrypy.session.get('id_user') a = db.query_select("select * from user where id_user = "******"") if a[7] == None: avatar = "/asset/img/avatar.png" else : avatar = a[7] return """ <div id="leftside"> <div class="user"> <img SRC="%s" width="44" height="44" class="hoverimg" alt="Avatar" /> <p>Masuk sebagai:</p> <p class="username">%s</p> <p class="userbtn"><a href="/user/detil_user" title="">Profile</a></p> <p class="userbtn"><a href="/libuser/logout" title="">Log out</a></p> </div> <div class="notifications"> <p class="notifycount"><a href="" title="" class="notifypop">10</a></p> <p><a href="" title="" class="notifypop">New Notifications</a></p> <p class="smltxt">(Click to open notifications)</p> </div> <ul id="nav"> <li> <a class="expanded heading">Aset Anda</a> <ul class="navigation"> <li><a href="#" title="">Daftar Aset Anda</a></li> <li><a href="#" title="">Buat Awan Baru</a></li> <li><a href="#" title="">Section link here</a></li> </ul> </ul> </div> """ % (avatar,username)
def checklogin(self,username=None,password=None): if username != '' and password != '': user = loader.setting.sanitize(username) pw = loader.setting.sanitize(password) enc_pass = loader.setting.hashing(pw) query = "select * from user where username like \"%s\" and password like \"%s\"" % (user,enc_pass) a = db.query_select(query) if a == None: raise cherrypy.HTTPRedirect('/user/login') elif a[6] == 0: cherrypy.session['id_user'] = a[0] cherrypy.session['username'] = a[1] cherrypy.session['level'] = '0' raise cherrypy.HTTPRedirect('/admin') elif a[6] == 1: cherrypy.session['id_user'] = a[0] cherrypy.session['username'] = a[1] cherrypy.session['level'] = '1' raise cherrypy.HTTPRedirect('/user') else: return query else: raise cherrypy.HTTPRedirect('/user/login')
def view(): a = db.query_select("select * from user where id_user not like 1", "all") data = "" for b in a: if b[6] == 0: clas = '<a href="#" class="notifypop"><span class="usagetxt redtxt">Administrator</span></a>' else: clas = '<a href="#" class="notifypop"><span class="usagetxt greentxt">Pengguna</span></a>' if b[10] == 0: stat = ( "<a href=\"#\" onclick=\"ngajax('status','" + str(b[0]) + '\')"><span class="usagetxt greentxt">Aktif</span></a>' ) else: stat = ( "<a href=\"#\" onclick=\"ngajax('status','" + str(b[0]) + '\')"><span class="usagetxt redtxt">Di Blok</span></a>' ) but = '<button class="btn">Edit</button> <button class="btn">Hapus</button>' data += ( "<tr><td>" + b[1] + "</td><td>" + b[3] + "</td><td>" + b[4] + "</td><td>" + b[5] + "</td><td>" + clas + '</td><td><button class="btn notifypop">' + str(b[9]) + "</button></td><td>" + stat + "</td><td>" + but + "</td></tr>" ) return ( """ <div id="rightside"> <div class="contentcontainer"> <div class="headings"> <h2>Pengguna yang terdaftar pada Mikail</h2> </div> <div class="contentbox"> <table widht="100%"> <tr><th>Username</th><th>Nama</th><th>Email</th><th>No Telp</th><th>Level</th><th>Point</th><th>Status</th><th>Aksi</th></tr> """ + data + """ </table> <div style="clear: both;"></div> </div> </div> <div class="notificationsbox" id="user_list"> <h4><span id="title"></span></h4> <ul> <li> <p id="isi"></p> </li> </ul> <p class="loadmore"></p> </div> </div> """ )