Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. You are looking at it in the wrong way, everyone by the way. You keep your files on your development server (laptop, desktop) and before you upload it to your production server you would pass it through an obfuscater (or some other program that will remove everything like spaces, newlines and tabs) and put it in some temporary directory and start to upload it. Your files with the nice newlines, spaces and tabs is kept on your development machine and all obfuscated code is put on the production server.
  2. What do you mean by Title,Year -> Genre,Director Director -> DirectorAddress I understand that bar.png is better this is how I would create it.
  3. $step = isset($_GET['step']) ? (int) $_GET['step'] : 1; if (1 === $step) { //code for step #1 //store data in $_SESSION } else if (2 === $step) { //code for step #2 // } In your form you could use: <input type="hidden" name="step" value="1">
  4. You are not guaranteed any normalization form just because you've made an E/R-diagram. How do you mean: 1) The person creating the ERD has a limited knowledge of database design and can therefor not create a normalized ERD? 2) or, the person creating the ERD has sufficient knowledge in database design, but due to not using Codd's method ends up with an ERD of which he only thinks is normalized? If 2, then yeah I have been thinking about that, it always turned out right (sort of). They taught us in college it this way and told us that we should favor it over Codd's method. Like most of the times they give no reason as to why, just that we must. Most students (like myself back then) are naive and ignorant, and asking for motive is (de facto) verboten. 2 years later and I haven't looked it back up, care to share some insights?
  5. I concur, I love your homepage! Although I would replace the submit button with the green button and the functionality of the now green button would I put somewhere else as people will probably want to add houses, hotels, restaurants without knowing they would first have to go through the tabs to be able to. I would add more spacing to the rest of the website as it shows a lot of information. Also use thumbnails for your images, they come in very slow now.
  6. andrew you are getting sloppy change function getAvailableRobeSize($robeType) to function getAvailableRobeSize($robeType, $db) call it like: $robeAvail = $robe->getAvailableRobeSize($stfAry['ROBE_TYPE'], $db);
  7. Don't forget MrAdam Ha, thank you ignace. Credit is due where credit is due, we all have helped so if she's to name names she might as well mention everyone.
  8. Just by reading your question I can think of multiple ways to achieve this, but your best bet would go to: plan (id, name, maximum_uploads) -- convention: 0 is unlimited member (id, username, password, ..) member_plan (member_id, plan_id, date_purchased, length_in_months) SELECT .. FROM table WHERE date_add(date_purchased, INTERVAL length_in_months MONTH) > now()
  9. No they are 2 different methods either you use the ERD or you use the Codd method don't mix them. And the Codd method is actually a bit harder then your 3-5 steps, see Objectives of Normalization. You create a bridge-table that has a foreign key for both tables primary keys.
  10. <body onload="document.getElementById('username').focus()">
  11. Your Database class is an improvement over the last you posted, but still can be made better. Add the access modifier public to any methods you wish to use in the main program and mark all others private. In the future it's possible you want to extend your Database class, but extending your Database class and overwriting it's behavior makes all that private stuff obsolete and makes for overhead as you can't access it from the child class. To avoid this we create an interface with the behavior we expect (the function's you call in your main program). If we take another great look at your Database class we notice it actually performs 3 tasks: 1) connect to a database 2) handle results 3) handle queries The Single-Responsibility Principle states that every class should have only one reason to change. Therefor we divide your big Database class into: MySQL Interface ------------------------- MysqlQuery -- handles select/insert/update/delete queries or MysqlQueryBuilder objects, returns MysqlResult MysqlResult -- returned by a MysqlQuery object, performs operations on a result (handles num_rows & affected_rows in a universal way) MysqlConnect -- connects to the database [MysqlQueryBuilder -- creates select/insert/update/delete queries, implements __toString()] This is specific to MySQL you can extend it or modify it to make it more universal. Usage: $con = new MysqlConnect('mysql://ignace:password@localhost:3601/database'); //creates mysql_connect($host, $username, $password, true/*$new_link*/) $q = new MysqlQuery('SELECT * FROM table', $con); $r = $q->execute(/*$query = null*/); print $r->getRowCount(); while ($row = $r->fetchRow(/*$mode = MYSQL_ASSOC*/)) { print_r($row); } $con2 = new MysqlConnect('mysql://ignace:password2@localhost:3602/database2'); $sql = new MysqlQueryBuilder(); $r = $q->execute($sql->insert($data)->into('table')); print $r->getRowCount();//num_rows & affected_rows universal accessor
  12. 1, I noticed when I was entering my password it was no longer obscured by asterisks. My bad, change type="text" to type="password" 2, I made the change you suggested <input type="submit" name="submit" value="Login"> I am guessing it's due to if (0 === mysql_num_rows($result)) { header('Location: ../../index.php'); exit(0); } And that's due to: $login = mysql_real_escape_string($_POST['login'], $db); Which should have been: $login = mysql_real_escape_string($_POST['username'], $db);
  13. I'm confused. How are you using the output of time() as a salt? It always changes so you wouldn't be able to confirm a user later. This just serves as an example of course I would create the salt and store it in the database, afterwards when a user logs in I used the stored salt append it to the sha1 of his password and then sha1 the entire thing (sha1 of password and salt). So the best would be to use: sha1('My91PaSsWoRD' . 'chocolate') instead of sha1(sha1('My91PaSsWoRD') . sha1('chocolate'))? I used the latter because I thought that because the input for the sha1 was more then 40 characters it would become extremely difficult to "decrypt" it.
  14. define("COOKIE_EXPIRE", 60 * 60 * 24 * 60); No matter how many times you calculate 60 * 60 * 24 * 60 the result will always be 5184000, so write it! Instead of needlessly calculating it on each new request. Drop the use of var instead use the proper access modifiers like private. Don't interweave PHP with HTML, don't return HTML from functions/methods, don't allow functions to output to screen. Typo if (trim($sql != "")) will result in if (trim(true)) you quite possibly want if (trim($sql) != '') The class looks good overall probably due to the earlier example you had a look at.
  15. i am asking this as a developer............how i can trouble shoot this problem.???? And? You want a special treatment? And the instructions are quit clear: So, my advice still stands. Wait. Or do you want us to show you illegal ways of obtaining that file?
  16. Modify <input type="submit" value="Login"> to <input type="submit" name="submit" value="Login"> and your script works again.
  17. Wrong, you don't call Controllers for data but your Models. Your Controller only ties together your Model & View
  18. You must note that the above code will fail when someone tries to register with an already existing e-mail address. MySQL returns a specific error code for this, figure it out and act accordingly otherwise people will just see: "Could not register because " and that makes little to no sense to them. How would I go about figuring out how to give one response to the already registered error and then a different one for any other errors? MySQL returns specific error codes for these.
  19. <html> <head> <meta http-equiv="Content-Language" content="en-us"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Concierge</title> <style type="text/css"> #blue-box { position: relative; width: 384px; height: 357px; margin: 0 auto; background-image: url(http://www.onina.net/concierge/graphics/concierge_auth.jpg); color: #FFF; font-family: Helvetica, Arial, Verdana, sans-serif; } form { position: absolute; top: 50%; left: 50%; margin-top: -75px; margin-left: -100px; width: 200px; height: 150px; } form label { font-weight: bold; } </style> <!--[if IE]><style type="text/css">body { text-align: center; } #blue-box { text-align: left; }</style><![endif]--> </head> <body> <div id="blue-box"> <form action="http://www.onina.net/concierge/scripts/authenticate/auth.php" method="POST"> <div> <label for="username">Username</label> <input type="text" id="username" name="username"> </div> <div> <label for="password">Password</label> <input type="text" id="password" name="password"> </div> <input type="submit" value="Login"> </form> </div> <div style="text-align:center">Concierge system powered by <a href="#">Onina</a></div> </body> </html> What code goes behind auth.php?
  20. I am no WP guru so I am not aware of the inner-workings of WP. But you have a few options: 1) Write some code that will pull the data from the database, this is not the best approach as you now have sql credentials stored in 2 places. 2) Include the required WP binaries and request the data through the WP API 3) Integrate your website in to WP (as a template) write custom modules to match what you want.
  21. That will take a long time! Do you use Firefox? And do you have Firebug installed? If not go to Extra > Add-Ons search for Firebug and install it and restart Firefox. Once Firefox starts again and opens your previous tabs press F12 on your page, click on the arrow on the left-top (next to the bug) move over your page with your mouse (blue borders will appear) to where your text should come, the styles rules for that area appear in the box on the right, click and scroll through it, double-click on a value to change it.
  22. http://www.php.net/manual/en/tokens.php Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home2/whatsong/public_html/test.php on line 246 makes me believe you tried: <?php echo "<a href="userstats.php?User=<?php echo ($_COOKIE ['Username']) ?>"><?php echo ($_COOKIE['Username']) ?></a>" ?> Edit: remove the space after $_COOKIE
×
×
  • 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.