for those of you who might have problems using a custom registration method (php/cgi sql injections)

Uchina_Itachi

Joined: 2006-08-11
Posts: 36
Posted: Mon, 2008-12-15 16:52

If you having issues with gallery getting php errors (blank pages) at the Users Administrator page please check the following:

To anyone wanting to use a custom registration method also read the following:

You will need to insert into three tables for a user account to become valid:

g2_Entity
g2_User
g2_UserGroupMap

Also, it is best if you pick up the g_id variable from g2_Entity.

you can use something like this for a cgi code:

$sth = $dbh->prepare("select g_id from g2_Entity order by g_id desc limit 1;"); 
$sth->execute() or die("could not select g_id " . $dbh->errstr); 
($g_id) = $sth->fetchrow_array; 
$g_id += 1;

and php:


$data = mysql_query("select g_id from g2_Entity order by g_id desc limit 1")
or die(mysql_error());
$info = mysql_fetch_array($data);
$ng_id = $info['g_id'];
echo ($ng_id);
$ng_id += 1;
echo ($ng_id);

both of those will get you the last g_id in the entity table then add 1 to it. then all you have to do is take that id and use it in 4 insert codes with your other gathered user information.

I say 4 because g2_UserGroupMap takes 2 or more entries. for normal users the group id's should be 2 and 4. for an admin I think 3 is used along with the 2 and the 4.

I have it setup with a post script (for testing)/CCBill (for the real thing) to send it the data it needs.

well thats my contribution to this awesome community, thought it was time to give back a little.