Jump to content

sKunKbad

Members
  • Posts

    1,832
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by sKunKbad

  1. If I have a variable that holds some text: $output = "<p>"; and then want to add to that variable with printf $output .= printf(....); then print: print $output; it doesn't work. it prints what is inside printf before what was in $output, and what was in printf is not in $output. Is what I want to do possible? I'm really just adding a string to a string.
  2. Those are helpful facts about MVC. Thanks for your reply. Would you personally use MVC in all projects, regardless of size?
  3. I'm exploring the Kohana PHP framework, and I can see how views, controllers, and the template work together, but I haven't had time to figure out the use of models. I'm used to procedural PHP, and while I understand and use OOP, MVC of Kohana takes me to a new level of feeling stupid. I really don't understand the need for MVC at all.
  4. It is a good start, but lacks true labels, and should include other form elements, such as textarea, checkboxes, selection boxes, radio buttons, etc. Also, if the form doesn't pass validation, then you might consider prefilling the form fields when the user gets directed back to the form.
  5. In the case of adding one to the serial number, you would let MySQL handle that. This isn't something you would do in PHP. User #1 and User #2 click on "add 1 button" MySQL will process one first, and "auto increment" the value, and will also "auto increment" the second transaction. Try it, and you will see that it works. You must of course set the serial number column of the table to auto increment.
  6. So now we know how you are setting some session variables. On the next page, how are you checking these variables?
  7. Just because you call session_start() doesn't mean that php knows that the user is logged in, because you must check the session data that is associated with that particular browser cookie, or PHPSESSID (if you have session ids appended to your links), and determine that a previously stored session variable contains some sort of token or value that is considered "logged in". The link itself shouldn't have anything to do with it. You need to show some code for a fix. I gotta go, but if you show code, somebody will help you out, or I will later.
  8. A full example for your pleasure: <?php $reffDOM = 'lo'; // here is your "user input" $websites = array(0 => 'qu',1 => 'he',2 => 'ra',3 => 'ac',4 => 'fr',5 => 'frs',6 => 'go',7 => 'wr',8 => 'lo'); $wID = array('Q','H','R','A','F','F2','G','W','L'); $position = array_search($reffDOM,$websites); $key = $wID[$position]; echo $key; ?>
  9. This returns 3, so I don't know what is the problem? <?php $websites = array(0 => 'qu',1 => 'he',2 => 'ra',3 => 'ac',4 => 'fr',5 => 'frs',6 => 'go',7 => 'wr',8 => 'lo'); $position = array_search('ac',$websites); echo $position; ?>
  10. You should go to an HTML character reference, like http://webdesign.about.com/library/bl_htmlcodes.htm, and look at the "Friendly Code".
  11. You should show us a link, or at least your code, so we can help you better.
  12. sKunKbad

    DOCTYPE

    Same for me.
  13. sKunKbad

    DOCTYPE

    try: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  14. I would think that you could take a static variable, in a for or while loop, and if the id is out of sync with the current variable value, mark that row with the background color, and for this row DO NOT increase the variable. During the next pass of the loop, the static variable should be in sync. If you can show some code, I'm sure we can get you set up quickly
  15. <?php function lfc(){ return "<a href='www.lfc.tv'>LFC</a>"; } echo lfc(); // I fixed an error, because the double quotes in the HTML either needed to be escaped, or substituted with single quotes. ?>
  16. OK, since this is more of a logic question, then why if the table is sorted by last name do you have to worry about the id being in line too. Most tables would only have one primary key.
  17. I think it's just saying that you are trying to count something that is a string, and count is meant to count array elements, so your out of luck. [id] does appear to be an array though, so I may be wrong. What is strange is that the Id array seems to be an associative array, but lacks a key for the first element. I can't even reproduce the array, but if I copy and paste your array, the key is an asterisk. Very odd.
  18. I think you will find yourself using cURL a lot now that you know it exists. I use it all the time.
  19. I'm sorry, just not feeling well tonight, and can't type much. Here is a tutorial on cURL post basics: http://davidwalsh.name/execute-http-post-php-curl and more tutorials: http://code.techinterviews.com/http-post-request-with-php-curl/33 http://phpsense.com/php/php-curl-functions.html http://www.toknowmore.net/e/1/php/how-to-post-data-without-forms-in-php.php
  20. cURL is part of php. http://www.php.net/manual/en/book.curl.php
  21. You'd have to at least leave the content-type header. Some headers can be removed, such as the server signature, and php exposing itself. What are you trying to get rid of? Below are some notes as to what I turned off on my server:
  22. with cURL you can submit to as many as you like. Seach for it.
  23. I'm working on an authentication script again, and learning more about the way php handles sessions. In the manual, fellow developers complain that setting session_regenerate_id to destroy the previous session can bring about problems if a site user is going from page to page too fast. The session data would be lost, which isn't good at all. They recommend leaving the old session data there, unless a critical need to destroy it exists. My thoughts were, if your going to regenerate the session id, why would you want to leave the old session data? If the old session data can still be used, what's the point of regenerating it at all? A malicious user could use the old session data if captured in some way, and the regenerated id would do nothing to protect the site/data/real user. I want to set my session_regenerate_id to true, but wondering if the issue of the session being lost is too common to do it. I'm not really using my authentication system for any live site just yet, but my project is more of an ultimate php authentication learning experience. I want it to be perfect if the need should arise, and I'm wondering about how the more qualified php user would handle this. My code shouldn't matter, which is why I haven't included it, but I've been asking around to see if other qualified php programmers and ethical hacker types would like to participate in making/perfecting the authentication system, and then distributing it as free/open source. Let me know if you are interested in seeing what I have. It's too much to post, so I'd send it via email.
  24. That's what I had to do. It's weird that I could do something like this: <?php $type= "user"; $row['user_id'] = 13874; $query = "UPDATE `{$type}s` SET login_hold = 0 WHERE " . $type . "_id = '" . $row[$type . _id] . "' LIMIT 1"; echo $query; ?> but when the query is actually inserted into mysqli_query, it doesn't work anymore.
  25. I'm having trouble with a mysql query. Specifically, I am looping through some queries, and I have a variable variable inside the query which I'm sure is causing the problem. Actually there are two variable variables. Right now the error is: Parse error: syntax error, unexpected '{', expecting ']' in C:\wamp\www\loginTest\status.inc.php on line 200 Here is the query: mysqli_query($db , "UPDATE `{$type}s` SET login_hold = 0 WHERE " . $type . "_id = '{$row[{"$type" . "_id"}]}' LIMIT 1"); I know I'd eventually get it, but some help is appreciated.
×
×
  • 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.