Tuesday, December 13, 2011

Add user in joomla from outside

#############Created By Rahul Dev Sharma ###################
#### Insert user into joomla data base from out side #######
############################################################

include('affut_org_connect.php');
$name = $first_name. " ".$middle_name. " " .$last_name;
$queryForInsertInMicrosite = "insert into `jos_users` set `name` = '".$name. "',
`username` = '".$email_address."',
`email` = '".$email_address."',
`password` = '".md5($password)."',
`usertype` = 'Registered',
`block` = '0',
`sendEmail` = '1',
`gid` = '18',
`registerDate` = '".date('Y-m-d h:i:s')."',
`lastvisitDate` = '".date('Y-m-d h:i:s')."',
`activation` = ''";

if(mysql_query($queryForInsertInMicrosite))
{
// insert into jos_core_acl_aro
$insert_user_id = mysql_insert_id();
$queryForInsertInto2Table = "INSERT INTO `jos_core_acl_aro` SET `section_value` = 'user' , `value` = '".$insert_user_id."', `name` = '".$name."', `hidden` ='0'";
if(mysql_query($queryForInsertInto2Table))
{
$aro_id = mysql_insert_id();
// insert into `jos_core_acl_groups_aro_map` table
$queryForInsertInto3Table = "INSERT INTO `jos_core_acl_groups_aro_map` SET `group_id` = '18' , `aro_id` = '".$aro_id."'";
if(!mysql_query($queryForInsertInto3Table))
{
mysql_query("DELETE FROM `jos_core_acl_aro` WHERE `id` = '".$aro_id."'");
}
}
else
{
mysql_query("DELETE FROM `jos_users` WHERE `id` = '".$insert_user_id."'");
}
}

Sunday, August 7, 2011

Warning: file_get_contents(lang.tmp) [function.file-get-contents]: failed to open stream: No such file or directory in E:\xampp\htdocs\xampp\index.php on line 2

Use the link "http://localhost/xampp/lang.php?en" to recreate this file.

Sunday, July 17, 2011

How many ways we can we find the current date using MySQL?

ANSWER:SELECT CURDATE();
SELECT CURRENT_DATE();
SELECT CURTIME();
SELECT CURRENT_TIME();

Q.9 What are the differences between mysql_fetch_array(), mysql_fetch_object(), mysql_fetch_row()?

mysql_fetch_array() -> Fetch a result row as a combination of associative array and regular array.
mysql_fetch_object() -> Fetch a result row as an object.
mysql_fetch_row() -> Fetch a result set as a regular array().

difference of move(), and copy() function in php?

copy() function copy images for temp folder on server to
move other location. move() function cut images for temp
folder on server to move other location.

How many error types in php?

1:fatal
2:notice
3:warning
4:parse

How can we register the variables into a session?

session_register($session_var);

$_SESSION['var'] = 'value';

What are the differences between require and include, include_once?

require_once() and include_once() are both the functions to include and evaluate the specified file only once. If the specified file is included previous to the present call occurrence, it will not be done again.

But require() and include() will do it as many times they are asked to do.

How can we repair a MySQL table?

REPAIR TABLE tablename
REPAIR TABLE tablename QUICK
REPAIR TABLE tablename EXTENDED

This command will repair the table specified.
If QUICK is given, MySQL will do a repair of only the index tree.
If EXTENDED is given, it will create index row by row.

What is meant by PEAR in php?

PEAR is the next revolution in PHP. This repository is bringing higher level programming to PHP. PEAR is a framework and distribution system for reusable PHP components. It eases installation by bringing an automated wizard, and packing the strength and experience of PHP users into a nicely organised OOP library. PEAR also provides a command-line interface that can be used to automatically install

What's PHP

The PHP Hypertext Preprocessor is a programming language that allows web developers to create dynamic content that interacts with databases. PHP is basically used for developing web based software applications

What is C++?

Released in 1985, C++ is an object-oriented programming language created by Bjarne Stroustrup. C++ maintains almost all aspects of the C language, while simplifying memory management and adding several features - including a new datatype known as a class (you will learn more about these later) - to allow object-oriented programming. C++ maintains the features of C which allowed for low-level memory access but also gives the programmer new tools to simplify memory management.

C++ used for:

C++ is a powerful general-purpose programming language. It can be used to create small programs or large applications. It can be used to make CGI scripts or console-only DOS programs. C++ allows you to create programs to do almost anything you need to do. The creator of C++, Bjarne Stroustrup, has put together a partial list of applications written in C++.

.what is the name of Cake's database configuration file?

by default it is database.php.default, you can find it in /app/config/database.php.default
for connecting to database, it should be renamed to database.php

What is features in cake php?

list some of the features in Cake php

1. Compatible with versions 4 and 5 of PHP
2. MVC architecture
3. Built-in validations
4. Caching
5. scaffolding

Q2. What are 3 important parts of MVC (MODEL-VIEW-CONTROLLER)?

ANSWER:
1. The Model represents the application data
2. The View renders a presentation of model data
3. The Controller handles and routes requests made by the client

Q1. What is meant by MVC (MODEL-VIEW-CONTROLLER)?

model view controller, it is a software architecture, used to isolates business logic from presentation logic. cakephp is

based on mvc pattern.

What are commonly used components of cakephp?

* Security
* Sessions
* Access control lists
* Emails
* Cookies
* Authentication
* Request handling

What is a Component in cakephp?

Components are packages of logic that are shared between controllers. They are useful when a common logic or code is required between different controllers.

What is default function for a controller?

index() function

What are controllers?

A controller is used to manage the logic for a part of your application. Most commonly, controllers are used to manage the logic for a single model. Controllers can include any number of methods which are usually referred to as actions. Actions are controller methods used to display views. An action is a single method of a controller.