Get line number of the code
<!--?
class myTest
{
function addMyAddress($street)
{
echo "
In class function at:".__LINE__;
echo "
class function called from:";
$e = new Exception();
$trace = $e->getTrace();
echo '
';print_r($trace);
// OR print_r(debug_backtrace());
}
}
echo "
Class created at:".__LINE__; $obj = new myTest();
echo "
Function called at:".__LINE__; $obj->addMyAddress('A/13 Skyline');
?>
Get any Website Page Title From URL in PHP
Hey guys,here below describe the how to get the page title form any website page using URL. Here for getting the page title we are using the file_get_contents function.This one also achieve using fopen( ) but in some servers disabled this function now a days due to some security reasons.
Here below shows the PHP code to get the page title form the URL.
<!--?php
function pageTitle($page_url)
{
$read_page=file_get_contents($page_url);
preg_match("/<title.*?>[\n\r\s]*(.*)[\n\r\s]*<\/title>/", $read_page, $page_title);
if (isset($page_title[1]))
{
if ($page_title[1] == '')
{
return $page_url;
}
$page_title = $page_title[1];
return trim($page_title);
}
else
{
return $page_url;
}
}
?>
Jquery Timeago Implementation with PHP.
Nowadays timeago is the most important functionality in social networking sites, it helps to updating timestamps automatically. Recent days I received few requests from 9lessons readers that asked me how to implement timeago plugin with dynamic loading live data using PHP. In this post I am just presenting a simple tip to implement timeago in a better way.
Why Live Query
LiveQuery utilizes the power of jQuery selectors by binding events or firing callbacks for matched elements auto-magically, even after the page has been loaded and the DOM updated.
Code
Contains javascipt code. $(this).timeago()- here this element is refers to timeagoclass selector of the anchor tag.
// <![CDATA[
javascript” src=”js/jquery.min.js”>
// ]]>
// <![CDATA[
javascript” src=”js/jquery.livequery.js”>
// ]]>
// <![CDATA[
javascript” src=”js/jquery.timeago.js”>
// ]]>
<script type=”text/javascript”>
$(document).ready(function(){
$(“.timeago”).livequery(function() // LiveQuery
{
$(this).timeago(); // Calling Timeago Funtion
});
});
</script>//HTML & PHP Code
<!–?php
$time=time(); // Current timestamp eg: 1371612613
$mtime=date(“c”, $time); // Converts to date formate 2013-06-19T03:30:13+00:00
?>You opened this page <a href=’#’ class=’timeago’ title=”<!–?php echo$mtime; ?>“></a>
Login with Facebook using PHP SDK in CakePHP
Here we used PHP SDK 3.0 and CakePHP 2.X for the process of authentication and authorizing users for your app.
For Creating an App, which you can obtain from the App Dashboard.
You need App Id and App Secret for integration of the facebook login in cakephp.
In this CakePHP module we included the Facebook PHP SDK 3.0 in vendors of the app directory.And we define Some variables in Core.php
And We create one file which is facebook.php in config folder for the define of AppId and Appsecret.
$config
=
array
(
'Facebook'
=>
array
(
'appId'
=>
'YOUR APP ID'
,
'secret'
=>
'YOUR APP SECRET'
,
)
);
We create one Controller which is FacebookCpsController.php
<?php
App::uses(
'Controller'
,
'Controller'
);
App::import(
'Vendor'
,
'Facebook'
,
array
(
'file'
=>
'Facebook'
.DS.
'facebook.php'
));
class
FacebookCpsController
extends
AppController {
public
$name
=
'FacebookCps'
;
public
$uses
=
array
();
public
function
index(){
$this
->layout=false;
}
function
login()
{
Configure::load(
'facebook'
);
$appId
=Configure::read(
'Facebook.appId'
);
$app_secret
=Configure::read(
'Facebook.secret'
);
=
new
Facebook(
array
(
'appId'
=>
$appId
,
'secret'
=>
$app_secret
,
));
$loginUrl
=
->getLoginUrl(
array
(
'scope'
=>
'email,read_stream, publish_stream, user_birthday, user_location, user_work_history, user_hometown, user_photos'
,
'redirect_uri'
=> BASE_URL.
'facebook_cps/facebook_connect'
,
'display'
=>
'popup'
));
$this
->redirect(
$loginUrl
);
}
function
facebook_connect()
{
Configure::load(
'facebook'
);
$appId
=Configure::read(
'Facebook.appId'
);
$app_secret
=Configure::read(
'Facebook.secret'
);
=
new
Facebook(
array
(
'appId'
=>
$appId
,
'secret'
=>
$app_secret
,
));
$user
=
->getUser();
if
(
$user
){
try
{
$user_profile
=
->api(
'/me'
);
$params
=
array
(
'next'
=> BASE_URL.
'facebook_cps/facebook_logout'
);
$logout
=
->getLogoutUrl(
$params
);
$this
->Session->write(
'logout'
,
$logout
);
}
catch
(FacebookApiException
$e
){
error_log
(
$e
);
$user
= NULL;
}
}
else
{
$this
->Session->setFlash(
'Sorry.Please try again'
,
'default'
,
array
(
'class'
=>
'msg_req'
));
$this
->redirect(
array
(
'action'
=>
'index'
));
}
}
function
facebook_logout(){
$this
->Session->
delete
(
'User'
);
$this
->Session->
delete
(
'logout'
);
$this
->redirect(
array
(
'action'
=>
'index'
));
}
}
?>
Here We create two view files for the FacebookCpsController which are located in app/View/FacebookCps directory.
index.ctp
<!--DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>
<head>
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
<title>Login with Facebook In CakePHP</title>
<?php
echo
$this
->Html->script(
'oauthpopup'
); ?>
<script type=
"text/javascript"
>
$(document).ready(
function
(){
$(
'#facebook'
).click(
function
(e){
$.oauthpopup({
path:
'facebook_cps/login'
,
width:600,
height:300,
callback:
function
(){
window.location.reload();
}
});
e.preventDefault();
});
});
</script>
</head>
<body>
<?php
$ses_user
=
$this
->Session->read(
'User'
);
$logout
=
$this
->Session->read(
'logout'
);
if
(!
$this
->Session->check(
'User'
) &&
empty
(
$ses_user
)) {
echo
$this
->Html->image(
'facebook.png'
,
array
(
'id'
=>
'facebook'
,
'style'
=>
'cursor:pointer;float:left;margin-left:550px;'
));
}
else
{
echo
'<img src="https://graph.facebook.com/'
.
$ses_user
[
'id'
] .
'/picture" width="30" height="30"/><div>'
.
$ses_user
[
'name'
].
'</div>'
;
echo
'<a href="'
.
$logout
.
'">Logout</a>'
;
}
?>
</body>
</html>
facebook_connect.ctp
<script type=
"text/javascript"
>
window.close();
</script>
Here I used one jquery plugin oauthpopup.jswhich is used for popup
(this file is located in app/webroot/js directory)
oauthpopup.js
(function (jQuery) {
jQuery.oauthpopup = function (options) {
options.windowName = options.windowName || ‘ConnectWithOAuth’;
options.windowOptions = options.windowOptions || ‘location=0,status=0,width=’+options.width+’,height=’+options.height+’,scrollbars=1′;
options.callback = options.callback || function () {
window.location.reload();
};
var that = this;
that._oauthWindow = window.open(options.path, options.windowName, options.windowOptions);
that._oauthInterval = window.setInterval(function () {
if (that._oauthWindow.closed) {
window.clearInterval(that._oauthInterval);
options.callback();
}
}, 1000);
};
})(jQuery);
In the PHP SDK 3.0,we change the facebook.php file.For the Session We uses the CakePHP core data source which is CakeSession. facebook.php file is located at app/Vendor/Facebook directory
facebook.php
//included this line the above class
App::uses(
'CakeSession'
,
'Model/Datasource'
);
public
function
__construct(
$config
) {
if
(!session_id()) {
//insted of session_start() we used CakeSession::start()
CakeSession::start();
}
parent::__construct(
$config
);
if
(!
empty
(
$config
[
'sharedSession'
])) {
$this
->initSharedSession();
}
}
Step-by-Step guide to Facebook Conversion Tracking
Step 1: Once you log in to your ‘Ads Manager’ tab, click on the Conversion Tracking button on the left side bar.
Step 2: Then click on the ‘Create Conversion Pixel’ tab to begin the process.
Step 3: You will be directed to this pop-up, which will ask you for a:
1. Name: An appropriate name will help you remember what you are tracking. (Example: Lead Generation – GATE Ad)
2. Category: This will help you decide the type of action that you want to track on your site. You can choose from the following:
1. Checkouts
2. Registrations
3. Leads
4. Key Page Views
5. Adds to Cart
6. Other Website Conversions
(For the purpose of this example, we have selected ‘Leads’).
Step 4: You will be able to see a pop-up window with a JavaScript code. This is the code that you will have to add to the page where the conversion will happen. This will let you track the conversions back to ads which you are running on Facebook.
The code should be placed on the page that a user will finally see when the transaction is complete.
Here is the tricky part. The code should not go on all pages. For that matter, it should not even go to the landing page of your product. The code should be placed on the page that a user will finally see when the transaction is complete.
For Example: If you want to track when students register for your GATE coaching, paste the code on the registration confirmation page/thank you page and not on the form that they need to submit.
How do you confirm that your conversion is working properly?
1. Check that the javascript snippet has been placed on the correct conversion page. Visit the page where the pixel has been embedded, right click and go to ‘View Page Source’ to find the pixel. The code should have the tag of the HTML. See image below.
2. Check that Facebook is receiving the conversion events from your website. Go to the conversion tracking tab in your Ads Manager account. There you will see a list of the conversion tracking pixels that you have created. If the conversion tracking pixel has been successfully implemented and a conversion event has been recorded, it will be reflected in the Pixel Status column. If the status shows active, it means that the page which contains the pixel has been viewed by users. If it shows inactive, it means that over the last 24 hours, the page with the pixel has not been viewed.
3.Later, when you create your Facebook ad , you need to check the track conversions box under the campaign, pricing and schedule tab to enable tracking.
Important security bulletin for WordPress users
A large distributed brute force attack against WordPress websites is understood to be occurring recently across the internet. A large botnet with thousands of attacking servers is attempting to log in by cycling through different usernames and passwords to get into the WordPress Admin dashboard. This is a global attack which is affecting thousands of servers globally.
To ensure that your websites are secure and safeguarded from this attack, we recommend the following steps to be implemented immediately if you are using WordPress:
1) Update your WordPress installation to the latest available version. If you have any plugins and themes installed under WordPress, please make sure that you update them to the latest version as well.
2) Use a strong alphanumeric password for your WordPress Admin login. You can use a password generator like http://www.strongpasswordgenerator.com
3) Password protect the WordPress admin directory (wp-admin) so that it will have an additional protection. You can do that through cPanel > Security > Password Protect Directories
Note: If it breaks the Ajax functionality or shows 404 errors in the dashboard, you may have to add the following in .htaccess file:
Order allow,deny
Allow from all
Satisfy any
4) If you have a static IP address, you can lock down the WordPress Admin access using .htaccess file with the following rules:
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/wp-login\.php(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/wp-admin$
RewriteCond %{REMOTE_ADDR} !^72\.72\.72\.72$ [OR]
RewriteCond %{REMOTE_ADDR} !^72\.72\.72\.73$ [OR]
RewriteCond %{REMOTE_ADDR} !^72\.72\.72\.74$
RewriteRule ^(.*)$ – [R=403,L]
(Replace 72.72.72.72, 72.72.72.73, 72.72.72.74 with your actual PC IPs)
5) Install security plugins like:
http://wordpress.org/extend/plugins/limit-login-attempts/
http://wordpress.org/extend/plugins/better-wp-security/
Upload Cover Photo to Facebook via PHP
Here is a tutorial to upload a Cover Photo on Facebook via PHP. We will need Facebook Application ID and Secret, and Facebook files from Github.com then upload to your web space only the src folder. Now create a file called upload.php and upload it to your web space. Open upload.php with notepad and add this code:
<?php ini_set('display_errors', 1); error_reporting(E_ALL); require 'src/facebook.php'; $facebook = new Facebook(array( 'appId' => "xxxxxxxxxxxxxxxxxxx", //Facebook App ID 'secret' => "xxxxxxxxxxxxxxxxxxx", // Facebook App Secret "cookie" => true, 'fileUpload' => true )); $user_id = $facebook->getUser(); if($user_id == 0 || $user_id == "") { $login_url = $facebook->getLoginUrl(array( 'redirect_uri' => 'https://selvabalaji.wordpress.com/upload.php?cover='.$_GET['cover'].'', // Replace with your site url 'scope' => "publish_stream,user_photos")); echo "<script type='text/javascript'>top.location.href = '$login_url';</script>"; exit(); } //get user album $albums = $facebook->api("/me/albums"); $album_id = ""; foreach($albums["data"] as $item){ if($item["type"] == "cover_photo"){ $album_id = $item["id"]; break; } } //set timeline cover atributes $full_image_path = realpath($_GET['cover']); $args = array('message' => 'Uploaded from hhttps://selvabalaji.wordpress.com/'); $args['image'] = '@' . $full_image_path; //upload cover photo to Facebook $data = $facebook->api("/me/photos", 'post', $args); $picture = $facebook->api('/'.$data['id']); $fb_image_link = 'http://www.facebook.com/profile.php?preview_cover='.$data['id'].''; //redirect to uploaded facebook cover and change it echo "<script type='text/javascript'>top.location.href = '$fb_image_link';</script>"; ?>
Now that just type in the URL of your site followed by the name of the image file and you’re done!
Example : http://yoursitename.com/upload.php?cover=selvabalaji.gif
vela vela song Lyrics from Velayudham
ada vela vela vela vela velayudham
nee otha paarva partha podhum nooraayudhamcoming down town, coming to the sea
he is the man like shiny bee
breaking to the barriers …..
gonna come and carry us
don shout out
come get some
you cant get down, he is velayuthamada vela vela vela vela velayutham
nee otha paarva partha podhum nooraayudham
chillax chillax song Lyrics From Velayutham
chillax chillax chillax chillax chillax..
chillax chillax chillax chillax chillax..manjanathi marathu katta
maiya vechi mayaki puta
naatu katta townu katta
rendum kalandha semma katta
kaiyu rendum urutu katta
kannu rendum vetta vetta
nenjukulla ratham sotta
eduku vara kitta..sooriyane thevaiyille vithudalama
rathiriya inga mattum inga vachukalama
thirupachi meesaiyile sikkikalama
neeyachu naanachu paathukalamamanjanathi marathu katta
maiya vechi mayaki puta
naatu katta townu katta
rendum kalandha semma katta
kaiyu rendum urutu katta
kannu rendum vetta vetta
nenjukulla ratham sotta
eduku vara kitta..dheem dheem thananam dheem dheem thananam
ah ah..ahhaaa..ah ah ahhaaen odhattu sayathula
ottikolla vaada ulla
patthu veral theekuchiya
pattha veika vaadi pulla
kattabomma peran ne katthi meesa veeran
muthan vechu kuthi kollu sethu poren
mayavi tha neeyum inga mayangiputta nanum
athangara moginiyum vaa nee enna katti pudikkachillax chillax chillax chillax chillax
chillax chillax chillax chillax chillax
chillax chillax chillax chillax chillax
chillax chillax chillax chillax chillax
chilllllaaaaa….x chillax babyen odambu panju metha
kitta vandhu kaatu vitha
un iduppu vaazha maata
naa pudicha thaanga maata
sandhu pondhu veedu nee vanthu vilayadu
patta vaanga thevaiyilla kotta podu
vetiya na sethu un marapula korthu
ennanamo pannuriye nenjukitta ketta kanava (ketta kanavu..)chillax chillax chilla chilla chillax
chillax chillax chilla chilla chillaxmanjanathi marathu katta
maiya vechi mayaki puta
naatu katta townu katta
rendum kalandha semma katta
kaiyu rendum urutu katta
kannu rendum vetta vetta
nenjukulla ratham sotta
eduku vara kitta..sooriyane thevaiyille vithudalama
rathiriya inga mattum inga vachukalama
thirupachi meesaiyile sikkikalama
neeyachu naanachu paathukalama
chillax chillax chillax chillax chillax..
chillax chillax chillax chillax chillax..
chillax chillax chillax chillax chillax..
chillax chillax chillax chillax chillax..
chillax chillax chillax
911Websiterepair announces Emergency Website Repair and Restore services for the do it yourself webmaster and the professional.
Waterbury, CT, April 21, 2009 John A. Monteleone, CEO, launched 911websiterepair.com for the growing market of “Do It Yourself” webmasters in need of “Pay As You Go” website development solutions. Customers hire dedicated Virtual Programmers by the hour or by the task and reduce costs by using the “Pay As You Go” pricing structures. Through a partnership with SecureNext Software Corporation (SNS), 911websiterepair.com provides skilled virtual developers to our customer base who build and manage their own websites, but occasionally need assistance to get the tasks done that are outside of their skill level. Monteleone stated ”online website building assistance is generally done by quote only, but through our relationship with SNS, there are no quotes, 911websiterepair provides virtual programming assistance for a low cost hourly or per task fee.”
App Store tally: 20,000 apps in seven months
iPhone and iPod touch users looking to download software from Apple’s App Store now have 20,000 programs to choose from—at least according to one Web site’s count.\
Apptism, an iPhone app activity aggregator, says that the 20,000th iPhone app was added to the store some time on Tuesday. Rob Libbey of apptism says his site monitors the App Store hourly and constantly updates the total number of apps available. As this article was posted, apptism’s tracker had already topped 20,150 apps.
If apptism’s count is accurate—when contacted for comment, Apple declined to confirm the number of apps available for download—it would mean that 5,000 new programs had arrived on the App Store in less than a month. After all, it was only January 16, when Apple officially announced that it had topped the 15,000 app mark.
Then again, a 5,000 app influx isn’t outside the realm of possibility. On December 5, Apple announced that there were 10,000 apps in the store—meaning it took the company a little more than a month to add the 5,000 apps needed to reach the Apple-confirmed 15,000 mark.
That’s a lot of gas-passing simulators and novelty noisemaker apps.
No matter how many apps are in the store officially, the App Store has seen booming business since it came online nearly seven months ago. The store opened its virtual doors on July 11, 2008, with just 500 apps.
Auto post into Blogspot using php code?
Rate this:
Share this: