RussellReal
Members-
Posts
1,773 -
Joined
-
Last visited
Everything posted by RussellReal
-
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
-
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
-
[SOLVED] Echos out Row Name Not Value.
RussellReal replied to WeirdMystery's topic in PHP Coding Help
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 -
Problem with fgetcsv and double quotes at end of string
RussellReal replied to Jeffski's topic in PHP Coding Help
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 -
try array($this,"prep") for your callback.. I think thats the way to do it
-
I'm GUESSING fpassthru returns the strlen of the string but outputs the contents inside the function not returns the value of the string.
-
Preventing Duplicate Entries into MYSQL table
RussellReal replied to k3ndr4's topic in PHP Coding Help
nopes.. lol idk you gotta dilemma -
Preventing Duplicate Entries into MYSQL table
RussellReal replied to k3ndr4's topic in PHP Coding Help
so make 'week' a unique field.. -
Preventing Duplicate Entries into MYSQL table
RussellReal replied to k3ndr4's topic in PHP Coding Help
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.. -
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..
-
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"
-
Looping Problem with PHP Image Gallery
RussellReal replied to blueberrylolli's topic in PHP Coding Help
add me to AIM or MSN / RussellCrevatas or RussellonMSN@hotmail.com ^^ respectively -
Stop Page From Scrolling To Top On Refresh?
RussellReal replied to twilitegxa's topic in PHP Coding Help
a javascript onload function.. document.onload = func; and then push yourself down scrollTo -
Combining then sorting to associative arrays
RussellReal replied to c_shelswell's topic in PHP Coding Help
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.. -
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.
-
You should probably use Daniel's RegEx because his makes sure there already isn't a % at the other side..
-
$_SERVER['SERVER_ADDR'] returns *NAT* address
RussellReal replied to dmcole's topic in PHP Coding Help
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.. -
mybad.. I was trying to but it evaluated the bbcode lmao [url]....[/url] is not a valid url
-
[SOLVED] capital lost while writing to file (Ubuntu Linux)
RussellReal replied to anatak's topic in PHP Coding Help
show some code.. that isn't normal behavior -
<?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 ?>
-
no problemo click 'solved' tho
-
trying to redirect based on ip address- but not working??
RussellReal replied to techexpressinc's topic in PHP Coding Help
PFM is right, just go with .htaccess -
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
-
trying to redirect based on ip address- but not working??
RussellReal replied to techexpressinc's topic in PHP Coding Help
what if the office's IP address changes?