Jump to content

shams

Members
  • Content count

    72
  • Joined

  • Last visited

Community Reputation

0 Neutral

About shams

  • Rank
    Regular Member

Profile Information

  • Gender
    Male
  1. shams

    php code problem from command line?

    I enabled the apc.enable_cli from the /etc/php/7.2/apache2/conf.d/20-apcu.ini now when i run the apc.php from the command line it just prints the 1, in every load it should increase the id by plus one, which is doing from the web browser prints the 5?
  2. shams

    php code problem from command line?

    from where i should enable apc.enable_cli i searched in /etc/php/7.2 and in /etc/apache2 but didn't find that one?
  3. shams

    php code problem from command line?

    no # is not of the command i put just for the bash prompt, this is the output when i run the apc.php from the firefox web browser: http://example.net/apc.php 1 prints the right ouput but from command line i didn't see any output.
  4. shams

    php code problem from command line?

    ~$ php -m | grep apc apc apcu
  5. shams

    php code problem from command line?

    i am running ubuntu 18.04 and the packages php-apcu php-apcu-bc are installed, these php codes working fine from the web browsers. should i install the apcu from github or it's sufficient?
  6. I need to run getmail with two php codes in a loop, i tried to run all these from the web browser but the php code cannot start the getmail i use the exec, shell_exec and system, now i decided to run these code from the gnome terminal, but i get the problem with the one of php code not running from the command line , this one is not running: <?php $val = apc_fetch('id'); $id=$val + 1; apc_store('id', $id, 0); $var = apc_fetch('id'); echo $var ?> the command i am running the php code is #php -f /home/user/wwww/example.net/apc.php any help please?
  7. shams

    problem running program with exec()?

    The original code is with the closing quote , mistake is in the post i forget to put the closing qoute: <?php system('/home/user/.getmail/getmail.sh'); ?>
  8. shams

    problem running program with exec()?

    This is the code i am trying to start the getmail from the php code in the ubuntu 18.04, getmail.sh cat start the getmail from the gnome terminal but from php code bellow it cannot start the getmail: <?php system('/home/user/.getmail/getmail.sh); ?>
  9. shams

    problem running program with exec()?

    Thanks for reply i test the code it runs the bash scripts, i created test.sh file with the content "this is a test file", and run with the code: <?php system('/home/user/tmp/test.sh'); ?> The code printed the file to the browser successfully, but cannot start the linux applications like getmail and i tested for the filezilla with the code: <?php sysetm('/usr/bin/filezilla'); ?> how to start the getmail with php?
  10. I want to run the getmail from php code, this is the php code but it is not running the getmail: <?php chdir('/home/user/.getmail'); exec('./getmail.sh'); ?> getmail.sh and gmail-file are inside the '/home/user/.getmail' directory, i also tried the shell_exec() but not run the program, this is the getmail.sh code: #!/bin/sh /usr/bin/getmail --rcfile gmail-file
  11. Problem solved with this modified post.php: $pdo = new PDO("mysql:host=$host;dbname=$db;charset=$charset", $user, $pass, $options); ///// session_start(); $subcat=$_POST['subcat']; $stmt = $pdo->prepare("SELECT * FROM subcategory WHERE subcategory=?"); $stmt->execute([$subcat]); while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $cat = $row['cat_id']; $from = $row['subcategory']; $user = $row['user']; $passw= $row['passw']; $server = $row['server']; }
  12. Hi, The index.php calling the check.php with the form action="check.php" and passing the value of $cat_id and $subcat to the check .php from the two drop down menu, i i included the other page post.php with require_once in the check.php, the post.php gets the value of $subcat from the index.php as condition and prints the full row of msqyl table subcategory, my question is how to pass the values of post.php in the variable $_POST to the check.php as you see below it prints the row but not with the $_POST variables, this is the output of all pages in the check.php: cat_id =4 subcategory=user@gmail.com user=user@gmail.com passw=aaaaaaa server=smtp.gmail.com Notice: Undefined index: user in /home/user/www/user.be.eu.org/check.php on line 5 Notice: Undefined index: passw in /home/user/www/user.be.eu.org/check.php on line 6 Notice: Undefined index: server in /home/user/www/user.be.eu.org/check.php on line 7 Value of $cat = 4 Value of $subcat = user@gmail.com Value of $user = Value of $passw = Value of $server = This is check.php: <?Php require_once 'post.php'; $cat= $_POST['cat']; $subcat= $_POST['subcat']; $from = $_POST['from']; $user = $_POST['user']; $passw = $_POST['passw']; $server = $_POST['server']; print_r($row); echo "Value of \$cat = $cat <br>Value of \$subcat = $subcat <br> Value of \$from = $from <br>Value of \$user = $user <br>Value of \$passw = $passw <br>Value of \$server = $server"; ?> this is post.php: <?php set_exception_handler(function($e) { error_log($e->getMessage()); exit('Something weird happened'); //something a user can understand }); error_reporting(E_ALL); ini_set('display_errors', '1'); $host = 'localhost'; $db = 'mail'; $user = 'root'; $pass = 'root'; $charset = 'utf8mb4'; $options = [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::ATTR_EMULATE_PREPARES => false, ]; $pdo = new PDO("mysql:host=$host;dbname=$db;charset=$charset", $user, $pass, $options); ///// session_start(); $subcat=$_POST['subcat']; // select a particular user by id $stmt = $pdo->prepare("SELECT * FROM subcategory WHERE subcategory=?"); $stmt->execute([$subcat]); while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { echo ('cat_id =' . $row['cat_id'] . "\r\n" . 'subcategory=' . $row['subcategory']. "\r\n". 'user=' . $row['user'] . "\r\n". 'passw=' . $row['passw']. "\r\n". 'server=' . $row['server'] . '<br />'); } ?> <!DOCTYPE html> <html> <head></head> <body> <br /> <div class="container"> <div class="row"> <div class="col-md-8" style="margin:0 auto; float:none;"> <br /> <form action = "" method = 'post'> <input type="hidden" name="from" value="<?php echo $_POST['subcategory']; ?>" /> <input type="hidden" name="user" value="<?php echo $_POST['user']; ?>" /> <input type="hidden" name="passw" value="<?php echo $_POST['passw']; ?>" /> <input type="hidden" name="server" value="<?php echo $_POST['server']; ?>" /> </form> </div> </div> </div> </body> </html>
  13. Hi, This is a code dd.php with two drop down list options, when select the value from the first drop down it retrieves the related values from the column subcategory from the second table subcategory and prents only these two columns: Value of $cat = 2 Value of $subcat = user@gmx.ca My question is how to pass the value of $subcat to the query below in the same dd.php page and prints the full row of the table subcategory which has more 4 columns: SELECT * FROM subcategory WHERE subcategory=?; this is dd.php: <?php require 'config.php'; // Database connection //////// End of connecting to database //////// ?> <!doctype html public "-//w3c//dtd html 3.2//en"> <html> <head> <title>Multiple drop down list box from plus2net</title> <SCRIPT language=JavaScript> function reload(form) { var val=form.cat.options[form.cat.options.selectedIndex].value; self.location='dd.php?cat=' + val ; } </script> </head> <body> <?Php @$cat=$_GET['cat']; // Use this line or below line if register_global is off if(strlen($cat) > 0 and !is_numeric($cat)){ // to check if $cat is numeric data or not. echo "Data Error"; exit; } ///////// Getting the data from Mysql table for first list box////////// $quer2="SELECT DISTINCT category,cat_id FROM category order by category"; ///////////// End of query for first list box//////////// /////// for second drop down list we will check if category is selected else we will display all the subcategory///// if(isset($cat) and strlen($cat) > 0){ $quer="SELECT DISTINCT * FROM subcategory where cat_id=$cat order by subcategory"; }else{$quer="SELECT DISTINCT * FROM subcategory order by subcategory"; } ////////// end of query for second subcategory drop down list box /////////////////////////// echo "<form method=post name=f1 action='dd-check.php'>"; /// Add your form processing page address to action in above line. Example action=dd-check.php//// ////////// Starting of first drop downlist ///////// echo "<select name='cat' onchange=\"reload(this.form)\"><option value=''>Select one</option>"; foreach ($dbo->query($quer2) as $noticia2) { if($noticia2['cat_id']==@$cat){echo "<option selected value='$noticia2[cat_id]'>$noticia2[category]</option>"."<BR>";} else{echo "<option value='$noticia2[cat_id]'>$noticia2[category]</option>";} } echo "</select>"; ////////////////// This will end the first drop down list /////////// ////////// Starting of second drop downlist ///////// echo "<select name='subcat'><option value=''>Select one</option>"; foreach ($dbo->query($quer) as $noticia) { echo "<option value='$noticia[subcategory]'>$noticia[subcategory]</option>"; } echo "</select>"; ////////////////// This will end the second drop down list /////////// //// Add your other form fields as needed here///// echo "<input type=submit value=Submit>"; echo "</form>"; while ($row = $quer->fetch(PDO::FETCH_ASSOC)) { echo ('cat_id =' . $row['cat_id'] . "\r\n" . 'subcategory=' . $row['subcategory']. "\r\n". 'user=' . $row['user'] . "\r\n". 'passw=' . $row['passw']. "\r\n". 'server=' . $row['server'] . '<br />'); } ?> <br><br> <a href=dd.php>Reset and start again</a> <br><br> <center><a href='http://www.plus2net.com' rel="nofollow">PHP SQL HTML free tutorials and scripts</a></center> </body> </html>
  14. shams

    Problem sending mail with PHPmailer?

    The problem solved with the: $mail->Subject = $_POST['subject']; $mail->Body = $_POST['message']; $mail->AltBody = $_POST['message'];
  15. shams

    Problem sending mail with PHPmailer?

    Thanks for reply, please can tell me how to post the Subject and Body in variables from the form to the mailer.php?
×

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.