Jump to content

batwimp

Members
  • Posts

    319
  • Joined

  • Last visited

Posts posted by batwimp

  1. Sorry. I was actually quoting this line of code:

     

    <?php if(isset($_POST['sub_comment_reply']) && $post_count >= $max_reply_per_day && $valid = false) {
    

    I didn't realize what I had typed was a complete line of code from another part of the file. You need to change THIS line so that (I'm assuming you want):

    <?php if(isset($_POST['sub_comment_reply']) && $post_count >= $max_reply_per_day && $valid != false) {
    

    or it may be:

    <?php if(isset($_POST['sub_comment_reply']) && $post_count >= $max_reply_per_day && $valid == false) {
    

    Either way, the code you have now will set the $valid variable to false no matter what, and the IF statement will fail.

  2. I found it. In order to pass the variable as a single argument with spaces, you need to enclose it in quotes, which means you need to quote the quotes:

     

    $arg1 = '"test 55"';
    

     

    Note the double quotes are inside the single quotes.

  3. You are essentially issuing this command through the command line by using exec() from PHP. This means that your arguments are separated by a space instead of a comma. So it is treating 'text' as a separate argument instead of being part of the same string. You can set up your VBS to take multiple arguments by adding them in, which should be fairly obvious:

     

    NOT TESTED

     

    Function WriteLineToFile(ntext,ntext2)
    Const ForReading = 1, ForWriting = 2
    Dim fso, f
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set f = fso.OpenTextFile("C:\inetpub\test\test.txt", ForWriting, True)
    f.WriteLine ntext+ntext2
    Set f = fso.OpenTextFile("C:\inetpub\test\test.txt", ForReading)
    WriteLineToFile = f.ReadAll
    End Function
    
    
    Dim Arg, var1, var1
    Set Arg = WScript.Arguments
    var1 = Arg(0)
    var2 = Arg(1)
    WriteLineToFile(var1, var2)
    

     

    But if you want to pass the entire string as a single argument with the space(s) in them, I'm not sure how to do that.

  4. google tells me you're not grabbing the arguments correctly in your VBS. It should be:

     

    Function WriteLineToFile(ntext)
    Const ForReading = 1, ForWriting = 2
    Dim fso, f
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set f = fso.OpenTextFile("C:\inetpub\test\test.txt", ForWriting, True)
    f.WriteLine ntext
    Set f = fso.OpenTextFile("C:\inetpub\test\test.txt", ForReading)
    WriteLineToFile = f.ReadAll
    End Function
    
    Dim Arg, var1
    Set Arg = WScript.Arguments
    var1 = Arg(0)
    WriteLineToFile(var1)
    

  5. You aren't running that section of code from VB, but from PHP, which will not parse variables inside of single quotes (unless those single quotes are inside double quotes).  Try changing them to double quotes and you will pass the value of that variable.

  6. I don't know much about VBS, but for your PHP you need to lower-case your exec function and use double quotes instead:

     

    $arg1 = 'test 55';
    exec("test.vbs $arg1");
    

  7. Try this:

     

    <?php include 'func.inc.php'; ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
           "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title>search</title>
    </head>
    <body>
    <form action="" method="POST">
        <p>
            <input type="text" name="keywords" size="17" maxlength="9" value="Enter B/L No." onfocus="if(this.value == 'Enter B/L No.'){this.value = '';}" /> <input type="submit" class="formbutton" value="Track" />
        </p>
    </form>
    <?php
    if  (isset($_POST['keywords'])) {
    $suffix = "";
    $keywords = mysql_real_escape_string(htmlentities(trim($_POST['keywords'])));
    $errors = array();
    if (empty($keywords)) {
      $errors[] = '';
    } else if (strlen($keywords)<9) {
      $errors[] = '<br><strong>Your Bill of Lading Number must contain 9-digits.</strong>';
    } else if (search_results($keywords) === false) {
      $errors[] = '<br><strong>Please enter a valid Bill of Lading Number.</strong>';
    }
    if (empty($errors)) {
       $results = search_results($keywords);
       $results_num = count($results);
       $suffix = ($results_num !=1) ? 's' : '';
       foreach($results as $result) {
         echo "<br><table>
        <thead>
            <tr>
                <th><strong>B/L No.</strong></th>
                <th><strong>Origin City</strong></th>
                <th><strong>Origin Country</strong></th>
                <th><strong>Destination City</strong></th>
                <th><strong>Destination Country</strong></th>
                <th><strong>Status</strong></th>
                <th><strong>Current Location</strong></th>
            </tr>
        </thead>
        <tbody>
    
            <tr>
    <td>{$result['Bill_No']}</td>
    <td>{$result['Origin_City']}</td>
    <td>{$result['Origin_Country']}</td>
    <td>{$result['Destination_City']}</td>
    <td>{$result['Destination_Country']}</td>
    <td>{$result['Status']}</td>
    <td>{$result['Current_Location']}</td>
            </tr>
        </tbody>
    </table>";
    }
    } else {
       foreach($errors as $error) {
        echo $error, '</br>';
      }
    }
    }
    ?>
    </body>
    </html>
    

    [/code]

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.