Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. That information comes from the webserver and operating system. I see no issues there, although you didn't provide much information about the nature of the application or why you are using the web server name as a database key.
  2. Just because you are using javascript, doesn't mean that it will change the basic ways that form elements work when a form is posted. Although you didn't include a crucial piece of the javascript code (addOption) I'm assuming it looks like this: function addOption(selectbox,text,value ) { var optn = document.createElement("OPTION"); optn.text = text; optn.value = value; selectbox.options.add(optn); } If so, then the value property should be getting set, and when the form is Posted, the appropriate select should have its value set. You can easily enumerate the values of the $_POST superglob using print_r() to test this and clarify everything to your own satisfaction.
  3. In repairItems, add a column named parentRepairId. When an item is being returned a second time, your app should have a function that the user can activate to indicate this. Then it's a simple matter of either filling the column with zero (has no previous Repair) or the repairID of the previous repair. This will allow you to establish the hierarchy of repairs on the item.
  4. First things first, you should check to see if your database connection was successful. Your code assumes it is, but that could be an erroneous assumption. Ditto, with your database select.
  5. Well just off the top of my head, you attempt to connect to a database and assume that is successful. At no time do you actually check a result, to insure that things actually worked. This is not a good approach, and can often result in problems.
  6. I think the site is pretty good, but there are a couple of issues I think you need to consider. 1st, the size of what is essentially a header block (The coffee cup) is way too big. What this block does in each page, is essentially nothing different from a header, and yet it takes up almost the entire above the fold area. As for the coffee cup image itself, while it's not horrible, it does beg the question: what are you selling? Does a coffee cup somehow universally denote "great web design?" 2nd, you use strong lines to separate your sections, and it's well known that this subliminally indicates that the content is separate and complete. This is again going to discourage users from scrolling to see your content. You could probably come up with a way of breaking that seperation as you did at the top with the breakout corners on each side of the Header.
  7. I would personally suggest you just lose this sentence: "Statistics demand I have 15 seconds to get your attention or you will lose interest and move on. I have decided not to waste your time with a reworded version of the same sales pitch you find throughout the web." I realize you are trying to be clever, but the way its phrased doesn't work. For example, "Statistics" is an area of mathematics, and as such, isn't capable of demanding anything. The main point in this regard, is that you're approaching things as if someone by accident is going to stumble upon your site, and it's your job to try and sell them on your skills as a web design and hosting provider. Instead, I think you're better served focusing on providing the facts about your services and portfolio in a clean matter of fact manner.
  8. I really don't see anything obvious, but I also feel like I don't have the full picture. When you have routines in play that are manipulating large nested arrays, and are populating these from queries, just a small mistake is certainly enough to throw your results off. As I said earlier in the thread, I can only suggest you question your assumptions. I also noted, that print_r will effect the results of arrays that you are stepping through in a loop. I don't know if you have xdebug installed, but you might find it helps you out in exploring the problem further.
  9. You had one example where you were using short tags ie. = rather than <?php as the start tag. This is a configurable item. Probably the host had it disabled. It's not a recommended setting to have on regardless. Otherwise, not my comment about putting arrays inside the {}, which will allow you to specify the single quotes around the array index name.
  10. Group by is before. Also these queries will display a number, but nothing else. If you actually want to see a name, you need it in the result set. Something like this: SELECT fname, lname, count(*) as countOf FROM titles WHERE fname = '$fname' AND lname = '$lname' GROUP BY fname, lname ORDER BY countOf DESC LIMIT 0, 10
  11. If you're attempting to access the value of an array inside an interpolated string, and you want to specify the array index as a string literal, then you can do this using curly brackets. For example: echo "{anArray['something']}"; Also, on your short tag version, it's not being interpreted as being PHP. Try using <?php echo ... ?>.
  12. Yes -- because if they weren't there, then your code wouldn't work anymore. As you stated, it's all about making them friendly for search engines, so you want those to be published. The other thing you want to do once you have this working, is make sure that your internal url's specify the pretty url format you now have working. Needless to say, search engines spider your site and derive url's from your own pages, so you don't want them to be showing the old/internal format anymore.
  13. Wow and your a mod? Its called a help section for a reason, I said I need to know how to do it so either help me or stay off my thread or give an idea/link to what I should do ... Here you go: This is a link to a tutorial series I wrote some years ago. http://www.gizmola.com/blog/index.php?serendipity[subpage]=downloads&level=1&thiscat=6 Skip through until you get to the part that shows you how to write your post script. It also shows how to get the data back out again, specifying an ID. There's also a zip with source code.
  14. Your RewriteRule doesn't match what you're trying to do for several reasons. You need to do some reading about regular expression syntax, which is what the rewrite rules require. This is closer, but I can't make any guarantees: RewriteRule ^postcode/([^/\.]+)/?$ postcode.php?postcode=$1&postcodesearch=Submit [L]
  15. What's your mod rewrite rules look like right now?
  16. There is about 1 million tutorials on how to do php/msyql development, not to mention books. How about putting in a bit of effort -- it seems you have a pretty good understanding of what you want.
  17. I'm part of a coop, so in essence we have our own hosting company. There is quite a lot to it. Basically you need: -A colocation facility (or several) -A contract for some amount of rack space + power -A contract for bandwidth -A router/firewall (although you may be able to use the ones provided by the colo company) -Server(s) -Software to handle signup/billing/support -Software to handle server setup -Software to provide client's the ability to configure their servers (WHM/Cpanel typically if *nix) -(Probably) an agreement with some DNS provider allowing you subcontract Domain registration and maintenance -If offering VPS, you need VPS software like Virtuozzo The market is highly saturated at the the low end, and you aren't going to compete at the high end without at minmum multiple hundreds of thousands of dollars of investment, not to mention salaries for the staff of sysadmins/techs you'll need. Remember -- you asked
  18. That would create an infinite loop, in the case that cookies are not set, unless you also include a get param that you check. To redirect is no different than any other type of redirect -- you have the http header location method or a meta refresh. As for getting the current page, there's the really helpful $_SERVER['PHP_SELF'].
  19. No, as I just explained, the most common way people get exploited is via script kiddies who are exploiting a vulnerability in a particular package. When you have custom software, that requires someone to really do a lot of testing on an app where they don't have the source code. They can try some things, but they're just guessing. Compare that with something like phpBB. There's are tens of thousands of sites running phpBB, so if someone finds an exploit in it, and puts it into an exploit script, they can easily use google to identify a long list of potential victims and then let their bot just run through those, letting the exploit kit do the work. There's absolutely no thought put into it, and they don't know you nor do they care who you are. I have a site for example, that is somewhat old and has a contact form. Every single day I get emails from this contact form that have a bunch of links in them. Clearly there is nothing to be gained from someone posting a form with a bunch of links to offshore viagra sites, that will simply be cleaned out by my spam filter. I continue to receive these because it's a Bot doing the sending that is simply looking for forms and attempting to stick in links and post them. A simple captcha easily defeats this, but I've been too lazy to add it to the contact form. With that said, it is in no way personal, that spammers continue to send these emails day in and day out. If they did, they would quickly realize that it is a complete waste of time to post these to a contact form.
  20. I don't agree at all -- simple code could mistakes and permissions issues could explain what happened. This is why looking at your web logs is important. Here's my thoughts -- 1st turn off allow_url_fopen to off for now. What that does is allow you to specify url's in all sorts of places including requires and includes. This is referred to as remote execution. If they can find any script that builds require or includes paths in an insecure way, they can trick your server into reading code from their server. allow_url_fopen will turn this off for now. Secondarily, modify your permissions on the code directories so that they don't allow write for apache. Replace all the original scripts and javascripts and in the meantime start pouring over and grepping your logs looking for weird urls and in particular anything that includes http://notyourserver in url's. Also make sure you look in your tmp directory. Often rootkits will be deposited initally in there. If you believe there's a chance you were rootkitted, you need to find out asap. Since they seemed to want to exploit your site and don't mind you knowing it, this might bode well for you, as usually they rootkit in order to turn your server into an ftp repo, spam relay, or shadow website. They'll often start up connections to an irc server in order to remote control it via an irc channel. If this is a redhat/centos based server, you have the great tool of rpm to help figure this out, since all the package contents have md5 hashes, you can use rpm to look at the basic packages that a rootkit will screw with, that goes after login, ps, sshd, etc. lsof is a great tool, but sometimes that gets rootkitted too. Again, if it's possible for now, disable php uploads until you figure out what has happened. Try and lock down the server as much as possible while you're doing this. Are you running any standard packages (phpBB, wordpress, etc.) on the server, that might be the source of the exploit? More often than not, exploits are the result of script kiddies who are running an exploit against a particular package. It's very important to figure this out, and patch any holes, or you'll get exploited again.
  21. sparedog: The simplest answer is that instead of looping through the queries, you simply take the first result. How to do this? It's extremely basic, which concerns me, because you presented this code and it doesn't seem you understand it yourself. The answer to how to do that is programming 101 - change the while to an if. I'm concerned you won't be able to understand what I'm trying to help you with if you don't understand what a while loop does. I also still don't understand what it is that you are trying to do, or why. From what I see -- 1. You have a column that defines a member and that member's "Friends" ie. other members. I'm not sure if there could be multiples, but if so, your database structure isn't really well thought out, because friends should be in a separate table. Despite this fact, I can still work with what you have, so long as I'm clear on the design. 2. You have a table that defines the "Teams" (fantasy hockey i'm guessing?) that a person could be associated with. 3. For any team, there are many players on the team. Now it seems that you are saying: - Get me 1 friend (I don't care if there are many) AND for that friend get me 1 Team (again there could be many teams associated with that person) and then get me the players for that team. This approach doesn't make sense to me, in terms of -- I don't see a valid application of this. Databases have no implied ordering of result sets, so this seems entirely arbitrary -- I have 5 friends but just give me "Fred" and "Fred" has 4 teams, but just give me the "Bruins". How is this useful? Secondarily, as I said previously multiple queries isn't the approach to take here -- the approach is to do this in 1 query which joins the related tables together. If you can explain, in plain language, what result set you are looking for, what columns should appear in the result set, and the basic logic of what you're trying to get from the tables, I can probably concoct said query for you, which would make the issue of these nested queries go away, and also possibly help you think through your application, not to mention future additions to your app.
  22. You need to break down your questions into seperate threads -- one question per thread. Don't by any means take this to mean you should immediately launch 10 new threads now. So it seems your first question is -- how do you get PHP installed with Apache? What operating system? What do you have working so far? Does apache work? Do you have a vhost setup that answers and returns you a default page? Is PHP installed? Have you created a simple phpinfo() page and attempted to access it?
  23. Yes absolutely, because you have 3 nested queries. The first query is going to produce a row for every "Friend" the particular member has, and for each friend, there's the teams, and for each team, you then will run the players query.
  24. Along with system() there's also the backtic, which allows you get back the results from standard out into a php variable. $ret = `someprog`; But as thorpe stated, you will only be able to execute programs that the php user can execute, unless you're using the command line php interpreter, but to do that you'd need to be in a shell, where, if that was the case, there's typically not a reason for you to write a php script to run them, when you could just run them directly.
×
×
  • 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.