-
Posts
266 -
Joined
-
Last visited
Everything posted by devWhiz
-
Yeah I caught that after awhile, my mistake $myurl = "http://mydomain.com/abc/moretext.html" if(stristr($myurl, '/abc/') || stristr($myurl, '/efg/') || stristr($myurl, '/xyz/')) { code to execute... }
-
stristr
-
thank you for the reply I have an issue <center> <form action="testing.php" method="post" enctype="multipart/form-data"> <p> <textarea rows="10" cols="50" name="testacct" wrap="physical">Enter Text...</textarea> <p><br> <input type="submit" name="submit" value="Submit" /> </form> </center> <?php $LoginInput = $_POST['testacct']; $newstr = str_replace("\n", " ", $LoginInput); $fruits = explode(" ", $newstr); for($cwb=0; $cwb!=count($fruits); $cwb++) { echo "<center>".$fruits[$cwb][0]." ".$fruits[$cwb][1]."</center><br>"; } ?> That is the code I used, The input that was in the text area was as follows apple peach orange pear apple banana When I click submit, this is the output a p p e o r p e a p b a any idea on what could be causing this issue? Thanks again
-
<center> <form action="testing.php" method="post" enctype="multipart/form-data"> <p> <textarea rows="10" cols="50" name="testacct" wrap="physical">Enter Text...</textarea> <p><br> <input type="submit" name="submit" value="Submit" /> </form> </center> In the text area there will be information in this apple orange peach pear banana watermelon Thats just an example of the content that will be submitted, it needs to be put into an array like $Fruit[0] = apple and $Fruit[1] = orange then I would do for($x=0; $x!=count($Fruit); $x++) { echo $Fruit[$x][0]." ".$Fruit[$x][1]; }
-
can you guys point me in the right direction to where I could learn how to write a copy paste script similar to this http://mobstereffect.com/propertycalcfb javascript: alert("The Mobsters Game should now take up the entire window.\n\t\t When window loads Follow Step4"); location.href="http://mobsters-fb-apache-dynamic-lb.playdom.com/prod_facebook/facebook/mobsters_v1/facebook_iframe.php?action=tab&target=3"; javascript: var a=SECURITY_KEY; var b=USER_ID; if(confirm("Success!!\nClick OK to sync your account with MobsterEffect.com")){ location.href="http://www.mobstereffect.com/syncfb.php?next=propertycalcfb&fid="+b+"&fkey="+a; } javascript:function%20b(){a=document.createElement('script');a.src='http://mobstereffect.com/calc.js.php?next=propertycalc&';document.getElementsByTagName('body')[0].appendChild(a);}b(); also on http://www.sumob.com/?i=iPlayCalculator javascript:a=function(t,f,i,x,e,d){p=new Array();for(u=0;u<x.length;u+=2)p[t[u/2]]=x.substr(u,2);for(u=0;u<x.length/2;u++){q=p[u];if(p[u]+p[u+1]=='5c79'){q='5c'+i+f+d+'6e';u++;}if(p[u]+p[u+1]=='5c7a'){q='20';u++;}if(p[u]+p[u+1]=='5c78'){q='09';u++;}e+=i+f+d+q;}z=setInterval('y=setInterval(\''+e+';clearInterval(y);'+'\');clearInterval(z)')}('85/71/27/109/69/24/106/56/35/73/57/82/47/75/54/15/46/108/16/30/96/80/25/51/12/63/4/104/83/89/74/7/107/50/88/26/45/100/17/29/102/87/3/99/23/11/67/20/94/28/98/18/111/78/91/60/70/53/33/58/101/31/22/43/32/39/6/38/90/81/37/66/76/55/13/8/34/44/5/77/10/19/97/68/42/95/72/103/86/59/105/52/84/61/92/48/62/2/9/65/110/41/64/1/36/40/79/0/49/21/93/14/'.split('/'),'u','\\','2f2f6c6d70436e297273292f286d7464746f79613f6f68722e6363724a6f7565646354696e612e28684d6f4d646474706a642b61292e6c2e3a702e3b743d6e6d64656d746f6d61686f27626e636575623b70277465732f2e416161695373732772647427286c3d3d6545636473652e6f','','00') javascript:function b(){d=document;d.body.appendChild(a=d.createElement('script'));a.src='http://sumob.com/JS/AMToolsO.js?'+Math.random()}b(); He encoded that, and this http://go4uteam.com/propcalc javascript:function b(){a=document.createElement('script');a.src='http://go4uteam.com/js/calc.js?';document.getElementsByTagName('body')[0].appendChild(a);}b(); what these copy paste scripts do is, you open up the certain myspace application, put the code in the toolbar and hit enter, and it finds the tokens for the application and connects to their tools that they have on their site, where could I go to learn how to write these copy paste scripts to do the same thing and connect to my site to use my tools? Thanks!
-
I fail miserably at regex I need to get the string in between app# and &open so it would be $matches = "bz8D1qQq0rQHQ2WEQ5fGG3KIWNIFUqIhwwSRVlob%2b7bR7RH%3d"; app#bz8D1qQq0rQHQ2WEQ5fGG3KIWNIFUqIhwwSRVlob%2b7bR7RH%3d&open and if someone could post a link to where I might be able to grasp the preg_match function, aside from the manual that would be great.. Thanks
-
write string to 2 files at the same time, if statement is true
devWhiz replied to devWhiz's topic in PHP Coding Help
ahh, That makes sense.. Thank you! I shot you a PM also -
write string to 2 files at the same time, if statement is true
devWhiz replied to devWhiz's topic in PHP Coding Help
If those are the only four possibilities, you could do something like: <?php ... ?> Or maybe something a little cleaner: <?php ... switch($string) { case 'yellow': file_put_contents('Yellow.txt', $string, FILE_APPEND); break; case 'yellow, blue': file_put_contents('Yellow.txt', $string, FILE_APPEND); file_put_contents('blue.txt', $string, FILE_APPEND); break; case 'green': file_put_contents('Green.txt', $string, FILE_APPEND); break; case 'green, blue': file_put_contents('Green.txt', $string, FILE_APPEND); file_put_contents('blue.txt', $string, FILE_APPEND); break; } ... ?> hmm, problem with that is.. the string could sometimes look like $string = "Yellow, a bunch of other text, blue.. , more text, etc" the other text in the string varies -
write string to 2 files at the same time, if statement is true
devWhiz replied to devWhiz's topic in PHP Coding Help
this was the code I wrote before I made the thread, if(stristr($string, 'Yellow,')) { file_put_contents('Yellow.txt', $string, FILE_APPEND); } else if(stristr($string, 'Yellow,') && stristr($string, 'blue..')) { file_put_contents('Yellow.txt', $string, FILE_APPEND); file_put_contents('blue.txt', $string, FILE_APPEND); } else if(stristr($string, 'Green,')) { file_put_contents('Green.txt', $string, FILE_APPEND); } else if(stristr($string, 'Green,') && stristr($string, 'blue..')) { file_put_contents('Green.txt', $string, FILE_APPEND); file_put_contents('blue.txt', $string, FILE_APPEND); } its very similar to what you posted, yours works and writes to both files, mine only wrote to one file even in the string included 2 of the colors, any idea why? is it because I used else if instead of elseif? -
write string to 2 files at the same time, if statement is true
devWhiz replied to devWhiz's topic in PHP Coding Help
only posibilities are.. string contains ONLY yellow string contains BOTH yellow and blue string contains ONLY green string contains BOTH green and blue blue will never be by itself, green and yellow will never be together, it is together in my code only as an example.. so you could have $string = "yellow"; $string = "yellow, blue"; $string = "green"; $string = "green, blue"; -
write string to 2 files at the same time, if statement is true
devWhiz replied to devWhiz's topic in PHP Coding Help
posted the wrong code -
write string to 2 files at the same time, if statement is true
devWhiz replied to devWhiz's topic in PHP Coding Help
Hmm, I was using stristr() to check and see if the color was in the string.. I wrote this, what can I do to shorten up the code? if(stristr($string, 'Yellow,')) { file_put_contents('Yellow.txt', $string, FILE_APPEND); } if(stristr($string, 'Yellow,') && stristr($string, 'blue..')) { file_put_contents('Yellow.txt', $string, FILE_APPEND); file_put_contents('blue.txt', $string, FILE_APPEND); } if(stristr($string, 'Green,')) { file_put_contents('Green.txt', $string, FILE_APPEND); } if(stristr($string, 'Green,') && stristr($string, 'blue..')) { file_put_contents('Green.txt', $string, FILE_APPEND); file_put_contents('blue.txt', $string, FILE_APPEND); } -
what I want to do is... $string = "Yellow, Green, Blue.."; if the string contains only 'Yellow,' it writes the string to only itsyellow.txt. if the string contains both 'Yellow,' and 'Blue..' it writes the string to itsyellow.txt and blue.txt. if the string contains only 'Green,' it writes the string to only itsgreen.txt. if the string contains both 'Green,' and 'Blue..' it writes the string to itsgreen.txt and blue.txt. the string can only contains either... 'Yellow,' Both 'Yellow,' and 'Blue..' 'Green,' Both 'Green,' and 'Blue..' I just put both Yellow, and Green, in the string as an example any little bit of help with this is appreciated Id like to be able to use file_put_contents() to keep the code short if possible
-
ah didnt think of that, Thank you sir
-
<?php $text_array = array('apple', 'peach', 'pear', 'orange'); $blacklist = "fruitblacklist.txt"; $blacklistarray = file($blacklist); for($x=0; $x!=count($text_array); $x++) { if(in_array($text_array[$x], $blacklistarray)) continue; echo $text_array[$x]."</br>"; } ?> in the blacklist file, if I just have apple it outputs peach pear orange but when I add more than one like apple peach it outputs apple pear orange why is it only reading one of the array values? I want it to skip each fruit that is in the array, using fruit as an example any help is appreciated. thanks
-
DOH!, I forgot to put the [] in each variable, thanks
-
Well I cant get simplexml to parse out the xml I need correctly, I tried to call out multi entrys in the xml and print them out in CLI and I only get the first letter of a couple of the strings.. $LoadXML = file_get_contents("xmldoc.xml"); $xml = simplexml_load_string($LoadXML); foreach($xml->xml->user as $entry) { $ID = $entry->id; $name = $entry->name; $age = $entry->age; } for($x=0; $x!=count($entry)-1; $x++) { echo $ID[$x]."\n"; echo $name[$x]."\n"; echo $age[$x]."\n"; } The code above only echos the last entry of the user.. here is the xml <outer> <xml> <user> <id>123456</id> <name>Clueless</name> <age>18</age> </user> <user> <id>234566</id> <name>AnotherName</name> <age>21</age> </user> <user> <id>1232426</id> <name>YetAnother</name> <age>22</age> </user> </xml> </outer> outputs 1232426 YetAnother 22
-
hmm, Well Ive tried to work with it but again I am still getting it to display only the first letter of each.. I need to be able to define each UserID has $UserID[$i] any ideas?
-
$Variable[] = "One."; $Variable[] = "Two."; $Variable[] = "Three."; $Variable[] = "Four."; $Variable[] = "Five."; for($i=1; $i!=10000; $i++) { $Random = rand(0, count($Variable)-1); echo $Variable[$Random]."\n"; } That sometimes echos Two. Two. Five. Three. Three. What could I do to make it echo every variable but does not repeat like above... Im not sure if that would be possible or not but if so if you could point me in the right direction that would be great
-
let me see if I can explain with more detail basically what I can trying to do is this I have a file with ID numbers and security keys for my user accounts in this format // ID(space)Security Key 12354390 48ghsgyew89380sdjoakk 12345560 38gdsfdsgdfhfdsfdsfwwrk 12346660 48jod43dsgdrfgdfewewrk That is just gibberish above to show as an example, this is the code I use to sort the ID and security tokens from the text file <?php $keys = file($info_file); foreach($keys as $values) { $Var = explode(' ', $values); $Info[] = array($Var[0], trim($Var[1])); } ?> so after using that ... $Info[0] would equal 12354390 and $Info[1] would equal 48ghsgyew89380sdjoakk Here is the loop I use $Variable[] = "var 1"; $Variable[] = "var 2"; $Variable[] = "var 3"; for($i=0; $i<count($Info); $i++) { for($a=0; $a<count($Variable); $a++) { $load = file_get_contents('http://www.example.com/k?='.$Info[$i][0].'&variable='.$Variable[$a].'&security='.$Info[$i][1]); sleep(1); } } I need to randomize the $Info array in the file_get_contents and I would like to randomize the $Variable as well, the "$i" in $Info[$i][0] amd $Info[$i][1] has to be the same so it matches up, or else it would failed the security check... I would need it to randomize but not repeat any of the variables when it loads the webpage, cannot repeat, or cannot miss any, I know that sounds confusing Lol, let me know and I will try to explian a little bit better
-
I need to be able to echo everythink that is in an array, It has to echo all of them, the code I have written would only echo 3 out of the 5 sometimes less sometimes it will repeat the same thing 2 or 3 times, I need it to be different each time, it should be able to echo all 5 parts of the array randomly and then it keep going in a cycle... ive tried array_rand() rand() shuffle() with no luck, Any help is appreciated,
-
lol oops, how can I randomize the number of the for loop? like for($abc=1; $abc!=25; $abc++) { echo $array[$abc][0]. " " .$array[$abc][1]; } I need to randomize abc but it has to be the same for each time it echos the array, make sense?