473,414 Members | 1,744 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

How can I create client accounts pages for customer's files to uploaded

I would like to create a page for my clients to login and check for updates on their accounts. Then I would like to create a page where my employees can login and make updates, specifically new file uploads, to the clients accounts. I have seen similar sites everywhere, such as bank websites, USPS site, et cetera. What is
required to accomplish this? I'm trying to do this with the PHP, MySQL and Adobe CS3 Master collection's 'Dreamweaver CS3'

I thought it would be as easy as setting up a database with a table containing 'Id, username, password, customer-name, text, files'
then setting up a server behavior of 'login user' where 'username, password' are the authenticating fields and then setting up dynamic text fields Where the 'customer-name' is the heading
followed by html text 'Account Files' then the where 'text' is the body of the clients information then where 'files' is the customers
links to their updated files. Does this sound correct or possible and what are the steps I need to take?

Here is my accounts page where the user is redirected after login with username and password. Also, I have set up a logout link that is supposed to redirect the user after the click
however it is not doing that.



Expand|Select|Wrap|Line Numbers
  1. <?php require_once('Connections/connex.php'); ?>
  2. <?php
  3. //initialize the session
  4. session_start();
  5.  
  6. // ** Logout the current user. **
  7. $logoutAction = $HTTP_SERVER_VARS['PHP_SELF']."?doLogout=true";
  8. if ((isset($HTTP_SERVER_VARS['QUERY_STRING'])) && ($HTTP_SERVER_VARS['QUERY_STRING'] != "")){
  9.   $logoutAction .="&". $HTTP_SERVER_VARS['QUERY_STRING'];
  10. }
  11.  
  12. if ((isset($HTTP_GET_VARS['doLogout'])) &&($HTTP_GET_VARS['doLogout']=="true")){
  13.   //to fully log out a visitor we need to clear the session varialbles
  14.   session_unregister('MM_Username');
  15.   session_unregister('MM_UserGroup');
  16.  
  17.   $logoutGoTo = "adminlogin.php";
  18.   if ($logoutGoTo) {
  19.     header("Location: $logoutGoTo");
  20.     exit;
  21.   }
  22. }
  23. ?>
  24. <?php
  25. if (!isset($_SESSION)) {
  26.   session_start();
  27. }
  28. $MM_authorizedUsers = "";
  29. $MM_donotCheckaccess = "true";
  30.  
  31. // *** Restrict Access To Page: Grant or deny access to this page
  32. function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
  33.   // For security, start by assuming the visitor is NOT authorized. 
  34.   $isValid = False; 
  35.  
  36.   // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
  37.   // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  38.   if (!empty($UserName)) { 
  39.     // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
  40.     // Parse the strings into arrays. 
  41.     $arrUsers = Explode(",", $strUsers); 
  42.     $arrGroups = Explode(",", $strGroups); 
  43.     if (in_array($UserName, $arrUsers)) { 
  44.       $isValid = true; 
  45.     } 
  46.     // Or, you may restrict access to only certain users based on their username. 
  47.     if (in_array($UserGroup, $arrGroups)) { 
  48.       $isValid = true; 
  49.     } 
  50.     if (($strUsers == "") && true) { 
  51.       $isValid = true; 
  52.     } 
  53.   } 
  54.   return $isValid; 
  55. }
  56.  
  57. $MM_restrictGoTo = "adminlogin.php";
  58. if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  59.   $MM_qsChar = "?";
  60.   $MM_referrer = $_SERVER['PHP_SELF'];
  61.   if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  62.   if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) 
  63.   $MM_referrer .= "?" . $QUERY_STRING;
  64.   $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  65.   header("Location: ". $MM_restrictGoTo); 
  66.   exit;
  67. }
  68. ?>
  69. <?php
  70. if (!function_exists("GetSQLValueString")) {
  71. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
  72. {
  73.   $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  74.  
  75.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  76.  
  77.   switch ($theType) {
  78.     case "text":
  79.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  80.       break;    
  81.     case "long":
  82.     case "int":
  83.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  84.       break;
  85.     case "double":
  86.       $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
  87.       break;
  88.     case "date":
  89.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  90.       break;
  91.     case "defined":
  92.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  93.       break;
  94.   }
  95.   return $theValue;
  96. }
  97. }
  98.  
  99. $colname_username = "-1";
  100. if (isset($_SESSION['MM_Username'])) {
  101.   $colname_username = $_SESSION['MM_Username'];
  102. }
  103. mysql_select_db($database_connex, $connex);
  104. $query_username = sprintf("SELECT * FROM customerup WHERE username = %s", GetSQLValueString($colname_username, "text"));
  105. $username = mysql_query($query_username, $connex) or die(mysql_error());
  106. $row_username = mysql_fetch_assoc($username);
  107. $totalRows_username = mysql_num_rows($username);
  108. $colname_Recordset1 = "-1";
  109. if (isset($_SESSION['pkid'])) {
  110.   $colname_Recordset1 = $_SESSION['pkid'];
  111. }
  112. mysql_select_db($database_connex, $connex);
  113. $query_Recordset1 = sprintf("SELECT * FROM files WHERE pkid = %s", GetSQLValueString($colname_Recordset1, "int"));
  114. $Recordset1 = mysql_query($query_Recordset1, $connex) or die(mysql_error());
  115. $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  116. $totalRows_Recordset1 = mysql_num_rows($Recordset1);
  117.  
  118.  
  119. ?>
  120. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  121. <html xmlns="http://www.w3.org/1999/xhtml">
  122. <div id="container">
  123.   <img src="images/ALM.gif" name="top" width="780" height="65" id="top" />
  124.   <div id="nav">
  125.     <ul>
  126.       <li><a href="/index.html">Home</a></li>
  127.       <li><a href="/about_us.html">About Us</a></li>
  128.       <li><a href="/delivery_services.html">Services</a></li>
  129.       <li><a href="/on_line_order.html">Place Order</a></li>
  130.       <li><a href="adminlogin.php">Tracking/Reports</a></li>
  131.       <li><a href="/contact_us.html">Contact Us</a></li>
  132.       <li><a href="/links.html">Links</a></li>
  133.     </ul>
  134.   </div>
  135.   <div align="center" id="log-in">
  136.  
  137.     <div align="right">
  138. <table width="228" border="0" cellpadding="0" id="logtable">
  139.           <tr>
  140.             <td height="68" colspan="2" bordercolor="#FFFFFF" id="form2"><span class="style12">
  141.               <label></label>
  142.                           </span>
  143.               <span class="style12"></span>
  144.               <label> </label>
  145.               <div align="center">
  146.                 <p><span class="style13">Logged In</span><br />
  147.                   <a href="<?php echo $logoutAction ?>" class="style12">Log out</a></p>
  148.             </div></td>
  149.           </tr>
  150.       </table>
  151.     </div>
  152.   </div>
  153.   <div id="body">
  154.  
  155.     <h2 align="right"><span class="style2">TRACKING &amp; REPORTS<br />
  156.       <br />
  157.     </span></h2>
  158.     <?php if ($totalRows_username > 0) { // Show if recordset not empty ?>
  159.       <?php } // Show if recordset not empty ?>
  160. <div id="customername">
  161.         <div align="center">
  162.           <h3><?php echo $row_username['menu_name']; ?></h3>
  163.         </div>
  164.     </div>
  165.  
  166.  
  167.  
  168.     <h3 align="center"><br />
  169.     <span class="style13"><em>CUSTOMER ACCOUNT FILES</em></span></h3>
  170.  
  171.     <?php if ($totalRows_Recordset1 > 0) { // Show if recordset not empty ?>
  172.       <div id="files"><?php echo $row_Recordset1['clientid']; ?></div>
  173.       <?php } // Show if recordset not empty ?>
  174. <p align="center">&nbsp;</p>
  175.   </div>
  176.  
  177.   <div id="footer"><div id="nav">
  178.  
  179.     <ul>
  180.       <li><a href="/index.html">Home</a></li>
  181.       <li><a href="/about_us.html">About Us</a></li>
  182.       <li><a href="/delivery_services.html">Services</a></li>
  183.       <li><a href="/on_line_order.html">Place Order</a></li>
  184.       <li><a href="adminlogin.php">Tracking/Reports</a></li>
  185.       <li><a href="/contact_us.html">Contact Us</a></li>
  186.       <li><a href="/links.html">Links</a></li>
  187.     </ul>
  188.   </div>
  189.     <!--end of the footer div -->
  190.   </div>
  191.   <h4 align="center"><em><span class="style1">A-LINE MESSENGER SERVICE </span></em><span class="style3">- 2 - DELIVER - 4 - YOU</span><em>!</em></h4>
  192. </div>
  193. <!--this is the close of the container div--></body>
  194. <?php
  195. mysql_free_result($username);
  196.  
  197. mysql_free_result($Recordset1);
  198. ?>
Jul 16 '08 #1
2 2764
dlite922
1,584 Expert 1GB
Welcome to Bytes,

Looking at this, you need major help; More help than we can give you in a forum like these. By the looks of your variables all starting with $MM_, you're using Dreamweaver-built code, its not hand written?

Look here, First get up to date with PHP5, we don't use HTTP_VARS anymore.

Second, take some tutorials and design test applications and look into code modularity. Code modularity is taking the problem/requirement and dividing it into specific functions.

See: MVC.

Generally here's how your pages should be laid out.

You have a xxx.php file, this is what gets called in the browser.

This file will include a general file such as config.inc that contains site_wide global variables. (database login etc)

This page takes the role of the conductor of an extra. It tells it what to do based on it.

Create another class (yes learn about OOP early) called the controller, such as loginController.php which contains the functions (the actions) you need for the login.php file. If your using a database, it helps to create a database class that handles all your querying, inserting, and other actions for the controller class like a middle man.

After you are done, with the logic and want to display something, put your content into variables and include() an HTML file.

The HTML file should NOT contain any logic except simple echo print commands and if statements and for loops.

Its also best to use a templating system like Smarty. (I assume you'll Google all terms here that you don't understand)

When you come back with more specific question like why isn't something working, we can help you. But we cannot rewrite the entire script for you.

Remember: Learning without thought is labor lost.



Dan
Jul 17 '08 #2
Welcome to Bytes,

Looking at this, you need major help; More help than we can give you in a forum like these. By the looks of your variables all starting with $MM_, you're using Dreamweaver-built code, its not hand written?

Look here, First get up to date with PHP5, we don't use HTTP_VARS anymore.

Second, take some tutorials and design test applications and look into code modularity. Code modularity is taking the problem/requirement and dividing it into specific functions.

See: MVC.

Generally here's how your pages should be laid out.

You have a xxx.php file, this is what gets called in the browser.

This file will include a general file such as config.inc that contains site_wide global variables. (database login etc)

This page takes the role of the conductor of an extra. It tells it what to do based on it.

Create another class (yes learn about OOP early) called the controller, such as loginController.php which contains the functions (the actions) you need for the login.php file. If your using a database, it helps to create a database class that handles all your querying, inserting, and other actions for the controller class like a middle man.

After you are done, with the logic and want to display something, put your content into variables and include() an HTML file.

The HTML file should NOT contain any logic except simple echo print commands and if statements and for loops.

Its also best to use a templating system like Smarty. (I assume you'll Google all terms here that you don't understand)

When you come back with more specific question like why isn't something working, we can help you. But we cannot rewrite the entire script for you.

Remember: Learning without thought is labor lost.



Dan
I understand. I love to learn so when someone points me in the correct direction of where to find the information I need, that is great. I'm taking as
much suggestion right now as possible. Thank you for your response.
Jul 17 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Lauren Quantrell | last post by:
Is there a way to create a text file (such as a Windows Notepad file) by using a trigger on a table? What I want to do is to send a row of information to a table where the table: tblFileData has...
3
by: eastcoastguyz | last post by:
On an Apache server, I want to be able to have a user name/password directory. I know this can be done with .htaccess, but I want to be able to do this for multiple users. The purpose of this, is...
15
by: joun | last post by:
Hi all, i want to create in my asp.net application a custom server variable, so i can retrieve later in other pages (even asp or perl) with request.servervariables("HTTP_mycustomvariable") ...
3
by: fred00 | last post by:
I have been searching for information relating to what I want to do, and I am assuming it is not a common issue. I have developed a web service and a client for a customer. I need to give the...
4
by: anders | last post by:
Hi! To create a new Windows account I use this code: const int UF_PASSWD_CANT_CHANGE = 0x0040; const int UF_DONT_EXPIRE_PASSWD = 0x10000; DirectoryEntry obDirEntry = new...
2
by: NRakhesh | last post by:
I have to submit a project as a part of my final year project. I consulted various domains and finally decided to implement a work on delevoping a system for transcription work based company. ...
0
by: Niyazi | last post by:
Hi, I created application that store the data in SQL SERVER that reside on network. The client also use this application to access the resources provided with application. But is the client want...
2
by: Canice | last post by:
I'm working on a web application where 90% of it is common 'product' code an the other 10% is customer specific. I want some method of separating the customer specific presentation, business and...
0
by: henry | last post by:
Folks: Thank you all for your replies. I'll reply briefly to each key point: Thanks! You are probably correct. I wanted to be aware of other options, that's all. Part of what got me in...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.