Jump to content

langenf

Members
  • Posts

    24
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

langenf's Achievements

Member

Member (2/5)

0

Reputation

  1. Are you sure? i think so. just the theory behind it, seperation of concerns of data(model), view(what user sees) and controller(logic)
  2. I have been procedurally programming, decided to learn ZF as it would be useful for large projects (and good for my resume). I read the theory behind design patterns in general and MVC in particular and understood it. But I do not understand the stuff in the zend website their quickstart does not help either. Please note that im learning ZF inorder to increase my prospects, others such as cakephp or symphony is not that used where i live so iam stuck with ZF. Please say what I need to learn to actually understand zend framework.
  3. sorry for the typo, it is actually yearafter. It still doesn't work i don't know why
  4. Iam attempting to display a prompt to the users. users have to see how many days left till they complete 1 year of membership, so that they can subscribe again.$tiArray['joiningDate'] looks id from the database and looks like an unixtimestamp. Code gives bizzare values. Please say why? $ayearafter=(365 * 24 * 60 * 60)+$tiArray['joiningDate']; echo floor (($yearafter-$tiArray['JoiningDate'])/( 60 * 60 * 24) ),"days left till completion of 1 year","<br>";
  5. Please let me introduce my weakness right away. I suck in database design since im largely a self learned coder. They have given me a couple of pages and asked me to program them. The most important among them is a form used to enter information http://img402.imageshack.us/img402/2549/screenshoton.jpg Industry in question is tourism. The table called user master has login information choosing and username, password , email (a different one shown in this screenshot). Kindly note that i have not included tables similar to Destinations ( country, businesscode,segment and jobarea) in this ERD. Kindly give me a few suggestions. I am willing to completely redesign this database if this design is too bad. Please have a look at http://img694.imageshack.us/img694/2725/erd.gif
  6. Im asked to customize a commercial application. Let us say that there are 4 types of users. 2 users are similar, one of them is paid and therefore can save more information, more photos etc. All 4 users have common information such as firstname, lastname etc. Data is stored across several tables, i will have to add a few more fields though. After they login, users may edit or enter their information. Free users have only 2 HTML tables : Contact Information with photo and about me. Each HTML page is arranged side by side and submit button is on the bottom. paid users have 4 or more HTML tables, each catering to specific section of information. I dont know whether it is easier to make just one php page with and then post back to the same page to save stuff in the database or make 4 different php pages, each for different type of user. Or i dont know if i have to make 8 pages, 4 for front end and 4 its backend. If just one page is enugh for the task, i dont know if(user==paid3){code for HTMLtable3} or if(user==paid3){include_once(HTMLtable3.php)} is better. Please suggest me how I go about this task.
  7. sorry, i dont understand. you mean ("Location:http:/server/app/index.php?mesagge=$mesagge") like this?
  8. I dont want to use absolute path since relative paths are usually better. If it cannot be done with relative path, im willing to use absolute paths though
  9. hi, im making an app that needs users to be logged in inorder to use it. The file structure of the app is like this. root /app //includes includes is in tha app folder which is in the root. includes folder has a file that login_check and moves the redirects the to app/index.php when the user is not logged in like this header("Location:../index.php?mesagge=$mesagge"). It works as expected within the application. Say for example when the user clicks the logout button or when user enters a wrong password trying to login . But when i try to access a file in the app folder say app/show_articles.php without logging in, it redirects the user to root folder index.php. Can you please say what is wrong here?
  10. Hi, This web app would have two types of logins (admin and user) and I check if either of them are logged in all pages. The login_check file is on includes and redirects user/admin to index.php when they are not logged in. all pages show a session error. It says trying destroy uninitialized session altho login_check file has session_start(). can you say what is wrong here?. <?php session_start(); if(isset($_GET['logout'])){ //echo "logout"; session_destroy(); setcookie("username", "", time()-3600); $mesg='logged out'; $mesg=urlencode($mesg); header("Location:../index.php?msg=$mesg"); } if (isset($_SESSION['admin_loggedin'])){ if (!($_SESSION['admin_loggedin']=="yes_loggedin")){ log_out(); } }else{ log_out(); } if (isset($_SESSION['user_loggedin'])){ if (!($_SESSION['user_loggedin']=="yes_loggedin")){ log_out(); } }else{ log_out(); } if (isset($_GET["logout"])){ log_out(); } function log_out(){ session_destroy(); //it shows the error Warning: session_destroy() [function.session-destroy]: Trying to destroy uninitialized session in" //header("Location:../approot/index.php?msg=login to continue"); $mesg='login to continue'; $mesg=urlencode($mesg); //header("Location:../approot/index.php?msg=$mesg"); } ?>
  11. hi mjdamato, thanks you very much. I have to admit its an application that deals with software licences so I wanted to say purchase to in order to be secretive. To spill the beans, there 3 tables clients, licences and (software)products. The page displays information about the client such as name, client number and licences purchased. license table has licenseid, clientid , productid etc. each client may purchase licenses for several products. Apparently , the client buys only one license for a particular product. You are right,the table design could be wrong... The query you suggested repeats the client information for every licence. please allow me to draw a small illustration that shows you how the page would look like client name client number Email / URL licences edit information ------------------------------------------------------------------------------------------------ client1 2342 client@company.com licence1,productname etc edit licence2,productname etc client2 62677 client2@company2.com licence1,productname etc edit as you can see, the information for client1 here is not repeated eventhough he has purchased 2 licences. Please say how to achieve this?
  12. Hi, let us say that there are 3 tables clients, purchase, products. The page displays the information about the client such as name, client number and products purchased (if any) and also links to edit or delete client information. purchase table has purchaseid, clientid , productid etc. I try to display all clients that are there along with the purchases they have made with a query like SELECT * FROM clients, purchase where clients.clientid = products.clientid innerjoin (select * from products where productid=purchase.productid) please say where the query is wrong.
  13. Thanks for your lightning fast answer . Its going exactly where its supposed to, however it looks like this and the message is not displayed... http://localhost/app/index.php?message=urlencode(%27Login%20to%20continue%27)
  14. hi, i have a file in app \scripts folder that checks if the user is logged and if not redirects the user to the index.php in the app folder. header("Location:../index.php?message=login to continue"); but it goes to the the topmost area(root). im using windows and the app folder is in the root. sorry for asking this here, but i cant understand why it isnt working.
  15. thanks for the illustration. The forms would be generated based on the database table. can you please say how to make a drop downmenu based on the enum values in the mysql table? <?php include('db2.php'); class form { public $input_name,$input_type,$form_name,$input_title,$form_title,$form_elements,$action, $form_elements_array; public function __construct($form_title, $form_name, $action, $form_elements_array){ $this->form_title = $form_title; $this->form_name = $form_name; $this->action = $action; $this->form_elements_array = $form_elements_array; } function make_form(){ echo "<form name=$this->form_name action=$this->action>\n"; echo "<table><tr><td><h3>$this->form_title</h3></td></tr>\n"; foreach($this->form_elements_array as $key=>$val){ $element=$val."_form"; if(stristr($key,"id")){ echo "<tr><td>id: </td><td>$key</td></tr>\n"; } else{ if(stristr($val,"enum")) { echo "<tr><td>$key</td><td><select name=$val></select></td></tr>\n"; } else{ echo "<tr><td>$key</td><td><input name=$val></td></tr>\n"; } } } echo "<tr><td colspan=2><input type='submit'></td></tr>\n"; echo "</table></form>\n"; } } //usage after connecting to database $query = "describe testtable"; $result = $myDB->query($query); if($result) { //while($row = mysql_fetch_assoc($result)) while($row =mysql_fetch_array($result, MYSQL_NUM)) { echo "#{$row[0]} {$row[1]}#<br />"; $fields_array[$row[0]] = $row[1];//associative array with field as key and datatype as member } //$row =mysql_fetch_array($result, MYSQL_NUM); } else { die("norecords from database <br />"); } global $str; echo $str; //end usage $f= new form("enter client information:","form_cl","somewhere.php",$fields_array); $f->make_form(); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.