Latest news
Home » PHP (page 3)

PHP

Check database exists in codeigniter

Load the Database Utility Class Notice: Databse Connection should be already established before loading the above class. <?php $this->load->dbutil(); ?> loaded class can access the functions using the  following method: <?php $this->dbutil->some_function() ?> <?php $this->dbutil->list_databases(); ?> the above function will  show an array of database names: <?php $dbs_smarttips = $this->dbutil->list_databases(); ?> <?php foreach ($dbs_smarttips as $db_name) { echo $db_name; } ?> ...

Read More »

How To Install Node.js Framework with Express and socket.io modules

1. Get a repository or package  of node.js using following command sudo apt-get install nodejs 2. After that we need a  NodeJS package manager (npm) sudo apt-get install npm Run the node.js using the command node node.js node.js supports different modules Examples : socket.io ,express,http..etc var socket = require( ‘socket.io’ ); var express = require( ‘express’ ); var http = require( ‘http’ ); ...

Read More »

removing or adding a prefix on existing tables in mysql

<?php $db_password = ‘root’; $db_user = ‘root’; $db_host = “-h localhost”; // Probably localhost $db_name = ‘test’; $prefix =’smarttips_’; $remove = ‘removeprefix’;//set a a condition name if(strtolower($remove) == ‘removeprefix’ || strtolower($remove) == ‘remove’){ $removeprefix = (bool) TRUE; } else { $removeprefix = (bool) FALSE; } $renmeQuery = “mysql -u$db_user -B -p$db_password -s -r $db_host $port $db_name -e ‘SHOW TABLES;'”; exec($renmeQuery, ...

Read More »

Socialengine video uploading source code

 public function jquerycreateVideo($params, $file, $values)   {     if( $file instanceof Storage_Model_File ) {       $params[‘file_id’] = $file->getIdentity();     } else {        // create video item       $video = Engine_Api::_()->getDbtable(‘videos’, ‘video’)->createRow();       $file_ext = $file[‘extension’];       $video->code = $file_ext;       $video->type = 3;       ...

Read More »

Signup or login through facebook

<div><a href=’javascript:void(null);’ onclick=”login();”>Signup/ login through facebook</a></div> <div id=”fb-root”></div> <script src=”http://connect.facebook.net/en_US/all.js”></script> 1. Include the above facebook all.js first. <script> 2. Initialize the facebook app settings. jQuery(function() { FB.init({ appId  : ” <12356666>”, status : true, // check login status cookie : true, // enable cookies to allow the server to access the session xfbml  : true  // parse XFBML }); });. //function ...

Read More »

How to change the redirection page after login in socialengine

socialengine is a zendframework based project helps the developers to build their own custom social network website. socialengine following the MVC structure. The login action is in user/controllers/AuthController.php Here we specify the redirection URL return $this->_helper->redirector->gotoRoute(array(“action”  =>  ‘home’) ,  “user_general” ,  true);  change the user router according to your need.

Read More »

Decode binary image data to image file

<?php $output = json_decode($result); foreach($output as $value) { echo $value->id.’–‘.$value->count.‘–‘; echo ‘<img src=”data:image/jpg;base64,’.$value->photo.'” width=”50″ height=”50″ alt=”embedded folder icon”><br />’; } ?>

Read More »