I am writing a php code in which i am trying to implement the following
- I have made a exe program in c++ which takes a string input from the user and then displays the output;
- Now in php, i am calling this program using passthru(), system(). like passthru('/var/php/hash')
- my code ask user to input a string & then i am passing this string as an argument with passthru function. echo passthru("/usr/local/bin/php/hashargu $p");
- but i am facing problem here. if i passes single word string, then it works. but when i try to pass a string of more than one word, it does not work. plz help. my code is .............

/* Get the posted value of the form if there is one */
$p = empty($_POST['p']) ? null : $_POST['p'];
<head><title>Hash testing</title></head>
<style type="text/css">
    table {border-collapse: collapse;}
    table, td, th {border: solid 1px #ccc;}
    th {background: #e1e1e1;border-color: #999;}
    td, th {padding: 0.25em;}
    td.algo {font-weight: bold;}
    tr.on td {background: #f0f0f0;}
    <h1>String hashing</h1>
    <form method="post" action="<?php echo basename(__FILE__) ?>">
        <p><label for="p">Enter a string to hash:</label><br /><input id="p" type="string" name="p" value="<?php echo $p ?>" /></p>
        <p><input type="submit" name="submit" value="Hash It" /></p>
    <?php /* If there is a posted value use it */ ?>
    <?php if ($p): ?>
    <hr />
    <h2>Your hash chain for <em><?php echo $p ?></em> is</h2>  
    [B]echo passthru("/usr/local/bin/php/hashargu $p");[/B]
     <?php endif; ?>

Edited by mike_2000_17: Fixed formatting

7 Years
Discussion Span
Last Post by pritaeas
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.