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.
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> <? echo BOX_CREATE_NEW_PLAYER; ?> </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> </td>
<td width="21%" nowrap> </td>
<td width="27%" nowrap> </td>
</tr>
<tr>
<td width="33%" align="right" nowrap> </td>
<td width="19%" align="left" nowrap> </td>
<td width="21%" align="left" nowrap> </td>
<td width="27%" align="left" nowrap> </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> </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> </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> </td>
<td width="19%" align="left" nowrap> </td>
<td width="21%" align="right" nowrap> </td>
<td width="27%" align="left" nowrap> </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.
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....
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.
I'll do it later when I have some spare time.
Thanks for your suggestion CS. Positive vote for you. +1
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
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.