Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. Where is $_SESSION['get'] being set ?
  2. WOW looks like the Maths degree paid off after all Daniel0
  3. Yes and No.. you could compile your own version of PHP and write the changes but i wouldn't recommend it, other than that no, all the functions use the same wrapper, (one connection routine fits all) if allow_url_fopen is ON then you can use remote files otherwise you can't, however lets try something different, why not create a fsocket function that does what file_get_contents does ie <?php $url = "www.apple.com"; $fp = fsockopen($url, 80, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno)<br />\n"; } else { $out = "GET / HTTP/1.1\r\n"; $out .= "Host: ".$_SERVER['SERVER_NAME']."\r\n"; $out .= "Connection: Close\r\n\r\n"; fwrite($fp, $out); $data = ""; $get = false; while (!feof($fp)) { $tmp = fgets($fp, 128); $data .= ($get)?$tmp:""; if($tmp=="\r\n") $get =true; } echo $data; fclose($fp); } ?>
  4. for testing I would also give "Everyone" access to the folder see if it is a permissions problem! For nested folders on root i think you need to do ~/ instead of just / I don't use IIS much anymore
  5. You shouldn't be getting any errors try something like this (so its easier to read) <?php $to = $_REQUEST['clientmail']; $from = $_REQUEST['sitemail']; $name = $_REQUEST['Name']; $headers = "From: $from"; $subject = "Domain.com: Volunteer Form"; $fields = array(); $fields{"Name"} = "Name"; $fields{"Email"} = "Email"; $fields{"Shelter"} = "Shelter"; $fields{"WebsiteQuestion"} = "WebsiteQuestion"; $fields{"Message"} = "Message"; $body = "We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); } $c_headers = "From: support@domain.com"; $c_subject = "Thank you for contacting us"; $autoreply = "Thank you for contacting us. Somebody will get back to you as soon as possible, usualy within 48 hours. If you have any more questions, please consult our website at www.ipetrescue.com"; if($from == ''){ print "You have not entered an email, please go back and try again"; }else{ if($name == ''){ print "You have not entered a name, please go back and try again"; }else { $send = mail($from, $subject, $body, $headers); //Send to site $send2 = mail($to, $c_subject, $autoreply, $c_headers);//send to client if($send){ header( "Location: http://www.domain.com/thankyou.html" ); }else{ print "We encountered an error sending your mail, please notify support@domain.com"; } } } ?> <html><body><font face=Arial size=2> <form method="post" action="contactvol.php"> <table width="635" align=center bgcolor=white> <tr> <td colspan=2><strong>Request to join volunteer at our organization using this form:</strong></td></tr> <tr> <td width="222"><font color=red>*</font> Full Name:</td><td width="401"><input size=25 name="Name"></td></tr> <tr><td><font color=red>*</font> Email:</td><td><input size=25 name="clientmail"></td></tr> <tr> <input name="sitemail" value="support@domain.com" type="hidden"> <td>Animal Shelter/Rescue Name (if applicable)</td><td><p> <input size=25 name="Shelter" id="Shelter"> </p> <p> </p></td></tr> <tr> <td>Where did you find out about us?</td><td><label> <input name="WebsiteQuestion" type="text" id="WebsiteQuestion" size="25"> <br> <br> </label></td></tr> <tr> <td colspan=2>Reason you would like to be a volunteer:</td></tr> <tr><td colspan=2 align=center><textarea name="Message" rows=5 cols=35></textarea></td></tr> <tr><td colspan=2 align=center><input type=submit name="send" value="Submit"></td></tr> <tr><td colspan=2 align=center><small>A <font color=red>*</font> indicates a field is required</small></td></tr> </table> </form> </body> </html>
  6. on the error are you getting the answer you posted ? ie you didn't select an answer. The answer is: BLAR
  7. Just swap the fields around <input size=25 name="Email"></td></tr> <tr> <input name="sendto" value="support@domain.com" type="hidden"> swap the Email and sendto around! <input size=25 name="sendto"></td></tr> <tr> <input name="Email" value="support@domain.com" type="hidden">
  8. simplexml_load_file or file_get_contents both use the allow_url_fopen directive, which while ON allows remote files to be include'd and/or require'd this is a security problem if someone include a script from a remote source.. to stop the remote include/require the allow_url_fopen directive is turned off that also turns off the remote options for function like fopen, simplexml_load_file and file_get_contents
  9. Very nice wildteen88 as always.. was kinda tempted to write a full script myself but gave a lesson instead lol.. Love the line if(!in_array($line_key, array(7, 8, 9, 12, 13, 14))) nice idea
  10. The main thing about this is setting up in away where if theres a problem you can find it easily and if needed just add another function to format the data the way you need it.. that's why I broke I up into smaller parts oow solved coolie
  11. that's almost correct it should be $details['num1'][0]; however I'm lazy.. so $n1 = implode(",", $details['num1']); echo "INSERT INTO table SET (stuff1,stuff2,stuff3,stuff4,stuff5,stuff6,stuff7,stuff8,stuff9,stuff10) VALUES ($n1)"; //Numbers don't require quotes
  12. LOL, i was just typing an example (see above) for the numbers use $details['num1'][0]; $details['num1'][1]; $details['num1'][2]; EDIT: i'm a dumb arse! (fixed)
  13. Your welcome, you may want to num1 to whatever that data is (to make later debugging easier) and add the other lines, then its a case of creating you echo, ie echo "INSERT INTO table SET (name,drafted) VALUES ('{$details['Name']}','{$details['drafted']}')"; The other good thing is now just say drafted was going to be a boolean you could add that logic before adding it to the new array ie if($lines[$player+16] == "drafted") { $details['drafted'] = "1"; //is drafted }else{ $details['drafted'] = "0"; //is NOT drafted } of course this could be true/false but you get the idea and any unneeded lines, just don't add to the new array
  14. $this->mydb['pass'] = $pass; //Sets $pass to an object array $this->pass = $pass;//Sets $pass to an object same question $mydb['pass'] = $pass; //Sets $pass to an array variable $pass = $pass;//Sets $pass to a variable
  15. few typo's try this <?php $lines = file('players.txt'); //$myLine = getLine(1); //echo $myLine[0]." ".$myLine[1]."etc".$myLine[10]."<br>"; function getLine($line) { global $lines; return explode(" ", trim(str_replace(" "," ",$lines[$line]))); } //other extended option /* $player = getPlayer(); echo $player['Name']; echo $player['num1'][0]; echo $player['num1'][1]; echo $player['num1'][2]; */ $tmpLine = 0; $player = 1; echo "<pre>"; while($details = getPlayer($player)) //loop until false { var_dump($details); //dump data // change to echo data correctly $player++; //edit: oops need this line! } function getPlayer($player) { global $lines; $player--; $player = $player * 20; //Check first line if(empty($lines[$player+1])){ return false; } //Setup details $details = array(); $details['num1'] = getLine($player+1); //Add other line extractions (2-13) $details['Name'] = $lines[$player+14]; //Milan Hnilicka $details['Blank'] = $lines[$player+15]; //? $details['drafted'] = $lines[$player+16]; //drafted return $details; } ?>
  16. When you say another PC on the domain, I assume you mean you have 2 PC's on the same network and your attempting to connect to the server via its domain FQDN domain name for example PC #1 IP = 192.168.1.10 PC #2 IP = 192.168.1.20 PC #1 is the WebServer that had the domain PublicDomain.com pointing to it (redirected via a router) and on PC#2 your typing in http://PublicDomain.com If the above is true then your going to have problems with the router.. try http://192.168.1.10 (change to correct IP) instead. another option is you find a online proxy and connect to the domain via that.. basically the router is taking control of the internal IP connecting out hope that makes sense
  17. Okay, assuming each player DOES have 20 lines, then you can use the second function, what you need do it extract the data (you know the data better than I do) $player = 1; while($details = getPlayer($player)) //loop until false { var_dump($details); //dump data // change to echo data correctly $player++; //edit: oops need this line! } function getPlayer($player) { $player--; $player = $player * 20 //Check first line if(empty($lines[$player+1])) return false; //Setup details $details = array(); $details['num1'] = getLine($player+1); //Add other line extractions (2-13) $details['Name'] = $lines[$player+14]; //Milan Hnilicka $details['Blank'] = $lines[$player+15]; //? $details['drafted'] = $lines[$player+16]; //drafted return $details; } please note this is all typed on the fly and probably had bugs Edit you may need a function for lines like "1.16 (24.3.2002) "
  18. I think for lines where you use more items then use this getLine function, $myLine = getLine(1); echo $myLine[0]." ".$myLine[1]."etc".$myLine[10]."<br>"; function getLine($line) { global $lines; return explode(" ", trim(str_replace(" "," ",$lines[$line]))); } //other extended option $player = getPlayer(); echo $player['Name']; echo $player['num1'][0]; echo $player['num1'][1]; echo $player['num1'][2]; $tmpLine = 0; function getPlayer() { global $tmpLine; //Setup details $details = array(); $details['num1'] = getLine($tmpLine+1); $details['Name'] = $lines[$tmpLine+14]; $tmpLine = $tmpLine+20; return $details; } EDIT: sorry had a visitor Building a few functions to sort out your data does helps the function above gives am example of this, so you can see its building an array that would hold details about the play and updates the counter for the next player, you could pass a var and times that by 20 instead of adding up, ie function getPlayer($player) { $player--; $player = $player * 20 //Setup details $details = array(); $details['num1'] = getLine($player+1); $details['Name'] = $lines[$player+14]; return $details; } $player= getPlayer(1); echo $player['Name']; $player= getPlayer(2); echo $player['Name']; With this in mind you could clean up the data your pulling and end up with an array, use that, then get the next players details.. I hope what i am suggestion is making sense!
  19. Yes that's exactly it (assuming you mean $x = $x + 20; ) As the 3500 is on line 0 Lines 1+$x to 20+$x would be the lines for each player, of course you could create other functions to get details like firstname, lastname etc
  20. Yes i get the problem but i have explained how to do each parts what part can't you do ?
  21. Okay, $lines is an array and $line is an item from that array $line will be a string but will have the 7 items you want, as these are comma delimited you can use explode() to convert the string to an array (the 7 items) that will help you pull out the data, ie $item[0] would be LastName Now for sorting see the PHP User Contributed Notes for uasort "php arobase kochira period com"
  22. From what I can remember it continues with a failed connection.. but there is a simple way to find out!
  23. Not much clearer So you don't need them but want to add them ?! I have no idea what part your suck on!
  24. output depends on what output you want! E.g. here's a quick function and example to pull the red data <?php $lines = file('myfile.txt'); echo getItem(3,3); echo "<br>"; echo getItem(6,0); function getItem($line, $item) { global $lines; $lineOneArray = explode(" ", trim(str_replace(" "," ",$lines[$line]))); return $lineOneArray[$item]; } ?>
×
×
  • 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.