Jump to content

colap

Members
  • Posts

    302
  • Joined

  • Last visited

Everything posted by colap

  1. 1) sendmail 2) postfix 3) ssmtp 4) msmtp or other Which mail server or mail client to install to send email in php? Is it possible to send email without mail server or mail client?
  2. $to = 'nobody@example.com'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: webmaster@example.com' . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); Where is the password for from address?
  3. https://github.com/PHPMailer/PHPMailer Does PHPMailer use any mail client?
  4. <?php // The message $message = "Line 1\r\nLine 2\r\nLine 3"; // In case any of our lines are larger than 70 characters, we should use wordwrap() $message = wordwrap($message, 70, "\r\n"); // Send mail('caffeinated@example.com', 'My Subject', $message); ?> What will be the from address for this code? Which software/package to install to send email?
  5. How can i do pagination with wordpress? https://codex.wordpress.org/Pagination <?php if ( have_posts() ) : ?> <!-- Add the pagination functions here. --> <!-- Start of the main loop. --> <?php while ( have_posts() ) : the_post(); ?> <!-- the rest of your theme's main loop --> <?php endwhile; ?> <!-- End of the main loop --> <!-- Add the pagination functions here. --> <div class="nav-previous alignleft"><?php next_posts_link( 'Older posts' ); ?></div> <div class="nav-next alignright"><?php previous_posts_link( 'Newer posts' ); ?></div> <?php else : ?> <p><?php _e('Sorry, no posts matched your criteria.'); ?></p> <?php endif; ?> <!-- Add the pagination functions here. --> , which functions to use here? Can anyone re-write this code with pagination functions?
  6. http://php.net/manual/en/function.mail.php It is windows 8, wamp server is installed. What package/software to install to send email from windows? Which code to take: <?php // The message $message = "Line 1\r\nLine 2\r\nLine 3"; // In case any of our lines are larger than 70 characters, we should use wordwrap() $message = wordwrap($message, 70, "\r\n"); // Send mail('caffeinated@example.com', 'My Subject', $message); ?> Or <?php $to = 'nobody@example.com'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: webmaster@example.com' . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); ?> Is it needed to write "From address" through mail function? Where to configure "From address" ?
  7. use Cake\ORM\Table; What i have understand: Load Cake folder>then ORM folder>then Table.php Is that correct ?
  8. Yes, i have checked, but could not understand what to do and how to do. Can you please post code?
  9. <?php /** * @package createtags */ /* Plugin Name: createtags Plugin URI: Description: Creating tags from title of posts Version: 1.0 Author: php-coder Author URI: */ function my_plugin_menu() { add_options_page('My Plugin Options', 'My Plugin', 'manage_options', 'my-unique-identifier', 'my_plugin_options'); } function my_plugin_options() { if (!current_user_can('manage_options')) { wp_die(__('You do not have sufficient permissions to access this page.')); } echo '<div class="wrap">'; echo '<p>Here is where the form would go if I actually had options.</p>'; echo '</div>'; global $current_user; echo '<pre>'; global $current_user; $user_roles = $current_user->roles; $user_role = array_shift($user_roles); //var_dump($user_role); $the_query = new WP_Query("select * from wp_posts"); // The Loop if ($the_query->have_posts()) { echo '<ul>'; while ($the_query->have_posts()) { $the_query->the_post(); echo '<li>' . get_the_title() . '</li>'; } echo '</ul>'; } else { echo "no posts found"; } echo '</pre>'; } add_filter('admin_menu', 'my_plugin_menu'); How can i add pagination here? This is wordpress-4.2.2
  10. How many rows can be inserted for id integer auto_increment ? What is the highest number of id ?
  11. Can't understand the syntax. What would be the correct syntax? http://stackoverflow.com/questions/5508993/pdo-limit-and-offset
  12. if (isset($_REQUEST['page']) ) { $offset = $_REQUEST['page']; } else { $offset = 0; } $limit = 2; $dbh = mysql_connection(); $sql = "select * from posts limit :limit offset :offset"; $stmt = $dbh->prepare($sql); $stmt->bindParam(':limit', $limit); $stmt->bindParam(':offset', $offset); $stmt->execute(); $result = $stmt->fetchAll(); It displays empty array(0) { } , what can be the reason?
  13. Please remove the two emails from the original post.
  14. It is working now. <?php $dbh = mysql_connection(); $sql = "select * from posts"; $stmt = $dbh->prepare($sql); $stmt->execute(); $result = $stmt->fetchAll(); formatted_value($result); ?>
  15. $dbh = mysql_connection(); $sql = "select * from posts"; $stmt = $dbh->prepare($sql); $rowCount = $stmt->rowCount(); $result = $stmt->fetchAll(); formatted_value($result); $stmt->execute(); ?> It returns empty array, What can be the reason?
  16. If get_post_format() returns "Standard" format, then will it be "content-get_post_format()" ?
  17. php.ini => [mail function] ; For Win32 only. ; http://php.net/smtp ;SMTP = localhost ;SMTP = smtp.gmail.com ; http://php.net/smtp-port ;smtp_port = 25 ;smtp_port = 587 ; For Win32 only. ; http://php.net/sendmail-from ;sendmail_from = you@yourdomain ;sendmail_from = ssmtpmailtesting@gmail.com ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). ; http://php.net/sendmail-path ;sendmail_path = sendmail_path = "C:\wamp\bin\sendmail\sendmail.exe -t" sendmail.ini => ; configuration for fake sendmail ; if this file doesn't exist, sendmail.exe will look for the settings in ; the registry, under HKLM\Software\Sendmail [sendmail] ; you must change mail.mydomain.com to your smtp server, ; or to IIS's "pickup" directory. (generally C:\Inetpub\mailroot\Pickup) ; emails delivered via IIS's pickup directory cause sendmail to ; run quicker, but you won't get error messages back to the calling ; application. smtp_server=smtp.gmail.com ;smtp_server=mail.mydomain.com ;smtp_server=localhost ; smtp port (normally 25) smtp_port=587 ;smtp_port=25 ; SMTPS (SSL) support ; auto = use SSL for port 465, otherwise try to use TLS ; ssl = alway use SSL ; tls = always use TLS ; none = never try to use SSL smtp_ssl=auto ;smtp_ssl=none ; the default domain for this server will be read from the registry ; this will be appended to email addresses when one isn't provided ; if you want to override the value in the registry, uncomment and modify default_domain=localhost ; log smtp errors to error.log (defaults to same directory as sendmail.exe) ; uncomment to enable logging error_logfile=error.log ; create debug log as debug.log (defaults to same directory as sendmail.exe) ; uncomment to enable debugging ;debug_logfile=debug.log ; if your smtp server requires authentication, modify the following two lines ;auth_username= ;auth_password= auth_username=ssmtpmailtesting@gmail.com auth_password=[mypassword] ; if your smtp server uses pop3 before smtp authentication, modify the ; following three lines. do not enable unless it is required. pop3_server= pop3_username= pop3_password= ; force the sender to always be the following email address ; this will only affect the "MAIL FROM" command, it won't modify ; the "From: " header of the message content force_sender=ssmtpmailtesting@gmail.com ; force the sender to always be the following email address ; this will only affect the "RCTP TO" command, it won't modify ; the "To: " header of the message content force_recipient= ; sendmail will use your hostname and your default_domain in the ehlo/helo ; smtp greeting. you can manually set the ehlo/helo name if required hostname=localhost php code => $message = "Line 1\r\nLine 2\r\nLine 3"; // In case any of our lines are larger than 70 characters, we should use wordwrap() $message = wordwrap($message, 70, "\r\n"); // Send mail('[myemail]@yahoo.com', 'My Subject', $message); It is not sending email to [myemail@yahoo.com] Where is the error/mistake ? What should i do in configuration? Thanks
  18. https://core.trac.wordpress.org/browser/branches/4.2/src/wp-content/themes/twentyfifteen/content.php When is content.php called? Thanks
  19. Hi, wampserver-2.1 PHP mail doesn't send mail. Which software do i have to install on windows 8? Thanks
  20. Hi, Old account is = php-coder, email = [...] New account is = php-cola, email = [...] Keep the old account, delete new account. Thanks
  21. I have installed ssmtp on debian. /etc/ssmtp/ssmtp.conf looks like this below: root=ssmtpmailtesting@gmail.com mailhub=smtp.gmail.com:587 #rewriteDomain= hostname=mybox UseSTARTTLS=YES AuthUser=ssmtpmailtesting@gmail.com AuthPass=[mypassword] FromLineOverride=YES php mail function: $to = 'shiblyldu60@yahoo.com'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: webmaster@example.com' . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); From apache error.log i get this message: sendmail: Authorization failed (534 5.7.14 https://support.google.com/mail/answer/78754 nz12sm1965155pdb.49 - gsmtp Which software is used to send mail with php for debian and windows? 1)sendmail 2)ssmtp 3)msmtp
  22. <?php if (session_status() == PHP_SESSION_NONE) { session_start(); } require_once 'functions.php'; $dbh = mysql_connection(); $allowedExts = array("gif", "jpeg", "jpg", "png"); $temp = explode(".", $_FILES["file"]["name"]); $extension = end($temp); if (( ($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/jpg") || ($_FILES["file"]["type"] == "image/pjpeg") || ($_FILES["file"]["type"] == "image/x-png") || ($_FILES["file"]["type"] == "image/png") ) && //($_FILES["file"]["size"] < 20000) && in_array($extension, $allowedExts)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br>"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br>"; echo "Type: " . $_FILES["file"]["type"] . "<br>"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; $objDateTime = new DateTime('NOW'); $created = $objDateTime->format("Y-m-d H:i:s"); $modified = $objDateTime->format("Y-m-d H:i:s"); $title = $_FILES["file"]["name"]; $photo_url = "upload/" . $_FILES["file"]["name"]; $user_id = $_SESSION['id']; $username = $_SESSION['username']; $sql = 'insert into p_photos(title,photo_url,user_id,username,created,modified) values(:title,:photo_url,:user_id,:username,:created,:modified)'; $sth = $dbh->prepare($sql); $rt = $sth->execute(array(':title' => $title, ':photo_url' => $photo_url, ':user_id' => $user_id, ':username' => $username, ':created' => $created, ':modified' => $modified)); } } } else { echo "Invalid file"; } ?> Image is uploaded nicely, but not inserting record into p_photos table, what can be the reason?
  23. <?php if (session_status() == PHP_SESSION_NONE) { session_start(); } require_once 'functions.php'; $dbh = mysql_connection(); $allowedExts = array("gif", "jpeg", "jpg", "png"); $temp = explode(".", $_FILES["file"]["name"]); $extension = end($temp); if ( ( ($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/jpg") || ($_FILES["file"]["type"] == "image/pjpeg") || ($_FILES["file"]["type"] == "image/x-png") || ($_FILES["file"]["type"] == "image/png") ) && //($_FILES["file"]["size"] < 20000) && in_array($extension, $allowedExts)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br>"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br>"; echo "Type: " . $_FILES["file"]["type"] . "<br>"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; $objDateTime = new DateTime('NOW'); $created = $objDateTime->format("Y-m-d H:i:s"); $modified = $objDateTime->format("Y-m-d H:i:s"); $title = $_FILES["file"]["name"]; $photo_url = "upload/" . $_FILES["file"]["name"]; $user_id = $_SESSION['id']; $username = $_SESSION['username']; $sql = 'insert into p_photos(title,photo_url,user_id,username,created,modified) values(:title,:photo_url,:user_id,:username,:created,:modified)'; $sth = $dbh->prepare($sql); $rt = $sth->execute(array(':title' => $title, ':photo_url' => $photo_url, ':user_id' => $user_id, ':username' => $username, ':created' => $created, ':modified' => $modified)); } } } else { echo "Invalid file"; } ?> File is uploaded in upload folder correctly. What's wrong with prepare and execute statement? What can be the reason not inserting record? What's the way to debug php pdo query?
  24. Yes, there is only one row/record for this table.
×
×
  • 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.