News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Registering at site, and forum together...

Started by Burke ♞ Knight, December 11, 2008, 12:01:18 PM

Previous topic - Next topic

Burke ♞ Knight

Ok, here's the thing...

I run a free web host on a domain. I currently run it's forum, SMF 2.0 Beta 4, on another domain.

I'd like to set it up so that when they sign up for a web hosting account, it also registers them at the support forum, using the same username and password.

How would I go about doing this?

The dual register would be on the web host, and leave just the regular forum signup on the forum. That way, people can still register at the forum, and not set up a hosting account.

The web host is plain website, not a CMS. The login there goes directly to the customer's account control panel, at another section of the domain.

IchBin™

You can use the SMF integration hooks to do this on your site most likely. Its a sticky at the top of this board.
http://www.simplemachines.org/community/index.php?topic=173483.0
IchBin™        TinyPortal

Burke ♞ Knight

Actually, what I plan on doing now, since it is just a website, is use the forum for the site. I plan on placing the pages of the site into the forum, through the Dozen Pages mod, and SimplePortal blocks.

However, I just need a way to set it so when they sign up for a hosting account, it also registers them to the forum. I would like to have that on the host's signup page. Not on the forum's register page. That way, like stated above, people can still register at the forum, without getting a hosting account.

So, I guess all I need, is to know how to combine the 2 forms on my hosting sign up page.

IchBin™

Well, that would most likely have to be a paid custom coding job.
IchBin™        TinyPortal

Burke ♞ Knight

Unfortunately, I cannot afford for a paid custom job. I am disabled with very little income, and all my sites are free services. Just trying to get a few set up that will bring in a little bit of money....LOL

djhowarth

Im wanting dual reg i got a code i av found


$query="SELECT u.id, u.username, u.id_level +10 id_level, u.password, u.email, UNIX_TIMESTAMP(u.joined) joined, u.lip, COUNT(p.userid) posts FROM {$TABLE_PREFIX}users u LEFT JOIN {$TABLE_PREFIX}posts p ON u.id=p.userid WHERE u.id >=$start AND u.id <=$end GROUP BY u.id ORDER BY u.id ASC";
    $list=mysql_query($query);
    $count=mysql_num_rows($list);
    if($start==2)
        @mysql_query("TRUNCATE TABLE {$db_prefix}members");
    if($count>0)
    {
        while ($account=mysql_fetch_assoc($list))
        {
            $counter++;
            @mysql_query("INSERT INTO {$db_prefix}members (ID_MEMBER, memberName, dateRegistered, ID_GROUP, realName, passwd, emailAddress, memberIP, memberIP2, is_activated, passwordSalt, posts) VALUES (".$account["id"].", '".$account["username"]."', ".$account["joined"].", ".$account["id_level"].", '".$account["username"]."', '".$account["password"]."', '".$account["email"]."', '".long2ip($account["lip"])."', '".long2ip($account["lip"])."', 1, '',".$account["posts"].")");
            @mysql_query("UPDATE {$TABLE_PREFIX}users SET smf_fid=".$account["id"]." WHERE id=".$account["id"]);
        }
        print("<script LANGUAGE=\"javascript\">window.location.href='".$_SERVER["PHP_SELF"]."?act=member_import&confirm=yes&start=$newstart&counter=$counter'</script>");
    }
   
    $last=mysql_fetch_assoc(mysql_query("SELECT ID_MEMBER, memberName FROM {$db_prefix}members ORDER BY ID_MEMBER DESC LIMIT 1"));
    @mysql_query("UPDATE {$db_prefix}settings SET value='".$last["memberName"]."' WHERE variable='latestRealName'");
    @mysql_query("UPDATE {$db_prefix}settings SET value='".$last["ID_MEMBER"]."' WHERE variable='latestMember'");
    print($lang[28] . $counter . $lang[29]);
   
}
elseif($act=="import_forum" && $confirm!="yes")
    die($lang[30] . $lang[31] . $lang[35]);
elseif($act=="import_forum" && $confirm=="yes")
{
    $sqlquery ="SELECT MAX(boardOrder)+1 AS nextboard, membergroups, MAX(catOrder)+1 AS nextcat ";
    $sqlquery.="FROM {$db_prefix}boards, {$db_prefix}categories ";
    $sqlquery.="WHERE ID_BOARD=1 ";
    $sqlquery.="GROUP BY membergroups";

    $res=mysql_query($sqlquery);
    $row=mysql_fetch_assoc($res);
    $membergroups=substr($row["membergroups"], 0, strlen($row["membergroups"])-3);
    $nextboard=$row["nextboard"];
    $nextcat=$row["nextcat"];

    $sqlquery ="INSERT INTO {$db_prefix}categories ";
    $sqlquery.="SET catOrder=$nextcat, name='My BTI Import'";

    @mysql_query($sqlquery);

    $ourcat=mysql_insert_id();

    // SQL Query to grab the current Internal Forum Layout
    $sqlquery ="SELECT * ";
    $sqlquery.="FROM {$TABLE_PREFIX}forums ";
    $sqlquery.="ORDER BY id ASC";

    $res=mysql_query($sqlquery);
    $forumlist=array();

    // Lets put all the found results into a single array for later
    while($forums=mysql_fetch_assoc($res))
    {
        $i=$forums["id"];
        foreach($forums as $key => $value)
        {
            if($key=="minclassread" && $value!=1) $value=$value+10;
            elseif($key=="minclassread" && $value==1) $value=-1;
            elseif($key=="minclasswrite" && $value!=1) $value=$value+10;
            elseif($key=="minclasswrite" && $value==1) $value=-1;
            $forumlist[$i][$key]=$value;
        }
        if($forumlist[$i]["minclassread"]==-1)
            $forumlist[$i]["permissions"]=$membergroups . ",-1";
        else
            $forumlist[$i]["permissions"]=substr($membergroups, strpos($membergroups, sprintf("%s", $forumlist[$i]["minclassread"])), strlen($membergroups));
   
        $sqlquery ="INSERT INTO {$db_prefix}boards ";
        $sqlquery.="(ID_CAT, boardOrder, memberGroups, name, description) ";
        $sqlquery.="VALUES ($ourcat, $nextboard, '".$forumlist[$i]["permissions"]."', ";
        $sqlquery.=" '".mysql_real_escape_string($forumlist[$i]["name"])."', ";
        $sqlquery.="'".mysql_real_escape_string($forumlist[$i]["description"])."')";

        @mysql_query($sqlquery);
        $forumlist[$i]["newid"]=mysql_insert_id();
        if($forumlist[$i]["id_parent"]!=0) $subcat.=$i .",";
        $nextboard++;
    }
   
    $subcat=explode(",", substr($subcat, 0, strlen($subcat)-1));
    foreach($subcat AS $v)
    {
        $main=$forumlist[$v]["id_parent"];
        $forid=$forumlist[$v]["newid"];
        $newparent=$forumlist[$main]["newid"];
        @mysql_query("UPDATE {$db_prefix}boards SET ID_PARENT=$newparent WHERE ID_BOARD=$forid");
    }
    $res=mysql_query("SELECT * FROM {$TABLE_PREFIX}topics ORDER BY id ASC");
    while($topiclist=mysql_fetch_assoc($res))
    {
        $i=$topiclist["id"];
        (($topiclist["locked"]=="no") ? $topiclist["locked"]=0 : $topiclist["locked"]=1);
        (($topiclist["sticky"]=="no") ? $topiclist["sticky"]=0 : $topiclist["sticky"]=1);
           
        foreach($topiclist AS $k => $v)
        {
            $topics[$i][$k]=$v;
        }
        $query="INSERT INTO {$db_prefix}topics (isSticky, ID_BOARD, ID_FIRST_MSG, ID_LAST_MSG, ID_MEMBER_STARTED, numViews, locked) VALUES (".$topics[$i]["sticky"].", ".$forumlist[$topics[$i]["forumid"]]["newid"].", ".rand(0,2147483647).", ".rand(0,2147483647).", ".$topics[$i]["userid"].", ".$topics[$i]["views"].", ".$topics[$i]["locked"].")";
        @mysql_query($query);
        $topics[$i]["newtopicid"]=mysql_insert_id();

    }
    $res=mysql_query("SELECT p.* , u.username, u.email, u.lip, ua.username AS edit_username FROM {$TABLE_PREFIX}posts p LEFT JOIN {$TABLE_PREFIX}users u ON p.userid = u.id LEFT JOIN {$TABLE_PREFIX}users ua ON p.editedby = ua.id ORDER BY p.id ASC");

    while($postlist=mysql_fetch_assoc($res))
    {
        $i=$postlist["id"];
           
        foreach($postlist AS $k => $v)
        {
            $posts[$i][$k]=$v;
        }
        $query="INSERT INTO {$db_prefix}messages (ID_TOPIC, ID_BOARD, posterTime, ID_MEMBER, subject, posterName, posterEmail, posterIP, smileysEnabled, modifiedTime, modifiedName, body) VALUES (".$topics[$posts[$i]["topicid"]]["newtopicid"].", ".$forumlist[$topics[$posts[$i]["topicid"]]["forumid"]]["newid"].", ".$posts[$i]["added"].", ".$posts[$i]["userid"].", '".mysql_real_escape_string($topics[$posts[$i]["topicid"]]["subject"])."', '".$posts[$i]["username"]."', '".$posts[$i]["email"]."', '".long2ip($posts[$i]["lip"])."', 1, ".$posts[$i]["editedat"].", '".(($posts[$i]["editedby"]==0) ? "" : $posts[$i]["edit_username"])."', '".mysql_real_escape_string($posts[$i]["body"])."')";
        @mysql_query($query);
        $posts[$i]["newpostid"]=mysql_insert_id();
    }
   
    $res=mysql_query("SELECT MAX(ID_MSG) AS max, ID_BOARD FROM {$db_prefix}messages GROUP BY ID_BOARD");
    while($row=mysql_fetch_assoc($res))
    {
        @mysql_query("UPDATE {$db_prefix}boards SET ID_LAST_MSG=".$row["max"]." WHERE ID_BOARD=".$row["ID_BOARD"]);
    }
   
    $res=mysql_query("SELECT min( ID_MSG ) AS min, MAX( ID_MSG ) AS max, ID_TOPIC FROM {$db_prefix}messages GROUP BY ID_TOPIC");
    while($row=mysql_fetch_assoc($res))
    {
        @mysql_query("UPDATE {$db_prefix}topics SET ID_FIRST_MSG=".$row["min"].", ID_LAST_MSG=".$row["max"]." WHERE ID_TOPIC=".$row["ID_TOPIC"]);
    }
print("<script LANGUAGE=\"javascript\">window.location.href='".$_SERVER["PHP_SELF"]."?act=completed'</script>");
}
elseif($act=="completed")
{
    // Lock import file from future use and change to smf mode
    @mysql_query("UPDATE {$TABLE_PREFIX}settings SET value ='smf' WHERE key='forum'");
    @mysql_query("UPDATE {$TABLE_PREFIX}users SET random=54345 WHERE id=1");
    echo $lang[32] . $lang[33] . $lang[35];
}


Take A Look At This


$query="SELECT u.id, u.username, u.id_level +10 id_level, u.password, u.email, UNIX_TIMESTAMP(u.joined) joined, u.lip, COUNT(p.userid) posts FROM {$TABLE_PREFIX}users u LEFT JOIN {$TABLE_PREFIX}posts p ON u.id=p.userid WHERE u.id >=$start AND u.id <=$end GROUP BY u.id ORDER BY u.id ASC";


That Would After Be Your Database Tables Throughout The Code And Then require this file from ure signup page

Burke ♞ Knight

I'll try it. What do I save the top code as? A file in the site root directory?

Also, I have to see where to add it to the signup page....

djhowarth

In Your signup page require("pageabove.php");

you wil need opening and closing php tags

<?

?>

Advertisement: