How to display HTML tags as plain text in browser using php
Show HTML tags in browser we can use htmlspecialchars() <?php $new = htmlspecialchars(“<a href=’test’>Test</a>”, ENT_QUOTES); echo $new; // <a href='test'>Test</a> ?>
How to install pear mail in ubuntu
pear install Net_SMTP sudo /etc/init.d/sendmail start sudo /etc/init.d/apache2 restart
Configure SMTP mail on apache server in ubuntu
sudo apt-get install php-pear sudo pear install Mail_Mime sudo apt-get install sendmail sudo /etc/init.d/sendmail start sudo /etc/init.d/apache2 restart
Hide Div using Javascript
To hide a div element using JavaScript, you can set its style. Display property to “none“. Here’s an example: <!DOCTYPE html> <html> <head> <title>Hide a div with JavaScript</title> <script> function hideDiv() { var divElement = document.getElementById(“myDiv”); divElement.style.display = “none”; } </script> </head><body> <div id=”myDiv”> <p>This is the content of my div element.</p> </div> <button onclick=”hideDiv()”>Hide […]
Node.js Response.WriteHead function
Up until now all we’ve been sending into the writeHead function is the status code. However, it can take additional parameters like ‘Content-Length’, ‘Content-Type’. var http = require(‘http’); var fs = require(‘fs’); http.createServer(function(request, response) { response.writeHead(200, {‘Content-Type’: ‘text/html’} ); fs.readFile(‘index.html’, function(err, contents) { response.write(contents); response.end(); }); }).listen(8080);
Node.js Read File from Server
Now, showing you how to create an HTTP non-blocking server and how to read a file of the non-blocking filesystem. var http = require(‘http’); var fs = require(‘fs’); http.createServer(function(request, response) { response.writeHead(200); fs.readFile(‘index.html’, function(err, contents) { response.write(contents); response.end(); }); }).listen(8080); Generate Request curl http://localhost:8080
node.js Convert Blocking
Everyone don’t knows why important to write non-blocking programs in Node.js. Here is some code using non-blocking function “readFile()“ Read the contents of ‘index.html’ and log them to the console. var fs = require(‘fs’); fs.readFile(‘index.html’, function(err, contents){ console.log(contents); });
Create User in Mysql
CREATE USER ‘monty’@’localhost’ IDENTIFIED BY ‘some_pass’; GRANT ALL PRIVILEGES ON *.* TO ‘monty’@’localhost’ WITH GRANT OPTION;
Get http header information in php
getallheaders — Fetch all HTTP request headers array getallheaders ( void ) Example <?php foreach (getallheaders() as $name => $value) { echo “$name: $valuen”; } ?>