Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Making Links Clickable 1 Time Per Day
Old 10-22-2007, 06:28 PM Making Links Clickable 1 Time Per Day
Novice Talker

Posts: 10
Trades: 0
I have a Paid To Click site and currently the links are only clickable one time... period. I want members to be able to click them one time each day, but I am completely at a loss of how to do this.

Secondly, I am wondering if anybody knows how to make a timer countdown. For instance, when a member clicks on an advertisement right now, it simply shows: "You will be credited in 30 seconds." I would like for it to show: "You will be credited in 30...29...28" etc so they know exactly how long until they are credited. I will post some code from the files I believe you would use, but I am not 100% sure. If anybody knows any fixes for this, I would greatly appreciate it.

Also, the website I am talking about is here: http://www.onlinecashclicks.com - If you want to sign up to see what I am talking about, feel free. Thanks again in advance.

Also, I know this code is horribly written, but being as I am horrible as well, I do not know how to fix it (this is someone else's script).

frame.php
PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title></title><link type="text/css" rel="stylesheet" href="css/style.css" />
</head>
<?

include('includes/data_conn.php');

$get_general mysql_query("SElECT * FROM main");

$grow mysql_fetch_array($get_general);
    
$g_genid $grow[genid];
    
$g_title $grow[title];
    
$g_baseurl $grow[baseurl];
    
$g_rooturl $grow[rooturl];
    
$g_aemail $grow[adminemail];
    
$g_pemail $grow[paypalemail];
    
$g_lcharge $grow[linkcharge];
    
$g_bcharge $grow[bannercharge];
    
$g_withdraw $grow[withdraw];
    
$g_bold $grow[bold];
    
$g_italic $grow[italic];
    
$g_referral $grow[referral];
    
?>
    <frameset rows="80,*" frameborder="no" border="0" framespacing="0">

        <frame src="timer.php?adid=<?=$adid;?>&time=<?=$time;?>" name="top" scrolling="no" noresize="noresize" />

     <frame src="http://<?=$url;?>" name="main" />

    </frameset><noframes></noframes>

    <body>

</body>

</html>
timer.php

PHP Code:
<? session_start(); ?>

<? include('includes/data_conn.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>

<title><? echo $g_title ?></title>

<link type="text/css" rel="stylesheet" href="fix/css/style.css" />

<?

include('includes/data_conn.php');
$get_general mysql_query("SElECT * FROM main");
$grow mysql_fetch_array($get_general);
    
$g_genid $grow[genid];
    
$g_title $grow[title];
    
$g_baseurl $grow[baseurl];
    
$g_rooturl $grow[rooturl];
    
$g_aemail $grow[adminemail];
    
$g_pemail $grow[paypalemail];
    
$g_lcharge $grow[linkcharge];
    
$g_bcharge $grow[bannercharge];
    
$g_withdraw $grow[withdraw];
    
$g_bold $grow[bold];
    
$g_italic $grow[italic];
    
$g_referral $grow[referral];
?>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">

<!--

td {

    font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;

    font-size: 12px;

    font-weight: bold;

    color: #FFFFFF;

    text-decoration: none;

}

-->

</style>

</head>

<body bgcolor="#000000" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF">



<table width="100%" cellspacing="0" cellpadding="0" border="0">

<tr>

    <td class="bgblu" width="5%" align="left" valign="middle" height="80"></td>

    <td class="bgblu" width="46%" align="left" valign="middle" height="80"><font color="#FFFFFF" size="5" face="Tahoma, Verdana, Arial, Helvetica, sans-serif"><strong><? echo $g_title ?></strong></font></td>

    <td class="bgblu" width="44%" align="right" valign="middle" height="80">

    <div class="whitex"> 

        <?

    $check_user_info 
mysql_query("SELECT visited, earned, refer FROM users WHERE name='$loguser'");

    
$row mysql_fetch_array($check_user_info);

    
$vised explode(","$row[visited]);

    for (
$i 0$i count($vised); $i++)

    {

        if (
$vised[$i] == $adid)

         
$already_seen 1;

    }

    if (
$already_seen)

    {

        echo 
"<b>You have already recieved payment for this click!</b>";

    }

    elseif (
$done)

    {

        
$get_oldinfo mysql_query("SELECT * FROM links WHERE linkid='$adid'");

        
$irow mysql_fetch_array($get_oldinfo);

        
$hit $irow[hits];

        
$hit++;

        
$tamount $irow[total] - $irow[perclick];

        
$update_link mysql_query("UPDATE links SET hits='$hit', total='$tamount' WHERE linkid='$adid'");

        
//GIVE REFERRER MONEY

        
$urefer $row[refer];

        
$refer_amt mysql_query("SELECT earned FROM users WHERE name='$urefer'");

        
$rrow mysql_fetch_array($refer_amt);

        
$refadd $irow[perclick] * 0.5 $g_referral;

        
$refer_total $rrow[earned] + $refadd;

        
$update_referrer mysql_query("UPDATE users SET earned='$refer_total' WHERE name='$urefer'");

        
//END REFERRER PAYMENT

        
$new_visited "$row[visited],$adid";

        
$new_earned $row[earned] + $irow[perclick] * 0.5;

        if (!
$update_user mysql_query("UPDATE users SET visited='$new_visited', earned='$new_earned' WHERE name='$loguser'"))

        {

            echo 
"<b>Error:</b> Your click transaction could not be processed!";

        }

        echo 
"<b>You have recieved payment for this click!</b>";

    }

    else

    {
        echo 
"<b>You will receive payment for this click after $time seconds!</b>";

?>
      
      <meta http-equiv="refresh" content="<?=$time;?> URL=timer.php?adid=<?=$adid;?>&amp;time=<?=$time;?>&amp;done=1">

<?

   
}

?>

    </div>

    <a class="fracon" href="#" onClick="parent.window.close()">Close Window</a>

    </td>

    <td class="bgblu" width="5%" align="left" valign="middle" height="80"></td>

</tr>

</table>
</body>
</html>
Thanks to anybody who cares to look this over.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
onlinecashflow is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-22-2007, 09:59 PM Re: Making Links Clickable 1 Time Per Day
Novice Talker

Posts: 10
Trades: 0
One of the errors I get is the following:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in html/timer.php on line 115

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in html/timer.php on line 126

The complete code is here:
PHP Code:
<? session_start(); ?>
<?
    
if(!$done) {
    if(
$browse) {
        
$is_browse=1;
    }
    elseif(!
$browse) {
        
setcookie("browse" "true"time()+"30");
    }
    }
?>
<? 
include('includes/data_conn.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

<head>
<title><? echo $g_title ?></title>
<link type="text/css" rel="stylesheet" href="fix/css/style.css" />
<?

include('includes/data_conn.php');

$get_general mysql_query("SElECT * FROM main");

$grow mysql_fetch_array($get_general);

    
$g_genid $grow[genid];

    
$g_title $grow[title];

    
$g_baseurl $grow[baseurl];

    
$g_rooturl $grow[rooturl];

    
$g_aemail $grow[adminemail];

    
$g_pemail $grow[paypalemail];

    
$g_lcharge $grow[linkcharge];

    
$g_bcharge $grow[bannercharge];

    
$g_withdraw $grow[withdraw];

    
$g_bold $grow[bold];

    
$g_italic $grow[italic];

    
$g_referral $grow[referral];

?>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
td {
    font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
    font-size: 12px;
    font-weight: bold;
    color: #FFFFFF;
    text-decoration: none;
}

-->
</style>
<?
    $get_link_info 
mysql_query("SELECT * FROM links WHERE linkid='$adid'");
    
$the_link_info mysql_fetch_array($get_link_info);
    
$the_timer $the_link_info[timer];
    
$the_status $the_link_info[status];
    if(
$the_status == "inactive")
    {
    }
    elseif(!
$the_status)
    {
    }
    elseif(!
$done)
    {
?>
<SCRIPT LANGUAGE="JavaScript">
    var start=new Date();
    start=Date.parse(start)/1000;
    var counts=<?PHP echo "$the_timer";?>;
    function CountDown(){
        var now=new Date();
        now=Date.parse(now)/1000;
        var x=parseInt(counts-(now-start),10);
        if(document.form1)
        {
            document.form1.clock.value = x;
        }
        if(x>0){
            timerID=setTimeout("CountDown()", 100)
        }
    }
</script>
<SCRIPT LANGUAGE="JavaScript">
<!--
window.setTimeout('CountDown()',100);
-->
</script>
<?
}
?>
</head>
<body bgcolor="#000000" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF">

<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
    <td class="bgblu" width="5%" align="left" valign="middle" height="80"></td>
    <td class="bgblu" width="46%" align="left" valign="middle" height="80"><font color="#FFFFFF" size="5" face="Tahoma, Verdana, Arial, Helvetica, sans-serif"><strong><? echo $g_title ?></strong></font></td>
    <td class="bgblu" width="44%" align="right" valign="middle" height="80">
    <div class="whitex">
    <?
    $check_lastday 
mysql_query("SELECT lastday, userid FROM users WHERE name='$loguser'");
    
$dayrow mysql_fetch_array($check_lastday);
    
$oldday $dayrow[lastday];
    
$timenow getdate();
    
$newvis ",";
    if(
$timenow[yday] > $oldday) {
        
$update_lastday mysql_query("UPDATE users SET lastday='$timenow[yday]', visited ='$newvis' WHERE name = '$loguser'");
    }
    else {
        
$newvis "x";
    }
    
$check_user_info mysql_query("SELECT visited, earned, refer, browser FROM users WHERE name='$loguser'");
    
$row mysql_fetch_array($check_user_info);
    
$check_visited $row[visited];
    
$browse $row[browser];
    
$vised explode(","$row[visited]);
    for (
$i 0$i count($vised); $i++)
    {
        if (
$vised[$i] == $adid)
         
$already_seen 1;
    }
    if(
$check_visited == $newvis) {
        
$already_seen 0;
    }
    if(
$is_browse) {
        echo 
"Sorry, you either already have a browsing page open or on the last page that you visited you wait until the timer finishes. Please wait 30 seconds and then try again.";
    }
    elseif (
$already_seen == 1)
    {
        echo 
"<b>You have already received payment for this click!</b>";
    }
    elseif(
$the_status == "inactive")
    {
        echo 
"This link is inactive";
    }
    elseif(!
$the_status)
    {
        echo 
"This link id does not exist";
    }
    elseif(!
$done)
    {    
        
$timer_time $the_timer 1;
?>
        <FORM NAME="form1">
        You will receive payment for this click in
          <INPUT TYPE="text" NAME="clock" SIZE="2" VALUE=<?PHP echo "$the_timer";?>>
        seconds.
        </FORM>
        <meta http-equiv="refresh" content="<?=$timer_time;?> URL=timer.php?adid=<?=$adid;?>&amp;done=1">

<?
    
}
    elseif (
$done)
    {
        
$get_oldinfo mysql_query("SELECT * FROM links WHERE linkid='$adid'");
        
$irow mysql_fetch_array($get_oldinfo);
        
$hit $irow[hits];
        
$hit++;
        
$tamount $irow[total] - $irow[perclick];
        
$update_link mysql_query("UPDATE links SET hits='$hit', total='$tamount' WHERE linkid='$adid'");
        
//GIVE REFERRER MONEY
        
$urefer $row[refer];
        
$refer_amt mysql_query("SELECT earned FROM users WHERE name='$urefer'");
        
$rrow mysql_fetch_array($refer_amt);
        
$refadd $irow[perclick] * 0.5 $g_referral;
        
$refer_total $rrow[earned] + $refadd;
        
$update_referrer mysql_query("UPDATE users SET earned='$refer_total' WHERE name='$urefer'");
        
//END REFERRER PAYMENT
        
$new_visited "$row[visited],$adid";
        
$new_earned $row[earned] + $irow[perclick] * 0.5;
        if (!
$update_user mysql_query("UPDATE users SET visited='$new_visited', earned='$new_earned' WHERE name='$loguser'"))
        {
            echo 
"<b>Error:</b> Your click transaction could not be processed!";
        }
        echo 
"<b>You have received payment for this click!</b>";
    }
?>
    </div>
    <a class="fracon" href="#" onClick="parent.window.close()">Close Window</a>
    </td>
    <td class="bgblu" width="5%" align="left" valign="middle" height="80"></td>
</tr>
</table>



</body>

</html>
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
onlinecashflow is offline
Reply With Quote
View Public Profile
 
Old 10-23-2007, 12:02 PM Re: Making Links Clickable 1 Time Per Day
Foundationflash's Avatar
Ultra Talker

Posts: 410
Name: Harry Burt
Location: Colchester, Essex, England
Trades: 0
Referring to the second post, do you get any other errors?
__________________
Foundation Flash tutorials :
Please login or register to view this content. Registration is FREE


New Dreamed Up Web Design:
Please login or register to view this content. Registration is FREE
Foundationflash is offline
Reply With Quote
View Public Profile Visit Foundationflash's homepage!
 
Old 10-23-2007, 12:39 PM Re: Making Links Clickable 1 Time Per Day
rion's Avatar
Experienced Talker

Posts: 31
Name: Rion
Location: Portland, Oregon
Trades: 0
I suggest making a transactions type table. It looks like you are storing your 'visited' links in your users table as a comma delimited field. I would suggest creating a table with user_id, url_visited, and date_last_visited. Your code can then refer to the date_last_visited field when deciding whether the user is allowed to visit the link again.


As far as the timer goes. There are tons of javascript timers out there. Just do a google search for one.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Last edited by rion; 10-23-2007 at 12:41 PM..
rion is offline
Reply With Quote
View Public Profile Visit rion's homepage!
 
Old 10-23-2007, 01:36 PM Re: Making Links Clickable 1 Time Per Day
Novice Talker

Posts: 10
Trades: 0
Thanks for the help, I will check that.

FoundationFlash: No, that is the only error I am getting.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
onlinecashflow is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Making Links Clickable 1 Time Per Day
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.19125 seconds with 12 queries