i want to create an application in friendster..

heres my code:

index.php

<?php

require_once(dirname(__FILE__). '/lib/FriendsterAPI.php');

// TO DO: Enter your secret key below
define('T_SECRET', 'f0ce8960ce76e39193ef43bea42f8a97');
define('T_CSS_STYLE', ' style=" height: 120px; background-color: #111111! important; overflow: hidden; margin: 0 auto; "');

// GET parameters from callback URL
$user_id = $_REQUEST['user_id'];
$api_key = $_REQUEST['api_key'];
$session_key = isset($_REQUEST['session_key'])? $_REQUEST['session_key'] : null;
$auth_token = isset($_REQUEST['auth_token'])? $_REQUEST['auth_token'] : null;
try {
 // Validate the request was really constructed and sent by Friendster 

 FriendsterAPI::validateSignature(T_SECRET);
 // Access friendster API
 if ( $session_key != null ) {
 $fapi = new FriendsterAPI($api_key, T_SECRET, $session_key);
 }
 else {
 $fapi = new FriendsterAPI($api_key, T_SECRET);
 $session_key = $fapi->session($auth_token);
 $_GET['session_key'] = $session_key;
 }
 // Access user info from friendster API
 $user_info = $fapi->users($user_id);
 $user_info = $user_info[0];

 

 // Update content in user profile
 if ( isset($_POST['updateapp']) ) {
 $fapi->post_widget($content);
 $params = array();
 $fapi->redirectToProfile($user_id, $params);
 exit;
 }
?>
<body bgcolor=#111111>
 <form action="index2.php" method="post">
<input type="textbox" name="fs" value="css url here"><br>
<input type="submit" name="updateapp" value="update my profile"><br>
</form>
 

<?
} catch (FriendsterAPIException $e){
 echo 'Error: ' . $e->getMessage() . '<br/><br/>';
 echo $e->getTraceAsString();
 exit;
}
?>

index2.php

<?php
$link = $_POST['fs'];
echo "<link rel='stylesheet' href='".$link."'>";


?>

idk what code should i add in index2.php to load css in my profile ..

can anyone help me pls?

have you tried

echo "<link href=\"$link\" rel=\"stylesheet\" type=\"text/css\" />";

instead of

echo "<link rel='stylesheet' href='".$link."'>";

I don't think that html can use single quotes for things like this. try using double quotes as i have and escape them and it should work.

also I think the fact you missed the type may have also had something to do with it.

hi
you can also call the css file as like this in php....
where no need of echo function for <link> tag

<?php
$link = $_POST['fs'];
?>
<link rel='stylesheet' href='<?=$link?>'>

Thanks

hi
you can also call the css file as like this in php....
where no need of echo function for <link> tag

<?php
$link = $_POST['fs'];
?>
<link rel='stylesheet' href='<?=$link?>'>

Thanks

That sometimes causes problems on some servers and would need to be replaced with the following:

<?php
$link = $_POST['fs'];
?>
<link rel='stylesheet' href='<?php echo $link; ?>'>

I don't know why but many people have posted a sample code simular to yours saying it doesn't work and the above is usually the solution.

This article has been dead for over six months. Start a new discussion instead.