need help with auto vip script

Results 1 to 8 of 8
  1. #1
    Member xforlife is offline
    MemberRank
    Jan 2012 Join Date
    NetherlandsLocation
    94Posts

    need help with auto vip script

    Hey,

    I'm busy with this code

    PHP Code:
    <?php 
    $con 
    mysql_connect("localhost","root","mypass"); 
    if (!
    $con
      { 
      die(
    'Could not connect: ' mysql_error()); 
      } 


    mysql_query("UPDATE users SET vip = 1 WHERE username = '".$_SESSION['user']['username']."' LIMIT 1");
    mysql_query("UPDATE users SET rank = 2 WHERE username = '".$_SESSION['user']['username']."' LIMIT 1");  


    mysql_close($con); 
    ?>
    But it doesn't work i hope someone can help me, i'm using rev 1.9.9.9

    my idea, after paying this php file wil run on the background so the users get automatic vip

    sorry if i had bad english
    Last edited by xforlife; 26-02-13 at 01:31 AM.


  2. #2
    Member xforlife is offline
    MemberRank
    Jan 2012 Join Date
    NetherlandsLocation
    94Posts

    Re: need help with auto vip script

    someone?

  3. #3
    I don't even know azaidi is offline
    Grand MasterRank
    Apr 2010 Join Date
    the NetherlandsLocation
    2,065Posts

    Re: need help with auto vip script

    First of all use mysqli: mysqli_query etc.
    You don't have to close the connection at the end of your script, PHP will do it for you.

    Try putting the 1 and 2 between single quotes:
    mysqli_query("UPDATE users SET vip = '1' WHERE username = '".$_SESSION['user']['username']."' LIMIT 1");
    mysqli_query("UPDATE users SET rank = '2' WHERE username = '".$_SESSION['user']['username']."' LIMIT 1");

  4. #4
    Developer Quackster is offline
    DeveloperRank
    Dec 2010 Join Date
    AustraliaLocation
    3,486Posts

    Re: need help with auto vip script

    you haven't selected the database.

  5. #5
    Grand Master iRetro™ is offline
    Grand MasterRank
    Feb 2010 Join Date
    United KingdomLocation
    558Posts

    Re: need help with auto vip script

    You haven't selected the db, also this is really bad as anyone could get vip with this script.

  6. #6
    Member xforlife is offline
    MemberRank
    Jan 2012 Join Date
    NetherlandsLocation
    94Posts

    Re: need help with auto vip script

    Okee, i got this code now (btw i dont know anything about php/mysql)
    Code:
    <?php
    
    $con=mysqli_connect("localhost","root","123","hotel");
    
    if (mysqli_connect_errno($con))
      {
      echo "Failed to connect to MySQL: " . mysqli_connect_error();
      }
    
    mysqli_query($con,"UPDATE users SET vip = '1' WHERE username = '".$_SESSION['user']['username']."' LIMIT 1");
    mysqli_query($con,"UPDATE users SET rank = '2' WHERE username = '".$_SESSION['user']['username']."' LIMIT 1");
      
    ?>
    but it still doesn't update in phpmyadmin/mysql

  7. #7
    Ask me about Daoism FullmetalPride is offline
    Grand MasterRank
    Nov 2010 Join Date
    2,172Posts

    need help with auto vip script

    Quote Originally Posted by xforlife View Post
    Okee, i got this code now (btw i dont know anything about php/mysql)
    Code:
    <?php
    
    $con=mysqli_connect("localhost","root","123","hotel");
    
    if (mysqli_connect_errno($con))
      {
      echo "Failed to connect to MySQL: " . mysqli_connect_error();
      }
    
    mysqli_query($con,"UPDATE users SET vip = '1' WHERE username = '".$_SESSION['user']['username']."' LIMIT 1");
    mysqli_query($con,"UPDATE users SET rank = '2' WHERE username = '".$_SESSION['user']['username']."' LIMIT 1");
      
    ?>
    but it still doesn't update in phpmyadmin/mysql
    My first question is why ever write a page specifically for giving free VIP? :l

    If you're going to be giving VIP to everyone, just write an extra query in registration.

  8. #8
    Eye Eye Capt'n Spheral is offline
    Grand MasterRank
    May 2010 Join Date
    TumptonshireLocation
    2,488Posts

    Re: need help with auto vip script

    I use auto ipn for payment, lol.



Advertisement