Jump to content

cpd

Members
  • Posts

    883
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by cpd

  1. As already indirectly pointed out, you can use a domain name to connect, it just maps across to an IP address. You can also put "localhost:3306" as the host as its the correct way to define a port on the end of a host. Have you eer considered how MySQLi does it behind the scenes? Just like that.
  2. Your code is unreadable because you've just slapped it on here with an abysmal explanation. I don't mean to be harsh but if you want help, first help yourself by taking the time to write a decent explanation, with examples, describing your problem. Then, maybe, someone will answer appropriately and solve your problem. I personally can't even be bothered to look at your code at the moment.
  3. header("location: 'home.php'); is your issue. Clear syntax error and in more than one place. Seems like you copied and pasted the code.
  4. Not really sure what that function is doing tbh. It looks like a big mess in all honesty. You look like your trying to convert any path, relative or absolute, to a URL? That can be somewhat tricky as there are some prerequisites such as knowing the root directory to ensure you don't try to append it to the URL - $_SERVER['DOCUMENT_ROOT'] gives you the root directory. Else you hard-code it for a specific file structure. Moreover, I can't actually see where your getting the parent directory for "../" so your function wouldn't ever really work. I also ran a test with what I thought the expected argument formats were and it completely failed. Did you test it?
  5. It doesn't sound great in all honesty. You shouldn't be putting entire pages into a database and just retrieving them its a very bad design and I'd imagine puts strain on the servers. You should be writing HTML in PHP pages, ideally, and putting snippets of PHP code in to do what you want. A combination of HTML, CSS, PHP and a MySQL back-end (dependent on whether or not its needed) are ideal but your styling, and DOM etc shouldn't really be kept in the database in its entirety.
  6. Well then its your WHERE clause not your select data. You should review that section of your code and I'm sure you'll find your problem.
  7. preg_replace("/<a(.*?)>|<\/a>/", "", $string); should remove any anchor tags from your text.
  8. I'm going to go ahead and take a random stab saying the WHERE clause is what's causing the lag, in-case you haven't already assumed - I say this because I honestly can't see why COUNT(*/id) would affect it. How much data are you dealing with?
  9. I don't see why your not putting the "grabs newsfeed posts" and "grabs post's likes" in a single query - it would be a nested select but it would be tiny. In terms of nested loops which you'd have with the third query, why not retrieve all the data at the top of the page or where ever the logical place is for you, build a multidimensional array and cycle through the array as opposed to doing the queries on the fly sort of thing.
  10. When you say you get a problem do you mean no data is returned or you get some data but not all your expecting? Or does it just error. Data being returned is dependent on your WHERE clause so if something is being returned but not everything you expect, its because the data your expecting in addition to what's returned doesn't actually match the criteria in the WHERE clause.
  11. What is the expected value to come out the database? Your also sending it in via reference which you shouldn't be doing. Just put it in as normal.
  12. Did you purchase the original software? If so did it include the database back-end? You need a license to use SQL Server, 1 for each user that connects. With websites this includes any means of authentication, even if each user is authenticated using a single database login, you still need a license for each user connected (kind of like a roaming license). Your question seems to be split between asking if you need to continue to pay for an interface, hence my initial question, and whether you need to pay for SQL Server? You need to clarify. You can't access data in SQL Server without using the schema name or setting the default schema (dbo) and just calling table names. Furthermore, I'm not convinced someone is going to help you reverse engineer (I think you mean duplicate) a database which is paid for, if that is the case. Not openly anyway because that's obviously wrong. @thomasw_lrd: You cannot, unless using SQL Server Express, use SQL Server without a license, period. Microsoft work on a trust ethos and don't actually directly enforce this however.
  13. I would handle the exception to ensure its working fine; just var_dump($e); inside the catch section. I also noted you've written 'uids' => uid - assumed $uid - inside the try statement. Just to simplify slightly what Phsyco said. How can you expect to set $_SESSION['id'] and the rest of them when $result is empty?
  14. I don't really understand what your asking but I can see straight away your code has errors. 1) $SERVER is non-existent unless you've created it. I'll assume you mean $_SERVER with an underscore. 2) Your trying to compare something inside the array index identifier section of your code: $SERVER['REQUEST_METHOD' == 'POST']. This should read as follows: $_SERVER['REQUEST_METHOD'] == 'POST'
  15. I'm not convinced your database structure is the best for what your trying to achieve. Can you clarify what it is you want to do? 1) A continuous messaging system where messages are just appended. 2) Individual conversations even if the recipient and origin users are the same. Every time you click a "New Message" button a new conversation is started. 3) Similar to 2 but instead of showing all messages you just display the reply to your previous message?
  16. In many cases the list isn't maintained and someone with in the organisation has built it. In the UK you can tap into the postal services addressing which is all maintained but at a cost and I would imagine its the same for other countries as well.
  17. OMFG is it that hard to count the parenthesise $image_properties = array( 'src' => [Open Bracket 1 ->](!empty [Open Bracket 2 ->]($this->session->userdata [Open Bracket 3 ->]('avatar')[<- Close bracket 3 )[<- Close Bracket 2 )[<- Err, oh shit, theres the bracket that shouldn't be closed] ? 'assets/peach/img/sprites/userinfo/'.$this->session->userdata('avatar') : 'assets/peach/img/sprites/userinfo/avatars/avatar.png') [<- AND OMG, who knew this is where it would close....] 'height' => '80px', 'width' => '80px', 'alt' => 'Avatar' ); And in-case you don't know what an in-line if statement is $variable = argument ? true : false; // Example $switchOn = true; $isSwitchOn = $switchOn == true ? 'Yes' : 'No'; Completed code $image_properties = array( 'src' => (!empty ($this->session->userdata('avatar') ) // OMG I REMOVED A BRACKET ? 'assets/peach/img/sprites/userinfo/'.$this->session->userdata('avatar') : 'assets/peach/img/sprites/userinfo/avatars/avatar.png') 'height' => '80px', 'width' => '80px', 'alt' => 'Avatar' ); Apologise for the sarcasm and the original mistake, this discussion wouldn't have taken place if I hadn't made the mistake. My bad...
  18. Object-orientation naturally has a larger overhead but in terms of your "rate of coding" you will be able to, theoretically, finish a program far quicker programming in an object-oriented style compared with a procedural style. How I see it is the foundations of an object-oriented system would probably take longer than a procedural system but the programming rate would increase exponentially, using object-orientation, as the application grows in size. Until recently I never actually gave it much thought but after thinking about it logically, procedural style software could run quicker than object-oriented software due to the overhead involved - it pretty much comes down to the overhead. As you can see you were referring to execution time, I was referring to development time.
  19. Using object orientation would actually provide speed as well. If you split your "validation" and "sanitisation" up into different areas of your application then re-use the code as is the way with OO, you will end up programming very quickly anyway.
  20. Have you made any attempt to debug it and narrow it down...
  21. An article I recently read, linked to me by CrayonViolent in IRC, clearly explains why a variable run through mysql_real_escape_string isn't enough to secure your database. More experienced PHP programmers are likely aware a nere escape_string isn't enough but for the newbies I definitely recommend reading it. Having a read of any referenced articles in this piece of text is also worthwhile as I've found stuff I was slightly sketchy on clearly explained. Whilst it was written back in 2007 5 years ago, I still feel its necessary today. http://www.webappsec.org/projects/articles/091007.txt
  22. cpd

    Checkbox Fun

    Moreover, I would argue a radio field is more appropriate for yes/no. Its clearer and having experienced the pain of watching simple minded people use the internet, I think making this sort of thing obvious is a must.
  23. Try setting your header to true and see if you have any content being returned.
  24. What are the actual results and what are the expected results?
×
×
  • 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.