How to Integrate Live Multi Player Texas Holdem Poker

lancashiredates posted 10th of April 2010 in Community Voice. 22 comments.

Ok where do I start?

Right then, I have done a basic integration of the PHP Poker Script from phppoker.net.

A step by step guide follows as to how I did it.

See it in action at Truckers Poker

Step 1. First you need to get the Poker Script, You can request an Open Source copy at PHPpoker.net http://www.phppoker.net/support.php for a small fee. Thanks HoustonLively for finding this resource.

IMPORTANT: You will be breaking licensing laws if you don't purchase a license from: http://www.phppoker.net

And in any case phppoker.net will file DMCA notices against web hosts and ISP's that hosts sites with unlicensed scripts.

Obviously to avoid this hassle and to be sure of having clean code it's best to purchase a licensed copy it's only $25.

Backup your original D7 database first ( just in case ).

Step 2. Upload and install the script into a directory in your root called /poker/ use your dolphin database to install the tables and for the Admin username put the actual admin username that you use in your D7 installation. You might also need to set your php.ini to short_open_tag=1 as this script uses short tags.

Step 3. Hacking the code: Well the good news is that we don't need to do anything with the Dolphin7 code.

So just these files in your Poker installation.

3.1 index.php

Replace everything with:

<?php

//Check to see if Member Logged into Dolphin

if (isset($_COOKIE["memberID"])) {

header('Location: create.php');

die();

}else { ?>

<div style="width:100%;margin-top:80px;text-align:center"

<img src="images/LogIn.jpg"/>

</div>

<?php

}

?>

3.2 create.php

Remove or comment this line

if($valid == true) header('Location: index.php'); ( line 3)

after

$time = time();

( around line4 )

insert

if (isset($_COOKIE["memberID"])) {

$memid=$_COOKIE["memberID"];

$result = mysql_query("select NickName from Profiles where ID = '".$memid."' ");

while($row = mysql_fetch_array($result))

{

$NickName=$row['NickName'];

}

$existmem = mysql_query("select username from ".DB_PLAYERS." where username = '".$NickName."' ");

if(mysql_num_rows($existmem) > 0) {

header('Location: lobby.php');

die();

}

and after

</html>

( at the last line)

insert

<?php

}

else {

?>

<div style="width:100%;margin-top:80px;text-align:center"

<img src="images/LogIn.jpg"/>

</div>

<?php

}

?>

around line 44

remove or comment this code:

}elseif((($pwd == '') || ($pwd2 == '') || ($usr=='') || (($email == '') && (EMAILMOD == 1))) && (MEMMOD != 1)){

$error = true;

$message = CREATE_MSG_MISSING_DATA;

around line 77

remove or comment this code:

if((eregi('[^a-zA-Z0-9_]', $pwd)) && (MEMMOD != 1)){

$error = true;

$pwd = '';

$pwd2 = '';

$message .= CREATE_MSG_PASSWORD_CHARS.'<BR>';

}

if(($pwd != $pwd2) && (MEMMOD != 1)){

$error = true;

$pwd = '';

$pwd2 = '';

$message .= CREATE_MSG_PASSWORD_CHECK.'<BR>';

}

if ((strlen($usr) < 2) || (strlen($usr) > 10)) {

$error = true;

$message .= CREATE_MSG_USERNAME_LENGTH.'<BR>';

}

if (((strlen($pwd) < 5) || (strlen($pwd) > 10))  && (MEMMOD != 1)){

$error .= true;

$pwd = '';

$pwd2 = '';

$message = CREATE_MSG_PASSWORD_LENGTH.'<BR>';

}

Then find this code

$result = mysql_query("insert into ".DB_PLAYERS." set banned = '0', username = '".$usr."', approve = '".$approve."', email = '".$email."', GUID = '".$GUID."', lastlogin = '".$time."' , datecreated = '".$time."' , password = '".$pwd."', sessname = '".$sessname."', avatar = '".$avatar."', ipaddress = '".$ip."' ");

Replace with

$result = mysql_query("insert into ".DB_PLAYERS." set ID = '".$memid."', banned = '0', username = '".$usr."', approve = '".$approve."', email = '".$email."', GUID = '".$GUID."', lastlogin = '".$time."' , datecreated = '".$time."' , sessname = '".$sessname."', avatar = '".$avatar."', ipaddress = '".$ip."' ");

find this code

<tr>

<td width="226" align="right" class="fieldsetheadcontentgrey">

<? echo CREATE_PLAYER_NAME; ?>

<input type="text" size="12" maxlength="10" name="user" class="fieldsetheadinputs" value="<? echo $usr; ?>" />

</td>

<td align="left" width="154" valign="middle" class="fieldsetheadcontentgrey">

<? echo CREATE_PLAYER_CHAR_LIMIT; ?>

</td>

</tr>

<tr>

<td width="226" align="right" class="fieldsetheadcontentgrey">

<? echo CREATE_PLAYER_PWD; ?>

<input type="password" size="12" maxlength="10" name="password" class="fieldsetheadinputs" />

</td>

<td align="left" width="154" valign="middle" class="fieldsetheadcontentgrey">

<? echo CREATE_PLAYER_CHAR_LIMIT; ?>

</td>

</tr>

<tr>

<td width="226" align="right" class="fieldsetheadcontentgrey"><span class="fieldsetheadcontent">

<? echo CREATE_PLAYER_CONFIRM; ?>

<font color="#FFFFFF" class="fieldsetheadcontent"> </font></span>

<input type="password" size="12" maxlength="10" name="password2" class="fieldsetheadinputs" />

</td>

<td align="left" width="154" valign="middle" class="fieldsetheadcontentgrey">

<input type="hidden" name="av" id="av" value="">

<input type="hidden" name="action" value="createplayer">

</td>

</tr>

and replace with

<tr>

<td class="fieldsethead"> <fieldset class="yellowborder"> <legend>&nbsp;<? echo BOX_CREATE_NEW_PLAYER; ?>&nbsp;</legend>

<form name="createplyr" action="create.php" method="post">

<table width="400" border="0" cellspacing="0" cellpadding="5" align="center">

<tr>

<td width="226" align="right" class="fieldsetheadcontentgrey">

</td>

<td align="left" width="154" valign="middle" class="fieldsetheadcontentgrey">

</td>

</tr>

<tr>

<td width="226" align="right" class="fieldsetheadcontentgrey"><span class="fieldsetheadcontent">

</td>

<td align="left" width="154" valign="middle" class="fieldsetheadcontentgrey">

<input type="hidden" size="12" maxlength="10" name="user" class="fieldsetheadinputs" value="<? echo $NickName; ?>" />

<input type="hidden" size="12" maxlength="10" name="MemID" class="fieldsetheadinputs" value="<?php echo $memid; ?>" />

<input type="hidden" name="av" id="av" value="">

<input type="hidden" name="action" value="createplayer">

</td>

</tr>

3.3 lobby.php

after

require('includes/inc_lobby.php');

( around line4 )

insert

if (isset($_COOKIE["memberID"])) {

and after

</html>

( at the last line)

insert

<?php

}

else {

?>

<div style="width:100%;margin-top:80px;text-align:center"

<img src="images/LogIn.jpg"/>

</div>

<?php

}

?>

3.4 login.php

after

$ip = $_SERVER['REMOTE_ADDR'];

(around line 7)

insert

if (isset($_COOKIE["memberID"])) {

$memid=$_COOKIE["memberID"];

$result = mysql_query("select NickName from Profiles where ID = '".$memid."' ");

while($row = mysql_fetch_array($result))

{

$usr=$row['NickName'];

}

Remove or comment

if(($action == 'process') && ($usr != '') && ($pwd != '')){

( around line 15)

find

}elseif(validate_password($pwd,$orig) == true){

session_start();

$_SESSION['playername'] = $usr;

$_SESSION['SGUID'] = $GUID;

$result = mysql_query("update ".DB_PLAYERS." set ipaddress = '".$ip."', lastlogin = '".$time."' , GUID = '".$GUID."' where username = '".$usr."' ");

header('Location: lobby.php');

}else{

$msg = LOGIN_MSG_INVALID;

}

}

and replace with

}

else

{

session_start();

$_SESSION['playername'] = $usr;

$_SESSION['SGUID'] = $GUID;

$result = mysql_query("update ".DB_PLAYERS." set ipaddress = '".$ip."', lastlogin = '".$time."' , GUID = '".$GUID."' where username = '".$usr."' ");

header('Location: create.php');

}

then at the bottom after

</html>

insert

<?php

}

else {

?>

<div style="width:100%;margin-top:80px;text-align:center"

<img src="images/LogIn.jpg"/>

</div>

<?php

}

?>

3.5 myplayer.php

after

require('includes/inc_myplayer.php');

insert

if (isset($_COOKIE["memberID"])) {

and at bottom after

</html>

insert

<?php

}

else {

?>

<div style="width:100%;margin-top:80px;text-align:center"

<img src="images/LogIn.jpg"/>

</div>

<?php

}

?>

find and remove (near the bottom)

<? if(MEMMOD != 1){ ?>

<form name="form1" method="post" action="">

<table width="100%" border="0" cellspacing="0" cellpadding="3" class="smllfontwhite" bgcolor="#333333">

<tr>

<td nowrap class="fieldsetheadcontent" width="33%"><b><font color="#FFCC33"><? echo PLAYER_CHANGE_PWD; ?></font></b></td>

<td width="19%" nowrap>&nbsp;</td>

<td width="21%" nowrap>&nbsp;</td>

<td width="27%" nowrap>&nbsp;</td>

</tr>

<tr>

<td width="33%" align="right" nowrap>&nbsp;</td>

<td width="19%" align="left" nowrap>&nbsp;</td>

<td width="21%" align="left" nowrap>&nbsp;</td>

<td width="27%" align="left" nowrap>&nbsp;</td>

</tr>

<tr>

<td width="33%" align="right" nowrap>

<? echo STATS_PLAYER_OLD_PWD; ?>

</td>

<td width="19%" align="left" nowrap> <b>

<input type="text" size="12" maxlength="12" name="old" class="fieldsetheadinputs" />

</b></td>

<td width="21%" align="left" nowrap><? echo STATS_PLAYER_PWD_CHAR_LIMIT; ?></td>

<td width="27%" align="left" nowrap>&nbsp;</td>

</tr>

<tr>

<td width="33%" align="right" nowrap>

<? echo STATS_PLAYER_NEW_PWD; ?>

</td>

<td width="19%" align="left" nowrap><b>

<input type="text" size="12" maxlength="12" name="pwd" class="fieldsetheadinputs" />

</b></td>

<td width="21%" align="left" nowrap>

<? echo STATS_PLAYER_PWD_CHAR_LIMIT; ?>

</td>

<td width="27%" align="left" nowrap>&nbsp;</td>

</tr>

<tr>

<td width="33%" align="right" nowrap>

<? echo STATS_PLAYER_CONFIRM_PWD; ?>

</td>

<td width="19%" align="left" nowrap><b>

<input type="text" size="12" maxlength="12" name="pwd2" class="fieldsetheadinputs" />

</b></td>

<td width="21%" align="left" nowrap>

<input type="hidden" name="action" id="av" value="updatepwd">

</td>

<td width="27%" align="left" nowrap>

<input type="submit" name="Submit" value="<? echo BUTTON_SUBMIT; ?>" class="betbuttons">

</td>

</tr>

<tr>

<td width="33%" align="right" nowrap>&nbsp;</td>

<td width="19%" align="left" nowrap>&nbsp;</td>

<td width="21%" align="right" nowrap>&nbsp;</td>

<td width="27%" align="left" nowrap>&nbsp;</td>

</tr>

</table>

</form>

<? } ?>

3.6 poker.php

after

require('includes/inc_poker.php');

insert

if (isset($_COOKIE["memberID"])) {

and at bottom after

</html>

insert

<?php

}

else {

?>

<div style="width:100%;margin-top:80px;text-align:center"

<img src="images/LogIn.jpg"/>

</div>

<?php

}

?>

3.7 rankings.php

after

require('includes/inc_rankings.php');

insert

if (isset($_COOKIE["memberID"])) {

and at bottom after

</html>

insert

<?php

}

else {

?>

<div style="width:100%;margin-top:80px;text-align:center"

<img src="images/LogIn.jpg"/>

</div>

<?php

}

?>

Step 4. Removing unrequired navigation links

in files

create.php, faq.php, lobby.php, myplayer.php, poker.php, rankings.php and rules.php

Find

<table border="0" cellspacing="0" cellpadding="1" width="98%" class="smllfontpink" align="center" height="55">

<tr onMouseOver="this.bgColor = '#330000'; this.style.color = 'FFFFFF'" onMouseOut="this.bgColor = ''; this.style.color = 'CC9999'" onClick="changeview('index.php')" class="hand">

<td>

<? echo MENU_HOME; ?>

</td>

</tr>

<? if (($valid == false) && (MEMMOD == 0)){ ?>

<tr onMouseOver="this.bgColor = '#330000'; this.style.color = 'FFFFFF'" onMouseOut="this.bgColor = ''; this.style.color = 'CC9999'" onClick="changeview('login.php')" class="hand">

<td>

<? echo MENU_LOGIN; ?>

</td>

</tr>

<? } ?>

<? if ($valid == false){ ?>

<tr onMouseOver="this.bgColor = '#330000'; this.style.color = 'FFFFFF'" onMouseOut="this.bgColor = ''; this.style.color = 'CC9999'" onClick="changeview('create.php')" class="hand">

<td>

<? echo MENU_CREATE; ?>

</td>

</tr>

<? } ?>

<? if ($valid == true){ ?>

<tr onMouseOver="this.bgColor = '#330000'; this.style.color = 'FFFFFF'" onMouseOut="this.bgColor = ''; this.style.color = 'CC9999'" onClick="changeview('lobby.php')" class="hand">

<td>

<? echo MENU_LOBBY; ?>

</td>

</tr>

<tr onMouseOver="this.bgColor = '#330000'; this.style.color = 'FFFFFF'" onMouseOut="this.bgColor = ''; this.style.color = 'CC9999'" onClick="changeview('rankings.php')" class="hand">

<td>

<? echo MENU_RANKINGS; ?>

</td>

</tr>

<tr onMouseOver="this.bgColor = '#330000'; this.style.color = 'FFFFFF'" onMouseOut="this.bgColor = ''; this.style.color = 'CC9999'" onClick="changeview('myplayer.php')" class="hand">

<td>

<? echo MENU_MYPLAYER; ?>

</td>

</tr>

<? } ?>

<tr onMouseOver="this.bgColor = '#330000'; this.style.color = 'FFFFFF'" onMouseOut="this.bgColor = ''; this.style.color = 'CC9999'" onClick="changeview('rules.php')" class="hand">

<td>

<? echo MENU_RULES; ?>

</td>

</tr>

<tr onMouseOver="this.bgColor = '#330000'; this.style.color = 'FFFFFF'" onMouseOut="this.bgColor = ''; this.style.color = 'CC9999'" onClick="changeview('faq.php')" class="hand">

<td>

<? echo MENU_FAQ; ?>

</td>

</tr>

<? if ($ADMIN == true){ ?>

<tr onMouseOver="this.bgColor = '#330000'; this.style.color = 'FFFFFF'" onMouseOut="this.bgColor = ''; this.style.color = 'CC9999'" onClick="changeview('admin.php')" class="hand">

<td>

<? echo MENU_ADMIN; ?>

</td>

</tr>

<? } ?>

<? if (($valid == true) && (MEMMOD != 1)){ ?>

<tr onMouseOver="this.bgColor = '#330000'; this.style.color = 'FFFFFF'" onMouseOut="this.bgColor = ''; this.style.color = 'CC9999'" onClick="changeview('index.php?action=logout')" class="hand">

<td>

<? echo MENU_LOGOUT; ?>

</td>

<? } ?>

</table>

And replace with

<table border="0" cellspacing="0" cellpadding="1" width="98%" class="smllfontpink" align="center" height="55">

<? if ($valid == true){ ?>

<tr onMouseOver="this.bgColor = '#330000'; this.style.color = 'FFFFFF'" onMouseOut="this.bgColor = ''; this.style.color = 'CC9999'" onClick="changeview('lobby.php')" class="hand">

<td>

<? echo MENU_LOBBY; ?>

</td>

</tr>

<tr onMouseOver="this.bgColor = '#330000'; this.style.color = 'FFFFFF'" onMouseOut="this.bgColor = ''; this.style.color = 'CC9999'" onClick="changeview('rankings.php')" class="hand">

<td>

<? echo MENU_RANKINGS; ?>

</td>

</tr>

<tr onMouseOver="this.bgColor = '#330000'; this.style.color = 'FFFFFF'" onMouseOut="this.bgColor = ''; this.style.color = 'CC9999'" onClick="changeview('myplayer.php')" class="hand">

<td>

<? echo MENU_MYPLAYER; ?>

</td>

</tr>

<? } ?>

<tr onMouseOver="this.bgColor = '#330000'; this.style.color = 'FFFFFF'" onMouseOut="this.bgColor = ''; this.style.color = 'CC9999'" onClick="changeview('rules.php')" class="hand">

<td>

<? echo MENU_RULES; ?>

</td>

</tr>

<tr onMouseOver="this.bgColor = '#330000'; this.style.color = 'FFFFFF'" onMouseOut="this.bgColor = ''; this.style.color = 'CC9999'" onClick="changeview('faq.php')" class="hand">

<td>

<? echo MENU_FAQ; ?>

</td>

</tr>

<? if ($ADMIN == true){ ?>

<tr onMouseOver="this.bgColor = '#330000'; this.style.color = 'FFFFFF'" onMouseOut="this.bgColor = ''; this.style.color = 'CC9999'" onClick="changeview('admin.php')" class="hand">

<td>

<? echo MENU_ADMIN; ?>

</td>

</tr>

<? } ?>

</table>

Step 5. Linking to Poker

This is example for button to open in sized popup window

<div class="button_wrapper">

<input  onClick="popup = window.open('/poker/', 'PopupPage', 'height=580,width=800,scrollbars=yes,resizable=yes'); return false" target="_blank" class="form_input_submit" type="submit" name="sbs_subscribe" value="Play Poker Now" />

<div class="button_wrapper_close"></div>

</div>

and this is the image that displays if user not logged in

this image should be saved as LogIn.jpg and saved in the images folder of your poker installation.

Well that should just about do it so login to your Dolphin site then go to your poker installation at yoursite.com/poker setup your avatar and then click on the admin link on the left to add tables and alter other settings.

Note if you receive an error on leaving a table you will need to set sitout to zero from within poker admin.

If anyone can improve on this or integrate more features then please expand.

If for some reason this don't work for you, just tell me the problem and i'll see what I can do...

Dave.

 
Comments
·Oldest
·Top
Please login to post a comment.
lancashiredates
I have amended since first post so for anyone who did this before the amendment you might need to do this.

3.2 create.php

Remove or comment this line
if($valid == true) header('Location: index.php');
( line 3)

I was bound to miss something.

Dave....
jtadeo
Thanks for the tutorial post and contribution.

For certain sites, games can help to get people to stick around and have fun with other members. I think Dolphin would benefit from other integrations like this.

Good work.
lancashiredates
Thanks James you done some great work yourself and contributed plenty and yer know it's good to give something back.
mydatery
Nice job at deleting your blog and reposting it to dump the negative points the fact that you first told people to break the law with this mod. Negative points still for you on this one.
CodeSatori
That's grand. Would be even more useful to have the tutorial downloadable in a text file where code indentation hasn't been lost.
lancashiredates
Ha ha good idea! You found me another job! LOL
I'll do it later when I have some spare time.

Thanks for your suggestion CS. Positive vote for you. +1
CALTRADE
Thank you for posting this Dave - I think it is great when people make contributions like this. I'm sure almost everyone here appreciates things like this.
lancashiredates
Thanks Rob! It's clear to see who is in the minority.
houstonlively
I've been looking at this poker script for a long time. It's been in beta until recently, and was apparently open source. I've been waiting for it to be released, but was not expecting it to be encoded. I'd sure like to use the most current version.,,, even though they are now selling the open source version for only $25.

Maybe the folks at phppoker can come up with a D7 integration for their script, and offer it in the market on this site. With 50,000 members on this site, I'd bet they would see more sell a few copies of their poker script. I'll buy the old open source version, but I won't buy the current version unless I know it can be integrated into Dolphin 7.
lancashiredates
Hi just to update,

Steven at PHPPoker.Net has already made a plugin for Joomla and will be making one for his latest version 2.5 for Dolphin7 so it will come eventually.
i would like to say that i have been working on this for a long time like 3 weeks unlike most of the people here i dont have a strong php back ground my specialty is html an this has all been a learn by trial an error for me mostly more error then success i have ask for help from about 8 different people from boonex community an have only gotten one person that seemed like they would talk to me at all its funny that this is the exact same poker that i have been working on for so long you have no see more idea how grateful i am that you have posted this it helps so much for someone like me that is php brain dead lol i hope i can get it to work now
modloaded
This is really a great post appreciate this. Good job.
magic123
superb and thanks might be if our collage rules permit then we will have this
thanks a lot i have my site now working with this game
thanks a lot i have my site now working with this game.
thanks a lot i have my site now working with this game.
thanks a lot i have my site now working with this game.
thanks a lot i have my site now working with this game.
thanks a lot i have my site now working with this game.
thanks a lot i have my site now working with this game.
thanks a lot i have my site now working with this game.
thanks a lot i have my site now working with this game.
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.
PET:0.059412002563477