|
|
|
|
![]() ![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members
Posts: 164 Joined: 2-July 06 From: England Member No.: 25,974 |
Post
#1
Jul 2 2006, 08:26 PM
Here is a function you can use to generate a simple random password for whatever use ;-) CODE <? function rand_pass($numchar){ $string = str_shuffle ("abcdefghijklmnopqrstuvwxyz1234567890"); $password = substr ($string, 1, $numchar); return ($password); } //example echo rand_pass('8'); // will return an 8 character long random password of numbers and letters like c8k4ss42 ?> [note=serverph]CODE tags added.[/note] Here is an extremly usefull search function that will search a directory and its subdirectories for files including the given keyword and display a link to these files. I have made some great file search systems for wap sites using this ;-) CODE <? function search($target, $directory){ if(is_dir($directory)){ $direc = opendir($directory); while(false !== ($file = readdir($direc))){ if($file !="." && $file != ".."){ if(is_file($directory."/".$file)){ if(preg_match("/$target/i", $file)){ $size = round(filesize($directory."/".$file)/1024,1); echo "<a href=\"$directory/$file\">$file ($size KB)</a><br>"; } }else if(is_dir($directory."/".$file)){ search($target,$directory."/".$file); } } } closedir($direc); } return; } ?> [note=serverph]CODE tags added.[/note] If you use (or have ever stopped using mobiliichat due to the stupid clone bug...) READ THIS! CODE <? //anti-CLONE v1.0 by wappy// //this i mainly designed for the cloning problem thats bugged mobiliichat (a cool wap chat script i used as base code for my WAP CHAT) since its release. Hope you can make good use of it. I have lol!!!!// //© wappyCULT 2006-2007// //!!DO NOT REMOVE HEADER!!// //if your using this on your site then sure remove this crap! But if you plan to give it out please keep the original contents intact!!!!!// //!!PUT THE FUNCTION UP HIGH ON YOUR PAGE SO IT CAN BE USED ANYWHERE!!// //build our function anti-CLONE!!!!! This is most of the important stuff out the way but we need to do a little more protection after he he he he he... Dumb clones..// function anti_clone($string){ return ereg_replace ("[^[:space:]a-zA-Z0-9*_:-]", "", $string); } //ENTER THIS PART WHERE YOU NEED IT!// //enter the value you want to protect from cloning, for mobilichat it is $nimi or you can see the general idea by now you can work it out and make your own layout... God im bored pmpl...// $value_to_protect = YOUR_VALUE; //use our anti-CLONE function!!!!!// $value_to_protect = anti_clone($value_to_protect); //add even more protection from enters an returns!!!!!// $value_to_protect = ereg_replace("\n", "", $value_to_protect); $value_to_protect = ereg_replace("\r", "", $value_to_protect); //strip any unwanted tags// $value_to_protect = striptags ($value_to_protect); //make sure all letters are small!!!!!// $value_to_protect = strtolower ($value_to_protect); //enter your value again here... Last bit now pmpl// YOUR_VALUE = $value_to_protect; //THATS IT YOUR VALUE WILL NOW BE SAFE FROM spaces, symbols, funny A's, tags, enters, returns an all the other crap these idiots try ha... Im SURE ITS SAFE NOW! Someone should of done this along time ago!! If you find a gap mail me asap with details!!// //if you try and claim you wrote this grrr at you, it because i spent hours on this cool mobiilichat BUG FIX!! lol!!!!// //if you can't get this to work or need help etc... I couldn't give a ????... If however you wanna share/trade scripts etc mail me at wappyCULT@gmail.com// //wappy from wappyCULT// ?> [note=serverph]CODE tags added.[/note] This is a good example of the strrev() command//// I used this simple function to determine the file extension of files on my site so i can put a unique icon next to each file thats listed. If you would like the icons (they are very small as designed for mobile/wap sites) you can get them at my wap site http://cul.t34.biz (please ignore the rude message at top its a test site i use for stuff ok) CODE <? //icon code $icon = "unknown.gif"; $rev = strrev ($file_name); $exp = explode (".", $rev); $true = strrev ($exp[0]); $trueext = strtolower ($true); if ($trueext=="zip" OR $trueext=="rar" OR $trueext=="gz"){$icon = "zip.gif";} if ($trueext=="amr"){$icon = "amr.gif";} if ($trueext=="midi"){$icon = "midi.gif";} if ($trueext=="mid"){$icon = "mid.gif";} if ($trueext=="gif"){$icon = "gif.gif";} if ($trueext=="jpeg"){$icon = "jpeg.gif";} if ($trueext=="jpg"){$icon = "jpg.gif";} if ($trueext=="jad"){$icon = "jad.gif";} if ($trueext=="jar"){$icon = "jar.gif";} if ($trueext=="sis"){$icon = "sis.gif";} if ($trueext=="bmp"){$icon = "bmp.gif";} if ($trueext=="wbmp"){$icon = "wbmp.gif";} if ($trueext=="txt"){$icon = "txt.gif";} if ($trueext=="avi"){$icon = "avi.gif";} if ($trueext=="thm"){$icon = "thm.gif";} if ($trueext=="nth"){$icon = "nth.gif";} if ($trueext=="png"){$icon = "png.gif";} if ($trueext=="mmf"){$icon = "mp4.gif";} if ($trueext=="wav"){$icon = "wav.gif";} ?> [note=serverph]CODE tags added.[/note] Here are a few snippets i was given by PhoenixBytes ;-) CODE ///////////////////////////////////////////////////////////////////////////////////// // // this is the code i use for my search engine, // the first if statement checks to see if this process has been done before or not, // $stringy is only passed from the previous page with the cearch box on it, not from any 'back' or next links. // the back and next links pass the $trimm variable // // so, if $trimm is empty, we must run $stringy through this code. // if trim is NOT empty, we put $trimm through instead // // both variables are imported with the $malteasers variable // ///////////////////////////////////////////////////////////////////////////////////// if ($stringy == "") $malteasers = "$trimm"; else $malteasers = "$stringy"; $trimmed = trim($malteasers); // this determines what characters can be used as a splitter, i.e 'space (%20)' // this is so you can search for "chicken soup", "chicken" and "soup" all in one single query! $trimmed_array = explode(" .%20.%2C.%26.%3F.%40",$trimmed); // this foreach call was cut from my code (my code is on a loop) // so this may work straight away or may need some editing, foreach ($trimmed_array as $trimm); // look for a slash if (preg_match ("/\"/i", "$trimm")) { // do something with a function i'm sure is wrong, i may have taken a long way round when i was less experienced. // $trimm = eregi_replace("/\"","",$trimm); might have worked instead of all the minusers and nudgers being needed! $minuser = "2"; $trimm = eregi_replace("\"","",$trimm); $preparetoslice = strlen("$trimm"); $sliceoffset = ($preparetoslice - $minuser); $nudger = "1"; $trimm = substr($trimm,$nudger,$sliceoffset); } $query = "select count(*) from my_links where keywords LIKE '%$trimm%' AND valid='yes'"; $result = mysql_query($query); $count = number_format(mysql_result($result,0,"count(*)")); // // if you wan't an ACCURATE search, let your text box pass a variable // called $stringy // // then replace the database code with your own, but, keep the "where keywords LIKE '%$trimm%'" part! // // and that should be it, good luck with search! // ///////////////////////////////////////////////////////////////////////////////////////////////// // // // Random link generation: // $query = "SELECT * from randylinks ORDER BY RAND(" . time() . " * " . time() . ") LIMIT 1"; $result = mysql_query($query); $num_rows = mysql_num_rows($result); $rowrandy = mysql_fetch_array($result); $linkname = $rowrandy["linkname"]; $linkurl = $rowrandy["linkurl"]; $randylink = "<a href=\"$linkurl\">$linkname</a>"; // // // just alter your database details to get this one working // you need a db table that supplies a linkurl and a linktext // // optionally you can easilly add an image into it to create an image link // ////////////////////////////////////////////////////////////////////////////////////////////////// // // MAKE WML COMPAT // // this is my make_wml_compat function, it should work though i have had issues with the carriage returns! // function make_wml_compat($string) { $string = ltrim($string); $string = ereg_replace(chr(13),"<br/>",$string); $string = ereg_replace(chr(10),"<br/>",$string); $string = ereg_replace("¶","<br/>",$string); $string = ereg_replace("µ"," ",$string); $string = ereg_replace("===","<br/>",$string); $string = ereg_replace("\n","<br/>",$string); $string = ereg_replace("\r","<br/>",$string); $string = ereg_replace("&","&",$string); $string = ereg_replace("\\$","$",$string); $string = ereg_replace("\","£",$string); $string = ereg_replace("<","<",$string); $string = ereg_replace(">",">",$string); $string = ereg_replace("","-1",$string); $string = ereg_replace("","-2",$string); $string = ereg_replace("","-3",$string); $string = ereg_replace("","-euro",$string); $string = ereg_replace("","©",$string); $string = ereg_replace("","®",$string); $string = ereg_replace("~club","♣",$string); $string = ereg_replace("~spade","♠",$string); $string = ereg_replace("~heart","♥",$string); $string = ereg_replace("~diamond","♦",$string); $string = ereg_replace("~1","¹",$string); $string = ereg_replace("~2","²",$string); $string = ereg_replace("~3","³",$string); $string = ereg_replace("~half","½",$string); $string = ereg_replace("~quart","¼",$string); $string = ereg_replace("~euro","€",$string); $string = ereg_replace("~dot","•",$string); return $string; } // // // this SHOULD work, however, different servers run different versions of php etc, so if you get an error on // say, line 3452345, then find the symbol on that line and google php escape %symbol% // an escape is to stop php parsing it, look at the dollar sign up there, // it's escaped with two back slashes. // // you can use the above function like this: make_wml_compat("$text"); // it will do nothing if you don't call it. // // enjoy! /////////////////////////////////////////////////////////////////////////////////////////////////// ©PhoenixBytes [note=serverph]CODE tags added. and finally merged FIVE successive posts in same thread. warning served as well. please review trap17 forum rules & TOS here.[/note] |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members
Posts: 1,052 Joined: 16-October 04 From: Houston, Tejas :D Member No.: 1,774 |
Post
#2
Jul 2 2006, 08:27 PM
Oooh, nifty cool. Reminds me of a Firefox plugin for encrypting passwords. Very nice |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members
Posts: 164 Joined: 2-July 06 From: England Member No.: 25,974 |
Post
#3
Jul 3 2006, 12:20 AM
Yeah the random password thing can come in handy for email registration etc.
|
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members
Posts: 183 Joined: 24-July 06 From: Cape Town Member No.: 27,194 |
Post
#4
Aug 2 2006, 04:58 PM
But rememeber, even fixing the scripts wont help sometimes because you have just released your wappy_anti_clone and now hackers and other misfits can maybe get around it. Thats normally what happens - bugs are fixed just to have more bugs formed |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members
Posts: 164 Joined: 2-July 06 From: England Member No.: 25,974 |
Post
#5
Aug 2 2006, 05:41 PM
sigh.. maybe i should stop releasing stuff then juice? Eh look dude there are NOT many people like dj.dance who will stalk and try to ruin everything i do, there is something wrong with people like that. If you install that it WILL MAKE IT HARDER BY FAR TO DO IT. have you seen me get cloned yet? nO. I don't know why i bother sometimes. When your on top jealous spoilt brats just try to bring you down. To be honest i thought about banning both the popular sa networks from my site all together as all the trouble comes from this country. Well at least 90percent of it does anyway. It drives me CRAZY and here is my escape, i really don't want to talk about the dark side of wap here ok.
|
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members
Posts: 628 Joined: 20-May 06 Member No.: 23,968 |
Post
#6
Aug 2 2006, 06:06 PM
D you mind if I put this stuff in my source code wiki? I will give you credit if you do allow me to.
|
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members
Posts: 164 Joined: 2-July 06 From: England Member No.: 25,974 |
Post
#7
Aug 2 2006, 06:18 PM
yes by all means :-) you can use it :-) what do you mean by credit like a link? If yes my wap site is http://cult.trap17.com or my web site is http://cult.trap17.com/forum :-) im wappy from © wappyCULT I hope you can make good use of these snippets :-) |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members
Posts: 628 Joined: 20-May 06 Member No.: 23,968 |
Post
#8
Aug 2 2006, 06:22 PM
I meant linking to this topic from the wiki page, but I can link to your site if you wish. Thanks!
This post has been edited by Tetraca: Aug 2 2006, 06:24 PM |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members
Posts: 164 Joined: 2-July 06 From: England Member No.: 25,974 |
Post
#9
Aug 2 2006, 06:42 PM
yes thanks i would rather you link to my site if possible. Wap or web i don't mind. Enjoy :-) |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members
Posts: 155 Joined: 15-July 06 Member No.: 26,695 |
Post
#10
Aug 2 2006, 11:40 PM
Come on wappy I'm from sa and all I do is defend you aganst dj and his little kid followers.The only thing is that sa's got some of the best hackers in the world.
|
![]() ![]() |
Similar Topics
| Topic Title | Replies | Topic Starter | Views | Last Action | ||
|---|---|---|---|---|---|---|
![]() |
1 | wappy | 160 | 4th July 2006 - 06:22 AM Last post by: BuffaloHELP |
||
![]() |
1 | maddog39 | 461 | 1st February 2005 - 10:30 AM Last post by: bjrn |
||
![]() |
19 | imacul8 | 1,081 | 5th October 2006 - 07:47 AM Last post by: tractor |
||
![]() |
10 | dLz | 1,341 | 5th October 2006 - 07:55 AM Last post by: tractor |
||
![]() |
1 | wappy | 225 | 31st July 2006 - 04:45 PM Last post by: husker |
||
![]() |
2 | imacul8 | 1,173 | 9th January 2007 - 10:07 AM Last post by: slu |
||
![]() |
3 | wappy | 1,755 | 24th February 2008 - 09:36 AM Last post by: |