micromax canvas hd lollipop update
I rewrite this tutorial from forum.xda-developers.com : The users of Micromax A116 Canvas Hd can now update their handsets to Android 5.0 Lo...
The Blog You Will Love To Revisit.
01
02
03
04
05
06
07
08
09
10
11
12
| CREATE TABLE IF NOT EXISTS `posts` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(120) NOT NULL, `text` text NOT NULL, `date` date NOT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM;INSERT INTO `posts` (`id`, `title`, `text`, `date`) VALUES(1, 'Some great article', 'It
is a long established fact that a reader will be distracted by the
readable content of a page when looking at its layout. The point of
using Lorem Ipsum is that it has a more-or-less normal distribution of
letters, as opposed to using ''Content here, content here'',
making it look like readable English. Many desktop publishing packages
and web page editors now use Lorem Ipsum as their default model text,
and a search for ''lorem ipsum''
will uncover many web sites still in their infancy. Various versions
have evolved over the years, sometimes by accident, sometimes on purpose
(injected humour and the like).', '2009-08-10'),(2, 'Another great article', 'It
is a long established fact that a reader will be distracted by the
readable content of a page when looking at its layout. The point of
using Lorem Ipsum is that it has a more-or-less normal distribution of
letters, as opposed to using ''Content here, content here'',
making it look like readable English. Many desktop publishing packages
and web page editors now use Lorem Ipsum as their default model text,
and a search for ''lorem ipsum''
will uncover many web sites still in their infancy. Various versions
have evolved over the years, sometimes by accident, sometimes on purpose
(injected humour and the like).', '2009-08-10'),(3, 'News from myfeed', 'It
is a long established fact that a reader will be distracted by the
readable content of a page when looking at its layout. The point of
using Lorem Ipsum is that it has a more-or-less normal distribution of
letters, as opposed to using ''Content here, content here'',
making it look like readable English. Many desktop publishing packages
and web page editors now use Lorem Ipsum as their default model text,
and a search for ''lorem ipsum''
will uncover many web sites still in their infancy. Various versions
have evolved over the years, sometimes by accident, sometimes on purpose
(injected humour and the like).', '2009-08-10'); |


1
| $autoload['libraries'] = array('database'); |

1
|

1
2
3
4
| $db['default']['hostname'] = "localhost"; // your host$db['default']['username'] = "root";$db['default']['password'] = "";$db['default']['database'] = "tut_feeds"; |

1
| $route['default_controller'] = "Feed"; |

1
2
3
4
5
6
7
| class Feed extends Controller { function Feed() { parent::Controller(); }} |
01
02
03
04
05
06
07
08
09
10
| class Feed extends Controller { function Feed() { parent::Controller(); $this->load->helper('xml'); $this->load->helper('text'); }} |
1
2
3
4
5
6
7
8
| class Posts_model extends Model { // get all postings function getPosts($limit = NULL) { return $this->db->get('posts', $limit); }} |
01
02
03
04
05
06
07
08
09
10
11
| class Feed extends Controller { function Feed() { parent::Controller(); $this->load->helper('xml'); $this->load->helper('text'); $this->load->model('posts_model', 'posts'); }} |
01
02
03
04
05
06
07
08
09
10
11
| function index(){ $data['feed_name'] = 'MyWebsite.com'; // your website $data['encoding'] = 'utf-8'; // the encoding $data['page_description'] = 'What my site is about comes here'; // some description $data['page_language'] = 'en-en'; // the language $data['creator_email'] = 'mail@me.com'; // your email $data['posts'] = $this->posts->getPosts(10); header("Content-Type: application/rss+xml"); // important!} |
01
02
03
04
05
06
07
08
09
10
11
12
13
| function index(){ $data['feed_name'] = 'MyWebsite.com'; $data['encoding'] = 'utf-8'; // the encoding $data['page_description'] = 'What my site is about comes here'; $data['page_language'] = 'en-en'; $data['creator_email'] = 'mail@me.com'; $data['posts'] = $this->posts->getPosts(10); header("Content-Type: application/rss+xml"); $this->load->view('rss', $data);} |
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
| class Feed extends Controller { function Feed() { parent::Controller(); $this->load->helper('xml'); $this->load->helper('text'); $this->load->model('posts_model', 'posts'); } function index() { $data['feed_name'] = 'MyWebsite.com'; $data['encoding'] = 'utf-8'; $data['page_description'] = 'What my site is about comes here'; $data['page_language'] = 'en-en'; $data['creator_email'] = 'mail@me.com'; $data['posts'] = $this->posts->getPosts(10); header("Content-Type: application/rss+xml"); $this->load->view('rss', $data); } } |
1
| <?php echo '<?xml version="1.0" encoding="' . $encoding . '"?>' . "\n"; ?> |
1
2
3
4
5
6
7
8
| <rss version="2.0" <channel> |
1
2
3
4
5
6
7
8
9
| <title><?php echo $feed_name; ?></title><link><?php echo $feed_url; ?></link><description><?php echo $page_description; ?></description><dc:language><?php echo $page_language; ?></dc:language><dc:creator><?php echo $creator_email; ?></dc:creator><dc:rights>Copyright <?php echo gmdate("Y", time()); ?></dc:rights> |
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
| <?php foreach($posts->result() as $post): ?> <item> <title><?php echo xml_convert($post->title); ?></title> <link><?php echo site_url('YOUR URL' . $post->id) ?></link> <guid><?php echo site_url('YOUR URL' . $post->id) ?></guid> <description><![CDATA[ <?php echo character_limiter($post->text, 200); ?> ]]></description> <pubDate><?php echo $post->date; ?></pubDate> </item> <?php endforeach; ?> </channel><</rss> |
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
| class Feed extends Controller { function Feed() { parent::Controller(); $this->load->helper('xml'); $this->load->helper('text'); $this->load->model('posts_model', 'posts'); } function index() { $data['feed_name'] = 'MyWebsite.com'; $data['encoding'] = 'utf-8'; $data['page_description'] = 'What my site is about comes here'; $data['page_language'] = 'en-en'; $data['creator_email'] = 'mail@me.com'; $data['posts'] = $this->posts->getPosts(10); header("Content-Type: application/rss+xml"); $this->load->view('rss', $data); } } |
1
2
3
4
5
6
7
8
| class Posts_model extends Model { // get all postings function getPosts($limit = NULL) { return $this->db->get('posts', $limit); }} |
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
| <?php echo '<?xml version="1.0" encoding="' . $encoding . '"?>' . "\n"; ?><rss version="2.0" <channel> <title><?php echo $feed_name; ?></title> <link><?php echo $feed_url; ?></link> <description><?php echo $page_description; ?></description> <dc:language><?php echo $page_language; ?></dc:language> <dc:creator><?php echo $creator_email; ?></dc:creator> <dc:rights>Copyright <?php echo gmdate("Y", time()); ?></dc:rights> <?php foreach($posts->result() as $post): ?> <item> <title><?php echo xml_convert($post->title); ?></title> <link><?php echo site_url('blog/posting/' . $post->id) ?></link> <guid><?php echo site_url('blog/posting/' . $post->id) ?></guid> <description><![CDATA[ <?php echo character_limiter($post->text, 200); ?> ]]></description> <pubDate><?php echo $post->date; ?></pubDate> </item> <?php endforeach; ?> </channel></rss> |



01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
| function register(){ if(isset($_POST['username'])){ // User has tried registering, insert them into database. $username = $_POST['username']; $password = $_POST['password']; $this->users->register($username, $password); redirect('login'); } else{ //User has not tried registering, bring up registration information. $this->load->view('register'); }} |
1
| $this->users->register($username,$password); |
1
2
3
4
5
| function Login(){ parent::Controller(); $this->load->model('users');} |
01
02
03
04
05
06
07
08
09
10
11
| function register($username, $password){ $new_user = array ( 'username'=>$username, 'password'=>$password ); $this->db->insert('users', $new_user); return true;} |
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
| function go(){ $username = $_POST['username']; $password = $_POST['password']; //Returns userid if successful, false if unsuccessful $results = $this->users->login($username,$password); if ($results==false) redirect('login'); else { $this->session->set_userdata(array('userid'=>$results)); redirect('profile'); }} |
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
| function login($username, $password){ $query = $this->db->get_where('users', array('username'=>$username, 'password'=>$password)); if ($query->num_rows()==0) return false; else{ $result = $query->result(); $first_row = $result[0]; $userid = $first_row->id; return $userid; } } |
01
02
03
04
05
06
07
08
09
10
| function Profile(){ parent::Controller(); $this->load->model('users'); $this->load->model('files'); $this->userid = $this->session->userdata('userid'); if (!isset($this->userid) or $this->userid=='') redirect('login');} |
1
2
3
4
5
| function logout(){ $this->session->set_userdata(array('userid'=>'')); redirect('login');} |


1
2
3
4
5
| function get($userid){ $query = $this->db->get_where('files', array('owner'=>$userid)); return $query->result();} |
1
2
3
4
5
| function index(){ $data['files'] = $this->files->get($this->userid); $this->load->view('profile', $data);} |
01
02
03
04
05
06
07
08
09
10
11
| <?php foreach($files as $file): ?><div class="section"> <span><?=$file->name?></span> <div style="float: right;"> <span><a href="<?=base_url()?>files/<?=$file->name?>">View</a></span> <span><a href="<?=site_url("profile/delete/".$file->id)?>">Delete</a></span> </div> </div><?php endforeach; ?> |
01
02
03
04
05
06
07
08
09
10
11
12
13
14
| function upload(){ if(isset($_FILES['file'])){ $file = read_file($_FILES['file']['tmp_name']); $name = basename($_FILES['file']['name']); write_file('files/'.$name, $file); $this->files->add($name); redirect('profile'); } else $this->load->view('upload');} |
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
| <form enctype="multipart/form-data" action="<?=site_url('profile/upload')?>" method="post"> <div id="boxtop"></div><div id="boxmid"> <div class="section"> <span>File:</span> <input type="file" name="file" /> </div> </div><div id="boxbot"></div> <div class="text" style="float: left;"><p>Before uploading, check out</p><p>the <a href=#>Terms of Service</a>.</p></div> <div class="text" style="float: right;"> <input type="submit" value="Upload" name="upload" class="submit" /></div><br style="clear:both; height: 0px;" /></form> |

1
2
3
4
| function add($file){ $this->db->insert('files', array('owner'=>$this->session->userdata('userid'),'name'=>$file ));} |


1
2
3
4
5
6
7
| function delete($id){ //This deletes the file from the database, before returning the name of the file. $name = $this->files->delete($id); unlink('files/'.$name); redirect('profile');} |
1
2
3
4
5
6
7
| function delete($fileid){ $query = $this->db->get_where('files',array('id'=>$fileid)); $result = $query->result(); $query = $this->db->delete('files', array('id'=>$fileid)); return $result[0]->name;} |


Get our latest updates direct in your inbox.Just enter your wail address below....
Your privacy and email address are safe with us!