-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
[url=http://us2.php.net/manual/en/function.file-get-contents.php]file_get_contents()[/url] and some regexing will do the trick
-
dammit. well i think i know who found my secret stash...
-
maybe if you explained exactly what you were trying to do here.. cuz i'm looking at your script and there's no apparent sense to it. you are missing a < tr > .. < /tr > in your echo inside your for loop though
-
w3c.. a high traffic site? bah
-
[code] <?php $textarea = $_POST['textarea']; $smilies = array( ':)' => "<img src =\'smile.jpg\'>", ':(' => "<img src = \'sad.jpg\'>", ); $codes = array_keys($smilies); $textarea = str_replace($codes,$smilies,$textarea); ?> <html> <body> <center> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <table width="400" border="0" cellspacing="4" cellpadding="0"> <tr> <td align="center"><textarea name="textarea" cols="50" rows="8"></textarea></td> </tr> <tr> <td align="center"><input type="submit" value="Go" name="post"></td> </tr> </table> </form> <?php if(isset($_POST['post'])){ echo "<table width='100' border='0' cellspacing='0' cellpadding='0'> <tr> <td> $textarea </tr> </table>"; } ?> </center> </body> </html> [/code]
-
[code] $cjmsg = $_POST['cjmsg']; $spam_array = array('breast enlargement', 'penis enlargement', 'weight loss', 'Incest Sex', 'Hentai Porn', 'Lose Weight', 'Free Money', 'Credit card', 'green card lottery', 'Viagra'); if (in_array($cjmsg, $spam_array)) { // prevent update } else { // do the update } [/code] though you should know..that's about as rudimentary as it comes... people can do all sorts of things to get around that, like doing V i a g a r a V..I..A..G..A..R..A etc.. so you're going to have to do better than that..
-
from what i understand, 'id' can be used instead of 'name' for client side stuff, like destinations for links, referencing an element, applying a particular style to the element with a style sheet, but it will not be posted to the server; only 'name' will.
-
Howcome you want to have a seperate error page and then have the user go back to the form in the first place? Wouldn't it be more convenient for the user to have the error messages displayed next to the offending fields, or at least on the same page?
-
FF lets you pause/resume downloads. I will agree that Opera's skin/widget download/install is bar far superior to FF. You click the download button and it automatically installs and changes it, and then asks you if you wanna keep it. If you say no, it makes it go away. With FF it's download it and then restart the browser and if you don't like it then go uninstall it. I will also agree that the .searchforword in Opera is pretty cool. Though come one, CTRL+F is just as easy.
-
i think he's talking about the menu that pops out from the left edge of the browser.
-
[code] $isitfree = mysql_query("SELECT free FROM map WHERE ID = '$mapcoord'") [/code]
-
you know, i just downloaded opera today. I finally decided to once and for all see what the big deal is. To be honest, I'm really not that impressed. Their Widget downloads consist almost entirely of clocks and games. And i do not notice any kind of load improvement from FF, though to be fair, I am on a 6mbps cable connect. I will however say that I think the "remember the page((s) - if you have several tabbed) you were last looking at" feature is pretty cool. maybe ober and/or someone else can come mention some good widgets and also make a case why i should [i]really[/i] convert to opera from FF.
-
i use fetch_array, simply because it's all encompassing. I mean, fetch_assoc returns an associative array. fetch_row returns a numerical array. but fetch_array returns both by default. Or i can specify one or the other if i [i]really[/i] want to, with an optional argument. But i usually don't. I can simply use fetch_array and just use the numerical or associative version as i see fit. I feel it is less hassle. Maybe that's just me.
-
I agree with ober. A bug that hasn't been fixed for years is at the "undocumented feature" status, soon to be a "browser-sepecific documented feature."
-
insert into table (column1, column2, column3) values ( 'value1','value2','value3') , ('value1','value2','value3'), etc.. ";
-
what is this supposed to be? [b]uClicksToday '0' [/b] are you meaning to do this? [b]$db->query("UPDATE users SET uClicksToday = '0' WHERE uType=1");[/b]
-
you are passing an argument in your function and calling it $scoreid as a local copy, but also declaring it as a global variable that already exists. assuming that you are doing something like this: $blah = displayOneItem(9); or just displayOneItem(9); change this global $db, $scoreid; to global $db;
-
are you hosting your webpage on your own computer or some other server? if it is some other server, then just setup a cron job. if it's you're own computer.. well if you turn it off, then it's off.
-
are you building your chatroom and forum yourself? Simply leave out the whole registration process. using 3rd party scripts? Most forum softwares allow you to alter the permissions of usergroups. You could simply alter it to give the "guest" or "unregistered user" or whatever permissions to post, etc... and that's about all the help I can give without more info. p.s. - if it's 3rd party software, I suggest going to their website and asking them.
-
[code] <?php echo "<table>"; while ($list = mysql_fetch_array($result)) { if ($list['serial#'] != $prev_row) { $color = ($color == '#AAAAAA') ? '#FFFFFF': '#AAAAAA'; } echo "<tr><td bgcolor = '$color'>"; echo "{$list['serial#']} {$list['description']}"; echo "</td></tr>"; $prev_row = $list['serial#']; } echo "</table>"; ?> [/code]
-
first guess is to use <?php instead of <? down there at the bottom.
-
i just knew barand would come in here and wave his magic wand :-\
-
(I deleted my previous post for clarity sake) okay so i just didn't feel right about posting code without testing it, so i went and setup a test table and tried it out. apparently there's a few more bugs in the above code, so I worked them out. I tried $num as various numbers including a number higher than the highest number and lower than the lowest number in the table and it gave the correct result. Again though, I'm sure there is a much much easier way of doing this... [code] <?php $num = 5; $sql1 = "select column from table where column > '$num' order by column asc limit 1 "; $sql2 = "select column from table where column <= '$num' order by column desc limit 1"; $result1 = mysql_query($sql1) or die(mysql_error()); $result2 = mysql_query($sql2) or die(mysql_error()); if (mysql_num_rows($result1) == 1) { $number1 = mysql_fetch_array($result1); $diff1 = $number1['column'] - $num; } if (mysql_num_rows($result2) == 1) { $number2 = mysql_fetch_array($result2); $diff2 = $num - $number2['column']; } if (!$number1 && $number2) { $finalnum = $number2['column']; } elseif (!$number2 && $number1) { $finalnum = $number1['column']; } elseif ($number1 && $number2) { $finalnum = ($diff1 <= $diff2) ? $number1['column'] : $number2['column']; } else { echo "nothing in db.."; } ?> [/code]
-
okay there is probably a way better way of doing this, but this is what came off the top of my head: [code] <?php $num = 5; $sql1 = "select number from table where number is > '$num' limit 1"; $sql2 = "select number from table where number is <= '$num' limit 1"; $result1 = mysql_query($sql1) or die(mysql_error()); $result2 = mysql_query($sql2) or die(mysql_error()); if (mysql_num_rows($result1) == 1) { $number1 = mysql_fetch_array($result1); $diff1 = $number1['number'] - $num; } if (mysql_num_rows($result2) == 1) { $number2 = mysql_fetch_array($result2); $diff2 = $num - $number2['number']; } if (!$number1 && $number2) { $finalnum = $number2; } elseif (!$number2 && $number1) { $finalnum = $number1; } elseif ($number1 && $number2) { $finalnum = ($diff1 <= $diff2) ? $number1 : $number2; } else { // nothing in database... } ?> [/code] you will have to re-arrange the ternary operator, depending on your preference. for example, if $num = 5 and $number1 = 3 and $number2 = 7, $finalnum will end up being $number2: 7. The way i set it up, it chooses the higher number. If you want it to pick the lower number in case of a tie, your ternary operator should be this: $finalnum = ($diff2 <= $diff1) ? $number2 : $number1; anywhoo... i'm sure that mysql probably has some kind of function to automatically do all that for you or something. I bet fenway or barand would know. You might wanna ask over in the database forums, just to make sure. actually, i see a flaw in my code already :( stay tuned...