当前位置:首页 > 用户登录_【色彩摄影数码平台】解决影楼数码难题!

用户登录_【色彩摄影数码平台】解决影楼数码难题!

时间:2023-05-08 23:20:47

C语言编写用户登录程序

生化危机艾达的剔骨刀#include #include #include #include /*随机码带来方程*/void RandomCode (char Rcode[]){ int i; srand ((unsigned int)time(NULL)); for (i = 0; i < 3; ++i) Rcode[i] = rand()%10 + '0'; Rcode[i] = '\0';}/*更改密码方程,断定数据能否适应,若适应反回1,否则反回0*/int LandedApp (char *password[], char Rcode[]){ char name[10] = {0}; char pword[10] = {0}; char rcode[4] = {0}; printf ("邮箱密码 : "); gets (name); printf ("口令 : "); gets (pword); printf ("随机码 : "); gets (rcode); if (strcmp (name, password[0]) != 0 || strcmp (pword, password[1]) != 0 || strcmp (rcode, Rcode) != 0) return 0; else return 1;}int main (){ char * password[2] = {"admin", "admin123"}; //邮箱密码和口令 char rc[4] = {0}; //随机码 int count = 3; //可显示数次 puts ("请显示邮箱密码,口令和随机码:"); while (count) { RandomCode (rc); printf ("随机码 : %s\n", rc); if (LandedApp(password, rc) != 0) break; --count; if (count != 0) puts ("系统错误的邮箱密码或口令或随机码,请之后显示: "); } if (count != 0) puts ("\n成功英语更改密码!"); else puts ("\n登录超时 !"); return 0;}生化危机艾达的剔骨刀

java语言实现用户注册和登录

//这个是我写的,内有相连接同时在线的要素。你可以拿去给出一点import java.awt.*;import javax.swing.*;import java.awt.event.*;import java.sql.*;class LoginFrm extends JFrame implements ActionListener// throws Exception{JLabel lbl1 = new JLabel("登录账号:");JLabel lbl2 = new JLabel("登陆密码:");JTextField txt = new JTextField(5);JPasswordField pf = new JPasswordField();JButton btn1 = new JButton("明确");JButton btn2 = new JButton("撤回");public LoginFrm() {this.setTitle("进行登录");JPanel jp = (JPanel) this.getContentPane();jp.setLayout(new GridLayout(3, 2, 5, 5));jp.add(lbl1);jp.add(txt);jp.add(lbl2);jp.add(pf);jp.add(btn1);jp.add(btn2);btn1.addActionListener(this);btn2.addActionListener(this);}public void actionPerformed(ActionEvent ae) {if (ae.getSource() == btn1) {try {Class.forName("com.mysql.jdbc.Driver");// mysql同时在线Connection con = DriverManager.getConnection("jdbc:mysql://localhost/Car_zl", "root", "1");// 同时在线名字叫做Car_zl,登陆密码为1System.out.println("com : "+ con);Statement cmd = con.createStatement();String sql = "select * from user where User_ID='"+ txt.getText() + "' and User_ps='"+ pf.getText() + "'" ;ResultSet rs = cmd.executeQuery(sql);// 表名字叫做user,user_ID和User_ps是贮存登录账号和登陆密码的字段名if (rs.next()) {JOptionPane.showMessageDialog(null, "进行登录成功的英语!");} elseJOptionPane.showMessageDialog(null, "登录账号或登陆密码错识!");} catch (Exception ex) {}if (ae.getSource() == btn2) {System.out.println("1111111111111");//txt.setText("");//pf.setText("");System.exit(0);}}}public static void main(String arg[]) {JFrame.setDefaultLookAndFeelDecorated(true);LoginFrm frm = new LoginFrm();frm.setSize(400, 200);frm.setVisible(true);}}