Results 1 to 3 of 3

Thread: NEED URGENT HELP -> DATABASE / EXPLODING

  1. #1

    Thread Starter
    Addicted Member Jazz00006's Avatar
    Join Date
    Feb 2006
    Posts
    185

    NEED URGENT HELP -> DATABASE / EXPLODING

    Heres my PHP project, and heres the demo site: http://greyfyre.info/
    (Admin password in the same in the PHP file and on the site (for now))


    And i need some help with the transfer data to the offical database. It splits them up, and gives them the correct UID, but the looping and (sometimes) the sending of the individual items doesnt work. Cant anyone please help with this. I have spent hours working on this project, and i dont want to stop here.
    Attached Files Attached Files

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: NEED URGENT HELP -> DATABASE / EXPLODING

    I'm not inclined to download your entire project and look for your problems for you.

    post some relevant code around the areas that are causing the problems and then ask for some help.

  3. #3

    Thread Starter
    Addicted Member Jazz00006's Avatar
    Join Date
    Feb 2006
    Posts
    185

    Re: NEED URGENT HELP -> DATABASE / EXPLODING

    Yes, it is a big project, but its almost done, and im sorry, i should have been more specific. This code in the file, Check.php doesnt submit the selected IP's to the database.

    PHP Code:
    <?php
    if(isset($_COOKIE['Admin'])) {
    if (
    $_COOKIE['Admin']==1) {
        echo 
    '<table width="358" height="18" border="0" background="bar.gif">
            <tr>
              <td width="352" background="images/bar.gif"><div align="center"><a href="Check.php">View Tempdatabase </a> | <a href="Clean.php">Clean</a></div></td>
            </tr>
          </table><p><BR><BR><BR></div>'
    ;
        include (
    "include.inc.php");
        
    $DB $GLOBALS["db2table"];



    if (isset(
    $_GET['IP'])) {
        if (
    $_GET['IP'] != '') {
            
    $sql mysql_connect($GLOBALS["dbhost"], $GLOBALS["dbuser"], $GLOBALS["dbpass"]);
            
    $dbHandle mysql_select_db($GLOBALS["dbname"]);    
            
    $result mysql_query("SELECT * FROM `tempbase` WHERE `IP` = '".mysql_real_escape_string($_GET['IP'])."';"$sql);
            
    $data mysql_fetch_assoc($result);
                if (
    $data['IP'] != '') {
                    echo 
    'Data found...<BR>Deleting...<BR>';    
                    
    $result mysql_query("DELETE FROM `tempbase` WHERE `IP` = '".mysql_real_escape_string($_GET['IP'])."';"$sql);
                    
    $data2 mysql_fetch_assoc($result);    
                    
    mysql_close($sql);
                    echo 
    'Data deleted...<BR>Moving...<BR>';
                    
    $sql mysql_connect($GLOBALS["dbhost"], $GLOBALS["dbuser"], $GLOBALS["dbpass"]);
                    
    $dbHandle mysql_select_db($GLOBALS["dbname"]);    
                    
    $IP $data['IP'];
                    
    $EMAIL $data['Email'];
                    
    $REASON $data['Reason'];
                    
    $Submitter $data['spare'];
                    
    $sql "INSERT INTO `$DB` ( `IP` , `Reason` , `Email` , `Submiter` )
                    VALUES (
                    '
    $IP', '$REASON', '$EMAIL', '$Submitter'
                    );"
    ;     
                    echo 
    'Data moved successfully!<BR><BR><BR>';
                    
    $result mysql_query($sql);
                    
    mysql_close($sql);
                }
        }
    }
        
    //
    //  BIG PROBLEM GETTING THIS TO WORK TOO
    //

    if (isset($_GET['UID'])) {
        if (
    $_GET['UID'] != '') {
            while (
    $data['Uid'] != '') {
                
    $sql mysql_connect($GLOBALS["dbhost"], $GLOBALS["dbuser"], $GLOBALS["dbpass"]);
                
    $dbHandle mysql_select_db($GLOBALS["dbname"]);    
                
    $result mysql_query("SELECT * FROM `tempbase` WHERE `Uid` = '".mysql_real_escape_string($_GET['UID'])."';"$sql);
                
    $data mysql_fetch_assoc($result);            
                if (
    $data['Uid'] != '') {    
                echo 
    'Data found...<BR>Deleting...<BR>';
                
    $result mysql_query("DELETE FROM `tempbase` WHERE `Uid` = '".mysql_real_escape_string($_GET['UID'])."';"$sql);
                
    $data2 mysql_fetch_assoc($result);    
                
    mysql_close($sql);            
                echo 
    'Data deleted...<BR>Moving...<BR>';
                
    $sql mysql_connect($GLOBALS["dbhost"], $GLOBALS["dbuser"], $GLOBALS["dbpass"]);
                
    $dbHandle mysql_select_db($GLOBALS["dbname"]);    
                
    $IP $data['IP'];
                
    $EMAIL $data['Email'];
                
    $REASON $data['Reason'];
                
    $Submitter $data['spare'];
                
    $sql "INSERT INTO `$DB` ( `IP` , `Reason` , `Email` , `Submiter` )
                VALUES (
                '
    $IP', '$REASON', '$EMAIL', '$Submitter'
                );"
    ;     
                echo 
    'Data moved successfully!<BR><BR><BR>';
                
    $result mysql_query($sql);
                
    mysql_close($sql);
                }
            }
        }
    }














        
    $Total=0;
        
    header("Cache-Control: no-cache, must-revalidate");
        
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); 
        
    $sql mysql_connect($GLOBALS["dbhost"], $GLOBALS["dbuser"], $GLOBALS["dbpass"]);
        
    $dbHandle mysql_select_db($GLOBALS["dbname"]);    
        
    $result mysql_query('SELECT * FROM `TempBase`'$sql);
        
    $data mysql_fetch_assoc($result);
        
    $rows mysql_query('select * from `TempBase`');


        if (
    is_resource($rows)) {
            echo 
    '  <table width="589" border="0">';
              while (
    $row mysql_fetch_assoc($rows)) {
                echo 
    '<tr><td width="15">IP:</td>
                  <td width="150">'
    .$row['IP'].'</td>
                  <td width="35">LOG:</td>
                 <td width="50"><a href="http://greyfyre.info/'
    .$row['Log'].'">[X]</a></td>
                  <td width="30">UID:</td>
                  <td width="220">'
    .$row['Uid'].'</td>
                  <td width="25"><a href="?IP='
    .$row['IP'].'">[S]</a></td>
                  <td width="25"><a href="?UID='
    .$row['Uid'].'">[A]</a></td> </tr>'
        
                
    $Total++;
              }
            
          echo 
    '</table>';
          echo 
    '<BR>Total databse items: '.$Total;
        } else {
          echo 
    mysql_error();
        } 
        


    } else {echo 
    '<meta http-equiv="refresh" content="0;URL=http://greyfyre.info/index.php" />';}          
    } else {echo 
    '<meta http-equiv="refresh" content="0;URL=http://greyfyre.info/index.php" />';}      
          



    ?>

    And this code in the submit part is what splits them up into the database

    PHP Code:
    <?PHP

    //Import teh database variables
    include ("include.inc.php");
    $DB $GLOBALS["dbtable"];
    //Remove cahing ability
    header("Cache-Control: no-cache, must-revalidate");
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); 

    $Code strtoupper($_POST['CODE']);
    $Verify m_crypt($_POST['Verify'],"de","Password");


    $extension1 explode('.',basename($_FILES['LOG']['name']));
    $extension strtolower($extension1[1]);
    $target_path 'Temp_Logs/'.date("F-j-Y-g-i-s-a").'.'.$extension



    //$Number = is_number(str_replace('.','',$_POST['IP']));
    //echo 'number is : ' . $Number; //Number = 1 is a number, 0 = not 
    if (strpos($_FILES["LOG"]["type"]."  app""app") == 0) {
        echo 
    '<span class="Invalid">Invalid file type!</span>';
    } else {
        if (
    $Code == $Verify && $Code != '' && $Verify != '') {
        
            
            if(
    move_uploaded_file($_FILES['LOG']['tmp_name'], $target_path)) {
                echo 
    "The file has been uploaded<BR>";
            } else{
                echo 
    "There was an error uploading the file, please try again!<BR>";
            }

    $UID randomkey(10).'-'.randomkey(10);

    $counterMax =  substr_count($_POST['IP'],"\r\n");


    for ( 
    $counter 0$counter <= $counterMax$counter += 1) {

        
    $sql mysql_connect($GLOBALS["dbhost"], $GLOBALS["dbuser"], $GLOBALS["dbpass"]);
        
    $dbHandle mysql_select_db($GLOBALS["dbname"]);
        
        
    $EMAIL mysql_real_escape_string($_POST['EMAIL']); 
        
    $REASON mysql_real_escape_string($_POST['REASON']); 
        
    $LOG mysql_real_escape_string($target_path); 
        
    $SPARE = (gethostbyaddr($_SERVER['REMOTE_ADDR']));
        
    $IP preg_split("/[\n,]+/"$_POST['IP'], -1PREG_SPLIT_OFFSET_CAPTURE);
        
    $NewIP utf8_encode(str_replace(' ','',mysql_real_escape_string($IP[$counter][0])));
        
    $NewIP $NewIP."\r\n";
        
    $NewIP mysql_real_escape_string($NewIP);
        
    $sql "INSERT INTO `$DB` ( `IP` , `Email` , `Reason` , `Log` , `spare` , `Uid` )
        VALUES (
        '
    $NewIP', '$EMAIL', '$REASON', '$LOG', '$SPARE' ,'$UID'
        );"

        
        
    $result mysql_query($sql);
        
        
    mysql_close($sql);
        if (
    is_resource($rows)) {
              } else {
            echo 
    mysql_error();
            }
            
    }
      
        echo 
    'Thankyou for your input, your entry will be verified before it is added to the main database.<BR><BR><BR>';
        
    } else {
        if (
    $Code != '' && $Verify != '') {
            echo 
    '<span class="Invalid">Invalid Code!<BR><BR><BR></span>';    
        }
        }
    }


    $KEY m_crypt(randomkey(5),"en","Password");
    ?>

Posting Permissions

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



Click Here to Expand Forum to Full Width