Sunday, June 13, 2010

Enable Htaccess in localhost AppServ

Open AppSer installed folder in that find conf folder and find httpd.conf file. In that file find below line(LoadModule rewrite_module modules/mod_rewrite.so)

For Example In Windows: D:\AppServ\Apache2.2\conf\

"LoadModule rewrite_module modules/mod_rewrite.so" if hash is there before the line remove that hash("#") and save the file and restart the AppServer to work

mysql command line windows

It is working for me like this

Set the path in command line to \mysql\bin i.e (in which directory mysql is installed)

For eg: (I had tried this one in localhost)


C:\AppServ\MySql\bin>

then enter a command mysql -u root -h localhost -p and "Press Enter" then it will ask for a password, then enter your password and "Press Enter" Then you got a message like this "Welcome to mysql moniter............... " like this

For testing type a command "Show databases;" without double Quotes now you can see the databases

Saturday, January 30, 2010

Generate Random Value

function random_code()
{
$string = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz0123456789";
$randval = '' ;

for($i = 0;$i <= 10;$i++)
{
$num = rand() % 62;
$tmp = substr($string, $num, 1);
$randval = $randval.$tmp;
}
echo $randval.uniqid();
}
random_code();

Friday, December 25, 2009

wordpress mu installation in localhost

I have installed the wordpress mu in localhost. I am using Appserv.

Copy the wordpress-mu folder in your root directory with some name as "wpmu". Create your database.

I just run like http://127.0.0.1/wpmu.

Then i fill the required details and submit the form it is installed i got admin username and password, now it is working.

Saturday, November 21, 2009

Phpbb3 admin login problem

Admin Login Page For Phpbb3:
  1. To Login into admin section you have to re-authenticate for admin account
  2. First you have to login from frontend with admin details
  3. Then you found "Registered users: admin" like this. when click on admin link the page move to related link where can find the below options
  4. Username:admin [ Administrate user ] [ Banning ]
  5. Click on " Administrate user" you found the admin login page from where you can login to your admin account by providing your details.
The admin URL is like this http://yoursitename/adm/index.php ( if it is localhost like this http://localhost/phpBB3/adm/index.php")

Admin login page like this "http://sitename/adm/index.php?i=users&mode=overview&u=2&sid=488e632c4df5103d5d1961f31321b251"

check value exist or not in php array

$os = array("Novmber, 2009", "NT", "Irix", "Linux");

if (in_array("Novmber, 2009", $os)) {
echo "You found that value";
}

Sunday, October 11, 2009

Htaccess tutorial for beginners

Note: Before using this you have to take backup for that code, I am not responsible for any problem occurred to your site.

I am explaining this by an example:
First create a folder name as Htest
In that folder create three files one is Test.php, First.php, .Htaccess

Test.php
Test
Click Test Page(href="http://sitename/some.php")

First.php
First
Click First Page(href="http://sitename/second.php")

.Htaccess
RewriteEngine On
RewriteRule ^(second.php)$ ./Test.php [L]
RewriteRule ^(some.php)$ ./First.php [L]

In the above example if you execute Test.php file and click on the link it goes to First.php page but in url it shows second.php because of first line in RewriteRule ^(some.php)$ ./First.php [L]
In .htaccess file as well as same process happen when executes First.php

If you have good idea about regular expressions you can do better.