Current location: Hot Scripts Forums » Programming Languages » PHP » Macromedia MX 2004 Server Behaviours


Macromedia MX 2004 Server Behaviours

Reply
  #1 (permalink)  
Old 07-05-04, 08:54 PM
mcrob mcrob is offline
Coding Addict
 
Join Date: Jul 2004
Posts: 266
Thanks: 0
Thanked 0 Times in 0 Posts
Macromedia MX 2004 Server Behaviours

Hey you all. Does anyone here on this message board uses the macromedia mx 2004 server behaviours when making PHP pages. If yes then please reply back too this message. I need help for something.

RoB
Reply With Quote
  #2 (permalink)  
Old 07-07-04, 05:02 AM
<?Wille?> <?Wille?> is offline
Junior Code Guru
 
Join Date: Jan 2004
Location: Helsinki, Finland
Posts: 666
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by mcrob
Hey you all. Does anyone here on this message board uses the macromedia mx 2004 server behaviours when making PHP pages. If yes then please reply back too this message. I need help for something.

RoB
rarely use it.. but got it.. what do you need help with?
Reply With Quote
  #3 (permalink)  
Old 07-07-04, 07:52 AM
mcrob mcrob is offline
Coding Addict
 
Join Date: Jul 2004
Posts: 266
Thanks: 0
Thanked 0 Times in 0 Posts
redirect.php

thanks for the reply. Basically I want too keep count of when the user login too my website, like once the user logins, it updates the date when they logged in. This is my code.


----------------------------------------------------------------------
<?php require_once('../../Connections/MainConnection.php'); ?>
<?php require_once('../../Connections/privatemessage.php'); ?>
<?php
session_start();
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;

// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}

$MM_restrictGoTo = "login.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php
$colname_Recordset1 = "1";
if (isset($_SESSION['MM_Username'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']);
}
mysql_select_db($database_MainConnection, $MainConnection);
$query_Recordset1 = sprintf("SELECT * FROM dbusers WHERE username = '%s'", $colname_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $MainConnection) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

mysql_select_db($database_privatemessage, $privatemessage);
$query_Recordset2 = "SELECT * FROM privatemessage";
$Recordset2 = mysql_query($query_Recordset2, $privatemessage) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);

?>
<?php echo $_SESSION['user']; ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>:: Redirecting you to your account ::</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
<!--
body {
background-color: #663333;
}
body,td,th {
font-family: Arial, Helvetica, sans-serif;
color: #FFFFFF;
font-weight: bold;
font-size: 12px;
}
.style1 {
font-size: 15px;
font-family: Geneva, Arial, Helvetica, sans-serif;
}
.style4 { font-size: 12px;
font-weight: bold;
}
.style2 { font-size: 15px;
font-weight: bold;
}
.style3 {font-size: 10px}
a:link {
color: #FF3333;
}
a:visited {
color: #FF3333;
}
a:hover {
color: #FF3333;
}
a:active {
color: #FF3333;
}
-->
</style>
<meta http-equiv="Refresh" content="4;URL=AdminInformation.php?reply=<?php echo $row_Recordset1['id']; ?>" />
</head>

<body>
<table width="600" border="1" align="center" cellpadding="1" cellspacing="1" bordercolor="#000000">
<tr>
<td height="16" valign="top" bgcolor="#333333"> <div align="right">Logged in Successfully::<br />
</div></td>
</tr>
<tr>
<td height="88" valign="top" bgcolor="#333333"><div align="center">
</div> <div align="center">
<div align="center">
<p>Welcome: <?php echo $row_Recordset1['firstName']; ?>
<?php echo $row_Recordset1['LastName']; ?><br />
<br />
Now redirecting you too your account <br />
<span class="style3">click <a href="AdminInformation.php?reply=<?php echo $row_Recordset1['id']; ?>">here</a> if you havent been redirected</span></p>
<div align="center" class="style4"></div>
</div>
</div></td>
</tr>
</table>
<div align="center"></div>

</body>
</html>
<?php
mysql_free_result($Recordset1);

mysql_free_result($Recordset2);
?>
--------------------------------------------------------------------------

This line of code is the redirect.php just after the user login from the login.php page.

keep me posted ASAP!!
RoB
Reply With Quote
  #4 (permalink)  
Old 07-08-04, 06:42 AM
<?Wille?> <?Wille?> is offline
Junior Code Guru
 
Join Date: Jan 2004
Location: Helsinki, Finland
Posts: 666
Thanks: 0
Thanked 0 Times in 0 Posts
so you want to add update on successfull login??
change this:
PHP Code:

<p>Welcome: <?php echo $row_Recordset1['firstName']; ?>

<?php 
echo $row_Recordset1['LastName']; ?><br />
into this:
PHP Code:

<? $q = (mysql_query("UPDATE dbusers SET LastLoginDateColumnName=CURDATE() WHERE username='$TheUsername'") ? "" "Error updateing userprofile >>".mysql_error());

echo(
"<p>Welcome: ".$row_Recordset1['firstName']." ");
echo (
$row_Recordset1['LastName']."<br />");
?>
should work


maby not what you wanted.. and i dont know how to do that sprintf() and all those un understandable things to get username.. hope this helps you
Wille

Last edited by <?Wille?>; 07-08-04 at 06:46 AM.
Reply With Quote
  #5 (permalink)  
Old 07-09-04, 07:16 AM
mcrob mcrob is offline
Coding Addict
 
Join Date: Jul 2004
Posts: 266
Thanks: 0
Thanked 0 Times in 0 Posts
hey willie I just wanted too say thank you for helping me out but it didnt work at all. This was my line of code

<?php require_once('../../Connections/MainConnection.php'); ?>
<?php require_once('../../Connections/privatemessage.php'); ?>
<?php
session_start();
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;

// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}

$MM_restrictGoTo = "login.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php
$colname_Recordset1 = "1";
if (isset($_SESSION['MM_Username'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']);
}
mysql_select_db($database_MainConnection, $MainConnection);
$query_Recordset1 = sprintf("SELECT * FROM dbusers WHERE username = '%s'", $colname_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $MainConnection) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

mysql_select_db($database_privatemessage, $privatemessage);
$query_Recordset2 = "SELECT * FROM privatemessage";
$Recordset2 = mysql_query($query_Recordset2, $privatemessage) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);

?>
<?php echo $_SESSION['user']; ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>:: Redirecting you to your account ::</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
<!--
body {
background-color: #663333;
}
body,td,th {
font-family: Arial, Helvetica, sans-serif;
color: #FFFFFF;
font-weight: bold;
font-size: 12px;
}
.style1 {
font-size: 15px;
font-family: Geneva, Arial, Helvetica, sans-serif;
}
.style4 { font-size: 12px;
font-weight: bold;
}
.style2 { font-size: 15px;
font-weight: bold;
}
.style3 {font-size: 10px}
a:link {
color: #FF3333;
}
a:visited {
color: #FF3333;
}
a:hover {
color: #FF3333;
}
a:active {
color: #FF3333;
}
-->
</style>
<meta http-equiv="Refresh" content="4;URL=<?php echo $row_Recordset1['redirect']; ?>?reply=<?php echo $row_Recordset1['id']; ?>" />
</head>

<body>
<table width="600" border="1" align="center" cellpadding="1" cellspacing="1" bordercolor="#000000">
<tr>
<td height="16" valign="top" bgcolor="#333333"> <div align="right">Logged in Successfully::<br />
</div></td>
</tr>
<tr>
<td height="88" valign="top" bgcolor="#333333"><div align="center">
</div> <div align="center">
<div align="center">
<? $q = (mysql_query("UPDATE dbusers SET LastLoginColumnName=CURDATE() WHERE username='$username'") ? "" : "Error updateing userprofile >>".mysql_error());
echo("<p>Welcome: ".$row_Recordset1['firstName']." ");
echo ($row_Recordset1['LastName']."<br />");

?>
Now redirecting you too your account <br />
<span class="style3">click <a href="<?php echo $row_Recordset1['redirect']; ?>?reply=<?php echo $row_Recordset1['id']; ?>">here</a> if you havent been redirected</span></p>
<div align="center" class="style4"></div>
</div>
</div></td>
</tr>
</table>
<div align="center"></div>

</body>
</html>
<?php
mysql_free_result($Recordset1);

mysql_free_result($Recordset2);
?>
Reply With Quote
  #6 (permalink)  
Old 07-09-04, 07:42 AM
<?Wille?> <?Wille?> is offline
Junior Code Guru
 
Join Date: Jan 2004
Location: Helsinki, Finland
Posts: 666
Thanks: 0
Thanked 0 Times in 0 Posts
did you get any error? and ofcourse you must change the columns and database names in the query to match the ones you use

EDIT:
ups.. error in my code
PHP Code:

<? $q = (mysql_query("UPDATE dbusers SET LastLoginColumnName=CURDATE() WHERE username='$username'") ? "" "Error updateing userprofile >>".mysql_error()); // a ( too much

echo("<p>Welcome: ".$row_Recordset1['firstName']." "); 
echo (
$row_Recordset1['LastName']."<br />"); 
?>
#######################################
//fix
#######################################
<? $q mysql_query("UPDATE dbusers SET LastLoginColumnName=CURDATE() WHERE username='$username'") ? "" "Error updateing userprofile >>".mysql_error());
echo(
"<p>Welcome: ".$row_Recordset1['firstName']." "); 
echo (
$row_Recordset1['LastName']."<br />"); 
?>

Last edited by <?Wille?>; 07-09-04 at 07:48 AM.
Reply With Quote
  #7 (permalink)  
Old 07-19-04, 07:31 AM
mcrob mcrob is offline
Coding Addict
 
Join Date: Jul 2004
Posts: 266
Thanks: 0
Thanked 0 Times in 0 Posts
weird updating query

Ok i am now able too update a table in the database without the use of a form field

PHP Code:

# Array<? $today mktime();?>

PHP Code:

$date=mysql("users""UPDATE dbusers SET LastLogin=$today WHERE id=1"); 

Ok this is so flipping weird ok. It updates nicely but when I go into the database it would generate this.

1090240146 <for example

How on earth can I convert that digit too this (July 26, 2004) And another thing, how is is that I can update the table too whatever I like

PHP Code:

$date=mysql("users""UPDATE dbusers SET LastLogin=newupdate WHERE id=1"); 

Whenever I do something like that nothing updates in the table. wtf
Reply With Quote
  #8 (permalink)  
Old 07-19-04, 10:20 AM
<?Wille?> <?Wille?> is offline
Junior Code Guru
 
Join Date: Jan 2004
Location: Helsinki, Finland
Posts: 666
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by mcrob

1090240146 <for example

How on earth can I convert that digit too this (July 26, 2004) And another thing, how is is that I can update the table too whatever I like
mktime => Get Unix timestamp for a date
Returns the Unix timestamp corresponding to the arguments given. This timestamp is a long integer containing the number of seconds between the Unix Epoch (January 1 1970) and the time specified.

i think you want this http://fi.php.net/manual/en/function.strftime.php
Reply With Quote
  #9 (permalink)  
Old 07-19-04, 02:18 PM
mcrob mcrob is offline
Coding Addict
 
Join Date: Jul 2004
Posts: 266
Thanks: 0
Thanked 0 Times in 0 Posts
thats cool.........

thats cool but I still dont understand how can I get those long digits and print them like (eg: July 24, 2004) And now is it that when I have the update query I cant update the table too whatever I want too set it too?
Reply With Quote
  #10 (permalink)  
Old 07-20-04, 04:33 AM
<?Wille?> <?Wille?> is offline
Junior Code Guru
 
Join Date: Jan 2004
Location: Helsinki, Finland
Posts: 666
Thanks: 0
Thanked 0 Times in 0 Posts
well.. first off.. sorry.. that function didnt have anything to do with ur problem but.. i hope the solution makes up for that little mistake.. here comes:
PHP Code:

$time mktime();

echo 
date("l dS F Y",$time)."<br />"
today it outputs: Tuesday 20th July 2004
to change the format check the date() arguments at http://fi.php.net/manual/en/function.date.php
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Free web site, control panel, and dedicated IP with game server purchase for only $25 twastudios General Advertisements 3 10-20-05 06:13 AM
Please Help ! sweetgurl Everything Java 2 04-13-04 11:57 AM
Newbie MySQL fccolon PHP 2 03-16-04 10:54 AM
FREE Team Speak server w/ every purchase of a Call of Duty Server twastudios General Advertisements 0 10-31-03 01:14 AM


All times are GMT -5. The time now is 05:08 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.