Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. You need to get post variables from the $_POST[] superglobals. Also your query should not have a closing ';'. Please use: [code=php:0] ... [/code] Around future code snippets.
  2. Please use the [code=php:0] .... [/code] BBcode blocks around your code in the future. Try adding this code: f ($result) { echo "Thank you for your purchase! You have been entered to win!"; } else { echo "An error has occurred. The item was not added."; echo $db->error; }
  3. Using sessions, each page request gets bound to previous ones by a session id. There are 2 ways the sessions ID can be passed: 1. As a url parameter 2. As a cookie Out of the box, PHP will utilize a cookie. Cookies are a mechanism of the browser. A server can request that the browser save a cookie. The specifics of that can vary, but what what is important is the domain of the cookie. If you have domain/subdomain specific issues you may need to look into those specifics. In general, if you create a cookie for mydomain.com, it is good for any subdomains. By default, php sessions use the hostname of the server as the domain for the cookie. You can verify what is configured like this: $parms = session_get_cookie_params(); echo $parms['domain']; So assuming this is the problem, both sites will need an adjustment to the base session management if they are to share sessions. You can set this prior to starting sessions like so: session_set_cookie_params(0, '/', '.yourdomain.com'); session_start();
  4. You probably already know this, but that's not valid syntax. Was just too lazy to break it into 2 lines. Maybe some day . Yeah, it's not really a magic wand, but just something that makes more sense when you just go ahead and try implementing it. Usually when people start working on classes to model their approach to the business problem, those things end up going into the model layer. so that's what lead me to bring up MVC because it seems like you're moving in that direction and before long would be asking the types of questions about how to handle the flow of control and seperation of presentation from logic that MVC handles.
  5. Don't get me wrong, if you have a sincere desire to learn web development, you're certainly welcome to come here with your questions. On the other hand, here's my outsider's point of view in regards to this thread: me- computer science education, long career in software engineering, worked for world famous movie studio and game companies, involved in the development of easily 90 websites to date. ... web development continues to be a challenge for me, even though I've been doing some form of it for a decade. you- a business person with no programming education or background, under duress Here's a short list of what you need to understand: -Computer basics (bits + bytes) -The PHP Programming language -Javascript Programming language -Relational database design and SQL -HTML -CSS -Internet protocols and HTTP -Unix system administration + bash scripting -The Apache webserver -Web design + photoshop -Software engineering practices like source code management --- and the list goes on and on. Any one of these topics can involve intense study and practice for months to years. In the web development world it's fairly standard to have teams of people work on a website, because there's so much to it, and there are very few people who are masters of every discipline. Often you have on a basic team, a sysadmin, web developer, dba and web designer. From time to time people come here with stories similar to yours and stating similar objectives, and I actually can't provide you a single example after 8 years at phpfreaks, of someone who started out where you are, and successfully became a web developer. It's just very very unlikely, because the reality is that this discipline is like quicksand and you can very quickly get over your head. It seems simple at times in abstraction, especially when people are able to get a quick script put together, but that by no means indicates that it's just as easy to platform to the level of development you'd need for your business. Frankly, we only have your side of the story. In no way shape or form, do I condone a company attempting to hold hostage assets you bought and paid for, but at the same time, we're not in a position to judge whether or not 10k is a lot of money for what you received. My advice to you is to find yourself a developer that you can work with for an hourly rate, and one that you can build a relationship with. Have this person interact with the development/hosting company on your behalf and help you extricate yourself from this mess as economically as possible. The approach you're taking isn't going to help you in the short term, and just is highly unlikely to pay off for you in the long term, unless your ultimate goal is to invest several years of time to get the point that you're at a basic level of competence, and I don't see how that will help with your current crisis.
  6. If you have short tags off in the php.ini you can't use short tags -- so anyplace you used you need <?php.
  7. I don't think there's much chance that the php base types will ever become real objects. It just doesn't seem to be anything that people are clamoring for.
  8. Corbin, I'd suggest taking a look at Zend Framework, which has solutions to a lot of your questions. For example, ZF provides a configuration class, and a Registry class. The config class will load up all your configuration specific variables, and the registry can be used to store connenctions, factories, and other singletons. Use an ORM if the idea appeals to you. Whether or not you use an ORM, you'll want to take a good hard look at MVC, if you haven't already.
  9. Probably because you tried to use a short tag here: delete Change the to <?php
  10. Human generated comment spam is insignificant when compared to the spam generated by bots. I did mention that humans can be tricked into defeating captcha's, or even paid to spam, however, for most communities, captchas work fine, although akismet is a great additional form of protection. So in summary, while I don't disagree with Daniel's point, that human spam can be a huge problem that captcha's don't solve, that's not a reason not to do a captcha as your first line of defense, and in my experience, for many sites, it eliminates the majority and often the entirety of comment spam. Sites like Yahoo get a lot of human spam, but you have to be a pretty high profile target to attract that type of attention.
  11. I don't think we have any way of knowing. When someone brings ups the mysql show tables and asks about info for a specific table, I assume they're wanting the schema information.
  12. Well it looks like this might be doable using a prepared statement, although i'm still not sure it would work in a trigger. Give it a try.
  13. You've hit a dead end. MySQL won't allow you to inject dynamic SQL statements into triggers or stored procedures.
  14. I'm going to just let this pass, with the comment that it's a bit presumptive of you to make the statement that my example is "more confusing manner for a newbie" or that your code is more portable. Let's say that the OP adds a single form element at the top of his form -- perhaps a text input with the name of "subject". Does your code still work? My code put the name/email combinations together into an array that could then be sent to a mail() function wrapper. Your example, if ran on the $_POST variable in the original post, would simply echo out the values. Is that the same thing? Is echoing it out helpful to his goal of emailing something to the people in the list? So... again, I'm taking into account your overall contributions here, and willingness to help people. If you will start using the php blocks around your code, I'm sure we'll end up fast friends. As for being right or wrong, it's all in the eye of the beholder. I think Atchkin probably provided the ultimate teachable moment for this topic, but with that said, I try not to completely throw out people's code, even if I wouldn't write things that way myself. In my experience with this forum going on 8 years now, I've found that it doesn't really teach people anything to take something that is workable if not ideal, rewrite it from scratch, and say: here's your solution. That type of advice also tends to get ignored, so not only did you waste their time, but you wasted your own.
  15. I already recommended implementing recaptcha, which is easy to do, as there are already php libraries that make it simple to integrate.
  16. I guess you may have tried, but I didn't see what I was expecting, which was that you would have a protected variable called something like "$comments" that would be an array of the comments related to the blog post. You would then provide some mechanism that would load the comments in when the blog post is loaded. That could be via a seperate comment class or a method in your current blog class. As for my comment about variables, my point is that your constructor does not set those variables. Instead as Mchl opined, it seems that your class is more a set of functions than something that looks like a blog class. The other thing you're doing that I wouldn't do, is you're tying the details of the presentation of data to the data itself. It's better to have the data in some sort of raw form, and then you can either have seperate presentation methods, or better yet, utilize a view class with one or more templates that handle the markup. If you were to remove the presentation stuff, you'd have something that typically would go into the category of a "model" since you asked about MVC frameworks. In terms of looking at how skilled practitioners do it, definately take a look at the Zend Framework. They have used well established design patterns throughout.
  17. You should also google Eric Myers css reset.
  18. It's all opinion. I would not do many of the things you're doing in your class, but that doesn't mean your code won't work. Off the top of my head, my first questions for you: You have the following class variables: public $title; public $body; public $id; Yet you do not setup any of these variable in your constructor. Why not? Also you have one private variable: private $row; Yet it appears from the code that this variable is really only used as a temporary variable -- if so there's no reason to have it in the class. Picking the right class variables is very important to establishing the identity of the class, and its relationship to other classes. As far as phpfreaks is concerned however, you got a really good answer from mchl and you completely seemed to have ignored his advice. Why would we want to delve into the details of what you're doing, when so far you've indicated that you'll just ignore it?
  19. An iframe is for all intents and purposes an embedded browser window. As such it has everything that a normal browser page would have, so you want to treat it the same way you'd treat any other page.
  20. In CSS there's something called the box model. You should do some reading about it, and it will help you understand the relationship and function of border, margin and padding. In your example, the 2nd margin would override the first, unless that's just an example. margin: 0px; would set the top, left, right and bottom margin of the current element to be 0px. margin: 0 auto, would set the top and bottom margin to 0, and the left and right to be "auto", which would use whatever built in default the browser provides.
  21. Not huh. At least not for me. Run it and see if what you get is not EXACTLY what was asked for. $array=array ( name1 => myname1, email1 => 'email1@email.com', name2 => myname2, email2 => 'email2@email.com', name3 => myname3, email3 => 'email3@email.com', name4 => myname4, email4 => 'email4@email.com' ); $i=1; foreach($array as $key => $value) { if($i % 2 == 1){$name=$value; $show='';} else{$show="$name $value";} if($show!=''){echo "$show ";} $i++; } ?> if you need an explanation of modulus and whats happening with the code I'll be happy to explain it to you. HTH Teamatomic It's great that you're trying to be helpful, but in the future it would be much more helpful if you used the bbcode code or php around your code. 2nd, your code makes the assumption that there will be nothing else in the $_POST other than the columns presented in the example. Then you simply echo it out, which in no way helps the OP solve his problem, which was how he would associate each name/email pair for further processing. If you're going to throw something abstract out, I think you need to provide a bit of explanation.
  22. You'll want to buy a cert from a certificate authority. This is the only way SSL will work seamlessly. You can generate your own certs but they cause messages to pop up and interrupt the flow of the application. They're fine for intranet or internal company applications, but for a business you want to buy one.
  23. BTW, as usual thorpe pretty much knows everything .... On windows ... "start program" is apparently functionally equivalent to unix... "program &"
  24. Nobody said that exec doesn't work, what doesn't work is using unix process control to background a process, as in thorpe's example.
×
×
  • 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.