Results 1 to 9 of 9

Thread: PHP help

  1. #1
    Join Date
    Feb 2007
    Posts
    2,941
    Tokens
    0

    Latest Awards:

    Default PHP help

    Not for me for a mate right here is what i want to know

    how would he code it so on a dj panel once a dj ahs viewed the radio info once it wont let them see it again untill a admin gives them permissions too via the panel


    what would the code be for the user and the admin

    basicly like what ch have

    Edited by Tomm (Forum Moderator): Moved from Website Design and Development, please post in the right forum next time.
    Last edited by Tomm; 20-10-2007 at 04:09 PM.

  2. #2
    Join Date
    Oct 2007
    Location
    Luton, England
    Posts
    1,548
    Tokens
    388
    Habbo
    DeejayMachoo

    Latest Awards:

    Default

    have you even tried to attempt this?

    The easyest way would to have a form saying "once i view the details i wont be able to view them again" and when u submit it it changes a coloum in the database to 1 or 0 and make the page check what that is and if its 1 then it doesnt display but if its 0 then it does, i find it hard to explain stuff like this its easyer to just write it

  3. #3
    Join Date
    Feb 2007
    Posts
    2,941
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Mattx.org View Post
    have you even tried to attempt this?

    The easyest way would to have a form saying "once i view the details i wont be able to view them again" and when u submit it it changes a coloum in the database to 1 or 0 and make the page check what that is and if its 1 then it doesnt display but if its 0 then it does, i find it hard to explain stuff like this its easyer to just write it
    Like i say not me,my mate, he has yes that is y he is now asking for help

    and + rep for help
    Last edited by Hayd93; 20-10-2007 at 04:10 PM.

  4. #4
    Join Date
    Oct 2007
    Location
    Luton, England
    Posts
    1,548
    Tokens
    388
    Habbo
    DeejayMachoo

    Latest Awards:

    Default

    ok so add a column to the users table called stats with default 0,

    Before i can contine helping your friend, could you get the name of the users table and what does he use for the sessioned user eg. $logged[username] or $logged[email] to display the logged in users infomation.

  5. #5
    Join Date
    Feb 2007
    Posts
    2,941
    Tokens
    0

    Latest Awards:

    Default

    $_SESSION['session_username']

    and users table is called staff

    donno what that means as i cant do php but taht si what he said

  6. #6
    Join Date
    Jan 2007
    Posts
    651
    Tokens
    0

    Default

    Make a column in the 'Staff' Column, call it 'Detail'

    then make a if like:
    PHP Code:
    <?php

    if ($_SESSION['Detail'] != '1' ) {
    die(
    'You have already read the Radio Information');
    }

    ?>
    James


    Connected to reality through a proxy server.

  7. #7
    Join Date
    Apr 2006
    Location
    Leamington Spa
    Posts
    1,375
    Tokens
    72

    Latest Awards:

    Default

    SQL Query to update your "staff" user table:
    PHP Code:
    ALTER TABLE `staffADD `radioinfoviewsVARCHAR10  NOT NULL DEFAULT '0'
    Add to the top of your radio information page:
    PHP Code:
    <?php
    mysql_query
    ("UPDATE `staff` SET `radioinfoviews` = '1' WHERE `username` = '$_SESSION['session_username']';");
    if(
    $users[radioinfoviews] <= "1"){ // THIS IS THE LINE YOU MIGHT NEED TO EDIT.
    echo("Sorry, you have already viewed the radio info, you now need to ask an admin to allow you rights.");
    exit;
    }
    ?>
    Now add this to your DJ admin page:

    PHP Code:
    <?php
    if(!$_POST['this']){
    echo(
    "<form method=\"POST\">
    Name of user to allow access: <input type=\"text\" name=\"username\">
    <br>
    <input type=\"submit\" name=\"this\" value=\"Allow Access\">
    </form>"
    );
    }else{
    $username=$_POST['username'];
    mysql_query("UPDATE `staff` SET `radioinfoviews` = '0' WHERE `username` = '$username' ;");
    echo(
    "The user $username has now been granted access to the radio info page for ONE TIME ONLY.
    ?>
    Would need basic SQL/PHP knowledge to do this. But, if you've already made a DJ panel then I guess you've got that already.

    EDIT: If you already know PHP, you might want to check this code, I have a reputation for being somewhat messy.
    Last edited by lolwut; 27-10-2007 at 10:18 PM.
    i've been here for over 8 years and i don't know why

  8. #8
    Join Date
    Oct 2007
    Location
    Noob Town.
    Posts
    91
    Tokens
    0

    Default

    Quote Originally Posted by Imperial March View Post

    PHP Code:
    <?php
    if(!$_POST['this']){
    echo(
    "<form method=\"POST\">
    Name of user to allow access: <input type=\"text\" name=\"username\">
    <br>
    <input type=\"submit\" name=\"this\" value=\"Allow Access\">
    </form>"
    );
    }else{
    $username=$_POST['username'];
    mysql_query("UPDATE `staff` SET `radioinfoviews` = '0' WHERE `username` = '$username' ;");
    echo(
    "The user $username has now been granted access to the radio info page for ONE TIME ONLY.
    ?>
    Would need basic SQL/PHP knowledge to do this. But, if you've already made a DJ panel then I guess you've got that already.

    EDIT: If you already know PHP, you might want to check this code, I have a reputation for being somewhat messy.
    Checking the code, I think this may work (I only checked the one shown in the quote..)

    Try Imperial's first, then try this:

    PHP Code:
    <?php

        
    if(!$_POST['this']){
            echo(
    "<form method=\"POST\">
            Name of user to allow access: <input type=\"text\" name=\"username\">
            <br>
            <input type=\"submit\" name=\"this\" value=\"Allow Access\">
            </form>"
    );
        }else{
            
    $username=$_POST['username'];
            
    mysql_query("UPDATE `staff` SET `radioinfoviews` = '0' WHERE `username` = '$username' ;");
            echo(
    "The user $username has now been granted access to the radio info page for ONE TIME ONLY.");
            }
            
    ?>
    EDIT: Looks the same, but I have changed some thinks, and made it look easier to read.
    Last edited by Kazco; 27-10-2007 at 10:26 PM. Reason: Advice

    My first User Bar


    Sign Up at
    http://www.habtown.net/forum/

    THANKIES>




  9. #9
    Join Date
    Apr 2006
    Location
    Leamington Spa
    Posts
    1,375
    Tokens
    72

    Latest Awards:

    Default

    ^^ What Kazco said. :rolleyes:
    i've been here for over 8 years and i don't know why

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •