Jump to content

holowugz

Members
  • Posts

    46
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

holowugz's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi guys here is what i am looking to do, the user dumps a large amount of text into a text box, and submits it here is an example of a line of the text: 2008-04-19 00:01:31: 67.71.153.73 Spud [?] Basically date, time, IP, Username I need these to be resorted to display by date and time. //if user presses submit button if($_POST['Submit']=="Submit"){ //Remove whitespace from beginning and end, and remove the [?] from the text $_POST['textarea']= trim(str_ireplace(" [?] ","",$_POST['textarea'])); //insert into array, seperated by new line $alpha=explode("\n",$_POST['textarea']); $counter = 0; //for every element in the array put it into array cheese (creating multi dimensional array) foreach ($alpha as $value) { $cheese["$counter"]=explode(" ",$value); $counter++; } echo "</br>"; //sort array by date and then time array_multisort($cheese[0],SORT_ASC,SORT_REGULAR,$cheese[1],SORT_ASC,SORT_REGULAR); //debug function, remove before final release var_dump($cheese); echo "</br>"; echo "<table width=\"50%\" border=\"1\"> <tr> <td>Date</td> <td>Time</td> <td>IP</td> <td>Name</td> </tr>"; foreach ($cheese as $value) { echo " <tr> <td>$value[0]</td> <td>$value[1]</td> <td>$value[2]</td> <td>$value[3]</td> </tr>"; } echo "</table>"; } The problem is it will NOT sort correctly i just get a jumbled mess, can anyone help?
  2. Hi ty for the help, it is early in the morning over here so i am not thinking lol. ty again
  3. Hi i am having a slight problem with an if statement i need it to do the following: if the value of do in the request superglobal array is set to alter, and the person usergroup id is 6 OR their is a 6 in there membergroupids then execute some code. [code] $_REQUEST['do']= "alter"; $citac->userinfo['membergroupids'] = "1,2,3,4,5,6"; if($_REQUEST['do'] == 'alter' AND ($citac->userinfo['usergroupid'] == 6 OR in_array(6,array($citac->userinfo['membergroupids'])))){ echo "test"; } [/code] theoretically that should echo test but it doesnt, can anyone see something wrong? thanks in advance, Luke
  4. yeah i know, i mean considering that some users have like 20 images in their sig it is a nightmare for me. so i am thinking i was going to run it as a cron job and make it generate a text file with the names of people who are over limit or something? But do you know any other way to optomise it?
  5. Hi i wrote a script that would go through all of the members on my forums and check there signature image sizes: now it works great for one person but it is taking an extremely long time to go through the entire thing, and i was wondering if i had coded something wrong or someone knows a way to optomise the script: here is an example signature from the db: [code] [IMG]http://www.sighost.us/members/lalias/tyler1z.jpg[/IMG] [IMG]http://www.ufdf.com/sigs/officially-gay.png[/IMG][img]http://img97.imageshack.us/img97/7767/clanbitch9ns.png[/img][img]http://www.ufdf.com/sigs/ufdf-member.png[/img][img]http://img74.imageshack.us/img74/5104/clanslut8fk.png[/img][img]http://www.ufdf.com/sigs/moocat-lover.png[/img] [img]http://www.ufdf.com/sigs/sci-fi-freak.png[/img][img]http://www.ufdf.com/sigs/luke's-bitch.png[/img][img]http://www.ufdf.com/sigs/-canada.png[/img][img]http://www.ufdf.com/sigs/-gaypride.png[/img] [/code] [code] <?PHP set_time_limit(0); require_once('Connections/connPASSWORD.php'); mysql_select_db($database_connPASSWORD, $connPASSWORD); $query_RsSig = "SELECT u.username, t.signature FROM vb3_usertextfield t, vb3_user u WHERE (t.userid = u.userid) AND (t.signature <> '') AND (u.usergroupid = 26)"; $RsSig = mysql_query($query_RsSig, $connPASSWORD) or die(mysql_error()); $row_RsSig = mysql_fetch_assoc($RsSig); $totalRows_RsSig = mysql_num_rows($RsSig); //set variables $imageLine = 1; $height = 0; $width = 0; $maxheight = 500; $maxwidth = 600; //create an array called data where the assosiative name is the persons username, and set the value to the signature value do { $data[$row_RsSig['username']] = $row_RsSig['signature']; } while ($row_RsSig = mysql_fetch_assoc($RsSig)); //valuedata is username cheesedata is the signature foreach ($data as $valuedata => $cheesedata){ //create an array called sigdata and and split it line by line. $sigdata = explode("\r\n",$cheesedata); //create a loop for every single line of the array foreach ($sigdata as $value => $cheese){ //check if the data matches the regex and if it does put the link to the image in the matches array. preg_match_all('/\\[IMG\\](.+?)\\[\/IMG]/i', $cheese, $match); //get the number of images in the current matches array $numImages = count($match[1]); if($numImages != 0){ foreach ($match[1] as $value1 => $cheese1){ $imagedata = getimagesize($cheese1); $height1 = $imagedata[1]; if($height1 > $height){ $height = $height1; } $width = $width + $imagedata[0]; $siginfo["Line$imageLine"]['width'] = $width; $siginfo["Line$imageLine"]['height'] = $height; $width = 0; $height1 = 0; $height = 0; } $finalInfo['height'] = $finalInfo['height'] + $siginfo["Line$imageLine"]['height']; if($siginfo["Line$imageLine"]['width'] > $finalInfo['width']){ $finalInfo['width'] = $siginfo["Line$imageLine"]['width']; } } //reset variables $imageLine ++; $sigdata = array(); $siginfo = array(); } if($finalInfo['height'] > $maxheight or $finalInfo['width'] > $maxwidth){ echo $valuedata ; echo "<br/>"; var_dump($finalInfo); echo "<br/>"; } $finalInfo = array(); //end of main foreach loop } mysql_free_result($RsSig); ?> [/code]
  6. there is another alternative i had this problem before the way i would do it for yours would be: $productsearch = $_GET['productsearch']; SELECT * FROM data WHERE (products LIKE '%,$productsearch,%') OR (products LIKE '%,$productsearch') OR (products LIKE '$productsearch,%') OR (products LIKE  '$productsearch') lets say that $productsearch was 16, that query will check your Comma seperated list for each of the following: products LIKE '%,$productsearch,%' = ,16, (This checks to see if 16 is inbetween other values likle this 12,13,15,16,21,43) products LIKE '%,$productsearch' = ,16 (This checks to see if 16 is at the end of the list like this 12,13,16) products LIKE '$productsearch,%' = 16, (this checks to see if 16 is at the beginning of the list like this 16,12,13,14) products LIKE  '$productsearch' = 16 (This checks to see if 16 is just on its own)
  7. Making a forum is a sifficult thing to do if you want a secure forum. But if you have no idea bout PHP i would advise you either look at free forums like phpbb www.phpbb.com or read the tutorials so you have an udnerstanding of PHP otherwise if you do not udnerstand what we are talking about we wont be able to help you.
  8. *resolved* SELECT * FROM vb3_user WHERE membergroupids LIKE '{$dept_id},%' OR membergroupids LIKE '%,{$dept_id}' OR membergroupids LIKE '%,{$dept_id},%' that works, cheers for the help though
  9. believe me i would have done it like that, but unfortunately this is from our vbulletin user table. so i cant change it. any other way?
  10. Hey i have a problem, on my site i have a script called departments.php an example link to this script is departments.php?ID=24 the script checks if ID is a number and then runs the following query: $query_RsDeptMembers = "SELECT * FROM vb3_user WHERE membergroupids LIKE '%{$dept_id}%')"; the column membergroupids is a comma seperated list of all of the usergroups this person is a member of. now the query works fine, but if for example they was another member who was NOT in usergroup 24 so 24 would not be in the field membergroupids for him, but he was a member of usergroup 124, then he would be selected. i did think about altering the query so it was like: SELECT * FROM vb3_user WHERE membergroupids LIKE '%,{$dept_id},%') But if ID is at the beginning then there would be no , at the beginning and if the ID was the last one in the list there would be no , at the end. Is there another way i can search the membergroupids field to make sure that the number is there, and that it is not part of another number?
  11. Hi is there a function that would convert numbers to their string counterparts IE: 1 to One and if so what is the function called?
  12. *resolved* [code] foreach($_POST as $key => $value){ if (!get_magic_quotes_gpc()) {    $$key = htmlentities(addslashes($value)); } else {    $$key = htmlentities($value); } } [/code]
  13. Ok the problem i am having is this, if i have a textfield called username, and in that field i input <script>. it should come out as [code] &lt;script&gt; [/code] in HTML and <script> on the screen. But it doesnt, but if i run htmlentities on $username it does but shouldnt that have been processed in the code above/
  14. Hi thanks for the tip, would this work: [code] foreach($_POST as $key => $value){ if (!get_magic_quotes_gpc()) {    $key = htmlentities(addslashes($value)); } else {    $key = htmlentities($value); } } [/code]
  15. Hi, i am trying to write a function to clean all input from the $_POST array, and it is well not working. [code] function cleanse($array){ foreach($array as $key => $value){ if (!get_magic_quotes_gpc()) {    $key = addslashes($value); } else {    $key = $value; } else { $error['"$key"'] = 1; $key = htmlspecialchars($value); } } } [/code] and i would basically call [code] cleanse($_POST); [/code] but it is not working, i get an unexpected if error. i have never written a function so i would really apopreciate some help.
×
×
  • 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.