Jump to content

Chesso

Members
  • Posts

    27
  • Joined

  • Last visited

    Never

Everything posted by Chesso

  1. Yeah, in alot of languages most properties or functions are accessed using ., rather than -> but it's the same thing. Like if you create a class, and a function within the class. Let's assume the class is called test_class and the function test_function. Also assuming the class is in the same document (for the purpose of simplcitiy) you could call the function like: test_class->test_function(); I came across this the other night, though I don't use classing myself, no need for it really, extra bloat when unnecessary but it has it's used.
  2. Wouldn't this sort of thing be best suited to a windows (or cross platform) application that's a bit more native. Or is there a specific reason it needs to be online?
  3. Oh, like the mail server address etc? What would a web host use? they must have something special setup for that. I just need anything I can use to make emails work to my main gmail account to make sure there aren't any holes or problems before I put it live.
  4. So i'm looking for: date_default_timezone_set('Etc/GMT-10'); Is there anywhere special, like just before I use time/date or perhaps just call it the once at the top of pages that make use of time and date? Woah, I didn't realise you could use case statements in PHP lol dang, I could have been using these.......
  5. Something I never found an answer for a long time ago. It's all fine locally but on web host they are in different location so it's all setup for them on the web server. How can I have the time() and date() functions etc return in my timezone? I'm in AU, Sydney (GMT+10)
  6. Thanks, that's mostly what I have been doing (although rarely using `` at all, so key names like table/field names? not value settings). like `myfield`=somevalue or `myfield`='$somevar'. Is it the same case for when intergrating php variables and array values in echo's, like for form action url's etc.
  7. I somewhat inconsistently use certain ways with php and mysql, like with queries I sometimes use quotes, sometimes don't, sometimes use ` and sometimes don't. Sometimes I can directly insert a variable (but fails without quotes around it.....), but when accessing an array like $r['myval'] it seems I need to get out of the string, .$r['myval']. back into string. What exactly is the right and minimal way? lol. 1. Do I need to use ``? if so, where is it appropriate or should I always use it. 2. Like "SELECT * FROM table WHERE id=4", fine no need for '' but, "SELECT * FROM table WHERE id='$id'", fails without ''s, why? 3. Like "SELECT * FROM table WHERE id=" .$r['myval']. ""; why go through all that, can't I use '' like with Q2? Things like this lol.
  8. Yeah you'll be looking at using GetUrl and the XML file class (the name he uses is just a name for a class instance, not the actual class name).
  9. Hi, is anyone familiar with WAMP5 or the like? for building and testing php/mysql applications locally. This is basically how I build my site, and it would save a lot of trouble if I could build and properly test emails locally and not need to upload to my web host just for it to work. I use the mail() function. If anyone knows how I can setup my WAMP5 locally to be able to test this, it would be greatly appreciated.
  10. Don't forget that, if I remember correctly there is a limit to how much information you can pass along using the GET method, I think that's the only real practical difference.
  11. Aha I see my problem now. It wasn't that DESC was wrong, but with that query build-up, the later DESC did not affect the pinned ordering, so it defaulted to ASC, so I just needed to put DESC to explicitely state it for it . Not sure if there is any possible problems with this, but it seems pretty darn good so far, thanks very much for the help everyone . I'll be sure to stop by here for help (and try and help of course lol).
  12. With that addition to the query, the pinned topic is pushed to the very bottom. Is there a modification to reverse this? I'd assume using ASC rather than DESC would reverse that, but I would need ASC for pinned and DESC for the other. So far most of my queries have been considerably simple (which I try to keep it that way if I can), so I'm not too experience with building slightly more complex queries like this.
  13. Or if you have a seperate results page, cross over variables back and forth so you can just easily re-populate the exact same search result again. Maybe not efficient, but it's not difficult to do. Or go with the temporary cache method.
  14. Hello, I may need help with similar things like this in the future concerning PHP/mySQL as I have some doubt about certain ways I have done things in the past (I am trying to build things as small/dynamic and efficient as I can). Right now I have a little quarm about performing 2 queried loops of mysql, when I think with a bit of help/thought I may be able to pull it off somehow with just 1. Right now for my topic_display page (where I display forum topics for a category), I do something along these lines: $result = mysql_query("SELECT id, topic_id, title, creator, posts, last_post, last_post_by, locked, pinned FROM forum_threads ORDER BY thread_standing DESC LIMIT " .$i. ",$start_from"); while ($r = mysql_fetch_array($result)) { if ($r['topic_id'] == $forum_topic_id) { // If locked, then show locked image, if not then null value. if ($r['locked'] == "true") { $temp_locked = "<img src=\"" .image_url. "locked_image.gif\" border=\"0\" /> "; } else { $temp_locked = ""; } // here I echo out the actual thread data etc. } } This basically grabs all threads within a certain limit (for paging) and displays them (title, total posts, last post user/time/date), and if it's status is locked I insert a little locked image. I wish to do the same for pinned topics, however pinned topics should obviously show above everything else in a descending (most recent displayed first) fashion. I could do this easy right now by doing an extra looped query like this one first and tell it to ignore those specific entries on purpose. But is there perhaps a better way to go about this?
  15. It's not the form that seems to be the problem, it is the sql. As I said works locally, but on the web host it randomly does not put the sql in, or when I do a news post edit, it makes it completely blank, so it in effect deletes the content but does not update it :S. I use $_REQUEST which handles both $_GET and $_POST. Iv'e heard using this isn't so great security wise, but functionality wise it hasn't caused a problem before. All I really did from the original that worked both for local and web host is use a new design, so not much if any of the php and sql was really touched at all besides some mysql_close(); statements and such being removed.
  16. I run WAMP5 (PHP 5 something and mySQL 5 something and Apache 2 something) locally on my Windows XP machine for building and testing my site. It works flawlessly but I am not seeing the same results on my web host. They use as far as I know: PHP version  4.4.2, Apache version  1.3.36 (Unix), MySQL version 4.0.27-standard. The problems I am having at this moment is news posting (when sometimes adding or modifying it fails and the query is not forfilled, but it's random when it happens). I also get errors for trying to use mysql_close(); even though it may be possible it wasn't used or already closed (in my footer) but I use mysql_close() or die();, I don't know any other way to stop it from trying if a connection isn't open, so it outputs the darn error anyway. Mostly what I am looking for is any advice on any differences between V5 of PHP/mySQL and V2 of apache compared to the V4 PHP/mySQL and V1 apache that might cause such problems.
  17. Ok well the editor for administration pages and forum is all done. Made it extensbile so all I need to do is paste a variable declaration, include and make sure the textarea has id attribute setup and it works heh. I couldn't manage to get insertion into cursor position though so I had to settle for inserting at the end. Which is kind of gay seen as many, many, many programs even such as word or notepad made in programming languages have the functionality for years and years now but nothing official for the web *shrugs*. The only thing I'm worried about now is making a web Chat. Still not sure on what way to go, I would prefer to build it all myself rather than rely on a third party one.
  18. Hmmmm I can't really find much relevant let alone usefull. The base of what I am looking for right now is just the method of allowing the user to select text in a textarea control as per usualy but when clicking on one of the buttons (like the editor for this forum) it will slap an open tag for w/e at the start of the selection and slap a close tag for w/e at the end. I already have the basic function definition where you just feed it string paramater that is the tag you want (eg. b or i) so you call the function from the button etc, and just pass what tag it's for. Just the selection and modify part (the hard part heh heh) I can't find much information on.
  19. I have managed the posting restriction for forums and shoutbox, they are all tied together and affected by the same values. 30 seconds isn't exactly long anyway, it's mostly just to prevent insanly mass spamming :P. I'm still looking up on chat, it really looks like I'm either going to dive deeper into Flash 8 or dive into Java and make an applet for it, depends if I feel it is worth it or not (I know enough programming/scripting languages as it is......, I even get the point that I feel like I'm neglecting half of the, lol). The BB code thing would be nice. For now I think I will start off just using the allowed HTML tags (any sort of text field has everything that could be funky stripped except plain text and some html tags, like bold, underline, strike, italic etc). Do you have any advice on the forum/message bit, like how the buttons should work for insertion into the text field (I use a plain html input text field type for now), as I know insertion of things isn't the best and I haven't done any selection manipulation and replacing regarding text fields. Plenty of that in a programming language but have not done it in a web application, plus I'm not sure on what keywords to use to search for some that information.
  20. I haven't had a chance to do any heavy searching yet as I need to head off for a bit very soon (but will do so when I get back). [b]NOTE:[/b] Anything striked through I have managed to implement already. [s]First off, I am considering implementing some form of spam protection both on my custom forums and shoutbox (I made them from scratch myself), I have seen forums use a timer for each user (eg. You cannot make another post for 30 seconds) which seems like a good idea to me, but I have no idea how that would work, I haven't made anything involving a counter like that before.[/s] I would also like to create a web chat accesible from the members page. I suppose I would prefer something that rely's more on the client rather than throttle the server. The only tutorials I have managed to find involve PHP/mySQL only and relying on mySQL or text files on the server for that matter with possible constant messaging seems a bit iffy to me. Oh yes and possibly a rather larger one. I really don't know what keywords to use to search for this, but when adding a post or modifying a post on my forum I do allow some HTML tags, but I would prefer to have some sort of small bb code implementation (with buttons etc) or atleast some options accesible via a mouse that sticks the html in automatically. An explanation or link to somewhere that can help me with any of these is greatly appreciated. I have been mostly fixing up my site for XHTML 1.0 Transitional compliance and syntax etc. Oh and the latest update (my latest updates are still being built and tested locally) you can see on my website, here: http://www.chessoscorner.com, it may give a better idea of what I mean for the Shoutbox/Forum. Any help is greatly appreciated :).
  21. This isn't intended to be php specific but it concerns regular expressions or perhaps just something more general. Someone I know wants an application/php page made up that can extract email addresses from text (this part is no problem), but they also want: [QUOTE]To extract specific email addresses by typing in their username of that particular website. For example: john1987....email is: jonnyknocks@email.com.[/QUOTE] I'm not *entirely* sure what they mean by this and how it could be done, any ideas?
  22. Well I was using __FILE__ in combination with $_SERVER['QUERY_STRING'] but I can't test locally (which I need to) because instead of using http://localhost it puts the literal location (I can't use PHP_SELF because it doesn't include the site url like www.chessoscorner.com for example).
  23. Just wondering what people do about this? Like if a user tryed to access an area that required sign in and were redirected to the login page, how would you redirect them back to the page they wanted to access afterwards? Iv'e tryed a few things but never got it to work properly.
  24. Iv'e been trying to make a basic rating system that allows a user to click on one of five images, each representing a number from 1 to 5 (1,2,3,4 or 5) and somehow calculate a 1-5 rating from the results. I have tried a few things (although scarce from my findings) but nothing actually works as it is intended. So I have a simpler idea but need help, basically in my db/table i'm going to have an entry for each rating, for example: rate_1, rate_2, rate_3, rate_4 and rate_5. If a user pressed the image that corresponds to a rating of 3 then rate_3 will go up by one. The only way I can think of using this data is to find out which of those rate_x happens to have the highest number, so if rate_3 was the highest out of the lot then the rating of the particular file would be 3. Iv'e tryed using the MAX() php function but this is rather useless to me, I need to know *which* field was the highest out of the rate_x's not have the *actual* highest value returned. Is there any function that exists or a query that can tell me which field has the highest value? or perhaps there is another way of going about this?
×
×
  • 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.