Results 1 to 2 of 2

Thread: PHP Help!

  1. #1
    Join Date
    Mar 2015
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default PHP Help!

    Hey i need some help with why it wont start the batch file. I see it start the cmd.exe in the background, but when i go to check if its running the batch file that i designated its not. i know because im trying to make it run a RSPS Source run.bat, and it says the port is still open, meaning, there are no other sources open. Anyways, heres my code. If you got any tips please tell me!

    PHP Code:
    <?php 
            session_start
    ();
            
    $id $_GET['serverid'];

                    
    $mysqli = new mysqli("localhost""root""""mainrspshosts");

    /* check connection */
    if ($mysqli->connect_errno) {
        
    printf("Connect failed: %s\n"$mysqli->connect_error);
        exit();
    }
    $query "SELECT * FROM servers WHERE id = '" .$id"' LIMIT 1";

    if (
    $result $mysqli->query($query)) {

        
    /* fetch associative array */
        
    while ($row $result->fetch_assoc()) {
            if(
    $_SESSION["username"]==$row["owner"]){


    set_time_limit(300);


    $WshShell = new COM("WScript.Shell");
    $run_cmd "CMD 'c:\testserver\run.bat' ";
    $WshShell $WshShell->Run($run_cmd1false);

            
    header("refresh:5;url=http://.zapto.org/ucp/serverstartedvalidation.php");











            }
            else{

            
    header("location:index.php");
            
            }
        }
    }
    else{

            
    header("location:index.php");
    }



            
    ?>

  2. #2
    Join Date
    Feb 2007
    Location
    Colorado, USA
    Posts
    3,716
    Mentioned
    51 Post(s)
    Quoted
    624 Post(s)

    Default

    system("cmd /c c:\testserver\run.bat");
    no?

    Also use PDO for your queries, eventually you'll have to re-learn a method where you can't get sql injected, might as well start now.
    The only true authority stems from knowledge, not from position.

    You can contact me via matrix protocol: @grats:grats.win or you can email me at the same domain, any user/email address.

Thread Information

Users Browsing this Thread

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

Posting Permissions

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