Jump to content

HenryC

Members
  • Posts

    30
  • Joined

  • Last visited

Posts posted by HenryC

  1. Yeah here is the code for index.php

     

    <?php
    session_start();
    include("header.php");
    
    // check if user logged in
    if (isset($_SESSION['logged'])){
    header("Location: home.php");
    exit();
    }
    
    $filename = "pageviewsindex.txt";
    $count= file($filename);
    $count[0]++;
    $file = fopen ($filename, "w");
    fputs($file, "$count[0]");
    fclose($file);
    
    include("connect.php");
    
    $sql = mysql_query("SELECT * FROM subscribers");
    $count = mysql_num_rows($sql);
    
    
    
    include 'counter/counter.php'; 
    ?>
    
    <div class="content">
        		<!--start banner-->
    
    
                <div class="banner">
                <div class="join_free"></div>
                
                
                <div id="slider" class="nivoSlider">
                    <img src="images/1.jpg" alt="" />
                   <img src="images/2.jpg" alt="" />
                    <img src="images/3.jpg" alt="" />
                    <img src="images/4.jpg" alt=""  />
                </div>
        
        <script type="text/javascript" src="js/jquery.nivo.slider.pack.js"></script>
        <script type="text/javascript">
        $(window).load(function() {
            $('#slider').nivoSlider();
        });
        </script>
                
                </div><!--end banner-->
        		<!--start left side-->
            <div class="left_side">
            	<div class="gray_box">What is Tubeviews</div>
                <div class="blue_pic"></div>
                <div class="txt_what">
                Tubeviews is a website that helps you gain more publicity on Youtube. With our automated systems you can gain thousands of Subscribers and Views.. You earn credits by subscribing to other members and viewing other members videos, those credits will then convert to subscribers/views for you. Our services are 100% free, all you have to do is signup, link your account and begin earning credits.          
                </div><!--end txt what-->        
            </div><!--end left side-->
            <div class="line_pic"></div>
            <!--start right side-->
            <div class="right_side">
            	<div class="title_right">Tubeviews News</div>
                <div class="txt_says">
    		<li>Brand New Look</li>
    		<li>Sub4sub section bug fixed</li>
    		<li>Add Friends System Added</li>
    		<li>Channel Views System Added</li>
                </div>
                <div class="txt_says">
    		We have had <u><?php echo $count; ?></u> subs to date
                </div>
    		<br>
            </div><!--end right side-->
            <div class="note">Website Launched June 6, Please Be Patient While We Get More Members, We Have The Potential To Get You Thousands Of Subs, Views </div>
       </div><!--end content-->
    
    <?php
    
    include("footer.php");
    ?>
    

     

    Header and footer are ok too.

     

    It started when i added the facebook like button, but i dont know how its possible for something to modify my pages without editing my code.

  2. I added the facebook like button to my website, and now i have ads covering my pages and taking over my ebsite content, i removed the like button but the ads are still there

     

    tubeviews.co.nr

     

    is this something in the html that is causing this?

  3. I don't use functions to often but i want to clean up my code to make less bandwidth and load so i have been making some, what i am stuck at is say i want a function to hold querys

     

    <?php
    function query() {
    $sql = mysql_query("SELECT * FROM users");
    $row = mysql_fetch_assoc($sql);
    }
    ?>
    

     

    How do i execute that when i need it?

    the usual query(); doesnt seem to work with it, neither does return;

  4. I'm using hosting24.com, when i first transferd my site only me and my staff new the new address, within 5 minutes the site was down to CPU, the live chat said its becuase i recived over 600 hits %20 CPU within 5 minutes and they only allow 600 in 5 minutes, they said it might be becuase i am using a chatroom which is the phpfreechat script, but even when i took that off and replaced with a forums i was still getting it, my site allows the user to sub to 30 people an hour so if 20 users do that within 5 minutes it will go down, thats pretty bad if you ask me.

     

    I mainly code in PHP and have done through the years so i don't have much knowledge in ajax or so..

     

    Also does it realy matter how low mysql bandwidth i use if it will still count as a hit anyway?

     

    Also hosting24 have unlimited space and bandwidth.

  5. As you may have seen by previous post's i own a sub4sub website for a community of people, the way i have it set up is users click on other members sub button to gain points and recieve subs and everytime they click the button it refreshes the page so more people can show up by the results query, every refresh counts as a hit and i am having trouble with my host because im getting to many hits, i am just wondering is this the way to do it correctly? or could i maybe use something like ajax where i dont have to refresh the page which means it wont count as a hit and stop it using up too much CPU.

  6. I have a co.nr domain which is a free domain pointed at my site, now i have a real .com domain i have put a message on the old one with a link to the new website, now when i click the link on that page and it takes me to the new site the address bar still says .co.nr when i am on my new domain, is there anyway i could use another method of redirect to force the new domain, i have tried header, meta, htacces..

  7. Hi i have a page where a few popup windows will popup

     

    <script language="JavaScript1.1">
    <!--
    function openWin(url) {
    self.name = "Popper";
    remote = open(url, "", "resizable,scrollbars,width=600,height=500,left=10 ,top=10");
    }
    //-->
    </script>
    
    <body onload="openWin('http://www.youtube.com/<?php echo $id; ?>');">
    

     

    I have a dynamic refresh after so many seconds which will change the $id to a new one.

     

    However as i have it each time my page refreshes and the popup opens, it opens in a new window instead of the same window from the previous popup(overwriting first popup), can i keep it in the same window?

     

     

  8. Hello all i am using the youtube api system on my website and part of it is to authenticate the user

     

    set_include_path('/home/u292976682/public_html/Zend/library');
    require_once 'Zend/Loader.php'; // the Zend dir must be in your include_path
    Zend_Loader::loadClass('Zend_Gdata_YouTube');
    $yt = new Zend_Gdata_YouTube();
    
    Zend_Loader::loadClass('Zend_Gdata_AuthSub');
    Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
    $developerKey = "";
    $yt = new Zend_Gdata_YouTube(getAuthSubHttpClient(), $applicationId,
    $clientId, $developerKey);
    function getAuthSubRequestUrl()
    {
        $next = 'link';
        $scope = 'http://gdata.youtube.com';
        $secure = false;
        $session = true;
        return Zend_Gdata_AuthSub::getAuthSubTokenUri($next, $scope, $secure, $session);
    }
    function getAuthSubHttpClient()
    {
        if (!isset($_SESSION['sessionToken']) && !isset($_GET['token']) ){
           echo "<a href='link' target='_blank'>Link Your Youtube Account</a>";
            return;
        } else if (!isset($_SESSION['sessionToken']) && isset($_GET['token'])) {
          $_SESSION['sessionToken'] = Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token']);
        }
    
        $httpClient = Zend_Gdata_AuthSub::getHttpClient($_SESSION['sessionToken']);
        return $httpClient;
    }

     

    Now that works great problem is if the user closes there browser and comes back

    they need to link there youtube account again, i have read up that the api session will never expire so im not sure why it is, i have even been forced to take session_destroy(); out of my logout page just so it doesnt destroy the sessionToken, anyone know a fix for this?

  9. I have all my variables assigned to a value i just didn't add that to the code here, i forggot to escape the new peice of code i added. the problem is when there is not a row the query will fail and give me a num rows error which is why i nested it around the mysql_query, how can i test it without the nums having a variable? and when the num does have a variable it will give out an error if no records are found

  10. Forgot to add in some code

     

    Show the members who can be subscribed

     

    <?php
    $query = "SELECT * FROM users WHERE subcreds > 0 AND username NOT IN (SELECT subscriber_username FROM subscribers WHERE my_id = '$id') ORDER BY RAND() LIMIT 6";
    $sql = mysql_query($query) or trigger_error($query . ' has an error:<br />' . mysql_error());
    
    ?>
    <div class="ssubs">
    
    <?php
    while($row = mysql_fetch_assoc($sql)){
    ?>
    <center>
    <div class="subs">
    <img src="sub.jpeg" height="64"><br>
    <?php echo mysql_real_escape_string($row['subchannel']); ?><br>
    <form action="sub4sub.php?id=<?php echo mysql_real_escape_string($row['id']); ?>" method="POST">
    <input type="submit" name="sub" value="Sub" style="background: white; border: none;">
    </form>
    </div>
    </center>
    <?php
    }

     

     

    After hit submit

     

    <?php
    if (isset($_POST['sub'])){
    
    include("connect.php");
    
    $id = mysql_real_escape_string($_GET['id']);
    $sql = mysql_query("SELECT * FROM users WHERE id= $id");
    $row = mysql_fetch_assoc($sql);
    $usersub = $row['username'];
    $ytkb = mysql_real_escape_string($row['subchannel']);
    $subscriberusername = mysql_real_escape_string($row['username']);
    
    // youtube stuff 
    
    try {
    $yt->insertEntry($newSubscription, $subscriptionsFeedUrl);
    $myid = $_SESSION['id'];
    $time = date("Y-m-d H:i:s");
    
    $sqlt = "SELECT * FROM subscribers WHERE my_username = '$username' AND subscriber_username = '$usersub'";
    
    if (mysql_num_rows(mysql_query($sqlt)) == 0){
    
    $sqlkb = mysql_query("INSERT INTO subscribers VALUES('','$myid','$user','$id','$subscriberusername','$time')");
    $sqlq = mysql_query("UPDATE users SET subcreds=subcreds+1 WHERE username = '$user'");
    $sqlk = mysql_query("UPDATE users SET subcreds=subcreds-1 WHERE id = $id");
    header("Location: sub4sub.php");
    }else{
    header("Location: sub4sub.php");
    }
    }
    catch (Zend_Gdata_App_HttpException $e)
    {
    
    $sqlt = "SELECT * FROM subscribers WHERE my_username = '$username' AND subscriber_username = '$usersub'";
    
    if (mysql_num_rows(mysql_query($sqlt)) == 0){
    
    $time = date("H:i:s");
        $sql = mysql_query("INSERT INTO subscribers VALUES('','$myid','$user','$id','$subscriberusername','$time')");
    header("Location: sub4sub.php");
    }else{
    header("Location: sub4sub.php");
    }
    }

     

    I even have a num rows check to make sure there can only be one row, so i dont know whats the problem?

  11. Hello there i am making a sub4sub site for a small community of people and have a sub4sub page where users can sub to people, once they click the sub button on there name a new record gets added to the subscriber database and that member whom he subscribed to goes off the list but recently i have noticed that there has been alot of double submissions, like if i check my database

     

    fred has subscribed to paul

     

    there could be 20 of that exact row, how is that ? when the button goes away soon as they click it the first time.

  12. Ok i have it working but i want to make sure this is the right way of going about it

     

    <?php
    $id = $_SESSION['id'];
    
    $time = time() - 3600;
    
    $time = date("H:i:s",$time);
    
    $sql = mysql_query("SELECT * FROM subscribers WHERE time > '$time' AND my_id = $id");
    
    $nums = mysql_num_rows($sql);
    
    if ($nums > 29){
    ?>
    <center>
    <font size="3" color="383838">
    Your Subscriber Limit Is Up, You May Subscribe Again In 1 Hour</font>
    </center>
    <?php
    }else{
    
    $query = "SELECT * FROM users WHERE subcreds > 0 AND username NOT IN (SELECT subscriber_username FROM subscribers WHERE my_id = '$id') ORDER BY RAND() LIMIT 6";
    $sql = mysql_query($query) or trigger_error($query . ' has an error:<br />' . mysql_error());
    
    // show subs
    

     

    so if the user has subed to 30 people then they will get the your subscription limit is up, then after the hour they can sub again that look ok?

  13. Ok i have the time of the sub and the current time

     

    <?php
    $sql = mysql_query("SELECT * FROM subscribers WHERE username = '$user'");
    $row = mysql_fetch_assoc($sql);
    
    $time = $row['time']; // 08:10:04
    echo "<br>";
    $date = date("H:i:s"); // 08:19:19
    
    What can i use to check if there has been 30 subs within the last hour?

  14. <?php
    $sql = "SELECT * FROM subscribers WHERE username = '$user'";
    $result = mysql_query($sql);
    $row = mysql_fetch_assoc($sql);
    
    $time = $row['time'];
    
    if ($time ???){
    
    // subed 30 in last hour
    // show message telling them
    }else{
    // not subed 30
    // my code
    }

     

    How can i tell if there has been 30 records within the hour by that user?

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.