manhattanpaul
-
Posts
4 -
Joined
-
Last visited
Never
Posts posted by manhattanpaul
-
-
Hi All
Anyone got any ideas how I can get the following code to offset by 5 hours. The field that displays the date / time is 'data' and the format is 2007-02-28 11:38:43 , ideally i would like it 11:38:43 28-02-2007.
Any thoughts......here is the code
Paul
<?
include ("../config.php");
include ("../functii_mail.php");
include ("../".$lang);
function accept($id)
{
$sql="update users set approvved=1 where id=$id";
$result=mysql_query($sql);
if (!$result)
{
echo "Error";
echo mysql_error();
}
}
function upgrade($id)
{
$sql="update users set upgraded=1 where id=$id";
$result=mysql_query($sql);
if (!$result)
{
echo "Error";
echo mysql_error();
}
}
function downgrade($id)
{
$sql="update users set upgraded=0 where id=$id";
$result=mysql_query($sql);
if (!$result)
{
echo "Error";
echo mysql_error();
}
}
function delete_u ($id)
{
$sql="delete from users where id=$id";
$result=mysql_query($sql);
if (!$result)
{
echo "Error";
echo mysql_error();
}
}
function suspend($id)
{
$sql="update users set approvved=0 where id=$id";
$result=mysql_query($sql);
if (!$result)
{
echo "Error";
echo mysql_error();
}
}
function get_picture($user_id)
{
//mod daca apare sau nu butonul radio
$sql="select nume,id from pictures where user_id=$user_id";
$result=mysql_query($sql);
$num=mysql_numrows($result);
if ($num<>0)
{
$i=0;
while ($i<$num)
{
$nume=mysql_result($result,$i,"nume");
$id=mysql_result($result,$i,"id");
?> <img src="../user_pic/ <?=$nume?>">
<?
$i++;
}
}
else
{
echo "This user have no pictures uploaded!";
}
}
function get_sound($user_id)
{
$sql="select nume,id from sounds where user_id=$user_id";
$result=mysql_query($sql);
$num=mysql_numrows($result);
if ($num<>0)
{
$i=0;
while ($i<$num)
{
$nume=mysql_result($result,$i,"nume");
$id=mysql_result($result,$i,"id");
$nume="user_sounds/ $nume";
?> <a href="../play_sound.php?fisier=<?=$nume?>" target="blank"><?echo $nume?></a>
<input name="sound" type="hidden" value="1">
<input type="radio" name="id" value="<?=$id?>"><br>
<?
$i++;
}
}
else
{
echo "This user have no sounds uploaded!";
}
}
db_connect($dbserver,$dbuser,$dbpass,$dbname);
if (isset($accept_))
{
accept($id);
}
if (isset($delete_))
{
echo $delete;
delete_u($id);
}
if (isset($suspend_))
{
suspend($id);
}
if (isset($upgrade_))
{
upgrade($id);
}
if (isset($downgrade_))
{
downgrade($id);
}
?>
<html>
<head>
<title>Dating site</title>
<meta http-equiv="Content-Type" content="text/html;">
<meta name="description" content="FW4 DW4 HTML">
<!-- Fireworks 4.0 Dreamweaver 4.0 target. Created Fri Nov 01 22:53:30 GMT+0200 (E. Europe Standard Time) 2002-->
<link href="stil.css" rel="stylesheet" type="text/css">
<?
if (isset($id))
{
//id id-ul userului
get_picture($id);
echo "<br>";
// get_sound($id);
echo "<br>";
}
?>
<?
if (isset($id))
{
$sql="SELECT * FROM users where id=$id order by data desc ";
$result=mysql_query($sql);
$num=mysql_numrows($result);
if ($num<>0)
{
$nick=mysql_result($result,0,"nick");
$data=mysql_result($result,0,"data");
$last_access=mysql_result($result,0,"last_access");
$email=mysql_result($result,0,"email");
$password=mysql_result($result,0,"password");
$sex=mysql_result($result,0,"sex");
$sexuality=mysql_result($result,0,"sexuality");
$personal_ad=mysql_result($result,0,"personal_ad");
$location=mysql_result($result,0,"location");
$country=mysql_result($result,0,"country");
$age=mysql_result($result,0,"age");
$birth_date=mysql_result($result,0,"birth_date");
$zodia=mysql_result($result,0,"zodia");
$marital_status=mysql_result($result,0,"marital_status");
$icq=mysql_result($result,0,"icq");
$msn=mysql_result($result,0,"msn");
$web=mysql_result($result,0,"web");
$eyes_colour=mysql_result($result,0,"eyes_colour");
$hair_colour=mysql_result($result,0,"hair_colour");
$weight=mysql_result($result,0,"weight");
$music=mysql_result($result,0,"music");
$partner=mysql_result($result,0,"partner");
$question=mysql_result($result,0,"question");
$newsletter=mysql_result($result,0,"newsletter");
$approvved=mysql_result($result,0,"approvved");
echo $nume_users."<font color=\"#FF0000\">".$nick;
echo "</font><br>".$data_intrarii."<font color=\"#FF0000\">".$data;
echo "<br></font>".$last_access_text."<font color=\"#FF0000\">".$last_access;
echo "<br></font>".$email_text."<font color=\"#FF0000\">".$email;
echo "<br></font>".$password_text."<font color=\"#FF0000\">". $password;
echo "<br></font>".$sex_text."<font color=\"#FF0000\"> ". $sex;
echo "<br></font>".$sexuality_text."<font color=\"#FF0000\"> ". $sexuality;
echo "<br></font>".$personal_ad_text."<font color=\"#FF0000\"> ". $personal_ad;
echo "<br></font>".$location_text." <font color=\"#FF0000\">". $location;
echo "<br></font>".$country_text."<font color=\"#FF0000\">". $country;
echo "<br></font>".$age_text."<font color=\"#FF0000\"> ". $age;
echo "<br></font>".$birth_date_text."<font color=\"#FF0000\">". $birth_date;
echo "<br> </font>".$zodia_text."<font color=\"#FF0000\">". $zodia;
echo "<br></font>".$marital_status_text."<font color=\"#FF0000\">". $marital_status;
echo "<br></font>".$icq_text."<font color=\"#FF0000\">". $icq;
echo "<br></font>".$msn_text."<font color=\"#FF0000\">". $msn;
echo "<br></font>".$web_text."<font color=\"#FF0000\">". $web;
echo "<br></font> ".$eyes_colour_text."<font color=\"#FF0000\">". $eyes_colour;
echo "<br></font>".$hair_colour_text."<font color=\"#FF0000\">". $hair_colour;
echo "<br></font>".$weight_text."<font color=\"#FF0000\">". $weight;
echo "<br></font>".$music_text."<font color=\"#FF0000\">". $music;
echo "<br></font>".$partner_text."<font color=\"#FF0000\">". $partner;
echo "<br></font>".$question_text."<font color=\"#FF0000\">". $question;
if ($newsletter==1)
{
echo $accept_newsletters;
}
else
{
echo $not_accept_newsletters;
}
if ($approvved==1)
{
echo $profile_accepted;
}
else
{
echo $profile_not_accepted;
}
}
}
?>
<br>
-
[b][color=red]Any thoughts ??
I am really desperate to get this sorted for a friend.
Regards
Paul[/color][/b] -
Hi there
I am currently trying to create a new display on the following page - mysite4singles.com/manager/users3.php
I want to be able to see at a glance which members have upgraded.
The only problem is, that the members who have upgraded are then repeated under 'Waiting to be registered' and 'Aleady registered' again !
Any thoughts (code below)
Cheers
Paul
[quote]The pages consists of the following code:
[color=purple]<?
include ("../config.php");
include ("../functii_mail.php");
db_connect($dbserver,$dbuser,$dbpass,$dbname);
function get_picture($user_id,$mod=0)
{
//mod daca apare sau nu butonul radio
$sql="select nume,id from pictures where user_id=$user_id";
$result=mysql_query($sql);
$num=mysql_numrows($result);
if ($num<>0)
{
$i=0;
while ($i<$num)
{
$nume=mysql_result($result,$i,"nume");
$id=mysql_result($result,$i,"id");
?>
<p><img src="../user_pic/ <?=$nume?>">
<?
if ($mod==1)
{
}
else
{
?>
<input type="radio" name="id" value="<?=$id?>">
<br>
<?}
$i++;
}
}
else
{
echo "This user have no pictures uploaded !";
}
}
function last_user($aproved=0)
{
$sql="SELECT count(*) FROM users where approvved=$aproved ";
$result=mysql_query($sql);
if($result)
{ $count=mysql_result($result,0,"count(*)");
echo '('.$count.')';
}
$sql="SELECT id,nick FROM users where approvved=$aproved order by data desc ";
$result=mysql_query($sql);
$num=mysql_numrows($result);
if ($num<>0)
{
$i=0;
while ($i<$num)
{
$nick=mysql_result($result,$i,"nick");
$id=mysql_result($result,$i,"id");
if ($i==$num-1)
{
?>
<a href="profile.php?id=<?=$id?>" target="mainFrame">
<?=$nick?>
</a>
<?is_online($id);
}
else
{
?>
<a href="profile.php?id=<?=$id?>" target="mainFrame">
<?=$nick?>
</a>,
<?is_online($id);
}
$i++;
}
}
$sql="SELECT id,nick FROM users where upgraded='1' order by data desc ";
$result=mysql_query($sql);
$num=mysql_numrows($result);
if ($num<>0)
{
$i=0;
while ($i<$num)
{
$nick=mysql_result($result,$i,"nick");
$id=mysql_result($result,$i,"id");
if ($i==$num-1)
{
?>
<a href="profile.php?id=<?=$id?>" target="mainFrame">
<?=$nick?>
</a>,
<?is_online($id);
}
else
{
?>
<a href="profile.php?id=<?=$id?>" target="mainFrame">
<?=$nick?>
</a>, </p>
<?is_online($id);
}
$i++;
}
}
}
echo "Waiting to be registered:";
last_user();
echo "<br>Already registered:";
last_user(1);
echo "<br>Upgraded:";
last_user(2);[/quote]
?>[/color]
BMI Calculations
in PHP Coding Help
Posted
Hi all
I have this page which collects some information on our clients.
As part of this assessment, it collects their height and weight. I want to get this to automatically calculate their BMI (which is calculated by Weight / Height Squared.
Here is my coding - you will see the Height and Weight Variables. What should I do to get the BMI to calcualte automatically or with the press of a button ??
Thanks Paul
mod edit: Use code tags
and just post the relevant code if you expect people to read it