Thread: PHP script to c++

  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    6

    PHP script to c++

    Hello..

    I have this php code that i user on my server, but i wont it to be a c++ code.

    So if there is anyone that will make this code for me i will be very happy.

    PHP Code:
    <?
    $mysql_host 
    "localhost";
    $mysql_user "root";
    $mysql_pw "d64";
    $mysql_db "test";

    $indbakkefolder "/home/in/";
    $readfolder "/home/read";
    $tb "inbox";

    $conn mysql_connect("$mysql_host","$mysql_user","$mysql_pw");
    mysql_select_db("$mysql_db");

    $folder "".$indbakkefolder."";
    if (
    $handle opendir($folder)) {
        while (
    false !== ($file readdir($handle))) { 
            if (
    $file != "." && $file != "..") { 
                if (
    is_dir($file)) {
                } else {
                    
    $files[] = $file;
                }
            }
        }
    }
    $antal 0;
    $count count($files);
    $tal = -1;
    while(
    $tal $count-1) {
        
    $tal++;
        
    $filename $folder."/".$files[$tal];
        
    $handle fopen($filename"r");
        
    $contents fread($handlefilesize($filename));
        
    fclose($handle);
        
        
    $date explode("Date/time: "$contents);
        
    $date2 explode(" "$date[1]);
        
    $dato $date2[0];
        
    $tid $date2[1];
        if(
    $debug == 1) {
            echo 
    "Dato: $dato<br>";
            echo 
    "Tid: $tid<br>";
        }
        
        
    $sender explode("Sender: "$contents);
        
    $sender1 explode(" "$sender[1]);
        
    $afsender $sender1[0];
        
    $afsender str_replace("+45"""$afsender);
        if(
    $debug == 1) {
            echo 
    "Afsender: $afsender<br>";
        }
    $class explode(" "$tekst);
    if(
    $class[0] == "Web") {
    $tekst ereg_replace("web """$tekst);
    $setclasse "web";
    }    
        
    $text explode("Text:"$contents);
        
    $tekst ereg_replace("\n"""$text[1]);
        if(
    $debug == 1) {
            echo 
    "Tekst: $tekst<br>";
        }
        
        if(
    mysql_query("INSERT INTO $tb (dato, tid, message, class, fra) VALUES ('$dato','$tid','$tekst','$setclase','$afsender')") OR DIE("FEJL ".mysql_error()."")) {
            
            
    $filename2 "".$readfolder."/".$files[$tal]."";
            
    touch($filename2);
            if (
    is_writable($filename2)) {
                
               if (!
    $handle fopen($filename2'a')) {
                       if(
    $debug == 1) {
                        echo 
    "Kunne ikke åbne filen ($filename)";
                    }
                     exit;
               }
               if (
    fwrite($handle$contents) === FALSE) {
                       if(
    $debug == 1) {
                           echo 
    "Kunne ikke skrive til filen ($filename)";
                    }
                   exit;
               }
           
               
    fclose($handle);
               
    unlink($filename);
            
            } else {
                if(
    $debug == 1) {
                       echo 
    "Der kunne ikke skrives til den nye fil";
                   }
            }

        }
        
    $antal++;
        
    }
    echo 
    "Done".$antal." add.";

    ?>

  2. #2
    Information Crocodile
    Join Date
    Dec 2004
    Posts
    204
    You want a cgi version of that or you want a stand alone app? Will this be free? PM me.

  3. #3
    Registered User
    Join Date
    Oct 2005
    Posts
    6
    Hi..

    I will like if the php to be translate to a c++ code.

  4. #4
    i think converting this to c/c++ is no good idea: php has the means to make this job simple but it is much more complex in c/c++. why do you want to have it converted?

  5. #5
    tell me what you want the program to do i think i could make it from their, because i don't know PHP

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Script in games
    By Shakti in forum Game Programming
    Replies: 7
    Last Post: 09-27-2006, 12:27 AM
  2. In a game Engine...
    By Shamino in forum Game Programming
    Replies: 28
    Last Post: 02-19-2006, 11:30 AM
  3. php script question (is this possible?)
    By Leeman_s in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 12-30-2003, 09:20 PM
  4. POSTing to a PHP script
    By bennyandthejets in forum Windows Programming
    Replies: 2
    Last Post: 11-26-2003, 07:10 AM
  5. Game structure, any thoughts?
    By Vorok in forum Game Programming
    Replies: 2
    Last Post: 06-07-2003, 01:47 PM