I'm trying to build a addressbook in PHP but I'm stuck at a point. How can I echo a table that automaticaly add a table row to display the next user in the addresbook, and how can I display all the users in my addressbook in the same table?
This is the code I have now.I hope someone can help me
<?php
if (!isset($_SESSION)) { session_start(); }
include "connect.php";
if (!isset($_SESSION['login']) || $_SESSION['login'] !== true || !isset($_SESSION['userid']) || $_SESSION['userid'] == "") {
header('location: login.php');
exit();
// Natuurlijk wel even controleren of de user daadwerkelijk is ingelogd!
// Als de login niet bestaat, terugsturen naar de homepage. Tevens script stoppen met uitvoeren voor de extra veiligheid.
} else {
session_regenerate_id();
// sessio_regenerate_id moet je altijd gebruiken wanneer de autorisatie van een gebruiker veranderd.
// Dit is tegen de hack session fixation, waarbij een hacker meelift op de sessie van een ander.
$userQuery = mysqli_query($conn, "SELECT roepnaam, telefoon, naam, bedrijf, stad, straat1, straat2, provincie, postcode, email FROM address");
// $userid is een integer (getal), en deze zet je in SQL niet tussen quotes.
// Tevens hoeft dit niet geHEX't te worden gezien deze informatie schoon uit de database komt
$user = mysqli_fetch_assoc($userQuery);
// Haal de gegevens uit de database als een associative array
}
?>
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 5px;
}
</style>
</head>
<body>
<table style="width:60%">
<tr>
<th>Roepnaam</th>
<th>Naam</th>
<th>Bedrijf</th>
<th>Telefoon</th>
<th>Email</th>
<th>Straatnaam 1</th>
<th>Straatnaam 2</th>
<th>Postcode</th>
<th>Stad</th>
<th>Provincie</th>
</tr>
<?php
while ($user = mysqli_fetch_assoc($userQuery)) {
?>
<tr>
<td><?php echo $user['roepnaam']; ?></td>
<td><?php echo $user['naam']; ?></td>
<td><?php echo $user['bedrijf']; ?></td>
</tr>
<?php
}
?>
</table>
</body>
</html>
try:
<?php
while ($user = mysqli_fetch_assoc($userQuery)) {
?>
<tr>
<td><?php echo $user['roepnaam']; ?></td>
<td><?php echo $user['naam']; ?></td>
<td><?php echo $user['bedrijf']; ?></td>
</tr>
<?php
}
?>
for more detail have a look at http://php.net/manual/en/mysqli-result.fetch-assoc.php
Make sure your $conn is included in the script.
If the connection is correct.
Remove previous $user = mysqli_fetch_assoc($userQuery);
and do this:
<?php
while ($user = mysqli_fetch_assoc($userQuery)) {
?>
<tr>
<td><?=$user['roepnaam']?></td>
<td><?=$user['naam']?></td>
<td><?=$user['bedrijf']?></td>
</tr>
<?php
}
?>
Related
i am new to php and coding in general. i wanted to make a signup/login system. the signup and login function works but when i login i want to stay on index.php and change the context. but for some reason it doesn't work. have i done something wrong?
this is my login code:
(gebruikersnaam = username & wachtwoord = password)
<?php
if(!isset($_SESSION)){
session_start();
}
include "../../db/dbconnect.php";
include "logs.inc.php";
$gebruikersnaam = mysqli_real_escape_string( $db, $_POST['gebruikersnaam'] );
$wachtwoord = mysqli_real_escape_string( $db, $_POST['wachtwoord'] );
$salt = "46elg9hl50h[[erlt".$wachtwoord."tesy45745jytj57sasfq";
if( empty( $gebruikersnaam ) || empty( $wachtwoord ) ){
header( "Location: ../index.php?/Fields=Empty" );
exit();
}
$sql = mysqli_query( $db, "SELECT * FROM organisatie WHERE OrgGebNaam='$gebruikersnaam' OR OrgEmail='$gebruikersnaam'" );
$result = mysqli_num_rows( $sql );
if( $result < 1 || $result > 1){
header( "Location: ../index.php?/Error/result" );
exit();
}
else {
if( $row = mysqli_fetch_assoc( $sql ) ){
$hashCheck = password_verify( $salt, $row['OrgWW']);
if( $hashCheck == false ){
header( "Location: ../index.php?/Error/Password_Incorrect#1");
exit();
}
else if( $hashCheck == true ){
$_SESSION['ID'] = $row['gebruikerID'];
$_SESSION['Geb'] = $row['gebruikersnaam'];
log_ingelogd();
header( "Location: ../index.ad.php?/Welcome.".$gebruikersnaam );
exit();
}
}
else{
header( "Location: ../index.php?Error/Password_Incorrect#2");
exit();
}
}
?>
and this is index.php:
<?php
include 'header.php';
include '../db/dbconnect.php';
error_reporting(0);
if( !isset( $_SESSION['ID']) && !isset( $_SESSION['Geb'])) {
?>
<section>
<table id="login-table">
<form action="include/login2.inc.php" method="POST">
<tr>
<td colspan=2 style="text-align: center;"> Login Formulier</td>
</tr>
<tr>
<td><div class="table-text">Gebruikersnaam: </div></td>
<td><input type="text" class="login-table-text" name="gebruikersnaam" required title="Vul hier uw gebruikersnaam in." placeholder="Gebruikersnaam"></td>
</tr>
<tr>
<td><div class="table-text">Wachtwoord: </div></td>
<td><input type="password" class="login-table-text" name="wachtwoord" required title="Vul hier uw wachtwoord in." placeholder="Wachtwoord"></td>
</tr>
<tr>
<td colspan=2 style="text-align: center;"><button id="login-btn" name="submit">Inloggen</button></td>
</tr>
</form>
<form action="signup.php" method="POST">
<tr>
<td colspan=2><hr></td>
</tr>
<tr>
<td><div class="table-text">Als u geen account heeft: </div></td>
</tr>
<tr>
<td colspan=2 style="text-align: center;"><button id="signup-btn" name="signup">Maak een account aan ></button></td>
</tr>
</form>
</table>
</section>
<?php
} // ending if statement.
$gebruikersnaam = $_SESSION['Geb'];
$sql = mysqli_query( $db, " SELECT * FROM gebruikers WHERE gebruikersnaam = '$gebruikersnaam'" );
$row = mysqli_fetch_assoc( $sql );
if( $row['IsAdmin'] == 1){
?>
<div class="container">
<div class="box">
<table class="box-information">
<tr class="box-information-titel">
<td>Gebruikers</td>
</tr>
</table>
<p class="box-information-omschrijving">Bekijk hier de gegevens van alle gebruikers, maak gebruikers aan, verwijder gebruikers en bewerk de gegevens van gebruikers.</p>
<div id="box-btn-gebruiker">
<button class="box-btn">Bekijk ></button>
</div>
</div>
<div class="box">
<table class="box-information">
<tr class="box-information-titel">
<td>Onderhoud</td>
</tr>
</table>
<p class="box-information-omschrijving">Bekijk hier het onderhouds tabel zodat u onderhoud kan uitvoeren.</p>
<div id="box-btn-onderhoud">
<button class="box-btn">Bekijk ></button>
</div>
</div>
<div class="box">
<table class="box-information">
<tr class="box-information-titel">
<td>Organisatie</td>
</tr>
</table>
<p class="box-information-omschrijving">Bekijk hier alle gegevens die een organisatie heeft.</p>
<div id="box-btn-organisatie">
<button class="box-btn">Bekijk ></button>
</div>
</div>
<div class="box">
<table class="box-information">
<tr class="box-information-titel">
<td>Factuur</td>
</tr>
</table>
<p class="box-information-omschrijving">Bekijk hier alle openstaande facturen, maak facturen en factuurregels.</p>
<div id="box-btn-factuur">
<button class="box-btn">Bekijk ></button>
</div>
</div>
</div>
<?php
}
include 'footer.php';
?>
can someone tell me what i did wrong?
edit: (im not sure but...) i think the problem lies here:
$gebruikersnaam = $_SESSION['Geb'];
$sql = mysqli_query( $db, " SELECT * FROM gebruikers WHERE gebruikersnaam = '$gebruikersnaam'" );
$row = mysqli_fetch_assoc( $sql );
if( $row['IsAdmin'] == 1){
edit: this is my header.php:
<?php
if(!isset($_SESSION)){
session_start();
}
?>
Maybe missing session_start(); in file index.php
goodnight need to keep a calendar event laravel and make a calendar but I can not do any other please Amano in this and in advance thank you very much
this is the code of my calendar
<?php
$month=date("n");
$year=date("Y");
$diaActual=date("j");
$diaSemana=date("w",mktime(0,0,0,$month,1,$year))+7;
$ultimoDiaMes=date("d",(mktime(0,0,0,$month+1,1,$year)-1));
$meses=array(1=>"Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio",
"Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre");
?>
<!DOCTYPE html>
<html lang="es">
<head>
<title>calendario </title>
<meta charset="utf-8">
<style>
#calendar {
font-family:Arial;
font-size:12px;
}
#calendar caption {
text-align:left;
padding:5px 10px;
background-color:#003366;
color:#fff;
font-weight:bold;
}
#calendar th {
background-color:#006699;
color:#fff;
width:40px;
}
#calendar td {
text-align:right;
padding:2px 5px;
background-color:silver;
}
#calendar .hoy {
background-color:red;
}
</style>
</head>
<body>
<h1>calendario </h1>
<table id="calendar">
<caption><?php echo $meses[$month]." ".$year?></caption>
<tr>
<th>Lun</th><th>Mar</th><th>Mie</th><th>Jue</th>
<th>Vie</th><th>Sab</th><th>Dom</th>
</tr>
<tr bgcolor="silver">
<?php
$last_cell=$diaSemana+$ultimoDiaMes;
// hacemos un bucle hasta 42, que es el máximo de valores que puede
// haber... 6 columnas de 7 dias
for($i=1;$i<=42;$i++)
{
if($i==$diaSemana)
{
// determinamos en que dia empieza
$day=1;
}
if($i<$diaSemana || $i>=$last_cell)
{
// celca vacia
echo "<td> </td>";
}else{
// mostramos el dia
if($day==$diaActual)
echo "<td class='hoy'>$day</td>";
else
echo "<td>$day</td>";
$day++;
}
// cuando llega al final de la semana, iniciamos una columna nueva
if($i%7==0)
{
echo "</tr><tr>\n";
}
}
?>
</tr>
</table>
</body>
</html>
this is the structure I only need to add the event and select dates mvc but everything goes to get here
So my problem is i`ve set Variables at the beginning og my Script and later in the script i need that variable to do some math so it knows if it has money to buy something and if it has no money to buy the items. so heres my script
The error shows up all the way on the bottom of the script.
$user = 'Ramon';
// get integer data from url
$removeslash = "/xampp/";
$actual_link3 = "$_SERVER[REQUEST_URI]";
$actual_link2 = str_replace($removeslash,"",$actual_link3);
$actual_link = str_replace(".php","",$actual_link2);
echo $actual_link;
// connect to mysql database
$conn = mysqli_connect($host,$username,$password, $database);
if (!$conn) {
die('Not connected : ' . mysqli_error());
}
$result = mysqli_query($conn, "SELECT * FROM Bedrijf WHERE ID='".$actual_link."'");
$row = mysqli_fetch_array($result);
$NaamBedrijf = $row['Name'];
$WorthNow = $row['WorthNow'];
$result2 = mysqli_query($conn, "SELECT * FROM Users WHERE Username='".$user."'");
$row2 = mysqli_fetch_array($result2);
$Aandelen = $row2['Shares'.$actual_link];
$Money = $row2['Money'];
echo "IK HRB NU".$Aandelen;
//Waarde aandelen berkenen
$WaardePort = $Aandelen * $WorthNow;
//Geld formateren van 1293384 naar $1,293,384.00
setlocale(LC_MONETARY, 'en_US');
$MoneyFOR = money_format('%(#10n', $Money) . "\n";
$WaardePort = money_format('%(#10n', $WaardePort) . "\n";
$WaardeNU = money_format('%(#10n', $WorthNow) . "\n";
echo "AANDELEN:".$Aandelen;
echo "<html>
<head>
<title>Beurs</title>
<link rel='stylesheet' type='text/css' href='index.css'/>
</head>
<body>
<center>
<table>
<tr>
<td width='992px'>
<p class='ingelogd'>Je bent ingelogd Als ".$user."</p>
</td>
</tr>
<tr>
<td width='992px'>
<p>Er staat ".$MoneyFOR." Dollar op je bank.</p>
</td>
</tr>
</table><br/>
<table>
<tr>
<td id='Title' width='992px'>Je Kunt Informatie zien over je aandelen en aandelen verkopen/kopen.</td>
</tr>
</table>
<table width='1000px'>
<tr>
<td>".$NaamBedrijf."</td>
<td>".$WaardeNu."</td>
<td>".$Aandelen."</td>
</tr>
<tr>
<form>
<td>Kopen of Verkopen?</td>
<td>
<input type='radio' name='1' value='1'>Verkopen</input>
<input type='radio' name='2' value='2'>Kopen</input><br/>
</td>
<td>Aantal andelen:<input style='width:85px;' type='text' name='Totaal'/><input type='submit' name='submit' value='Koop/Verkoop'/></td>
</form>
</tr>
</table>
<table>
<tr>
<td width='992px'><label>Je aandelen zijn ".$WaardePort." Dollar Waard.</label><input type='submit' name='back' value='Ga Terug naar overzicht'/></td>
</tr>
</table>
</center>
</body>
</html>";
echo "AANDELEN:".$Aandelen;
if($_GET){
if(isset($_GET['submit'])){
if(isset($_GET['1'])){
echo "Aandelen totaal:".$_GET['Totaal'];
echo "Hoeveel aandelen heb ik: ".$Aandelen;
if (!$_GET['Totaal'] > $Aandelen) { //ERROR IS HERE AND BELOW
echo "<center><p style='color:red; font-weight:bold;'>je hebt niet zoveel andelen!</p></center>";
}else{
$jekrijgt = $WorthNow * $_GET['Totaal'];
$Aandelen = $Aandelen - $_GET['Totaal'];
$Money = $jekrijgt + $Money;
echo "Je hebt ".$_GET['Totaal']." Aandelen Verkocht Voor: ".$Money;
echo $Aandelen;
}
}else{
echo "BUY";
}
}
}
?>
EXPLAINATION !
When echo the Variable aandelen before the If statements it Shows up perfectly fine but when i try to do some math to mae it when it doesnt have that much Shares(aandelen) then it will echo You dont have that much Shares. But it always echo That you have sold shares even if you dont have that much shares.
To see whats going wrong check http://wirechat.net16.net/xampp/5.php
!$_GET['Totall'] is processed before the > operator.
This means that it will only ever (numerically) be zero (if Totall is truthy), or one (if Totall is empty or zero).
The correct way to negate > is by using <= instead.
if( $_GET['Totaal'] <= $Aandelen)
I've got a part of a PHP script, but it gives a T_CLASS error.
But i'm not sure how to convert the VAR element into a php5 compliant code...
Can somebody help me?
<?php // Defining the "calc" class
if (!class_exists('calc'))
class calc {
var $number1;
}
?>
p.s. this is just part of a bigger code, but it keeps saying: "PHP Syntax Check: Parse error: syntax error, unexpected T_CLASS in your code on line 3". So the error should be either in "class calc {" or in "var $number1;". Please help :P
I had to place the entire code. Just adding the brackets gave me a new error.
<?php // Defining the "calc" class
if (class_exists('calc')) {
class calc {
var $number1;
}
}
function boek($number1)
{
$result =$number1 * 2;
echo "Om een tekst van $number1 pagina's te redigeren, rekenen wij: <strong>€ $result,-*</strong></br>";
echo "<small>*Deze prijs is slechts een indicatie. Om een vrijblijvende offerte aan te vragen kunt u gebruikmaken van het contactformulier onderaan de pagina. <br/><span style=\"text-decoration: underline;\">Let op: studenten krijgen op vertoon van hun studentenpas 25% korting.</span></small>";
}
}
//Creating object of class
$calc = new calc();
?>
<style type="text/css">
.calcbutton {
Cursor: pointer;
display: block;
text-indent: -5000px;
width: 136px;
height: 44px;
border: none;
background-image: url('http://www.mijncreaties.com/wp-content/themes/GoedVerwoord/images/buttons.png');
background-repeat: no-repeat;
}
.calcbutton {background-position: top left;}
.calcbutton:hover {background-position: center left;}
.calcbutton:active {background-position: bottom left;}
</style>
<form name="calc" action="" method="POST">
<table>
<tr>
<td>Aantal pagina's: </td>
<td><input type="text" style="padding-left: 3px;" class="calc-form wpcf7-text" name="value1" value="0" onfocus="if (this.value == '0') {this.value = '';}" onblur="if (this.value == '') {this.value = '0';}"><br>
<input type="hidden" name="oper" value="boek">
</td>
</tr>
</table>
<input type="submit" value="Bereken prijs" name="submit" class="calcbutton">
</form>
<?
if($_POST['submit']){
$number1 = $_POST['value1'];
$oper = $_POST['oper'];
if(!$number1){
echo "<p><font color=\"red\">Vul a.u.b. een getal in.</font></p>";
}
if($oper == "boek"){
$calc->boek($number1);
}
}
?>
Try wrapping it in an extra set of braces:
<?php // Defining the "calc" class
if (!class_exists('calc')) {
class calc {
var $number1;
}
}
?>
Editted to add:
if (class_exists('calc')) {
class calc {
var $number1;
function boek($number1)
{
$result =$number1 * 2;
echo "Om een tekst van $number1 pagina's te redigeren, rekenen wij: <strong>€ $result,-*</strong></br>";
echo "<small>*Deze prijs is slechts een indicatie. Om een vrijblijvende offerte aan te vragen kunt u gebruikmaken van het contactformulier onderaan de pagina. <br/><span style=\"text-decoration: underline;\">Let op: studenten krijgen op vertoon van hun studentenpas 25% korting.</span></small>";
}
}
}
Your closing bracket was in the wrong place.
Wrap brackets around that if:
<?php
// Defining the "calc" class
if (!class_exists('calc')){
class calc {
var $number1;
}
}
?>
You will have the same issue when conditionally creating functions:
<?php
if (!function_exists('new_function')){
function new_function{
return 'awesome';
}
}
?>
I made this app: http://apps.facebook.com/citynumbersfriends. After users give permission they get redirected to the app outside FB. How can I redirect to the app in canvas view?
I already tried it setting redirect_uri='http://apps.facebook.com/citynumbersfriends/' but the I end up in an endless loop of URL's liek this: w1k5twJ0igxm7bAf30HfeAixibuF4xdHt1a94wSJ8M1BkRBHK8zHqWowqcD-G8-Dtcvrtw1sAx0qgLzKqQI5fm-1CYMHMiko80EPpsrvourUn2fPRE5UGNEcoSw38SXBd5ij9Ngt4yQwI#=_">http://apps.facebook.com/citynumbersfriends/?state=6e21ca70b7aef6316b2b600a03d790bf&code=AQCFfLzwUWi1mDJ8r2eWLkjJ9vRUVyAPfMKJFVC13edSSeeoVIgfGExpvbCREki53hYQES5iE-w1k5twJ0igxm7bAf30HfeAixibuF4xdHt1a94wSJ8M1BkRBHK8zHqWowqcD-G8-Dtcvrtw1sAx0qgLzKqQI5fm-1CYMHMiko80EPpsrvourUn2fPRE5UGNEcoSw38SXBd5ij9Ngt4yQwI#=_
with different state & code values.
Can anyone tell me what I am doing wrong?
I use this parts of code:
$loginUrl = $facebook->getLoginUrl(
array(
'app_id' => $app_id,
'req_perms' => 'publish_stream,status_update'
// 'redirect_uri' => $my_url
)
);
//--------------
catch (FacebookApiException $e) {
echo "<script type='text/javascript'>top.location.href = '$loginUrl'; </script>";
exit;
}
The complete code is below:
<?php
$name_search = $_GET['name_search'];
$invite = $_GET['invite'];
$reden = $_GET['reden'];
$foto = $_GET['foto'];
$app_id = '195571338990';
$app_secret = 'xxxxxxxxxxxxxx';
$my_url = 'http://apps.facebook.com/citynumbersfriends/';
$canvasPage = 'http://www.facebook.com/citynumbers';
$uid = null; //facebook user id
include ("facebook.php");
// Create our Application instance.
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'cookie' => true,
));
//Facebook Authentication part
// $session = $facebook->getSession();
$loginUrl = $facebook->getLoginUrl(
array(
'app_id' => $app_id,
'req_perms' => 'publish_stream,status_update'
//'redirect_uri' => $my_url
)
);
$me = null;
if (1==2) {
echo "<script type='text/javascript'>self.location.href = '$loginUrl';</script>";
exit;
}
else {
try {
$uid = $facebook->getUser();
$me = $facebook->api('/me');
$fql = "SELECT uid, name, first_name, pic_small FROM user WHERE strpos(lower(name),'$name_search') >= 0 AND uid IN (SELECT uid2 FROM friend WHERE uid1=".$uid.") order by name";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<head>
<link rel="stylesheet" href="http://citynumbers.com/styles/layout.css">
</head>
<table align='center' cellpadding='0' cellspacing='0' width='500px'>
<tr>
<td colspan='4'><a target='new' href='http://facebook.com/citynumbers'><img alt='Ga naar de Citynumbers Fanpage' title='Ga naar de Citynumbers Fanpage' src='/images/layout/logo.jpg'></a></td>
</tr>
<tr><td colspan='4'>
<iframe src="//www.facebook.com/plugins/like.php?app_id=263168060373514&href=http%3A%2F%2Fwww.facebook.com%2Fcitynumbers&send=false&layout=standard&width=350&show_faces=false&action=like&colorscheme=dark&font&height=40" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:350px; height:40px;" allowTransparency="true"></iframe>
</td></tr>
<tr><td colspan='4'>
<form id="form">
<h3>Nodig je vrienden uit om weer eens te gaan stappen!</h3>
<h3>Stap 1: Kies de reden waarom je wil stappen met je FB vriend</h3>
We moeten snel weer een keer uitgaan omdat:<BR>
<input type="radio" name="reden" <?if($reden=='ik me van de vorige keer weinig meer kan herinneren!'){echo "checked";} ?> value="ik me van de vorige keer weinig meer kan herinneren!" checked/>... ik me van de vorige keer weinig meer kan herinneren...<BR>
<input type="radio" name="reden" <?if($reden=='ik zin heb om weer met je te dansen!'){echo "checked";} ?> value="ik zin heb om weer met je te dansen!"/>...ik zin heb om weer met je te dansen!<BR>
<input type="radio" name="reden" <?if($reden=='we nodig moeten bijpraten!'){echo "checked";} ?> value="we nodig moeten bijpraten!"/>...we nodig moeten bijpraten!<BR>
<input type="radio" name="reden" <?if($reden=='het gewoon veel te lang geleden is!'){echo "checked";} ?> value="het gewoon veel te lang geleden is!"/>...het gewoon veel te lang geleden is!<BR>
<BR><BR>
<h3>Stap 2: Kies een foto</h3>
</td></tr>
<tr align='center'>
<td align='center'><img src='pics/facebook/girls_drinking_cocktails_tn.jpg' border='0'></td>
<td align='center'><img align='center' src='pics/facebook/girls-drinking-beer-271x300_tn.jpg' border='0'></td>
<td align='center'><img src='pics/facebook/drinking-students_tn.jpg' border='0'></td>
<td align='center'><img src='pics/facebook/clubbing_tn.jpg' border='0'></td>
</tr>
<tr>
<td align='center'><input type="radio" name="foto" <?if($foto=='http://citynumbers.com/pics/facebook/girls_drinking_cocktails_tn.jpg'){echo "checked";} ?> value="http://citynumbers.com/pics/facebook/girls_drinking_cocktails_tn.jpg" checked/></td>
<td align='left'><input type="radio" name="foto" <?if($foto=='http://citynumbers.com/pics/facebook/pics/facebook/girls-drinking-beer-271x300_tn.jpg'){echo "checked";} ?> value="http://citynumbers.com/pics/facebook/girls-drinking-beer-271x300_tn.jpg"/></td>
<td align='center'><input type="radio" name="foto" <?if($foto=='http://citynumbers.com/pics/facebook/drinking-students_tn.jpg'){echo "checked";} ?> value="http://citynumbers.com/pics/facebook/drinking-students_tn.jpg"/></td>
<td align='center'><input type="radio" name="foto" <?if($foto=='http://citynumbers.com/pics/facebook/clubbing_tn.jpg'){echo "checked";} ?> value="http://citynumbers.com/pics/facebook/clubbing_tn.jpg"/></td>
</tr>
<tr>
<td colspan='4'><BR><BR></td>
</tr>
<tr>
<td><img src='pics/facebook/Krakow-nightlife_tn.jpg' border='0'></td>
<td><img src='pics/facebook/Girls-having-Dinner-360x240_tn.jpg' border='0'></td>
<td><img src='pics/facebook/romantic-dinner-lg-84114188_tn.jpg' border='0'></td>
<td></td>
</tr>
<tr>
<td align='center'><input type="radio" name="foto" <?if($foto=='http://citynumbers.com/pics/facebook/Krakow-nightlife_tn.jpg'){echo "checked";} ?> value="http://citynumbers.com/pics/facebook/Krakow-nightlife_tn.jpg"/></td>
<td align='left'><input type="radio" name="foto" <?if($foto=='http://citynumbers.com/pics/facebook/pics/facebook/Girls-having-Dinner-360x240_tn.jpg'){echo "checked";} ?> value="http://citynumbers.com/pics/facebook/Girls-having-Dinner-360x240_tn.jpg"/></td>
<td align='center'><input type="radio" name="foto" <?if($foto=='http://citynumbers.com/pics/facebook/romantic-dinner-lg-84114188_tn.jpg'){echo "checked";} ?> value="http://citynumbers.com/pics/facebook/romantic-dinner-lg-84114188_tn.jpg"/></td>
<td align='center'></td>
</tr>
<tr><td colspan='4'>
<h3>Stap 3: Selecteer je vriend</h3><BR>
<?
echo "Type hier (een deel van) de naaam van je Facebook vriend:<BR><BR><input name='name_search' value='$name_search' type='text'><input name='url' value='$url' type='hidden'><INPUT TYPE=SUBMIT Name=SUBMIT Value='GO!'></Form><BR>";
if ($name_search<>''){
$param = array(
'method' => 'fql.query',
'query' => $fql,
'callback' => ''
);
$fqlResult = $facebook->api($param);
if (is_array($param) && count($param)) {
echo "<table border=0><tr>";
$i=0;
foreach($fqlResult as $result)
{
$i=$i+1;
echo "<td valign=top width=80 height=100 border=1><a target='top' href='http://www.facebook.com/dialog/feed?app_id=195571338990&link=http://apps.facebook.com/citynumbersfriends&picture=".$foto."&name=Ik vind dat we snel weer eens moeten uitgaan omdat:&to=".$result['uid']."&caption=...".$reden."&description=Kijk%20snel%20welke%20redenen%20ik%20NIET%20gekozen%20heb...&message=Facebook%20Dialogs%20are%20so%20easy!&redirect_uri=http://apps.facebook.com/citynumbersfriends/?invite=sent'><img border=0 src=".$result['pic_small']."><BR>".$result['name']."</a></TD>";
if($i % 8 == 0){
echo "</tr><tr>";
}
}
echo "<tr></td>";
echo "</form>";
if ($i==0){
echo "Geen vrienden gevonden, probeer het opnieuw!";
}
else
{
echo "<h3>Stap 4: klik op je vriend om hem of haar uit te nodigen!</h3>";
}
if ($invite<>''){
echo "<BR><BR>Nodig nog een andere vriend uit.";
}
echo "</td></tr></table>";
}
}
;
} catch (FacebookApiException $e) {
echo "<script type='text/javascript'>top.location.href = '$loginUrl';</script>";
exit;
}
}
function d($d){
echo '<pre>';
print_r($d);
echo '</pre>';
}
?>
I solved the problem by using this code:
$loginUrl='https://graph.facebook.com/oauth/authorize?type=user_agent&client_id=195571338990&redirect_uri=http%3A%2F%2Fwww.facebook.com/citynumbers?sk=app_195571338990&scope=publish_stream,status_update';
Case closed!