Activity Stream
48,167 MEMBERS
61138 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 8 of 8
  1.     
    #1
    Member
    Website's:
    rootw.net

    Default PHP Approval/Deny help

    Hey erybody! I'm making a CMS and right now I'm working on the avatars.
    When they upload their avatars, it automatically sets their approved status to false, because i want to be able to approve/deny them in the acp.
    This is what I have for the Approve/deny portion, since i already got the uploading script all taken care of.

    PHP Code: 
    $picture mysql_query("SELECT * FROM images WHERE approved='false'");
    echo 
    "<form action='approve.php?do=submit' method='post'>"
    while($result mysql_fetch_array($picture)){
    echo 
    "<img src='../".$result['path']."'>";
    echo 
    "<input type='checkbox' id='".$result['id']."' />
    }
    echo "
    </form>"; 
    Approve.php?do=submit :
    PHP Code: 
    $do $_GET['do'];
    //this says whats going to be in approve.php?do=submit
    if($do == submit){
    //code here

    I've been stuck on this for a few hours trying to figure and google a way on how to get more than one $_POST thingies and update them in the mysql.
    Im not sure if thats a good description of my problem or not lol
    narutoroot Reviewed by narutoroot on . PHP Approval/Deny help Hey erybody! I'm making a CMS and right now I'm working on the avatars. When they upload their avatars, it automatically sets their approved status to false, because i want to be able to approve/deny them in the acp. This is what I have for the Approve/deny portion, since i already got the uploading script all taken care of. $picture = mysql_query("SELECT * FROM images WHERE approved='false'"); echo "<form action='approve.php?do=submit' method='post'>" while($result = Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Member
    something like this? i wrote this for streamscene.me

    PHP Code: 
        if (isset($_GET['do']) && isset($_POST['id']) && is_array($_POST['id']))
        {
            foreach (
    $_POST['id'] as $id)
            {
                if (!
    mysql_query("UPDATE movies SET top=1 WHERE id = '$id'"))
                {
                    echo 
    error_message(sql_error());
                }
            }
        } 

  4.     
    #3
    Member
    Website's:
    rootw.net
    So,

    PHP Code: 
    $do $_GET['do']; 
    //this says whats going to be in approve.php?do=submit 
    if($do == submit){ 
     if (isset(
    $_GET['do']) && isset($_POST['id']) && is_array($_POST['id'])) 
        { 
            foreach (
    $_POST['id'] as $id
            {
                if (!
    mysql_query("UPDATE images SET approve=true WHERE id = '$id'")) 
                { 
                    echo 
    error_message(sql_error()); 
                } 
            } 
        }  

    ill try it

  5.     
    #4
    Member
    Website's:
    Doxsters.net
    I don't really get what you're trying to do?
    From what I can see, isn't essentially just you manually approving avatars? So you initially have the avatar approved='false' and you want it on submit to make approved='true'?
    I don't get what you mean by 'multiple post thingies'

    Need a Designer/Web Developer? Click Me

    MSN: PM me for it.
    Email(Preferred):timtamboy63@gmail.com

    "Power Corrupts. Absolute Power Corrupts Absolutely"

  6.     
    #5
    Member
    Website's:
    epicimagehost.com
    Notice I changed your checkbox.
    I added name=" and value=""

    I'm fairly tired atm and can't focus. So could be entirely wrong

    PHP Code: 
    <?php
    if($_GET['do'] == 'submit' && !empty($_POST['id'])){
      foreach(
    $_POST['id'] as $ID){
        if(!
    is_numeric($ID)){
          echo 
    ' Whaaaat, the ID '.$ID.' isn\'t a number? ';
          exit;
       }
       
    mysql_query('UPDATE `images` SET `approved` = "true" WHERE `id` = '.$ID);
      }
    }else{
      
    // Show form
      
    $picture mysql_query("SELECT path, id FROM images WHERE approved='false'"); 
      echo 
    "<form action='approve.php?do=submit' method='post'>" ;
      while(
    $result mysql_fetch_array($picture)){ 
       echo 
    "<img src='../".$result['path']."'>"
       echo 
    '<input type="checkbox" name="id[]" value="'.$result['id'].'" id="'.$result['id'].'" />';
      } 
      echo 
    "</form>";
    }
    ?>

  7.     
    #6
    Member
    Website's:
    th3fallen.com
    what your going to want to do is a switch statement heres a the base structure from a login i had minus the code between as an example.

    PHP Code: 
    <?php
    if (isset ( $_GET ['do'] )) {
        switch (
    $_GET ['do']) {
            
            case 
    'logout' :
            
    //code for ?do=logout
            
    break;
                
            case 
    'view' :
           
    //code for ?do=view
           
    break;
            
            case 
    'register' :
            
    //code for ?do=register
            
    break;
            
            default :
            die ( 
    'Invalid Command' );
            break;
        }
     }
    ?>

    That will allow you to do page.php?do=submit and it will execute whatever code in in the submit code area.

  8.     
    #7
    Member
    Website's:
    rootw.net
    Quote Originally Posted by Robin H View Post
    Notice I changed your checkbox.
    I added name=" and value=""

    I'm fairly tired atm and can't focus. So could be entirely wrong

    PHP Code: 
    <?php
    if($_GET['do'] == 'submit' && !empty($_POST['id'])){
      foreach(
    $_POST['id'] as $ID){
        if(!
    is_numeric($ID)){
          echo 
    ' Whaaaat, the ID '.$ID.' isn\'t a number? ';
          exit;
       }
       
    mysql_query('UPDATE `images` SET `approved` = "true" WHERE `id` = '.$ID);
      }
    }else{
      
    // Show form
      
    $picture mysql_query("SELECT path, id FROM images WHERE approved='false'"); 
      echo 
    "<form action='approve.php?do=submit' method='post'>" ;
      while(
    $result mysql_fetch_array($picture)){ 
       echo 
    "<img src='../".$result['path']."'>"
       echo 
    '<input type="checkbox" name="id[]" value="'.$result['id'].'" id="'.$result['id'].'" />';
      } 
      echo 
    "</form>";
    }
    ?>
    Worked perfect thanks

  9.     
    #8
    Banned
    Solved - Closed

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to use the IP Deny Manager in cPanel
    By Areon in forum Server Management
    Replies: 0
    Last Post: 1st Mar 2014, 04:12 PM
  2. Non Approval Vs Approval Article Sites
    By GBot in forum Whitehat SEO
    Replies: 0
    Last Post: 10th Dec 2013, 08:21 AM
  3. [PHP] using ipRangeCalculate.php to deny IPs
    By NewEraCracker in forum Web Development Area
    Replies: 2
    Last Post: 27th Aug 2011, 09:22 PM
  4. how to auto deny ip's via csf
    By adanrott in forum Technical Help Desk Support
    Replies: 3
    Last Post: 16th Mar 2011, 06:51 PM
  5. [BATCH] Firewall - Allow/Deny Script
    By l0calh0st in forum Web Development Area
    Replies: 0
    Last Post: 31st Jul 2010, 04:16 PM

Tags for this Thread

BE SOCIAL