Modification to Member Registration
Login / Search
#102241 (In Topic #20039)
Fan in training
This should have been a simple modification to when a member registers...
What I needed to do is "Catch" user registrations and "Sync" (create an account) on another Mysql
database at a remote site. So I read up on things, copied the ocf_join.php to sources_custom and
dropped my own php file in the same directory with it.
End result output is:
[ Could not connect: Access denied for user 'mrjpmyth'@'localhost' (using password: NO) ]
This occurs during the Join process after hitting save on the user join form. And here is my script.
I figure I am doing something very simple wrong, but I am not much of a PhP coder, I do c++/c#
(original code above ... Starting at line 332 in ocf_join.php)
ewaction_register( $username, $password );
(original code below..)
// Send confirm mail
And my little file: ewgame.php
$host_ewgame = "xxxx.xxxxxxxx.com";
$user_ewgame = "xxxxxxx";
$pass_ewgame = "xxxxxxxxx";
// Here we receive the update from smf
function ewaction_register( $username, $password )
global $host_ewgame, $user_ewgame, $pass_ewgame;
if ( !(isset($username) && isset($password)) )
die("Empty input data");
$link = mysqli_connect($host_ewgame, $user_ewgame, $pass_ewgame, 'Xxxxxx' ) or die('Could not connect: ' . mysqli_connect_error());
End result: Full error report...
PHP WARNING  mysqli_connect() [<a href='http://www.php.net/manual/en/function.mysqli-connect.php'>function.mysqli-connect.php</a>]: (28000/1045): Access denied for user 'mrjpmyth'@'localhost' (using password: NO) in sources_custom/ewgame.php on line 18 (version: 9.0.11, PHP version: 5.2.17, URL: /ewproject/index.php?page=join&type=step3&redirect=http%3A%2F%2Feveronworlds.com%2Fewproject%2Findex.php%3Fpage%3Dstart%26redirected%3D1)
Now I have had this working on my Test Server using Smf, but I liked the looks of OcPortal and
when I moved to a commercial hoster I went with you guys and now I am unsure why it no longer
works as it should.
Originally I had been using $host ="xxx";, etc... but when I got the wrong user/host I changed the
globals as I thought it might be a Global clash, but even with the $host_ewgame change, it is still
giving me the above errors..
Any help would be greatly appreciated.
While you have your initialisation code in the global scope of that particular file, you are including the file within a local scope (require_code inside a function). Hence it executes as local scope and nothing is automatically globalised. You then jump out to ewaction_register, a different local scope.
I realised this as it said it wasn't using a password, because PHP auto-casted unset variables to blank.
Fan in training
There are too many online users to list.