The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Auto account PHP web
Author Message
Ultima One
Journeyman
*

Posts: 238
Likes Given: 7
Likes Received: 10 in 6 posts
Joined: Jan 2013
Reputation: 6

Ultima One

Post: #8
RE: Auto account PHP web
change sphere_serv_trigs.scp to contain this:

Code:
// Update accounts from database
[function f_acc_update]
if ( <DB.connected> )
    DB.QUERY "SELECT * FROM accounts WHERE status='0'"
    if (<DB.ROW.NUMROWS> > 0)
        for R 0 <eval <DB.ROW.NUMROWS>-1>
            serv.account add <DB.ROW.<eval <LOCAL.R>>.login> <DB.ROW.<eval <LOCAL.R>>.password>
            DB.EXECUTE "UPDATE accounts SET status='1' WHERE login='<DB.ROW.<eval <LOCAL.R>>.login>'"
            serv.log MySQL Debug: #<eval <LOCAL.R>> Account <DB.ROW.<eval <LOCAL.R>>.login> has been created!
        end
    endif
endif


[FUNCTION f_onserver_timer]
serv.f_acc_update
ACCOUNT.UPDATE

In Sphere.ini set the TimerCall to 10, and activate SQL if not already done:

Code:
// MySql configuration.
MYSQL=1
MySqlHost=127.0.0.1
MySqlUser=username
MySqlPassword=password
MySqlDatabase=dbNAme

// Amount of minutes to call f_onserver_timer (0 disables this, default)
TimerCall=10


Create a file called db.php (to connect to your database):

PHP Code:
<?php

$username 
"yourUserNAme";
$password "yourPAssword";
$hostname "localhost";
$db "theDbName";

try {
    
$con = new PDO("mysql:host=$hostname;dbname=$db"$username$password);
     }
    catch(
PDOException $e)
    {
        echo 
$e->getMessage();
    }
?>


Then, create a file called register.php :

PHP Code:
<?php

session_start
();
include(
'db.php');
$account $_POST['account'];
$password $_POST['password'];
$email $_POST['email'];
$ip $_SERVER['REMOTE_ADDR'];
    if (!empty(
$_SERVER['HTTP_CLIENT_IP'])) {
        
$ip $_SERVER['HTTP_CLIENT_IP'];
    } elseif (!empty(
$_SERVER['HTTP_X_FORWARDED_FOR'])) {
        
$ip $_SERVER['HTTP_X_FORWARDED_FOR'];
    }

$sql "SELECT * FROM accounts WHERE login = '".$account."'";
$rows $con->prepare($sql);
$rows->execute();
if(
$rows->rowCount() > 0){
    
header('Location: signup.php?regError=Username%20already%20in%20use');
}else{
    
$sql2 "INSERT INTO accounts (`login`, `password`, `email`, `ip`) VALUES ('".$account."','".$password."','".$email."','".$ip."')";
    
$rows2 $con->prepare($sql2);
    
$rows2->execute();
    
$_SESSION['account'] = $account;
    
header('Location: signup.php');
}
?>


Then, create signup.php:


PHP Code:
<?php
session_start
();
if(isset(
$_SESSION['account'])){
echo 
"Thank you for Registering. Your account will be activated within 10 minutes.";
}else{
?>
<h1>Fill in the form below to sign up!</h1>
<form id="regForm" action="register.php" method="post">
            <?php if(isset($_GET['regError'])){ echo "<span class='error'>".$_GET['regError']."</span><br />"; } ?>
            <label for="accountr">Account:</label>
            <input id="accountr" type="text" value="" name="account" />
            <label for="passwordr">Password:</label>
            <input id="passwordr" type="password" value="" name="password" />
            <label for="emailr">Email:</label>
            <input id="emailr" type="email" value="" name="email" />
            <input id="register" type="submit" value="Register" />
        </form>
<?php




This is a simplified version of the script I wrote for our server (can see it at theuoproject.co.uk)

Hope that helps.

ULTIMA ONE
The modern, sphere powered Ultima Online server
01-07-2013 01:04 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Messages In This Thread
Auto account PHP web - admin_teclis - 12-24-2012, 11:03 PM
RE: Auto account PHP web - admin_teclis - 12-28-2012, 11:53 PM
RE: Auto account PHP web - Shaklaban - 12-29-2012, 01:00 AM
RE: Auto account PHP web - escribano - 12-29-2012, 03:34 PM
RE: Auto account PHP web - Darkyhood - 12-31-2012, 08:31 AM
RE: Auto account PHP web - admin_teclis - 01-02-2013, 04:26 AM
RE: Auto account PHP web - admin_teclis - 01-05-2013, 11:55 PM
RE: Auto account PHP web - Ultima One - 01-07-2013 01:04 PM
RE: Auto account PHP web - TopCat - 11-03-2015, 12:07 AM
RE: Auto account PHP web - Sharlenwar - 01-07-2013, 08:34 PM
RE: Auto account PHP web - Ultima One - 01-07-2013, 10:35 PM
RE: Auto account PHP web - admin_teclis - 01-09-2013, 12:07 AM
RE: Auto account PHP web - htid4life - 01-09-2013, 01:59 AM
RE: Auto account PHP web - Ultima One - 01-09-2013, 11:53 AM

Forum Jump:


User(s) browsing this thread: 2 Guest(s)