Skip to main content

Posts

Showing posts from November, 2012

Here is the Solution for Every Problem

Here is the Solution for Every Problem Nice approach towards the problems “Life is a problem” Vs. “In Life there are problems” If we get any problem we usually say “Life is a Problem” better than this we can say that “In Life will have some problems” this sounds good and we will try to solve those, because we said problem will be a part of life. If you feel that, you have many problems then here is the solution…… to make them less… >  Know about your Problems. Take a chart and Marker. Write your problems on chart using marker (Might be small, silly or important) which includes all types (Social, Professional, Personal, Ethical). Write whatever comes to your mind. ( Note : It should complete in 5 min). Read them only once (Complete it in one min). If you get some more problems than write them but in separate section called Late Entries (Don’t read them again). At this stage you have to feel free because you have your problems on paper. Don’t add probl

Resetting Drupal 7 administrator password using a php file

This snippet will be helpful if you don’t have command-line access to the server to run the password-hash.sh shell file or no Drush access. In most shared hosts, command-line access is not provided. Please keep in mind that leaving the code below on your server after resetting the password is highly critical security problem that anyone can reset your administrator password. Use this carefully. All we are going to do is, bootstrapping Drupal, getting the necessary functions that generates the password and then updating the database with new password. First, create a file with a random name (gh34tu9.php for example) and put the following content in it. <?php define('DRUPAL_ROOT', getcwd()); require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); require_once DRUPAL_ROOT . '/includes/password.inc'; if (isset($_GET['pass']) && !empty($_GET['pass'])) { $newhash =  user_hash_passw

how to excute a .sql file through php

<?php ini_set(‘memory_limit’, ’5120M’); set_time_limit ( 0 ); /*************************************************************************** *                             sql_parse.php *                              ——————- *     begin                : Thu May 31, 2001 *     copyright            : (C) 2001 The phpBB Group *     email                : support@phpbb.com * *     $Id: sql_parse.php,v 1.8 2002/03/18 23:53:12 psotfx Exp $ * ****************************************************************************/ /***************************************************************************  *  *   This program is free software; you can redistribute it and/or modify  *   it under the terms of the GNU General Public License as published by  *   the Free Software Foundation; either version 2 of the License, or  *   (at your option) any later version.  *  ***************************************************************************/ /********************************************

creating folder and copy of folder through php in drupal

getenv() which gives the total path of the site from where it is comming. $directory= getenv("DOCUMENT_ROOT").base_path() . 'sites/<name_of_folder>';   drupal_mkdir($directory); // if u want to copy a file to desired path then here is the code. $desired_filepath = getenv("DOCUMENT_ROOT").base_path() . <path>;   $new_filepath = file_unmanaged_copy($desired_filepath, $directory, FILE_EXISTS_ERROR); please reach me if u find any problem. Thanks, Bhanu Prakash