Not Solved What do I CHMOD 777 to make Ajax Cool Reg work?
#1
Not Solved
I'm trying to get Ajax Cool Registration to work, but I'm getting errors that it can't access the server. I remember reading a while back that this was caused by not CHMODing a particular folder, but I can't remember which one. I've searched these forums and don't see it here. Any help is greatly appreciated.

I'm currently getting this error:

Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /misc/38/000/164/778/0/user/web/baytownbb.com/inc/plugins/ajax_cr.php on line 34


Thanks,
Dstaten
Reply
#2
Not Solved
dastaten Wrote:I'm trying to get Ajax Cool Registration to work, but I'm getting errors that it can't access the server. I remember reading a while back that this was caused by not CHMODing a particular folder, but I can't remember which one. I've searched these forums and don't see it here. Any help is greatly appreciated.

I'm currently getting this error:

Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /misc/38/000/164/778/0/user/web/baytownbb.com/inc/plugins/ajax_cr.php on line 34


Thanks,
Dstaten

try reactivating it, it has to do with you mysql.
Reply
#3
Not Solved
i've deactivated and reactivated a few times. it has never worked from the beginning.

Isn't the "cannot connect" because I need to chmod something?

Here are my mysql settings:

MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version 5.0.27
MYSQL_MODULE_TYPE external
MYSQL_SOCKET /var/lib/mysql/mysql.sock
MYSQL_INCLUDE -I/usr/include/mysql
MYSQL_LIBS -L/usr/lib -lmysqlclient

Directive Local Value Master Value
mysql.allow_persistent On On
mysql.connect_timeout 30 30
mysql.default_host no value no value
mysql.default_password no value no value
mysql.default_port 3306 3306
mysql.default_socket no value no value
mysql.default_user no value no value
mysql.max_links Unlimited Unlimited
mysql.max_persistent Unlimited Unlimited
mysql.trace_mode Off Off
Reply
#4
Not Solved
Can you post that line? It might not be using the $db class and may need to be rewritten.

ADD:

Yeah...took a look and you need to change the function.

function ajax_cr_action()
{
    global $mybb;
    if ($mybb->input['action'] == 'CheckUsername') {
	$query = mysql_query("SELECT username FROM `".TABLE_PREFIX."users` WHERE `username` = '" . $_GET['user'] . "'");
	$count = mysql_num_rows($query); 
	if ($count > 0) { 
		$return_value = $_GET['user'] . ",Invalid"; 
	} else {
		$return_value = $_GET['user'] . ",Working";
	}
	echo $return_value;
}
}

To this:

function ajax_cr_action()
{
    global $mybb, $db;
    if ($mybb->input['action'] == 'CheckUsername') {
	$query = $db->query("SELECT username FROM `".TABLE_PREFIX."users` WHERE `username` = '" . $db->escape_string($_GET['user']) . "'");
	$count = $db->num_rows($query); 
	if ($count > 0) { 
		$return_value = $_GET['user'] . ",Invalid"; 
	} else {
		$return_value = $_GET['user'] . ",Working";
	}
	echo $return_value;
}
}

Let me know if that doesn't work cuz it's not tested but that should fix it.

Holy crap....the original code has a HUGE mysql injection problem by not sanitizing the query. I recommend anyone reading this fix that.
Reply
#5
Not Solved
looks a little better. but now i'm getting this...

Fatal error: Call to a member function query() on a non-object in /misc/38/000/164/778/0/user/web/baytownbb.com/inc/plugins/ajax_cr.php on line 34
Reply
#6
Not Solved
Oh ...forgot to global the $db.
function ajax_cr_action()
{
    global $mybb, $db;
    if ($mybb->input['action'] == 'CheckUsername') {
    $query = $db->query("SELECT username FROM `".TABLE_PREFIX."users` WHERE `username` = '" . $db->escape_string($_GET['user']) . "'");
    $count = $db->num_rows($query); 
    if ($count > 0) { 
        $return_value = $_GET['user'] . ",Invalid"; 
    } else {
        $return_value = $_GET['user'] . ",Working";
    }
    echo $return_value;
}
}
Reply
#7
Not Solved
IT WORKS!!! I've been trying off and on to get this working for a long time. Thanks for all your help! Smile
Reply
#8
Not Solved
No problem...glad I could help.
Reply
#9
Not Solved
one last question, if you don't mind. i'm using captcha and i'm not sure where to paste this code. i'm on step 3 on this page: http://www.captchacreator.com/v-howtoinstall.html I've uploaded the captcha images and fonts and everything and i've got it showing on the page. but i'm not sure where to paste that last code. i tried on member.php and i'm getting an error.
Reply
#10
Not Solved
Mybb comes with Captcha. It's on by default.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)