Jump to content

jazzman1

Staff Alumni
  • Posts

    2,713
  • Joined

  • Last visited

  • Days Won

    12

Everything posted by jazzman1

  1. Or....if want to be exactly like your output: products.txt apple orange orange grape lemon lemon lemon mango $file = array_filter(array_map('trim', file('products.txt'))); $products = (array_count_values($file)); foreach ($products as $key=>$value) { echo ($value == 1) ? $key : $key.' '.$value.'x'; echo '<br />'; } Results:
  2. Try, <?php $file = array_filter(array_map('trim', file('products.txt'))); $products = (array_count_values($file)); foreach ($products as $key=>$value) { echo $key.'('.$value.')'."<br />"; } Results: P.S products.txt is the file that contains strings of products.
  3. The right syntax should be something like: SELECT * FROM tbl_name WHERE column_name_1 LIKE '%a%' AND column_name_2 LIKE '%b'; Also, don't quote the tables and columns it's a wrong sql syntax. Sorry, I am in a hurry.
  4. And the columns?
  5. Google "how to html and php" or something similar. Every "<?" tags in your scripts must be "<?php".
  6. Is there a table named - WHERE 'Short Item Name' ? If does, why did you quote it?
  7. Aside, don't mess up the full and short php opening tags.
  8. That depends of your hosting provider, just check the helping guide manual that they provide to their customers.
  9. The easiest way is to create a custom php.ini file which overridding the main php.ini file from the server, or to use ini_set setting new values. EDIT: The other way is to hack the server
  10. Did you restart apache?
  11. Wow....dude...a lot of code, use the code (<>) tags that the editor of the forum provides us Just put down error_reporting(-1) on the top of your files and for debugging sql's use mysql_error()
  12. Check this thread, especially my last post it would help you I guess.
  13. If you're planning to install Linux as second OS you might consider checking the hardware compability list in linux.
  14. Never ever run queries in loop, It’s so easy to start hammering the database with a crazy number of queries. So, turn on your error_reporting and also check out that thread - http://forums.phpfreaks.com/topic/267013-looping-multiple-rows-into-database/
  15. Well, requinix's solution should not work according that log (/var/www/html/dd/subdir), it should be work only if you moved the menu.php file outside of the project. In RedHat /CentOS /Fedora the web root directory is named html, so in that case "dd" is your project folder not a web root as you posted in your first post.
  16. So, here is the test using my local CentOS machine. Check the status of sendmail client to be sure that we don't use it: [jazz@centos-box ~]$ su -c '/etc/init.d/sendmail status' Password: sendmail is stopped sm-client is stopped Now I will try to use my google account sending a message(s) to my yahoo mail account. <?php // include the library require_once 'Swift-5.0.0/lib/swift_required.php'; date_default_timezone_set('America/Toronto'); // Create the Transport $transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, 'ssl') ->setUsername('accountName@gmail.com') ->setPassword('myPassword') ; // Create the Mailer using your created Transport $mailer = Swift_Mailer::newInstance($transport); $subject = 'Wonderful Subject From SwiftMailer'; $body = '<p>Here is the message itself</p>'; // that's your html content $message = Swift_Message::newInstance() ->setContentType("text/html") ->setMaxLineLength(100) ->setSubject($subject) ->setFrom(array("centos-box@localdomain" => "jazzman")) ->setTo(array('myEmail@yahoo.com' => 'jazzman')) ->setBody($body); // Send the message $numSent = $mailer->send($message); printf("Sent %d messages\n", $numSent); Result: So, to use this method you don't have to have a mail server on the machine just we're using a remote mail server over ssl.
  17. Ops....I just forgot to add setTo() or if you prefer setBcc() methods. So the message should be something like: $message = Swift_Message::newInstance() ->setContentType("text/html") ->setMaxLineLength(100) ->setSubject($subject) ->setFrom(array("centos-box@localdomain" => "jazzman")) ->setTo(array('receiver@domain.org', 'other@domain.org' => 'A name')) ->setBody($body); That's all.
  18. I don't have a previous attempt with phpMailer, so I will give you an example in swiftMailer. It's a pretty simple: <?php // include the library require_once 'lib/swift_required.php'; // Create the Transport $transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465) ->setUsername('your username') ->setPassword('your password') ; // Create the Mailer using your created Transport $mailer = Swift_Mailer::newInstance($transport); $subject = 'Wonderful Subject From SwiftMailer'; $body = '<p>Here is the message itself</p>'; // that's your html content $message = Swift_Message::newInstance() ->setContentType("text/html") ->setMaxLineLength(100) ->setSubject("' . $subject . '") ->setFrom(array("centos-box@localdomain" => "jazzman")) ->setBody($body); // Send the message $numSent = $mailer->send($message); printf("Sent %d messages\n", $numSent);
  19. The easiest way to achieve that is to use some php mail library as swiftmailer, phpMailer.... I'm a swiftmailer fan or you want to create everything from scratch? http://swiftmailer.org/docs/sending.html
  20. He-he, I was completely forgot about that I'm using openssl on my RedHat server but in Bash language. Good job
  21. Turn on error_reporting and try something like that: $fp = fsockopen("ssl://smtp.gmail.com", 465, $errNo, $errStr, 15); $str = "EHLO \r\n AUTH LOGIN \r\n "; $str .= base64_encode("author@gmail.com")."\r\n"; $str .= base64_encode("password")."\r\n"; $str .= "etc......"; fputs($fp,$str); fclose($fp); Are you sure that your email header format is correct, too?
  22. Well, go to newpage.php file and give us the result of: // current directory echo getcwd() . "\n";
  23. You have to concatenate your string, something like: <?php $fp = fsockopen("ssl://smtp.gmail.com", 465, $errNo, $errStr, 15); $str = fputs($fp, "EHLO"."\r\n"); $str .= fputs($fp, "AUTH LOGIN"."\r\n"); $str .= fputs($fp, base64_encode("author@gmail.com")."\r\n"); $str .= etc...... echo fputs($fp,$str); fclose($fp); Or.....much better, create the string and pass it as a second parameter to fputs()
  24. None of the answers above are corect b/s of lack of server side knowledge. So, the copy php function is a simple and it's works only if the file already exist on the machine (server). When you try to upload a file from a local machine to the server the file is saved as a tmp, that's why mac_gyver proposal is correct to use move_uploaded_file ().
  25. Double check kicken's reply. Reserved words require special treatment for use.
×
×
  • 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.