Tuesday, November 10, 2020

How to get Logged In Username in Wordpress or Woocommerce

It is really easy to get the logged-in user’s information in Wordpress or Woocommerce. In this article we will show you how to get the related to the currently logged in user.

We will utilize get_currentuserinfo(); function. This could be used anywhere in your theme (header, footer, sidebar, page-template etc). In order for this to work this code the user must be logged-in.

Sunday, August 20, 2017

The action you have requested is not allowed in codeignitor

The easiest way to ignore this is to add the url you want to exclude in config.php.

To do this ,

Go To application -> config -> config.php

Now search for the following "csrf_exclude_uris"
Then add your url into the excluded urls list like
$config['csrf_exclude_uris'] = 'admin/updatevpassword','admin/submitnewpassword';




Wednesday, April 26, 2017

Reasons to choose Wordpress to make your website

Reasons to choose Wordpress to make your website

This post is for the people who wants to make their website very quickly using a trending open source framework called Wordpress.
We have number of open source ready made CMS (Content Management System) platforms.
  1. Wordpress
  2. Joomla
  3. Drupal etc



But now a days the world of CMS is looking towards the wordpress. The king of CMS platforms. Earlier days wordpress was used to make a blog. Which means you write a post it will show. You can also create pages for your website but it can be done by the developers who know wordpress development. Availability of the plugins for our need was the main problem.

Thursday, April 20, 2017

Retrieve Duplicate Values from an alphanumeric column in mysql database

To retrieve duplicate values and its count from an alphanumeric column in mysql database
you can use the following query
SELECT `column_name`, COUNT(*) c FROM `table_name` GROUP BY `column_name` HAVING c > 1;

Wednesday, April 19, 2017

How to Create a Custom 404 Page in codeigniter

To Create a Custom 404 Page in CodeIgniter. I will tell you the  quick and easiest way.

1. Find Create a View Page as per your design requirements
2. Next define a route in config/routes.php like this

$route['404_override'] = 'MyCustom404Page';

3. Next Create a New Controller in your application/controller with the name MyCustom404Page

4. Then paste the below code in the newly created controller

<?php

class MyCustom404Page extends CI_Controller  {
    public function __construct() {
        parent::__construct();
    }

    public function index(){
        $this->output->set_status_header('404');

        // Make sure you actually have some view file named 404Page.php
        $this->load->view('404Page'); // Your View Page Name
    }
}

?>

Thats it now the custom 404 page is ready...

Wednesday, March 25, 2015

File is empty. Please upload something more substantial. This error could also be caused by uploads bei

If you get this error in wordpress or any other website initially try to increase the
upload_file_size to your preferred size and post_max_size in php.ini.

If this works fine./...

Or just call to hosting provider and ask them to increase the size manually......

Monday, February 9, 2015

Very Simple and easy pagination in php

<?php
$num_rec_per_page=10;
mysql_connect('localhost','root','');
mysql_select_db('apex1');
if (isset($_GET["page"])) { $page  = $_GET["page"]; } else { $page=1; };
$start_from = ($page-1) * $num_rec_per_page;
$sql = "SELECT * FROM student $start_from, $num_rec_per_page";
$rs_result = mysql_query ($sql); //run the query
?>
<table>
<tr><td>Name</td><td>Phone</td></tr>
<?php
while ($row = mysql_fetch_assoc($rs_result)) {
?>
            <tr>
            <td><?php echo $row['Name']; ?></td>
            <td><?php echo $row['Phone']; ?></td>          
            </tr>
<?php
};
?>
</table>
<?php
$sql = "SELECT * FROM student";
$rs_result = mysql_query($sql); //run the query
$total_records = mysql_num_rows($rs_result);  //count number of records
$total_pages = ceil($total_records / $num_rec_per_page);

echo "<a href='pagination.php?page=1'>".'|<'."</a> "; // Goto 1st page

for ($i=1; $i<=$total_pages; $i++) {
            echo "<a href='pagination.php?page=".$i."'>".$i."</a> ";
};
echo "<a href='pagination.php?page=$total_pages'>".'>|'."</a> "; // Goto last page
?>

Friday, February 6, 2015

URL redirect using .htaccess

302 (Temporary) Redirect: Point an entire site to a different temporary URL. This is useful for SEO purposes when you have a temporary landing page and plan to switch back to your main landing page at a later date:

# This allows you to redirect your entire website to any other domain Redirect 302 / http://mt-example.com/

301 (Permanent) Redirect: Point an entire site to a different URL on a permanent basis. This is the most common type of redirect and is useful in most situations. In this example, we are redirecting to the "mt-example.com" domain:

# This allows you to redirect your entire website to any other domain Redirect 301 / http://mt-example.com/




Saturday, January 31, 2015

How to restrict login from another IP using PHP

To restrict login from another unknown IP 

you must need to use $_server['REMOTE_ADDR']

the syntax to restrict is 

if(isset($_POST['submit'])=="SUBMIT")
{
     if($_server['REMOTE_ADDR']=='127.0.0.1') // replace with your own IP
        {
             // your code
        }
}

insert form data into mysql database using php

If you want to insert data into mysql database using php

if the database table is tblemployees


<form action="insert.php" method="POST">
<table>
<tr><td><input type="text" name="EMPNAME"/></td></tr>
<tr><td><input type="text" name="AGE"/></td></tr>
<tr><td><input type="text" name="MOBILE"/></td></tr>
<tr><td><input type="text" name="EMAIL"/></td></tr>
<tr><td><input type="submit" name="SUBMIT"/></td></tr>
</form>


and the php code to insert the data into database table is as follows

insert.php:

<?php


if(isset($_POST['submit'])=='SUBMIT')
{
     $insert=mysql_query("insert inot tblemployees (EMPNAME,AGE,MOBILE,EMAIL) values ('".$_POST['EMPNAME']."','".$_POST['AGE']."','".$_POST['MOBILE']."','".$_POST['EMAIL']."')");

if($insert)
{
   echo "Employee Created Successfully";
}

}

?>

Tuesday, January 27, 2015

How to get Logged In Username in Wordpress or Woocommerce

It is really easy to get the logged-in user’s information in Wordpress or Woocommerce. In this article we will show you how to get the relat...