Jump to content

holowugz

Members
  • Posts

    46
  • Joined

  • Last visited

    Never

Everything posted by holowugz

  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.
  16. Hi, i was just wondering which functions i should use to cleans user input, so far i have: addslashes - (If magic quotes is not on) htmlentities strip_tags htmlspecialchars mysql_real_escape_string --- Is there any functions i have missed or any other way of inputting malicious code that i have not accounted for, if so is there a function to remove IT?
  17. hi i got it to work now, thought i would post the finished code: [code] $dir ="msn_files"; $currentDir = $dir . "/" . date('d-m-Y'); if (file_exists($dir)) {    $arrayFiles = glob("$dir/*");    if($arrayFiles){        foreach($arrayFiles as $filename) {               if($filename != $currentDir and $filename != $dir .'.htaccess'){                if(is_dir($filename)){                    $arrayFiles2 = glob("$filename/*");                       if($arrayFiles2){                       foreach($arrayFiles2 as $filename2) {                     chmod($filename2,0777);                       unlink($filename2);                     }                     }                 if($filename != $currentDir and $filename != $dir .'.htaccess'){                 rmdir($filename);                 }             }else{             unlink($filename);             }            }        }    } }[/code] Luke Brown
  18. Hi this little snippet of code when run should delete all the folders and the files in them from the directory msn_files except a directory which is called what ever the current date is. and it is just not working, the error i get is: Warning: rmdir(msn_files/20-05-2006): Directory not empty in (Line 108) which is all very well and good but my if statement should be stopping it from trying to delte the directory marked with whatever the date is, would really appreciate some fresh eyes [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /] [code] //directory name of directory to delte form $dir ="msn_files"; //directory we want to protect $currentDir = $dir . "/" . date('d-m-Y'); //if the directory exists procede if (file_exists($dir)) { //select all the folders and files in the main directory    $arrayFiles = glob("$dir/*"); //if there are folders and files in the directory proceed    if($arrayFiles){        foreach($arrayFiles as $filename) { //if the name of the file we are looking at is not the protected directory or called .htaccess then proceed               if($filename != $currentDir or $filename != $dir .'.htaccess'){ if it is a directory then proceed                if(is_dir($filename)){ //select all the files in the new directtory                    $arrayFiles2 = glob("$dir/$filename/*");                       if($arrayFiles2){                       foreach($arrayFile2s as $filename2) { //set them to 0777 so we can deltee them                     chmod($filename2,0777); //delete the files                       unlink($filename2);                     }                     } //make sure we dont delte the protected folder                 if($filename != $currentDir or $filename != $dir .'.htaccess'){ delete the folder now we emptied it                 rmdir($filename);                 }             }else{ //if it is not a folder then delete the file             unlink($filename);             }            }        }    } }[/code]
  19. I do not believe it is possible, if you want people to be able to view the information you you need to store it in a database or something similar. And then display it. But i am curious why exactly do you want to be able to do this?
  20. [!--quoteo(post=366902:date=Apr 20 2006, 06:19 PM:name=Darkness Soul)--][div class=\'quotetop\']QUOTE(Darkness Soul @ Apr 20 2006, 06:19 PM) [snapback]366902[/snapback][/div][div class=\'quotemain\'][!--quotec--] isn't simple you set different session names for each app? so, each app will use differente files to record sessions.. Never tested your idea, so, don't know.. ^^" D.Soul [/quote] when you say session names, i assume you mean the variable names.
  21. Ok i have a few questions. First of all i have two applications that run on my web server, and just as an experiment i logged into one of them, and then tried to acces a page on the other. Now that is because the login system is practically identical and requires the same user permissions. So techncially that is fine, but i want to make sure they log into each system first. Now i was thinking if i created a table for each one called session. and i stored teh session ID, User ID, Time, and IP. and on each page as a secuirity check i just make sure that the current session ID exists in the database. the information is entered upon login and deleted upon logout. would that work?
  22. This isnt really an appropriate topic or question for this forum. I have used vBulletin for a while and am afraid i do not know any subsilver themes for vBulletin. how ever there are many sites that sell themes a good one is extremepixels. But if you want free themes you can go to the official vbulletin modding site vbulletin.org Hope that helps Luke
  23. OH i did not know that at all, i dont know what i would have done, thankyou to the both of you ! :D
  24. Hi, i have been working on this for a while and it is killing me i am not too sure what to do. [code]mysql_select_db($database_connFish, $connFish); $query_rsCareerAwards = "SELECT * FROM career_record_data WHERE record_id = {$record_ID} AND class = 2 OR class = 1 ORDER BY date_Time ASC "; $rsCareerAwards = mysql_query($query_rsCareerAwards, $connFish) or die(mysql_error()); $row_rsCareerAwards = mysql_fetch_assoc($rsCareerAwards); $totalRows_rsCareerAwards = mysql_num_rows($rsCareerAwards);[/code] It when ever i run the query if the record_id is 1 it runs fine but if i run others it brings back some of the records in which the record_id is 1 and it shouldnt. is the query wrong or something?
  25. Oh i see, Ok fair enough ty very much
×
×
  • 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.