Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. As an idea, we could have an interesting discussion, but the fact is, that is not supported.
  2. There is no way to provide you what you are asking for, because their is no way given the information you provided for someone to know what requests are intended for a particular manager. In fact it seems that the request table is missing a key column which would be the requestor_id, as well. All that table can seem to tell us at the moment is that "someone" made a request for a player, for a particular fixture, and that request has been accepted (or not). If that's a (1 for yes, 0 for no) then that design is also deficient, as you would want a state to indicate that the request is "pending" and has not yet been accepted or refused. You could use null for that state, but I think that's poor practice, and would typically have a scheme that involved something like: 0 = Pending (default), 1 = "Rejected", 2 = "Accepted".
  3. Yes, SSL is an entirely different protocol than HTTP, and you absolutely must configure your HTTPS site as a seperate vhost. The webroot can be the same between the sites, but they are completely different hosts and share nothing between them in terms of cookies, state etc. You can not have one vhost that supports both protocols.
  4. That is a user generated event! Is it your design that you change an input, and then the user has to visit some other input, using some non-intuitive unconnected key to get the behavior you are looking for? I'd hate to be the user of your application, stumbling around pressing keys on random inputs hoping that something will work correctly..... My advice to you is to use firebug and debug your code, if you're not clear on why something doesn't work.
  5. If I understand you, the doz function recalculates based on the values of other inputs, and like a spreadsheet you want these calculations to cascade. Events fire based on user actions. There is no event that fires when the value of an input changes. What you should do, is call your doz function in your other event handlers, so that your summarization function runs.
  6. Well if you are asking why the session code doesn't work, it is because this is not a .php script, it's .htm.
  7. If you use pdo or mysqli with bind variables, there is no need to worry about SQL injection. With pdo::prepare as an example, you eliminate the need to escape data AND eliminate sql injection concerns. I highly recommend that approach. In terms of the other things you have, typically they are of concern with form processing, and many frameworks provide form building classes which let you specify validation routines that bake in security, as well as additional user defined validation rules. So strictly speaking, this would not be code in either the controller or the model but in a form handling class. Take a look at symfony2 and zend framework for some examples of how more sophisticated frameworks approach the problem. Last but not least, XSS is something that can be neutralized in the way content is displayed. Frameworks that have templating in support of the view layer, can cook data when injecting it into the view, to insure that no active XSS is rendered.
  8. Oh yeah, great point Barand. The default mysql storage engine "myisam" simply ignores any constraints in your DDL. Myisam doesn't support referential integrity, nor transactions. If your tables are myisam that could explain why you don't have an option to set constraints in phpMyAdmin.
  9. Ok, so you need to write DDL for the tables. You need to figure out the MySQL datatypes you need. -For name and nickname, this would be varchar(#) where # is the maximum number of characters you'll need. -For djdesc this could be either varchar() or text. Which you choose depends on the amount of text you'll be storing. Typically people use text for reasons I won't go into, but if you will only allow a few paragraphs of text, you might want to use a varchar(2048) and can go as far as 64k characters, but that hits up against the size limit of a single row. -djpicture should probably also be a varchar. It is possible to store the actual image data inside the database, but typically people do not do that, and instead store the path to the image file, and store it on their server in a specific location. -djshowpicture, I assume is a flag that indicates if the picture should be shown? If so, use a tinyint. For shifts, it would help if you could elaborate on what the system is trying to do. For example, if you are going to use this as the basis for a scheduling application, you might be much better off using mysql datetime columns and having shifts be: id integer presenter_id integer from datetime to datetime To actually create a table, you simply issue a CREATE TABLE command. There are plenty of references and tutorials how to do this, but you'd want something for the presenters table like: CREATE TABLE presenter ( id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, djname VARCHAR(80), djnickname VARCHAR(40), djdesc TEXT, djpicture VARCHAR(128), djshowpicture TINYINT UNSIGNED DEFAULT 1, CONSTRAINT PK_presenter PRIMARY KEY (id) ) engine=innodb; This should help you get started. Google for "mysql create table" for more detail.
  10. Did you try and add the constraint using ALTER TABLE ADD CONSTRAINT.....
  11. You seem to misunderstand what the word specific means. Pasting a form with a few random session variables in it, is not going to help anyone answer your question. The fact that you pasted the same code TWICE for no reason, is annoying. Please don't do it again. We have code and php tags you can use, to make your code snippets easier to read. Bottom line: you need to break this down into small pieces with questions that people can answer for you. We answer questions to help people learn and develop code. We don't write the code for you.
  12. Do you have a specific question?
  13. You are on the right track. What many people do is store a "slug" in the database as an alternative to using the id. If you do some googling on "sluggable" and "slug" you'll find material on it. For the most part, you want to have it be a database call and not something you lookup, however, often people will use something like your friendly url, and just add on the id at the end of the slug. So your category #20 might be "Clothes for him" and your url would be: .../category/clothes_for_him_20/04-2012 And your code simply needs to strip off the digits after the last '_' in the string. As for your rewrite rules... almost there, but you of course need to have one for each pattern you want to match, so rather than have a completely generic one you have one for /category, /browse and /model. For example the category rule (assuming you use a slug instead of an id) might be: RewriteRule ^/category/([a-zA-z0-9_-]+)/(.*)$ category.php?cat=$1&collection=$2
  14. This will be a lot more doable if you rewrite to: 1. CATEGORIES - http://daytona.bg/category/for-him/04-2012 2. PRODUCTS - http://daytona.bg/browse/men-shirts/04-2012 3. PRODUCT - http://daytona.bg/model/men-lastic-shirt-silk-ysl-1286 There are actually 2 problems you have to deal with: 1. Rewriting the url to parameters 2. Adding the capability of your script to accept a slug, and lookup the proper id's in the database. #2 has nothing to do with rewriting, and rewriting will not help you with that problem. If your script is designed only to take a category id, then you have to add code to instead take a string, and lookup the category using that string rather than the id number.
  15. That is because your WHERE clause in the outer query is restricing them: WHERE Continent = 'Europe'
  16. Yes they can. You have a syntax issue. As best as I can tell, all you really want in the subquery is: SELECT * FROM CountryLanguage WHERE Language = 'Spanish'
  17. There is no "best web hosting company". There are many web hosting companies out there to choose from, and the choice you make is highly dependent on your hosting requirements and budget. For example, if your application requires a lot of diskspace but very little cpu and memory then that is going to drive you towards different providers than if it's a cpu intensive application. I don't know of any hosting company that prevents you from running a cron job every 5 minutes. Speaking generally, there is shared hosting, virtual hosting and dedicated hosting. They all have different use cases. In the last few years most of my work has been with virtual hosts either on Amazon AWS or Linode. While I don't need CPanel (worth an entire thread in its own right) you can always license it directly from the company that makes it, although there are FOSS alternatives out there like Openpanel or webmin which might be acceptable.
  18. Well, let me try this a different way... You need to put in some debugging statements to figure out what values you have at certain points in your code. What debugging would be helpful, at what places?
  19. Well it seems pretty clear that it couldn't load that dll. Does it exist on the file system in the location specified?
  20. In this type of setup all you need to do to connect to mysql is provide the host of 'localhost'. This worked, as shown in your script. MySQL does listen on a well known port, but that is nothing you need to be concerned about. Don't confuse the php script connecting to the mysql database with a web application like phpmyadmin. Web apps listen on port 80 by default, but in setups like this, they use a different port for administration web applications, just to keep things simple for people. Phpmyadmin is nothing other than a php script that connects to mysql in the same way your php script connects to it. Now let's focus on what your mistake was.... //connect to mysql database server mysql_connect($db_host, $db_user, $db_pass) or die (mysql_error()); echo "Successfully connected to MySQL Database! "; //Select Database mysql_select_db($db_naam) or die (mysql_error()); Notice that your code told you it connected fine. It was on the mysql_select_db call that you got an error. Hmm, let's look at your variables: $db_name = "projecteasywebsite"; And you tried to select the database with this: mysql_select_db($db_naam) or die (mysql_error()); See the problem with the database name variable?
  21. Chris, I'm confused how that could be, since you're using a bunch of constants and arithmetic that explain the behavior you are complaining about. Let's just focus on this: $Start = (($this->CurPage - 2) >= 1 ? $this->CurPage - 2 : 1); Substitute '5' for $this->CurPage, and it's clear that you set $Start to '3'.
  22. The php code you have pasted is not valid. You have a start block and a broken loop that is in the wrong place, so it's no wonder that you're not getting results. In order to get people to help you, you really need to try and ask better questions, and provide more information about what is wrong. I did nothing here other than correct your screwed up blocks and formatting. It's important to indent your blocks so that it's clear to anyone looking at your code how the flow of control works. $multipleOrders = 0; $linuxCopies = 0; $macintoshCopies = 0; $windowsCopies = 0; $orderFile = fopen("ordersBoles.txt", "r"); $nextOrder = fgets ($orderFile); while (!feof($orderFile)) { list($os,$copies) = split (":", $nextOrder); if ($os == "Linux") { $linuxCopies = $copies + 1; } if ($os == "Macintosh") { $macintoshCopies = $copies +1; } if ($os == "Windows" ) { $windowsCopies = $copies + 1; } if ($os == "Multiple") { $multipleCopies = $copies + 1; } $nextOrder = fgets ($orderFile); } fclose($orderFile); print ("SOFTWARE ORDERS: REPORT"); print (" ORDERS FOR MULTIPLE COPIES: $multipleOrders"); print (" LINUX COPIES ORDERED: $linuxCopies"); print (" MACINTOSH COPIES ORDERED: $macintoshCopies"); print (" WINDOWS COPIES ORDERED: $windowsCopies"); ?>
  23. Tutorials are tutorials. If you're happy with the one you're learning from, then keep going. No one tutorials is going to teach you to be a professional level php developer. Like all things it's a process.
×
×
  • 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.