/    Sign up×
Community /Pin to ProfileBookmark

MSSQL Error in homemade script

Hello people,

Can anyone help me fixing my script error? It’s not working somehow. It would be really great if someone can fix it.

Vote.php (gives the error: ( ! ) SCREAM: Error suppression ignored for
( ! ) Fatal error: Call to undefined function mssql_connect() in C:wampwwwflyffvotevote.php on line 44
Call Stack

# Time Memory Function Location

1 0.0010 689864 {main}( ) ..vote.php:0)

[CODE]<?php
if(isset($_POST[‘doVote’]))
{

include_once(“class/class.vote.php”);
include_once(“inc/inc.class_initiate.php”);
include_once(“inc/inc.config.php”);

$mssqlcon = mssql_connect($mssqlServer, $mssqlUser, $mssqlPass);

$eVoteHEAD = “Error!”;

if($_POST[‘etCharacter’] && $eVote->checkIP() && $eVote->checkCharacter($_POST[‘etCharacter’]))
{

$eVote->removeLog($_POST[‘etCharacter’]);

$itemSendResult = $eVote->sendItem($_POST[‘etCharacter’]);

if($itemSendResult)
{

$eVoteHEAD = “Link generated!”;
$eVoteMSG = “Click <a href=”javascript:etOpenVoteWindow()”>here</a> to open the vote window.<br/>The reward will be sent to you after you voted.<br/>If it doesn’t appear however, try relogging.”;

}
else
$eVoteMSG = “The character doesn’t exist!<br/>Please refresh the browser and try again.”;

}
else
$eVoteMSG = “Either you left the character field blank, or you are trying to vote from the same character more than once within 6 hours.<br/>Please refresh the browser and try again.”;

echo(“<p>{$eVoteHEAD}</p>{$eVoteMSG}”);

}
else
{

include_once(“class/class.vote.php”);
include_once(“inc/inc.class_initiate.php”);
include_once(“inc/inc.config.php”);

$mssqlcon = mssql_connect($mssqlServer, $mssqlUser, $mssqlPass);

if($eVote->checkIP())
{

?>

<script type=”text/javascript” src=”js/jquery.js”></script>
<script type=”text/javascript” src=”js/vote.js”></script>

<div id=”et_vbutton” onclick=”etLiteGetVoteDialog();” style=”background-image: url(‘images/votenow.png’); text-align: center; width: 250px; height: 150px; position: absolute; top: 0px; right: 20px; cursor: pointer;”>

<div id=”et_vcharenter” style=”background-color: #F8F8F8; margin: 10px auto; width: 200px; height: 70px; text-align: center; display: none;”>

Character Name:<br/>
<input type=”text” id=”etCharField”/><br/>
<input type=”submit” id=”etCharSubmit” onclick=”etLiteDoVoteDialog();” value=”Vote!”/>

</div>

</div>

<?php

}

}

?>[/CODE]

inc.config.php

[CODE]<?php

//The itemName must be the EXACT same name as the item in-game. itemId is the ID of the item, amount is how many they will be getting.
$voteReward = array(“itemName” => “Happy Money”, “itemId” => 26419, “itemAmount” => 300);

$mssqlServer = “MICHAELFLYFF”;
$mssqlUser = “sa”;
$mssqlPass = “passwordhere”;
$mssqlAccountDBF = “ACCOUNT_DBF”;
$mssqlCharacterDBF = “CHARACTER_01_DBF”;

?>[/CODE]

inc.class_initiate.php

[CODE]<?php

$eVote = new ETUNIA_VOTE_LITE();

?>[/CODE]

class.vote.php

[CODE]<?php

class ETUNIA_VOTE_LITE
{

private $mssqlExploitArray = array(“0x”, “DROP”, “SELECT”, “‘”, “FROM”, “DELETE”, “drop”, “select”, “from”, “delete”, “–“, “#”);

private function mssql_escape_string( $inputString )
{

return str_replace($this->mssqlExploitArray, “”, $inputString);

}

public function checkCharacter( $etCharacter )
{

global $mssqlAccountDBF;

$etCharacter = $this->mssql_escape_string($etCharacter);
$currentDate = date(“mdHi”);

mssql_select_db($mssqlAccountDBF);

$sql_string = “SELECT time FROM VOTE_TBL WHERE character='{$etCharacter}’;”;
$sql_query = mssql_query($sql_string);

if(mssql_num_rows($sql_query) == 0)
return true;

$sql_row = mssql_fetch_row($sql_query);

if(($currentDate – $sql_row[0]) < 600)
return false;

else
return true;

}

public function checkIP()
{

global $mssqlAccountDBF;

$userIP = $this->mssql_escape_string($_SERVER[‘REMOTE_ADDR’]);
$currentDate = date(“mdHi”);

mssql_select_db($mssqlAccountDBF);

$sql_string = “SELECT time FROM VOTE_TBL WHERE ip='{$userIP}’;”;
$sql_query = mssql_query($sql_string);

if(mssql_num_rows($sql_query) == 0)
return true;

$sql_row = mssql_fetch_row($sql_query);

if(($currentDate – $sql_row[0]) < 600)
return false;

else
return true;

}

public function removeLog( $etCharacter )
{

global $mssqlAccountDBF;

$userIP = $this->mssql_escape_string($_SERVER[‘REMOTE_ADDR’]);
$etCharacter = $this->mssql_escape_string($etCharacter);

mssql_select_db($mssqlAccountDBF);

$sql_string = “DELETE FROM VOTE_TBL WHERE ip='{$userIP}’;”;
$sql_query = mssql_query($sql_string);

if($sql_query)
return true;

else
return false;

}

public function sendItem( $etCharacter )
{

global $mssqlCharacterDBF;

global $voteReward;

$rewardId = $voteReward[‘itemId’];
$rewardName = $voteReward[‘itemName’];
$rewardAmount = $voteReward[‘itemAmount’];
$etCharacter = $this->mssql_escape_string($etCharacter);

mssql_select_db($mssqlCharacterDBF);

$sql_string = “SELECT m_idPlayer FROM CHARACTER_TBL WHERE m_szName = ‘{$etCharacter}’;”;
$sql_query = mssql_query($sql_string);

if(mssql_num_rows($sql_query) == 0)
return false;

$sql_row = mssql_fetch_row($sql_query);

$etCharacterId = $sql_row[0];

$sql_string = “INSERT INTO ITEM_SEND_TBL([m_idPlayer], [serverindex], [Item_Name], [Item_count], [idSender], [adwItemId0]) VALUES(N'{$etCharacterId}’, N’01’, N'{$rewardName}’, ‘{$rewardAmount}’, N’0000001′, ‘{$rewardId}’);”;
$sql_query = mssql_query($sql_string);

if($sql_query)
{

$this->logPlayer($etCharacter);

return true;

}

else
return false;

}

private function logPlayer( $etCharacter )
{

global $mssqlAccountDBF;

mssql_select_db($mssqlAccountDBF);

$currentTime = date(“mdHi”);

$sql_string = “INSERT INTO VOTE_TBL([character], [ip], [time]) VALUES(N'{$etCharacter}’, N'{$_SERVER[‘REMOTE_ADDR’]}’, N'{$currentTime}’);”;
$sql_query = mssql_query($sql_string);

}

}

?>[/CODE]

I’m sure my MSSQL connection details are right.
Kind regards,

Michael

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@rh_lloydnorthovDec 19.2012 — As far as I can recall the php MSSQL module isn't included by default - have you enabled the appropriate module in php.ini? have a look at http://php.net/manual/en/book.mssql.php.
×

Success!

Help @Clockworkz spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...