NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

<%@page import="java.sql.PreparedStatement"%>
<%@page import="paste.x.Mail"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="paste.x.DB"%>
<%@page import="org.apache.catalina.tribes.util.Arrays"%>
<%@page import="java.util.Map"%>
<%@page import="java.util.Iterator"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
DB db = new DB();

request.setCharacterEncoding("UTF-8");

String op = request.getParameter("op");

Map<String, String[]> params = request.getParameterMap();
Iterator<String> keys = params.keySet().iterator();

System.out.println("Yeni Request Geldi : ");
while (keys.hasNext())
{
String key = keys.next();
String val = Arrays.toString(params.get(key));

System.out.println(key+" --> "+val);
}


// Kullanıcı Kayıt İşlemi
if (op.equals("reg"))
{
String un = request.getParameter("un");
String pw = request.getParameter("pw");
String ad = request.getParameter("ad");

String sql = "insert into users values (0, '%s', '%s', '%s')";
sql = String.format(sql, un, pw, ad);

db.qWNR(sql);

}

// Kullanıcı Login İşlemi
if (op.equals("login"))
{
String un = request.getParameter("un");
String pw = request.getParameter("pw");

String sql = "select count(*) as 'cnt', id, un, ad from admins where un = '%s' and pw = '%s'";
sql = String.format(sql, un, pw);
System.out.println("SQL : "+sql);
ResultSet rs = db.qW1R(sql);
int cnt = rs.getInt("cnt");

if (cnt == 0)
{
db.close();
response.sendRedirect("index.jsp?msg=1");
}
else
{
int id = rs.getInt("id");
String ad = rs.getString("ad");
session.setAttribute("yid", id);
session.setAttribute("yad", ad);

response.sendRedirect("home.jsp");
}
}

// Kullanıcı Şifremi Unuttum İşlemi
if (op.equals("forget_pw"))
{
String un = request.getParameter("un");

String sql = "select count(*) as 'cnt', id, ad, un from admins where un = '"+un+"'";
ResultSet rs = db.qW1R(sql);

int res = rs.getInt("cnt");

if (res == 1)
{
int id = rs.getInt("id");
String ad = rs.getString("ad");
int seed = (int)(100000+Math.random() * 900000);
String newPw = "PaStEx-"+seed;

sql = "update users set pw = '"+newPw+"' where id = "+id;
db.qWNR(sql);

Mail.gonder(ad, newPw, un);
response.sendRedirect("index.jsp?msg=3");
}
else
{
response.sendRedirect("index.jsp?msg=4");
}
}

if (op.equals("del_post"))
{
String id = request.getParameter("id");

db.qWNR("delete from paylasimlar where id = "+id);

}

if (op.equals("add_content"))
{
/*
op --> {add_content}
tur --> {java}
gizlilik --> {2}
icerik --> {asdfcsd}
*/

String tur = request.getParameter("tur");
String gizlilik = request.getParameter("gizlilik");
String baslik = request.getParameter("baslik");
String icerik = request.getParameter("icerik");
String userId = session.getAttribute("yid")+"";



/*
| Field | Type | Null | Key | Default | Extra |
+------------+---------------------+------+-----+---------+----------------+
| id | bigint(20) unsigned | NO | PRI | NULL | auto_increment |
| user_id | int(11) | NO | | NULL | |
| tarih | datetime | NO | | NULL | |
| tur | varchar(255) | NO | | NULL | |
| baslik | varchar(255) | NO | | NULL | |
| icerik | longtext | NO | | NULL | |
| vote_cnt | int(11) | YES | | NULL | |
| vote_total | double(10,2) | YES | | NULL | |
| vote_score | double(10,2) | YES | | NULL | |
| gizlilik | varchar(255) | YES | | NULL | |
+------------+---------------------+------+-----+---------+----------------+

*/
String sql = "insert into paylasimlar values "+
"(0, ?, now(), ?, ?, ?, 0, 0, 0, ?)";

PreparedStatement ps = db.conn.prepareStatement(sql);
ps.setInt(1, new Integer(userId));
ps.setString(2, tur);
ps.setString(3, baslik);
ps.setString(4, icerik);
ps.setString(5, gizlilik);

ps.execute();
ps.close();

response.sendRedirect("ekle.jsp");
}

if (op.equals("add_vote"))
{
String id = request.getParameter("id");
String oy = request.getParameter("oy");

String sql = "update paylasimlar set vote_cnt = (vote_cnt + 1), vote_total = (vote_total + "+oy+"), vote_score = (vote_total / vote_cnt) where id = "+id;
db.qWNR(sql);
//out.println("<h1> IP : "+request.getRemoteAddr()+"</h1>");
response.sendRedirect("show.jsp?id="+id);
}


%>
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.