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
admin_teclis
Journeyman
*

Posts: 51
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Aug 2012
Reputation: 0

Age of Apocalypse

Post: #1
Auto account PHP web
Hello and Merry Christmas!
For days, I'm trying to create a script in PHP to automatically create accounts ... Unfortunately I do not know where to start ... PHP and MYSQL know them but I do not understand how to interact with sphere ... There are ready-made scripts out there? I was able to make sure that I create the account via the web, but now I can not be postponed password if you lose ... Can you help?
12-24-2012 11:03 PM
Find all posts by this user Like Post Quote this message in a reply
admin_teclis
Journeyman
*

Posts: 51
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Aug 2012
Reputation: 0

Age of Apocalypse

Post: #2
RE: Auto account PHP web
help me please....
12-28-2012 11:53 PM
Find all posts by this user Like Post Quote this message in a reply
Shaklaban
Master
**

Posts: 378
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Mar 2012
Reputation: 8

DOT

Post: #3
RE: Auto account PHP web
scripts side is this since you know mysql and php i think you can do the rest:

PHP Code:
[function create_new_accounts]
if <
db.connected>
    
DB.QUERY "SELECT * FROM accounts WHERE status='0' LIMIT 10"
    
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>    
            
serv.account <DB.ROW.<eval <LOCAL.R>>.logintag.mail=<DB.ROW.<eval <LOCAL.R>>.email>
            
serv.account <DB.ROW.<eval <LOCAL.R>>.logintag.password=<DB.ROW.<eval <LOCAL.R>>.password>
            
serv.account <DB.ROW.<eval <LOCAL.R>>.loginplevel 1    
            DB
.EXECUTE "UPDATE accounts SET status='1' WHERE login='<DB.ROW.<eval <LOCAL.R>>.login>'"
        
endfor
    endif
endif 
(This post was last modified: 12-29-2012 01:01 AM by Shaklaban.)
12-29-2012 01:00 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes Shaklaban's post
escribano
Journeyman
*

Posts: 170
Likes Given: 16
Likes Received: 32 in 23 posts
Joined: Nov 2012
Reputation: 2

Dragon Shard

Post: #4
RE: Auto account PHP web
All u gotta do is a table, where u need to store ACCOUNT and PASSWORD of the new account

Create a Invis Stone that on=@Timer calls the db.query to execute a query and add the new accounts Smile

Code:
ON=@Timer
db.connect
db.query "select * from accounts where created=0"
if (<eval <db.row.numrows>> >= 1)
    for x 0 <eval <db.row.numrows>-1>
        serv.account add <db.row.<eval <dlocal.x>>.login> <db.row.<eval <dlocal.x>>.pass>
        serv.log Account created: <db.row.<eval <dlocal.x>>.login>
        db.query "update accounts set created=1 where id=<db.row.<eval <dlocal.x>>.id>"
    endfor
endif
timer 300
return 1

See yah!

UltimaPHP - OpenSource Ultima Online Server v0.1-pre-alpha under development, we need help!
12-29-2012 03:34 PM
Find all posts by this user Like Post Quote this message in a reply
Darkyhood
Apprentice
*

Posts: 36
Likes Given: 2
Likes Received: 3 in 3 posts
Joined: Mar 2012
Reputation: 0



Post: #5
RE: Auto account PHP web
(12-29-2012 03:34 PM)escribano Wrote:  Create a Invis Stone that on=@Timer calls the db.query to execute a query and add the new accounts Smile
I think better use function f_onserver_timer
12-31-2012 08:31 AM
Find all posts by this user Like Post Quote this message in a reply
admin_teclis
Journeyman
*

Posts: 51
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Aug 2012
Reputation: 0

Age of Apocalypse

Post: #6
RE: Auto account PHP web
Happy new year!!!Big Grin

tnx for the reply...

I was able to create accounts from web ... I used a script I found and modernized according to my needs ... Unfortunately, the script in question would also recover password recovery via pin and pin, but I do not know why I do not work ... If you want to place the code ...
Now I have another problem inherent in the web ...
Should I create a status page and let me know how to find some values ​​..
example:
Name pg - Race - Class - Gilda - Gold - Kills - Fama - Karma - connection time and the various skill above 100 ...
How do I? I have not the faintest idea how to do it ... I opened the spherestatus but honestly I have not figured out how to pass the values ​​...
Last thing .. I was also able to connect to a mysql sphere ... Eventulamente I could do this status, how do I pass it into another table?
01-02-2013 04:26 AM
Find all posts by this user Like Post Quote this message in a reply
admin_teclis
Journeyman
*

Posts: 51
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Aug 2012
Reputation: 0

Age of Apocalypse

Post: #7
RE: Auto account PHP web
help me pls Sad
01-05-2013 11:55 PM
Find all posts by this user Like Post Quote this message in a reply
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
Sharlenwar
Journeyman
*

Posts: 55
Likes Given: 0
Likes Received: 3 in 3 posts
Joined: May 2012
Reputation: 0



Post: #9
RE: Auto account PHP web
Thanks for that basic PHP implementation. Helps out for anyone looking to do the same. Big Grin

-= Meh =-
01-07-2013 08:34 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Ultima One
Journeyman
*

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

Ultima One

Post: #10
RE: Auto account PHP web
NP.

The one thing I hate about these forums is people asking for simple things never getting a simple answer. Sad

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


Forum Jump:


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