Jump to content

desithugg

Members
  • Posts

    281
  • Joined

  • Last visited

    Never

About desithugg

  • Birthday 02/12/1992

Contact Methods

  • MSN
    pakiboi44@hotmail.com
  • Website URL
    http://www.pca.x3teamz.net

Profile Information

  • Gender
    Male
  • Location
    Scarborough

desithugg's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Hi, I'm trying to convert a function someone wrote for me in PHP a while back which returns the text between two objects in an array. For example. text="[saad]hello[/saad]sffsad90aa89a8da[saad]bye[/saad]"; found=findText("[saad]","[/saad]",text); //found[0] would return hello //found[1] would return bye Below is what I've wrote, but it doesn't seem to be working. I believe the problem is the !==, anybody else have a clue? function mySubStr(strP,startP,endP){ if(endP==0) endP=strP.length-startP; return strP.substr(startP,endP); } function myIndexOf(strP,searchP){ return strP.indexOf(searchP); } function findText(openPin,endPin,hayStack){ var textFound = new Array(); openPin = openPin.toLowerCase(); endPin = endPin.toLowerCase(); var opLength = opLength.length; var epLength = epLength.length; var hsCheck = hsCheck.toLowerCase(); do{ opPos=myIndexOf(hsCheck,openPin); if(opPos!==false){ epPos=myIndexOf(mySubStr(hsCheck,opPos+opLength,0),endP); if(epPos!==false){ textFound[] = mySubStr(hayStack,opPos+opLength,epPos); hayStack = mySubStr(hayStack,opPos+opLength+epPos+epLength,0); hsCheck = hayStack.toLowerCase(); } } }while((opPos!==false) && (epPos!==false)); return textFound; }
  2. Umm I'm not totally sure what you mean but why don't you just use preg/str replace to add \n to the string so. <?php $bbcode = array("'\</(.*?)\>'is" => "</\\1>\n"); $xml = preg_replace(array_keys($bbcode), array_values($bbcode), $xml); ?> something like that could work
  3. well my monitr pin was out of place so i opened my pc and put it back properly. in the processi had to disconnect some wires fom the mother board. i've tried putting them back but my keyboard wont work. the wires are labled usb(3 holes),gnd(1 hole)-there's two sets of those wires. as for the pins theres 2 rows [back row 5 pins, front 4] does anyone know what order they go back in, i get an error saying [overload in one of the usbs] when i connect them. ive tried countless combos, using the onscreen keyboard is tiring. any help is appreciated, sorry for the spam but searching on google could take forever without the keyboard for a new forum. thanks
  4. Without trying to be nasty, that is some seriously poor reference material. I'm aware, I didn't add any comments and stuff. But I have other things to do. I'm pretty sure he can make out how to fetch single rows form the database now.
  5. Here I rewrote the whole thing for you. Give it a try. <?php $pokemon= Bulbasaur; $Valid_User= $_SESSION['valid_user']; $result = mysql_query("SELECT * FROM dbUsers where username='".$Valid_User."'") or die(mysql_error()); $row = mysql_fetch_array( $result ); $promo_row = $row['promo']; $result = mysql_query("SELECT * FROM pokemons where username='".$Valid_User."' order by position desc limit 1") or die(mysql_error()); $row = mysql_fetch_array( $result ); $positioncheck = $row['position']; if(!isset($positioncheck) OR $positioncheck=="" OR $positioncheck=="0"){ $positioncheck=1; }else{ $positioncheck = ($positioncheck+1); } if($positioncheck>6){ $positioncheck="box"; } if($promo_row!="No"){ echo "Sorry, ".$Valid_User." you already have the pokemon."; exit; }else{ echo "Congrats, you got the promo."; mysql_query("INSERT INTO pokemons (username, pokemon, position) VALUES('".$Valid_User."', '".$pokemon."','".$positioncheck."')")or die(mysql_error()); mysql_query("UPDATE dbUsers SET promo='Yes' WHERE username='".$Valid_User."'"); } ?> Next time use it as a reference when fetching information from the database.
  6. The variable $Valid_User isn't being defined properly anywhere. Trying using echo to make sure the $Valid_User variable is set. So try putting echo $Valid_User; at the top to make sure it's being set.
  7. Well I have a swf file. I'm trying to send POST variables from the flash movie to a page and I want that page to open up in a new window. I'm trying to do a test first just to find out how it works. Actionscript: on(press){ send_lv = new LoadVars(); send_lv.say = "asdadsads"; send_lv.send("http://pn-network.net/rectanle.php","_BLANK","POST"); } PHP: <? echo $_POST['say']; ?> Now everything works fine except the variables are being sent as GET and not POST. So when I click on the button the window that opens up is "http://pn-network.net/rectanle.php?say=asdadsads". I don't want the variables to appear in the URL I want them to be passed using the POST method. I've been trying for two days. I've tried getURL and everything I could find but no luck. Any help is greatly appreciated, thanks.
  8. umm. Well I didn't see anything wrong with doing this. Because the website allows users to host images for free (without requiring login). That's basically what I'm doing, storing images using php so I don't have to do it manually. But I guess you're right I will email them and seek permission anyways. I got it to working though.
  9. Umm Yea imageshack does redirect when a form is submit. I tried adding the autorefer and followlocation but it still didn't work. <?php $post_data = array( "url" => "http://pn-network.net/sprites/tc_012_2.png", "fileupload" => "http://pn-network.net/sprites/tc_012_2.png", "MAX_FILE_SIZE" => "13145728", "refer" => "", "brand" => "", ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.imageshack.us/transload.php"); curl_setopt($ch, CURLOPT_MAXREDIRS, 10); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); curl_exec($ch); curl_close($ch); ?> I also tried <?php $post_data = array( "url" => "http://pn-network.net/sprites/tc_012_2.png", "fileupload" => "http://pn-network.net/sprites/tc_012_2.png", "MAX_FILE_SIZE" => "13145728", "refer" => "", "brand" => "", ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.imageshack.us/transload.php"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); curl_exec($ch); curl_close($ch); ?> and <?php $post_data = array( "url" => "http://pn-network.net/sprites/tc_012_2.png", "fileupload" => "http://pn-network.net/sprites/tc_012_2.png", "MAX_FILE_SIZE" => "13145728", "refer" => "", "brand" => "", ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.imageshack.us/transload.php"); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); curl_exec($ch); curl_close($ch); ?> But so far no luck. Btw. I did try and send the post vars to another page and printed them. They came out fine.
  10. Here try changing <td align="right">Username:</td> <td align="right">Password:</td> to <td align="right" style="color: #fff;">Username:</td> <td align="right" style="color: #fff;">Password:</td>
  11. You could use php predefined variables to check where the user is coming from and if the value doesn't match the page with your form you can show an error. <? if($_SERVER['HTTP_REFERER']!="http://www.phpfreaks.com/myform.html"){ echo"Error."; exit; } ?> That would work but there's ways around it but you wouldn't expect the average person to go through so much trouble.
  12. Umm I didn't quite understand what you want but here's what I think you're looking for. A bit of javascript. <head> <script language='javascript'> function checkForm(){ document.theForm.submit(); setTimeout("location.href = 'errorpage.php';",5000); } </script> </head> <form name='theForm' action="submit.php" method="post"> <input type='button' onclick="checkForm();"> </form>
  13. Does the css come before the php part. Because if you output anything to the browser before the redirect line php will not redirect. Example: <?php echo "Hey there"; header("location: saad.php"); exit; ?> The above will not work but if you do. <? header("location: saad.php"); exit; echo "Hey there"; ?> It will work. If that doesn't work try changing the header("location:portal.php"); to header("location: portal.php"); (put a space after location:
×
×
  • 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.