acc_no.php
Cod: Selectaţi tot
<?php
ERROR_REPORTING(E_ALL | E_STRICT);
date_default_timezone_set('Europe/Helsinki');
include("config.php");
mysql_connect("$db_host", "$db_user", "$db_pass") or die(mysql_error());
mysql_select_db("$db_name") or die(mysql_error());
$id = $_GET['id'];
$actiune = "DELETE FROM friends WHERE id = '$id'";
$query = mysql_query($actiune) or die(mysql_error());
if($query){
include("cel_care_a_invitat_refuz.php");
}
mysql_close();
?>
Cod: Selectaţi tot
<?php
error_reporting(E_ALL|E_STRICT);
include("../../config.php");
mysql_connect("$db_host", "$db_user", "$db_pass") or die(mysql_error());
mysql_select_db("$db_name") or die(mysql_error());
$id = $_GET['id'];
//Aici selectez din tabela friends pentru a lua emailul la userul care a acerut in prietenie si la cel care tre sa accepte
$actiune1 = mysql_query("SELECT * FROM friends WHERE id = '".$id."'");
while ($afis1 = mysql_fetch_assoc($actiune1)){
//Aici selectez userul care a cerut cererea de prietenie
$actiune2 = mysql_query("SELECT * FROM users WHERE email = '".$afis1["invite_by"]."'");
while ($afis2 = mysql_fetch_assoc($actiune2)){
//Aici selectez userul care trebuie sa accepte cerere de prietenie sau sa o refuze
$actiune3 = mysql_query("SELECT * FROM users WHERE email = '".$afis1["friend_with"]."'");
while ($afis3 = mysql_fetch_assoc($actiune3)){
$msg = 'Dear '.$afis2['first_name'].' '.$afis2['last_name'].' , <br>
Sorry, but, '.$afis3['first_name'].' '.$afis3['last_name'].' has declined your friend request. ';
$date = date('d.m.Y');
date_default_timezone_set('Europe/Helsinki');
$hour = date("H:i:s", time());
$actiune4 = "INSERT INTO messages (`from`, `to`, `subject`, `message`, `read`, `date`, `hour`)
VALUES
('System', '".$afis2["first_name"]." ".$afis2["last_name"]."', 'New Friend', '".$msg."', '0', '".$date."', '".$hour."')";
$q = mysql_query($actiune4);
if ($q){
echo "Mesaj trimis cu succes";
}else{
echo mysql_error();
}
}
}
}
?>
Si...aici e chestia care ma enerveaza cel mai mult: Daca scriu in browser cel_care_a_invitat_refuz.php?id=id si dau enter...el trimite mesaj...Dar cand e inclus in acc_no.php nu trimite mesaj...
Deci...cum pot sa fac sa trimita mesaj cand e inclus in acc_no.php? Eu unu nu mai stiu ce sa ii fac:(. Ms mult!