Time Point To Cash
#1

Hey Guys I worked on it for abiut 3 hours ;D

 

I want to show you my new script for change time point for cash !!!

 

Here Are :

 

// Check For Login
if( $User->LoggedIn == true )
{

$mysql1 = mysql_select_db( $SiteSQL["config-database_auth"] , $Site_sqlcon) or die( mysql_error() );
$query1 = mysql_query("SELECT cash from bg_user WHERE user_code = ". $User->ID ."");
$result1b = mysql_fetch_array( $query1 );
$mysql2 = mysql_select_db( $SiteSQL["config-database_site"] , $Site_sqlcon) or die( mysql_error() );
$query2 = mysql_query("SELECT a_online_time from t_user_log WHERE a_account_index = ". $User->ID ."");
$result2b = mysql_fetch_array( $query2 );
$cash = $result1b['cash'];
$onlinetimepoints = $result2b['a_online_time'];

echo'<center>';
echo 'Your Currenty Cash Is : ';

print $cash;

echo'<br>';
echo 'Your Currenty Online Time Points : ';

print $onlinetimepoints;
echo '<br>';

if(isset($_POST['change'])) {
$mysql1 = mysql_select_db( $SiteSQL["config-database_auth"] , $Site_sqlcon) or die( mysql_error() );
$query1 = mysql_query("UPDATE bg_user SET cash = cash + ". $onlinetimepoints ." WHERE user_code = ". $User->ID ."");

$mysql2 = mysql_select_db( $SiteSQL["config-database_site"] , $Site_sqlcon) or die( mysql_error() );
$query2 = mysql_query("UPDATE t_user_log SET a_online_time = 0 WHERE a_account_index = ". $User->ID ."");

$mysql1 = mysql_select_db( $SiteSQL["config-database_auth"] , $Site_sqlcon) or die( mysql_error() );
$query1 = mysql_query("SELECT cash from bg_user WHERE user_code = ". $User->ID ."");
$result1b = mysql_fetch_array( $query1 );
$mysql2 = mysql_select_db( $SiteSQL["config-database_site"] , $Site_sqlcon) or die( mysql_error() );
$query2 = mysql_query("SELECT a_online_time from t_user_log WHERE a_account_index = ". $User->ID ."");
$result2b = mysql_fetch_array( $query2 );
$curonlinept = $result2b['a_online_time'];
$curcash = $result1b['cash'];

echo 'Now You Got(Cash) : ';
print $curcash;

echo '<br>Now You Got(OnlinePoints) :';
print $curonlinept;
}
?>
<form id="form1" name="form1" method="post" action="">
<input name="change" value="Time For Cash !" type="submit" />
</form>
</html>
<?php

echo '</center>';

}
else{
echo 'No Logged ! Please Login For Excange Online Time Points !' ;
}

 

You Must Use It For Your Page ;D

 

Have Fun !

 

Some Things :

 

 

2

2

 

 

THIS IS CREATED BY MYSELF !!!

#2
Nice release and nice work

#3


Nice release and nice work

 

 

And Nice Thanks ;D

 

i'm looking for addeals.php and addseals.tpl you got it ? if yes can send me a pm with link ?

#4

I wouldn't use MySql library from PHP, since with the latest versions of PHP it gotten deprecated, I suggest using MySQLi, or PDO, mysqli only available for mysql, where PDO is available for 8 databases types.

 

If you have experience with mysql, mysqli will be easier to understand since the function names are the same only is added the I in the function names.

 

2

#5


I wouldn't use MySql library from PHP, since with the latest versions of PHP it gotten deprecated, I suggest using MySQLi, or PDO, mysqli only available for mysql, where PDO is available for 8 databases types.

 

If you have experience with mysql, mysqli will be easier to understand since the function names are the same only is added the I in the function names.

 

2

 

PDO and Mysqli is harder >.>

#6


Its actually quite simple, I personally wouldn't say one is harder over another.

 

Well i'm already used to mysql and i'm still pretty noob at it xd

#7
how i can create a a_online_time in db

#8
barroso if you're using navicat just design table button and add a_online_time | varchar | 200 | 0 | Not NULL

#9

Its really not that hard to make it in pdo.

Also, if u want to edit that later u will spend hours on tracing back all the variables u used.

 

<?php

try
{
$db = new PDO('mysql:host=localhost', 'username', 'password');
}
catch
{
die('Unable to connect to the database<br />Please try again later');
}

if( $User->LoggedIn == true )
{

$dbauth = $SiteSQL["config-database_auth"];
$dbsite = $SiteSQL["config-database_site"];
$uid = $User->ID;

$query = sprintf
("
SELECT
u.cash as cash,
l.a_online_time as time

FROM
%s.bg_user u,
%s.t_user_log l

WHERE
u.user_code = :uid

AND
l.a_account_index = u.user_code

", $dbauth,
$dbsite );

$dbh = $db->prepare($query);

$dbh->bindParam(':uid', $uid, PDO:TongueARAM_INT);
$dbh->execute();

$result = $dbh->fetch();

$cash = $result['cash'];
$time = $result['time'];

if( isset($_POST['change']))
{

$dbh = $db->prepare( sprintf('UPDATE %s.bg_user SET cash = cash + :timepoints WHERE user_code = :uid', $auth));
$dbh->bindParam(':timepoints', $time, PDO:TongueARAM_INT);
$dbh->bindParam(':uid', $uid, PDO:TongueARAM_INT);
$dbh->execute();

$dbh = $db->prepare( sprintf('UPDATE %s.t_user_log SET a_online_time = 0 WHERE a_account_index = :uid', $db));
$dbh->bindParam(':uid', $uid, PDO:TongueARAM_INT);
$dbh->execute();

$cash -= $time;
$time = 0;

}

printf
('
<center>
Your Current Cash Is : %d<br />
Your current online time points : %d<br />

<form id="form1" name="form1" method="post">
<input name="change" value="Time For Cash !" type="submit" />
</form>
</center>

', $cash, $time);

}
else
echo 'Please login to exchange Online Time Points for Cash';

?>

 

#10

Sorry but this has to be said now..

 

THIS IS CREATED BY MYSELF !!!

 

Lol if you look closer at the code, yea go on have a look!

if( $User->LoggedIn == true )

{

}

$SiteSQL["config-database_auth"]

 

All of this [CeNsOrEd] originates from my sites with originates from Wizateks EP2 control pannel

So quoting "THIS IS CREATED BY MYSELF !!!" means you used our code learn't alittle an got a script to work.

Its not fully created by yourself.. lol



Forum Jump:


Users browsing this thread: 1 Guest(s)