Jump to content

RussellReal

Members
  • Posts

    1,773
  • Joined

  • Last visited

Everything posted by RussellReal

  1. for #1 just have a viewed db field and put the ids of the viewed posts into that field.. that or store it into a session.. and store the session id of the last session in the db so you can recall the session id of the user each time.. so the session file could be more of a storage container outside of the database #2 you could simply loop from 1 - 100 and add 100 array entries with numeric values.. for each possible outcome.. then pull a random entry from that array.. so 20 entries for something.. 79 for nothing and 1 for something else.. but than again php random isn't completely random
  2. save all the dynamic data inside the database then set up users by ID and pull the data when the user's page is reached
  3. I am not COMPLETELY sure.. but I'd guess that because you're selecting 'desc' instead of desc or `desc` you're selecting a string rather than a field.. either that or that user's description is 'desc' because I read somewhere mysql supports single quotes but that again is not really solid information from me try removing the ' ' around desc in the select clause
  4. don't use csv at all.. just use a whole bunch of serialized strings.. seperated by \x01 and then explode then unserialize each throw em into an array and pick it up where you left off
  5. try array($this,"prep") for your callback.. I think thats the way to do it
  6. I'm GUESSING fpassthru returns the strlen of the string but outputs the contents inside the function not returns the value of the string.
  7. INSERT UNIQUE and make one of your unique fields.. E.G. username as a unique key.. and it will throw a mysql error if it tries to add a new row with the same username..
  8. krats, this was not a question about security, it was a question about getting to the FIRST result in the result set, your answer only shows the query from a security standpoint furthermore, you do NOT need to use mysql_real_escape_string on a md5 checksum because you only possibly can receive an alphanumeric output.. so it would be impossible to inject your sql after passing to the md5 function, and addslashes was his attempt at security, meanwhile mysql_real_escape_string would most likely be the better choice, also.. adding slashes to a possibly already 'magic_quote'ed string is probably redundant and could cause query errors..
  9. a quick fix since I have never seen this error before.. would probably be to add a LIMIT clause to the query "SELECT bus_id FROM businesses WHERE password='password' AND bus_id='username' LIMIT 1"
  10. add me to AIM or MSN / RussellCrevatas or RussellonMSN@hotmail.com ^^ respectively
  11. a javascript onload function.. document.onload = func; and then push yourself down scrollTo
  12. usort what that will do is pull up two results from the array at a time.. if you have a multi-dimensional array such as.. array ( [0] => array ( ['whatever'] => "lol" ['whatever'] => "lol" ['whatever'] => "lol" ) [1] => array ( ['whatever'] => "lol" ['whatever'] => "lol" ['whatever'] => "lol" ) ) it will pull up two elements from the arrays.. not the more inward arrays.. so inside of the callback function you will compare the fields inside of the arrays passed into the callback function against eachother and return -1 0 or 1 depending on whether to push back.. leave in place.. or send forward..
  13. lol.. this will be moved sadly.. but.. preg_replace('/<img:([^:]+?):/img>/ei','crazy_image_function(\'$1\')',$whatever); add me if you want to I don't have many people to help out lately getting bored.
  14. You should probably use Daniel's RegEx because his makes sure there already isn't a % at the other side..
  15. ignace is referring to the client's address.. if PHP is getting the subnet ip of the computer the server is running on, you most likely cannot reference the ip of the network it is running on without jumping through a loop or two.. like set up some free webhost on freehostia.com or whatever than set up a php file that spits out the 'REMOTE_ADDR' server variable and then file_get_contents on that file to get the ip address assigned to your network not your computer ON the network..
  16. mybad.. I was trying to but it evaluated the bbcode lmao [url]....[/url] is not a valid url
  17. <?php function getLastIndex($a,$s) { $a = array_reverse($a,true); foreach ($a as $k => $v) { if (strpos($v,$s) !== false) return $k; } return false; } $array = array('abcd1','cdef','gpd1'); $key = getLastIndex($array,'d1'); // $key should equal 2 ?>
  18. you mean it is received already quoted.. because php has some feature as of php 4 I think it is.. that for 'security' reasons.. the text is quoted by default.. but really it is just a freaking pain on us web developers.. All you need to do is stripslashes() on the text.. and as for new lines.. most email clients will handle new lines just fine
×
×
  • 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.