Register for your free account! | Forgot your password?

You last visited: Today at 21:48

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[PHP/OOP]Release/Tutorial Registration

Discussion on [PHP/OOP]Release/Tutorial Registration within the Metin2 PServer Guides & Strategies forum part of the Metin2 Private Server category.

Reply
 
Old   #1

 
iKyroja :>'s Avatar
 
elite*gold: 20
Join Date: May 2010
Posts: 2,792
Received Thanks: 1,988
Cool [PHP/OOP]Release/Tutorial Registration

Hayho, Elitepvpers.

Ihr schwirren zwar einige Registrations Tutorials etc. herrum, die auf das Standart PHP basieren,
deshalb zeige ich euch heute bzw. stelle ich euch heute eine einfache Registartion zu verfügung
die mit PHP OOP gecodet ist, wer fragen zu dem script hat schreibt sie als kommentar.
ich werde es dan beantworten und wem es nicht gefällt soll ALT+F4 drücken.

register.class.php:
PHP Code:
<?php
define
('SQL_HOST','localhost'); // <- Hier die IP-Adresse der Datenbank eintragen
define('SQL_USER','root');        // <- Hier den Datenbank-User eintagen
define('SQL_PASS','');            // <- Hier das Datenbank Passwort eintragen

$sqlCon mysql_connect(SQL_HOST,SQL_USER,SQL_PASS) or die ('MYSQL CONNECTION FAILED');

class 
Registration {
    private 
$login;
    private 
$password;
    private 
$email;
    private 
$rl_name;
    private 
$social_id;
    private 
$question1;
    private 
$answer1;
    
    public function 
__construct() {
        
$this->login      mysql_real_escape_string($_POST['login']);
        
$this->password  mysql_real_escape_string($_POST['password']);
        
$this->email     mysql_real_escape_string($_POST['email']);
        
$this->rl_name      mysql_real_escape_string($_POST['rl_name']);
        
$this->social_id mysql_real_escape_string($_POST['social_id']);
        
$this->question1 mysql_real_escape_string($_POST['question1']);
        
$this->answer1   mysql_real_escape_string($_POST['answer1']);
    }
    
    public function 
insertsql() {
        
$sqlInsert mysql_query("INSERT INTO
                                  account.account
                                  (login,password,email,real_name,social_id,question1,answer1)
                                  VALUES
                                  ('
$this->login',PASSWORD('$this->password'),'$this->email','$this->rl_name','$this->social_id','$this->question1','$this->answer1')");
        if(
$sqlInsert) {
            return 
true;
        } else {
            return 
false;
        }
                                                                    
    }
    
    public function 
checkUser() {
        
$checkId mysql_num_rows(mysql_query("SELECT login FROM account.account WHERE login = '$this->login'"));
        if(
$checkId  == 0) {
            return 
true;
        } else {
            return 
false;
        }
        
    }
    
    public function 
process() {
        if(!empty(
$this->login) && !empty($this->password) && !empty($this->email) && !empty($this->rl_name) && !empty($this->social_id) && !empty($this->question1) && !empty($this->answer1)) {
            if(
$this->checkUser()) {
                if(
$this->insertsql()) {
                    echo 
'<div id="succes">SUCCES: Du hast erfolgreich den Account <i>"'.$this->login.'"</i> erstellt</div>';
                } else {
                    echo 
'<div id="error">ERROR: FATAL MYSQL ERROR</div> </ br>'.mysql_error();
                }
                
                
            } else {
                echo 
'<div id="error">ERROR: Der Account existiert bereits</div>';
            }
        } else {
            echo 
'<div id="error">ERROR: Es sind nicht alle Felder ausgefüllt</div>';
        }
        
    }
    
}
    
?>
register.php
PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Registartion Script</title>
</head>
<style type="text/css">
#error {
    background:#ab7b7b;
    margin:0 auto;
    padding:7px;
    width:550px;
    border:solid 1px #cb0d0d;
    color:#000;
}
#succes {
    background:#a0ab7b;
    margin:0 auto;
    padding:7px;
    width:550px;
    border:solid 1px #9ecb0d;
    color:#000;
}
</style>
<body>
<?php
$question 
= array(
                    
'1'=>'Name deiner Mutter ?',
                    
'2'=>'Name deines Vaters ?',
                    
'2'=>'Name deines Hundes ?'
                  
);
if(isset(
$_POST['submit']) && $_POST['submit'] == 'Anmelden') {
    include_once(
'class/register.class.php');
    
$registration = new Registration;
    
$registration->process();
}
?>
<form action="register.php" method="post">
<table width="500" border="0" align="center" style="margin-top:10px;">
  <tr>
    <td width="147" align="right">AccountID:</td>
    <td width="343"><input type="text" name="login" /></td>
  </tr>
   <tr>
    <td width="147" align="right">Passwort:</td>
    <td width="343"><input type="password" name="password" /></td>
  </tr>
   <tr>
    <td width="147" align="right">Email:</td>
    <td width="343"><input type="text" name="email" /></td>
  </tr>
   <tr>
    <td width="147" align="right">Name:</td>
    <td width="343"><input type="text" name="rl_name" /></td>
  </tr>
   <tr>
    <td width="147" align="right">Löschcode:</td>
    <td width="343"><input type="text" name="social_id" /></td>
  </tr>
   <tr>
    <td width="147" align="right">Sicherheitsfrage:</td>
    <td width="343">
        <select name="question1" style="width:142px;">
            <?php
                
foreach($question as $id => $frage) {
                    echo 
'<option value="'.$id.'">'.$frage.'</option>';
                }
            
?>
        </select>
    </td>
  </tr>
   <tr>
    <td width="147" align="right">Antwort:</td>
    <td width="343"><input type="text" name="answer1" /></td>
  </tr>
   <tr>
    <td colspan="2"><center><input type="submit" name="submit" value="Anmelden" /></center></td>
  </tr>
</table>
</form>

</body>
</html>
! Ich habe es gestet und geschreiben, es funktioniert auch ^^
iKyroja :> is offline  
Thanks
7 Users
Reply


Similar Threads Similar Threads
Web Registration shaiya pserver VID TUTORIAL
11/05/2011 - Shaiya Private Server - 0 Replies
i do not own this video i take no credit , credits goes to ToMiK . Here is a video tutorial showind how to do a registration page for pserver . http://www.youtube.com/watch?v=DzvgHzOSKtY dont ask me question if u get error plz i dont know how to fix those .
[TUTORIAL]Korean S4 League registration & download
11/21/2010 - S4 League - 309 Replies
WARNING: This guide will allow to make a temporary TRIAL account (for 30 days). For the permanent guide (but it's more difficult) this is the link: http://www.elitepvpers.com/forum/s4-league/290579- tutorial-pmang-korean-s4league-permanent-registrat ion-download.html Traducción en español: asdas? QWERTY =D: descargar y poder jugar el s4 koreano (Thanks to miziful for translating from english to spanish)
Suche Tutorial (PHP,SQL und HTML Registration)
11/16/2010 - Web Development - 6 Replies
CLOSED
Tutorial Newlongju leichte Registration
03/08/2009 - Metin2 Private Server - 4 Replies
Wie ich sehe haben viele mühe mit dem Captcha, das ist unnötig. Viele wissen nicht, das man es auch einfacher machen kann. Schritt 1. Inet Explorer 7 auf Sprachtools Schritt 2. Die Registration Seite übersetzen. Schritt 3. Name: 5 Buchstaben 3 Nummern Passwort: 1 Grossbuchstabe 4 kleine 2 zahlen Ausweisnummer. 18 Buchstaben ohne 0 Frage aussuchen, da irgendwas reinschreiben Schritt 4. Captcha auslassen und den Besätigungsknopf drücken.



All times are GMT +1. The time now is 21:51.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.