Hi, I'm learning PHP and I want to use the mail() function from my localhost. I have WAMP installed and a Gmail account. I know that the SMTP for Gmail is smtp.gmail.com and the port is 465 (more info from gmail).
What I need to configure in WAMP so I can use the mail() function?
Thanks!!
I'm working with a function whose signature looks like this
afunc(string $p1, mixed $p2, array $p3 [, int $p4 = SOM_CONST [, string $p5 ]] )
In some cases I don't have data for the last parameter $p5 to pass, but for the sake of consistency I still want to pass something like NULL. So my question, does PHP treat passing a NULL exactly the same as not passing anything?
somefunc($p1, $p2, $p3, $p4 = SOM_CONST);
somefunc($p1, $p2, $p3, $p4 = SOM_CONST, NULL);
How can I prevent XSS but allow any characters to be used? Like I can post HTML code on a forum like <html><body><h1>Test</h1></html>, but it would not be rendered in the browser as html? How can I do this so it does not convert the characters in PHP?
I have an application in PHP (private CMS) that I would like to rewrite and add some new things - I would like to be able to extend my app in an easier way - through plugins
But the problem is - I don't know how to achieve "pluggability", how to make system that recognizes plugins and injects them into the app?
So, what's the logic of a simple plugin system?
I want to make an email for my website like "[email protected]" where people can send their feedbacks and suggestions to it. How can I do it? Can I do it with PHP or there is something else needed?
I want to display total number of user who only have posts at Wordpress. I can get all users by this query
<?php $user_count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->users;"); echo $user_count ?>
But for the user count only with posts, i think i might need to join another table, does anyone have snippets ? Thanks.
I have created a pdf using tcpdf in php. i have a table with one row and one column. when i put the content from a form which is a textarea, the content in the form flows out of the table border. how can i make it so that it is contained in the border itslef???
Trying not to invent wheels :) and thus I am looking for a way to convert schedule(such as say crontab format) into readable English, much like Google Calendar has. Is there something(preferably written in PHP) that could do that?
Is there any way to explode() using an array of delimiters?
PHP Manual:
array explode ( string $delimiter , string $string [, int $limit ] )
Instead of using string $delimiter is there any way to use array $delimiter without affecting performance too much?
I'm doing a PHP site that uses a shell_exec() function like this:
$file = "upload/" . $_FILES["file"]["name"];
$output = shell_exec("leaf $file");
echo "<pre>$output</pre>";
Where leaf is a program that is located in the same directory of my script, but when I tried to run this script on the server, I just got nothing. What is wrong?
I have an int(11) column which is used to store money. I read some of the answers on SO and it seems I just need to update it to be a decimal (19,4) data type.
Are there any gotchas I should know about before I actually do the converting? My application is in PHP/Zend and I'm not using an ORM so I doubt I would need to update any sort of class to consistently identify the data type.
I have a WordPress installation on my site, and I want to display WP posts on other parts of my site (that is outside the WP installation). How do I do that with PHP?
I tried to search this type of question on Stack Overflow, Google and WP official site but I didn't find anything.
I have a form which has a field for email id. When form is submitted then a confirmation message should be send automatically to the given email id, how?
I want to do this in php.
Hi,
I have some PHP code that sends a section of html code including some inline Javascript code by curl to google. When i get it back from Google translated into the language that i chose, the Javascript code has been translated too.
Any ideas as to how i can stop Google translating my inline JavaScript code?
Thanks,
M
Obviously, I am a novice web designer. I'm using php and sql to do all the under-the-hood stuff, but I want a visually appealing as well as functional comment system. Right now I am just using HTML forms but they don't look very good. Should I be using javascript? Any tips to get me started?
I am collecting registration information on my site and need to figure out how to pass all data stored in the MySQL DB (or just portions of it) as a comma delimited CSV file through an SFTP so our partners can access the information. The pages are built using PHP.
I literally have no idea how to do this and am hoping somebody has experience doing so.
Thanks ahead of time!
Example link on my footer
$powered = 'Powered by <a href="htp://stackoverflow.com">Stackoverflow</a>';
theme file
<?php echo $powered; ?>
How to make if $powered removed from my footer and the error/reminder notice it.
Example die('Do not remove the powered link')
I am developing a website and sometimes the browsers keeps loading, and I would like to know exactly what's making it load for so long. It gets stuck kindof.
So I wonder if there is any application or way to check what is getting loaded onto the page, so I can see what element or object it gets stuck on?
The website uses php/javascript/mysql and html
I guess these are all questions that everyone must just know, because I'm not seeing this in the documentation :-D
I understand that the public folder is the folder that the world has access to.
I know it is the case with the css folder, but in migrating a traditional php website over, will my /images folder, /js folder /mp3s, etc Will those all just also be public folders that will be accessed via the layout or view.phtml pages?
Thanks!
Hai frnds i am new to php i am having following problems in my coding...
1.Actually i am opening word document with com object and storing it in textarea.
2.when content gets opened in textarea i am editing that content and saving the document
3.actually when i edited that file and done save after that if i open word document then file properties-custom the old content getting removed i wannt to retain that even if i edited the word document..please do the needful
i am using below code
<?php
$filename = 'C:/xampp/htdocs/mts/sites/default/files/a.doc';
//echo $filename;
if(isset($_REQUEST['Save'])){
$somecontent = stripslashes($_POST['somecontent']);
// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {
// In our example we're opening $filename in append mode.
// The file pointer is at the bottom of the file hence
// that's where $somecontent will go when we fwrite() it.
if (!$handle = fopen($filename, 'w')) {
echo "Cannot open file ($filename)";
exit;
}
// Write $somecontent to our opened fi<form action="" method="get"></form>le.
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
echo "Success, wrote ($somecontent) to file ($filename) <a href=".$_SERVER['PHP_SELF']."> - Continue - ";
fclose($handle);
} else {
echo "The file $filename is not writable";
}
}
else{
// get contents of a file into a string
$handle = fopen($filename, "r");
$somecontent = fread($handle, filesize($filename));
$word = new COM("word.application") or die ("Could not initialise MS Word object.");
$word->Documents->Open(realpath("$filename"));
// Extract content.
$somecontent = (string) $word->ActiveDocument->Content;
//echo $somecontent;
$word->ActiveDocument->Close(false);
$word->Quit();
$word = null;
unset($word);
fclose($handle);
}
?>
<h6>Edit file --------><? $filenam=explode("/",$filename);$filename=$filename[7]; echo $filename ;?></h6>
<form name="form1" method="post" action="">
<p>
<textarea name="somecontent" cols="100" rows="20"><? echo $somecontent ;?></textarea>
</p>
<div style='padding-left:250px;'><input type="submit" name="Save" value="Save"></div>
</p>
</form>
<?
}
?>
I need to write php code to identify common e-mail errors, like "inbox full" or specially "invalid email name" from email messages, because we need to clear our databases from nonexistent emails.
I'm looking the MIME and IMF formats but I didn't find any kind of standard error code, does it exist?
I am trying to create folder like this
$destination = "../enumesis.com/_pcode/../_compile";
mkdir($destination);
But this gives error
UPDATE
What i am doing is, taking ../enumesis.com/_pcode as input from user and I want to create a folder outside the _pcode Directory
Here is my error
Warning: mkdir() [function.mkdir]: No such file or directory in G:\wamp\www\tools\compile.php on line 57
../enumesis.com/_pcode/../_compile
A non-hypothetical but abstracted situation:
I have a domain www.foo.com, from which I'm making an AJAX POST to beta.foo.com. Examining the XHR object, I see a response header of 200 OK, but no response text - I even get a response 12B long, which is the exact response (a 12-character string) that I'm expecting - but the response text is blank.
If this is a cross-domain issue, why am I getting 200 OK, and better yet - why am I seeing the PHP functions fire on the beta.foo.com side - yet getting no response?
I need to add the URL 'user/7/orders' to a particular menu. As this requires PHP for the UID (7), how do I write a script to add an item to a particular menu?