Jump to content

mrbuter

Members
  • Posts

    53
  • Joined

  • Last visited

    Never

Everything posted by mrbuter

  1. Change the "F" to an "M". http://us.php.net/manual/en/function.date.php
  2. Your cases are commented so php is getting confused Lines like " // Ascending by date posted (oldest first) case 5: " need to become // Ascending by date posted (oldest first) case 5:
  3. This is so weird.... check out this function: function addhttp($url) { if (!strstr("http://", $url)) { $url = "http://".$url.""; } return $url; } It's so easy.... It's meant to add an http:// prefix to a url if it does not already have one. If I enter www.google.com into the function, it outputs as http://www.google.com (correct!0 If I enter http://www.google.com into the function, it outputs as http://http//www.google.com Two things here: 1. why is it adding the prefix if it already has it? The code shouldn't let that happen...right? 2. Stranger still, not only does it ADD the prefix, but it proceeds to remove the colon from the original http:// which results in http://http// rather than http://http:// (which would still be wrong anyways) Any ideas what on earth is going on??
  4. This is so simple but I am having a hard time with it. Almost there! I want to have: www.example.com/user/me display what is currently shown in the ugly url: www.example.com/index.php?page=users&action=view&id=me I have this in htaccess: Options +FollowSymLinks RewriteEngine on RewriteRule user/(.*) index.php?page=users&action=view&id=$1 RewriteRule user/(.*)/ index.php?page=users&action=view&id=$1 And it works....except now all the images are broken. Anyone know how I can fix the images, or rather, stop images from getting redirected?
  5. Hi, quick question: are exec() commands vulnerable to timeouts? I'm going to use it to run a mysqldump with a $date command so that it doesn't overwrite (among other things). Then I'm going to make a cron to run it every 24 hours. I tried to append a date to the file using cron jobs and cPanel but it wasn't working...lol. So yeah, my question is if I use exec(), can the dump time out and leave me with a broken backup?
  6. Yes that's correct. When someone selects something in menu 1 it should call some kind of ajax function/script to populate menu 2 with the correct options.
  7. Hey guys..tried googling but I normally get more help here. I'm trying to setup a page where users select a date from a dropdown menu and then the server queries a database to return valid times of the day associated with the selected date. Think of it as a reservation system I guess. If user 1 reserves something for March 2nd 2009 @ 5PM then User 2 can't reserve it for that same time so the server shouldn't show "5PM" on the 2nd dropdown menu (and ideally will have like a +/- 2 hours along with that but that's unrelated and I know how to do that part). It's the ajax that's confusing me because I haven't really ever worked with it. Thanks in advance!
  8. I was under the impression that the values needed to be quoted. Anyways, any ideas how to make it work?
  9. //here we get all the ids for both the usergroups $bootyusers_19 = mysql_query(" SELECT userid FROM `user` WHERE `membergroupids` LIKE '%19%' "); $bootyusers_19_rows = mysql_num_rows($bootyusers_19); $bootyusers_20 = mysql_query(" SELECT userid FROM `user` WHERE `membergroupids` LIKE '%20%' "); $bootyusers_20_rows = mysql_num_rows($bootyusers_20); $bootytotal = $bootyusers_19_rows + $bootyusers_20_rows; //and we add them together (effectively our number of rows for later on) //now we need to implode both results into one set so we can make explode it and make it into an array $i = 0; $imploded = ""; while($row = mysql_fetch_array($bootyusers_19)){ // ($x=0;$x<$bootyusers_19_rows;$x++){ //and like $imploded += etc. if ($i == 0) { $imploded = $row['userid']; } else { $imploded .= "," . $row['userid'] . ""; } $i++; } //now we slap on the usergroup id =20 users onto the back of it...still imploding of course $i = 0; while($row = mysql_fetch_array($bootyusers_20)){ $imploded .= "," . $row['userid'] . ""; $i++; } //weee exploded $exploded = explode(",", $imploded); //now we do work for ($x=0;$x<$bootytotal;$x++) { //this query does leeches $query = mysql_query(" SELECT userid FROM post_thanks WHERE userid = $exploded[$x] ORDER BY userid DESC "); $rowsleech = mysql_num_rows($query); $array = mysql_fetch_array($query); //we're not using this anymore //this query does uploads $query = mysql_query(" SELECT postid FROM post AS post INNER JOIN thread AS thread ON(thread.threadid = post.threadid) WHERE post.userid = $exploded[$x] AND post.post_thanks_amount != 0 "); $rowsupload = mysql_num_rows($query); $array = mysql_fetch_array($query); //we're not using this anymore if ($rowsleech == 0) { $ratio = 0; } else { $ratio = round(($rowsupload / $rowsleech), 2); } $bootyuser[$x]['userid'] = $exploded[$x]; $bootyuser[$x]['leeches'] = $rowsleech; $bootyuser[$x]['uploads'] = $rowsupload; $bootyuser[$x]['ratio'] = $ratio; //now we echo just to make sure it works (which it does)...........but how the hell do we sort it echo "Userid: " . $bootyuser[$x]['userid'] . ", number of leeches: " . $bootyuser[$x]['leeches'] . " and number of uploads: " . $bootyuser[$x]['uploads'] . " so the ratio for this user is " . $bootyuser[$x]['ratio'] . "<br>"; } That's the rest of it in case it helps.
  10. I forgot to add, in my code $explode[$x] is equal to the user's userid.
  11. First things first...my end goal is sorting some numbers I calculated from lowest to highest. From what I understand in order to do this I need to place them into an array first. One other thing though, the numbers being calculated have an id related to them (it's a ratio for users) The numbers are calculated through a for loop. After each iteration the number is stored in $ratio. I can successfully echo the numbers corresponding to the users so I'm almost there, now I just need to sort it. The problem is I really don't know how to put the information into an array. I tried doing something like this but it didn't worrk: if ($x == 0) { $info = Array( $x => Array ( "" . $explode[$x] . "", "" . $ratio . "" ) } else if($x != $nbr_rows - 1) { $info .= $x => Array ( "" . $explode[$x] . "", "" . $ratio . "" ), } else { $info .= $x => Array ( "" . $explode[$x] . "", "" . $ratio . "" ) ); } So say, after it completes all 3 iterations (realistically there will be about 70) it would look like this: $info = Array( [0] => Array ( [0] => 238492 [1] => 0.21 ) [1] => Array( [0] => 100 [1] => 0.32 ) [2] => Array( [0] => 819 [1] => 0.87 ) ) That way I would have the ratio that goes along with a unique id. By all means, if you have any other way that I could sort these out that would be absolutely fine. Thanks in advance.
  12. What is the best way to do this? I made a script which makes the tables etc. Works fine. Adding info to them works well too (INSERT INTO). However....I have one table which needs a _MASSIVE_ ammount of data put into it. (42,000 some rows). On my localhost server I get a timeout error (set to 30 seconds) but what would you recommend? Splitting it up wouldn't be too useful since it would probably be like 200 steps lol. PHP has no notion of time right? So I can't add like any "wait" commands every 100 or so insert queries?
  13. alright i think i fixed all those.
  14. Am I doing it wrong? This sounds like the simplest thing ever but it isn't removing my backslashes! (\) $something = stripslashes($something); $something is previously set through a form. If I include backslashes it will not remove them! I also have str_replace removing all letters and other characters (including the normal slash). But since I can't seem to include the backslash in that array I tried using stripslashes to no avail.
  15. stripslashes isn't working I do $string = stripslashes($string); but it's a no-go. am i doing it wrong?
  16. Well here's a script I made a while back. Just tested it and it works fine. <? if ($submitting == "yes") { $message = wordwrap($message, 70); $recipent = "someone@domain.com"; $subject = "" . $subject . ""; $name = "" . $name . ""; $sender = "" . $sender . ""; $headers = 'From: ' . $name . '' . "\r\n" . 'Reply-To: ' . $sender . '' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($recipent,$subject,$message,$headers); echo "Email sent"; exit; } ?> <form name="emailbomb" method="post" action="<?=$PHP_SELF?>"> <p>Your Name:</p><br> <input name="name" type="text" class="field_text" id="name" maxlength="25"><br><br> <p>Your email:</p><br> <input name="sender" type="text" class="field_text" id="sender" maxlength="25"><br><br> <p>Subject: </p><br> <input name="subject" type="text" class="field_text" id="subject" size="16" maxlength="25"><br><br> Message: <textarea rows=15 cols=60 name="message" id="message"></textarea><br> <input type="hidden" name="submitting" value="yes" /> <input type="submit" name="submit" value="Send" /> </form> make sure you edit $recipent on line 4 with the email that should be receiving all this.
  17. I dont really understand the question. Are you trying to explode using php? With that you would do $var = "70||1207290213||Agility||Abdominals||Agility Ladder||ex_26_a.jpg" $exploded = explode("||", $var) $exploded[1] --> 70 $exploded[2] --> 1207290213 ..etc. or was that not your question? lol.
  18. So it's basically a contact form? A user enters a subject, message etc. and the server sends it to an email. But you don't get the email? Like someone suggested do you KNOW that it's trying to mail()? Try adding echo "Message sent!"; below mail(). So effectively: if(isset($message) and isset($subject) and isset($sender)){ mail("amie@amb-design.com", $subject, $message, "From: $sender"); echo "Message sent!"; } If it outputs Message Sent when you submit the form and you dont get the email then it's a problem on the server's end. If it DOESN'T output Message sent then something is wrong and your 3 variables are not set (and thus the if is false)
  19. okay I think it's because I cant get the site to strip back slashes (\). How can I get it to do that lol. I've been using str_replace ex: $illegal = array("a", "b", "c",..., "<", ">", "/"...etc.) $var = str_replace($illegal, "", $var); but I cant include "\" in the array. At least I can't figure out how to do it. Ideas?
  20. That's strange...the participation one isn't supposed to ever error out. It searches the databases for the entries that the user has participated in and started. If there are 0 rows then it will say that there's nothing there (and it won't try to display anything so it shouldn't error out like that...) Did you happen to do anything for that to happen?
  21. uhm how can you do the xss code on the tracking page? I'm pretty sure I made it remove all letters and most characters. As for the full path discolure, best way to fix that would be to just change the or die(mysql_error()) to or die("some message"); right?
×
×
  • 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.