Jump to content

ajicles

Members
  • Posts

    112
  • Joined

  • Last visited

    Never

Everything posted by ajicles

  1. So for some reason when I put mysql close inside of a function if give me a santax error in DreamWeaver CS5 and with the mysql close isn't inside of the function its fine.. All I am trying to do it if the user get the captcha wrong it will not do the function. $captcha = rand(1,10); if(isset($_POST['MultiPowUpload_browserCookie'])) { $cookies = split(";", $_POST['MultiPowUpload_browserCookie']); foreach($cookies as $value) { $namevalcookies = split("=", $value); $browsercookie[trim($namevalcookies[0])] = trim($namevalcookies[1]); } $_COOKIE = $browsercookie; } //restore session if possible if(isset($browsercookie) && isset($browsercookie['PHPSESSID'])) { session_id($browsercookie['PHPSESSID']); session_start(); } if (isset($_POST['submit'])) {} function upload_form(){ $uploaddir = dirname($_SERVER['SCRIPT_FILENAME'])."/UploadedFiles/"; if(count($_FILES) > 0) { $arrfile = pos($_FILES); $uploadfile = $uploaddir . basename($arrfile['name']); $filename = basename($arrfile['name']); if (move_uploaded_file($arrfile['tmp_name'], $uploadfile)) echo "File " . basename($arrfile['name']) . " was successfully uploaded."; //$filename = basename($arrfile['name']; } echo '<br> '; // At least one symbol should be sent to response!!! $ip_address = $_SERVER['REMOTE_ADDR']; $file_hash = hash('ripemd160', '$filename'); echo 'Link to your file: <a href="http://localhost/filehosting/?d='.$file_hash.'">http://localhost/filehosting/?d='.$file_hash.'</a>'; $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("filehosting"); $sql="INSERT INTO data(ID, file_location, file_hash, file_ip_address) VALUES ('','$filename','$file_hash','$ip_address')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } } mysql_close($con) And this doesn't work: if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } mysql_close($con) }
  2. Thank you. I thought it won't over write if the name was upper case.
  3. I have my script that was working before I added a function to error trap different file extensions and I got an error and I can't figure it out. And I was wondering how I could just add the watermark to the image and just save it. Thanks ~AJ <?php $filename = @$_GET['image']; $filename = 'images/'.$filename.''; $ext = end(explode('.', $filename)); $ext = strtolower($ext); function HEADER(&$ext){ if ($ext == 'png'){ header('Content-Type: image/png'); } elseif($ext == 'bmp'){ header('Content-Type: image/png'); } elseif($ext == 'jpeg'){ header('Content-Type: image/png'); } elseif($ext == 'jpg'){ header('Content-Type: image/png'); } elseif($ext == 'gif'){ header('Content-Type: image/png'); } else { echo 'I do not know that file extenstion '; } } function DEST(&$ext){ if ($ext == 'png'){ $dest = imagecreatefrompng($filename); } elseif($ext == 'bmp'){ $dest = imagecreatefrombmp($filename); } elseif($ext == 'jpeg'){ $dest = imagecreatefromjpeg($filename); } elseif($ext == 'jpg'){ $dest = imagecreatefromjpg($filename); } elseif($ext == 'gif'){ $dest = imagecreatefromgif($filename); } else { echo 'I do not know that file extenstion '; } } $watermark = 'watermark.gif'; DEST($ext); $src = imagecreatefromgif($watermark); list($width, $height, $type, $attr)=getimagesize($filename); $markwidth = 86; $markheight = 20; $opacity = 35; imagecopymerge($dest, $src, ($width-$markwidth)>>1, ($height-$markheight)>>1, 0, 0, $markwidth, $markheight, $opacity); header($IMG); imagegif($dest); imagedestroy($dest); imagedestroy($src);
  4. ajicles

    Preg Match

    Its a remote server and I can't edit anything on it. I am a noob at php lol.
  5. I feel bad, I made the worlds worst captcha system ever! It is a simple captcha system, it works by php getting a rand number from one to ten and then echos the number back and asks the user to enter what the number times 2 is and then there is a hidden div holding the random number and gets pass to another page that uses an if statement to see if the answer is wrong. I was wonder what you guys have to say and any suggestions? <form id="myform" onSubmit="return mysubmit();" enctype="multipart/form-data" action="uploadfiles.php" method="POST"> Select file:<br> <input name="FileData" type="file" /> <br> <br /> For security reasons please solve the question below: <br /> What is <?php echo $randINT; ?> + <?php echo $randINT; ?> <input name="captcha" type="text" /> <br /> <input type="submit" value="Upload" /> <br> <div id="captchadata" style="visibility:hidden"> <input name="captchadata" type="text" value="<?php $randINT = $randINT*2; echo $randINT; ?>" /> </div> </form> uploadfiles.php if ($_POST['captcha'] == $_POST['captchadata']){ //correct and submits files } else { //wrong please go back and enter correctly. } I fail lol.
  6. ajicles

    Preg Match

    Well the only thing is it is a remote server and the xml is always changing with the new data. The .htaccess or something isn't allow to access it because it is a server talking to a server not a server talking to a client. So it disallows it to access it. Warning: simplexml_load_file(http://68.168.98.191:13511/admin.cgi?pass=&mode=viewxml) [function.simplexml-load-file]: failed to open stream: HTTP request failed! ICY 404 Resource Not Found in D:\wamp\www\Radioo\xml test.php on line 3 Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "http://68.168.98.191:13511/admin.cgi?pass=&mode=viewxml" in D:\wamp\www\Radioo\xml test.php on line 3 Notice: Trying to get property of non-object in D:\wamp\www\Radioo\xml test.php on line 3
  7. I found a script but it doesn't do much except display my part of my code lol. Returns: (.*?)<\/SONGTITLE>/si"; preg_match($pattern, $content, $matches); echo $matches[1]; //sleep(2); //} ?> Index.php <script src="ajax.js"></script> <script type="text/javascript"> refreshdiv_parserdiv(); </script> <div name="parserdiv" id="parserdiv"></div> AJAX.JS // The AJAX function... function AJAX(){ try{ xmlHttp=new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari return xmlHttp; } catch (e){ try{ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer return xmlHttp; } catch (e){ try{ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); return xmlHttp; } catch (e){ alert("Your browser does not support AJAX."); return false; } } } } // Timestamp for preventing IE caching the GET request (common function) function fetch_unix_timestamp() { return parseInt(new Date().getTime().toString().substring(0, 10)) } //////////////////////////////// // // Refreshing the parser // //////////////////////////////// function refreshdiv_parserdiv(){ // Customise those settings var seconds = 5; var divid = "timediv"; var url = "xml grabber.php"; // Create xmlHttp var xmlHttp_one = AJAX(); // No cache var timestamp = fetch_unix_timestamp(); var nocacheurl = url+"?t="+timestamp; // The code... xmlHttp_one.onreadystatechange=function(){ if(xmlHttp_one.readyState==4){ document.getElementById(divid).innerHTML=xmlHttp_one.responseText; setTimeout('refreshdiv_timediv()',seconds*1000); } } xmlHttp_one.open("GET",nocacheurl,true); xmlHttp_one.send(null); } // Start the refreshing process window.onload = function startrefresh(){ setTimeout('refreshdiv_timediv()',seconds*1000); } xml grabber.php $fp = fsockopen("$server", $port, $errno, $errstr, 30); fputs($fp, "GET /admin.cgi?pass=".$password."&mode=viewxml HTTP/1.0\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)\r\n\r\n"); while (!feof($fp)) { $content = fgets($fp); } $pattern = "/<SONGTITLE>(.*?)<\/SONGTITLE>/si"; preg_match($pattern, $content, $matches); echo $matches[1];
  8. I just don't want to have to use a iframe or refresh the page. I'm keep looking for an answer.
  9. I don't really want to hide it but, I was googling around and there is a cool guy from youtube who said: But it doesn't really work for me. I just want to echo the new data over the old. It's only one line but it should work. $fp = fsockopen("$server", $port, $errno, $errstr, 30); fputs($fp, "GET /admin.cgi?pass=".$password."&mode=viewxml HTTP/1.0\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)\r\n\r\n"); while (!feof($fp)) { $content = fgets($fp); } $pattern = "/<SONGTITLE>(.*?)<\/SONGTITLE>/si"; preg_match($pattern, $content, $matches); echo $matches[1]; I just need to learn how to make the script pause before starting up again. The only thing with sleep command is it just holds up the webpage from loading during the seconds it is waiting :-\
  10. I have a remote shoutcast server and I was wonder if I could use an if statement to see if the server is offline or online. Except when its offline the script has to wait for it to time out then display an error message, which takes along time. So I want to check if it is online to return the online message and if not then it returns offline message. Thanks ~AJ $fp = fsockopen("$server", $port, $errno, $errstr, 30); if (!$fp) { echo "Offline"; } else { echo "Online"; }
  11. I have kind of a dumb question, but is there some way to clear what I have just echo after a certain amount of time? I have my script and I tried to delay it by using sleep and it just delay the time it took to load the webpage lol. Thanks ~AJ $fp = fsockopen("$server", $port, $errno, $errstr, 30); fputs($fp, "GET /admin.cgi?pass=".$password."&mode=viewxml HTTP/1.0\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)\r\n\r\n"); while (!feof($fp)) { $content = fgets($fp); } $pattern = "/<SONGTITLE>(.*?)<\/SONGTITLE>/si"; preg_match($pattern, $content, $matches); echo $matches[1];
  12. ajicles

    Preg Match

    Yay, it works fantasic. Ill I had to is add the i in the pattern and remove the function because it wasn't working, because I tried to echo hello in it and it didn't return anything lol. $server = "68.168.98.191"; $port = "13511"; $password = ""; $fp = fsockopen("$server", $port, $errno, $errstr, 30); fputs($fp, "GET /admin.cgi?pass=".$password."&mode=viewxml HTTP/1.0\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)\r\n\r\n"); while (!feof($fp)) { $content = fgets($fp); } $pattern = "/<SONGTITLE>(.*?)<\/SONGTITLE>/si"; preg_match($pattern, $content, $matches); echo $matches[1];
  13. ajicles

    Preg Match

    Its for Shoutcast radio and the XML and setting are behind a password protected area.
  14. if ($_POST["a"] == "") { // Has Nothing } else { // Has something in it. }
  15. $ID = @$_GET['id'] ; $db_host = 'Host'; $db_user = 'username'; $db_pwd = 'password'; $database = 'database'; $table = 'table'; if (!mysql_connect($db_host, $db_user, $db_pwd)) die("Can't connect to database"); if (!mysql_select_db($database)) die("Can't select database"); $result = mysql_query("SELECT id,post_content FROM $table WHERE id = '$ID'"); if (!$result) { echo 'Could not run query: ' . mysql_error(); exit; } $row = mysql_fetch_row($result); echo $row[1]; Something like that? id and post_content are columns in the database just enter your own.
  16. Ouch you are trying to use HTML syntax in PHP. Um try make the php part in one file. And the html form in another. And use HTML Form to reference the php code. So like this: Try that and see if there are any errors. ~AJ Submit Page: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <form action="submit.php" method="post"> <input type="hidden" name="b[]" value="1" /> <td align="center" width="15%"><select name="a[]" ><option selected value="">---</option><option value="0">0</option><option value="1">1</option><option value="2">2</option><option value="3">3</option></select></td> <td align="center" width="15%"><select name="c[]"><option selected value="">---</option><option value="0">0</option><option value="1">1</option><option value="2">2</option><option value="3">3</option></select></td> <td align="center" width="15%">B: <select name="d[]"><option selected value="">---</option><option value="0">0</option><option value="1">1</option><option value="2">2</option><option value="3">3</option></select> S: <select name="e[]"><option selected value="">---</option><option value="0">0</option><option value="1">1</option><option value="2">2</option><option value="3">3</option></select> </td> <td align="center" width="8%"><select name="f[]"><option selected value="">---</option><option value="0">0</option><option value="1">1</option><option value="2">2</option></td> <td align="center" width="5%"><select name="g[]"><option selected value="">---</option><option value="0">0</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option></select></td> <td align="center" width="15%">Att: <select name="h[]"><option selected value="">---</option><option value="0">0</option><option value="1">1</option><option value="2">2</option><option value="3">3</option></select> S: <select name="i[]"><option selected value="">---</option><option value="0">0</option><option value="1">1</option><option value="2">2</option><option value="3">3</option></select> </td> <td align="center" width="8%"><select name="j[]"><option selected value="">---</option><option value="0">0</option><option value="1">1</option></select></td> </tr> <input type="hidden" name="b[]" value="2" /> <td align="center" width="15%"><select name="a[]" ><option selected value="">---</option><option value="0">0</option><option value="1">1</option><option value="2">2</option><option value="3">3</option></select></td> <td align="center" width="15%"><select name="c[]"><option selected value="">---</option><option value="0">0</option><option value="1">1</option><option value="2">2</option><option value="3">3</option></select></td> <td align="center" width="15%">B: <select name="d[]"><option selected value="">---</option><option value="0">0</option><option value="1">1</option><option value="2">2</option><option value="3">3</option></select> S: <select name="e[]"><option selected value="">---</option><option value="0">0</option><option value="1">1</option><option value="2">2</option><option value="3">3</option></select> </td> <td align="center" width="8%"><select name="f[]"><option selected value="">---</option><option value="0">0</option><option value="1">1</option><option value="2">2</option></td> <td align="center" width="5%"><select name="g[]"><option selected value="">---</option><option value="0">0</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option></select></td> <td align="center" width="15%">Att: <select name="h[]"><option selected value="">---</option><option value="0">0</option><option value="1">1</option><option value="2">2</option><option value="3">3</option></select> S: <select name="i[]"><option selected value="">---</option><option value="0">0</option><option value="1">1</option><option value="2">2</option><option value="3">3</option></select> </td> <td align="center" width="8%"><select name="j[]"><option selected value="">---</option><option value="0">0</option><option value="1">1</option></select></td> </tr> </select> </body> </html> submit.php foreach($_POST['a'] as $row=>$At) { $a =$At; $b =$_POST['b'][$row]; $c =$_POST['c'][$row]; $d =$_POST['d'][$row]; $e =$_POST['e'][$row]; $f =$_POST['f'][$row]; $g =$_POST['g'][$row]; $h =$_POST['h'][$row]; $i =$_POST['i'][$row]; $j =$_POST['j'][$row]; } $addall = "INSERT INTO alphabet (`a`, `b`, `c`, `d`, `e`, `f`, `g`, `h`, `i`, `j`) VALUES ('.$a.','.$b.','.$c.','.$d.','.$e.','.$f.','.$g.','.$h.','.$i.','.$j.')";
  17. ajicles

    Preg Match

    I need help again with preg match and trying to grab text between two xml tags. And it doesn't return anything back to be I tried adding /s to my pattern for the multi line thing. I am new and getting better at what the patterns mean and stuff. Thanks ~ AJ Code: $server = "68.168.98.191"; $port = "13511"; $password = "********"; $fp = fsockopen("$server", $port, $errno, $errstr, 30); fputs($fp, "GET /admin.cgi?pass=".$password."&mode=viewxml HTTP/1.0\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)\r\n\r\n"); while (!feof($fp)) { $content = fgets($fp); } //echo $content; function getTextBetweenTags($string, $tagname) { $pattern = "/<songtitle>(.*?)<\/songtitle>/s"; preg_match($pattern, $content, $matches); return $matches[1]; } Echo Content Returns: <?xml version="1.0" standalone="yes" ?><!DOCTYPE SHOUTCASTSERVER [<!ELEMENT SHOUTCASTSERVER (CURRENTLISTENERS,PEAKLISTENERS,MAXLISTENERS,REPORTEDLISTENERS,AVERAGETIME,SERVERGENRE,SERVERURL,SERVERTITLE,SONGTITLE,SONGURL,IRC,ICQ,AIM,WEBHITS,STREAMHITS,STREAMSTATUS,BITRATE,CONTENT,VERSION,WEBDATA,LISTENERS,SONGHISTORY)><!ELEMENT CURRENTLISTENERS (#PCDATA)><!ELEMENT PEAKLISTENERS (#PCDATA)><!ELEMENT MAXLISTENERS (#PCDATA)><!ELEMENT REPORTEDLISTENERS (#PCDATA)><!ELEMENT AVERAGETIME (#PCDATA)><!ELEMENT SERVERGENRE (#PCDATA)><!ELEMENT SERVERURL (#PCDATA)><!ELEMENT SERVERTITLE (#PCDATA)><!ELEMENT SONGTITLE (#PCDATA)><!ELEMENT SONGURL (#PCDATA)><!ELEMENT IRC (#PCDATA)><!ELEMENT ICQ (#PCDATA)><!ELEMENT AIM (#PCDATA)><!ELEMENT WEBHITS (#PCDATA)><!ELEMENT STREAMHITS (#PCDATA)><!ELEMENT STREAMSTATUS (#PCDATA)><!ELEMENT BITRATE (#PCDATA)><!ELEMENT CONTENT (#PCDATA)><!ELEMENT VERSION (#PCDATA)><!ELEMENT WEBDATA (INDEX,LISTEN,PALM7,LOGIN,LOGINFAIL,PLAYED,COOKIE,ADMIN,UPDINFO,KICKSRC,KICKDST,UNBANDST,BANDST,VIEWBAN,UNRIPDST,RIPDST,VIEWRIP,VIEWXML,VIEWLOG,INVALID)><!ELEMENT INDEX (#PCDATA)><!ELEMENT LISTEN (#PCDATA)><!ELEMENT PALM7 (#PCDATA)><!ELEMENT LOGIN (#PCDATA)><!ELEMENT LOGINFAIL (#PCDATA)><!ELEMENT PLAYED (#PCDATA)><!ELEMENT COOKIE (#PCDATA)><!ELEMENT ADMIN (#PCDATA)><!ELEMENT UPDINFO (#PCDATA)><!ELEMENT KICKSRC (#PCDATA)><!ELEMENT KICKDST (#PCDATA)><!ELEMENT UNBANDST (#PCDATA)><!ELEMENT BANDST (#PCDATA)><!ELEMENT VIEWBAN (#PCDATA)><!ELEMENT UNRIPDST (#PCDATA)><!ELEMENT RIPDST (#PCDATA)><!ELEMENT VIEWRIP (#PCDATA)><!ELEMENT VIEWXML (#PCDATA)><!ELEMENT VIEWLOG (#PCDATA)><!ELEMENT INVALID (#PCDATA)><!ELEMENT LISTENERS (LISTENER*)><!ELEMENT LISTENER (HOSTNAME,USERAGENT,UNDERRUNS,CONNECTTIME, POINTER, UID)><!ELEMENT HOSTNAME (#PCDATA)><!ELEMENT USERAGENT (#PCDATA)><!ELEMENT UNDERRUNS (#PCDATA)><!ELEMENT CONNECTTIME (#PCDATA)><!ELEMENT POINTER (#PCDATA)><!ELEMENT UID (#PCDATA)><!ELEMENT SONGHISTORY (SONG*)><!ELEMENT SONG (PLAYEDAT, TITLE)><!ELEMENT PLAYEDAT (#PCDATA)><!ELEMENT TITLE (#PCDATA)>]><SHOUTCASTSERVER><CURRENTLISTENERS>0</CURRENTLISTENERS><PEAKLISTENERS>1</PEAKLISTENERS><MAXLISTENERS>50000</MAXLISTENERS><REPORTEDLISTENERS>0</REPORTEDLISTENERS><AVERAGETIME>1</AVERAGETIME><SERVERGENRE>Rock</SERVERGENRE><SERVERURL>http://www.listen2myradio.com/</SERVERURL><SERVERTITLE>Ajicles Radio</SERVERTITLE><SONGTITLE>Down With Webster - Rich Girl$</SONGTITLE><SONGURL></SONGURL><IRC>#shoutcast</IRC><ICQ>0</ICQ><AIM>N/A</AIM><WEBHITS>51</WEBHITS><STREAMHITS>2</STREAMHITS><STREAMSTATUS>1</STREAMSTATUS><BITRATE>96</BITRATE><CONTENT>audio/mpeg</CONTENT><VERSION>1.9.8</VERSION><WEBDATA><INDEX>8</INDEX><LISTEN>0</LISTEN><PALM7>0</PALM7><LOGIN>0</LOGIN><LOGINFAIL>0</LOGINFAIL><PLAYED>0</PLAYED><COOKIE>0</COOKIE><ADMIN>0</ADMIN><UPDINFO>8</UPDINFO><KICKSRC>0</KICKSRC><KICKDST>0</KICKDST><UNBANDST>0</UNBANDST><BANDST>0</BANDST><VIEWBAN>0</VIEWBAN><UNRIPDST>0</UNRIPDST><RIPDST>0</RIPDST><VIEWRIP>0</VIEWRIP><VIEWXML>33</VIEWXML><VIEWLOG>0</VIEWLOG><INVALID>2</INVALID></WEBDATA><LISTENERS></LISTENERS><SONGHISTORY><SONG><PLAYEDAT>1279206492</PLAYEDAT><TITLE>Down With Webster - Rich Girl$</TITLE></SONG><SONG><PLAYEDAT>1279206142</PLAYEDAT><TITLE>Swedish House Mafia - One - Original Mix</TITLE></SONG><SONG><PLAYEDAT>1279205829</PLAYEDAT><TITLE>Aaren San - Apes From Space (Dirtyloud Remix)</TITLE></SONG><SONG><PLAYEDAT>1279205509</PLAYEDAT><TITLE>Taio Cruz - Break Your Heart</TITLE></SONG><SONG><PLAYEDAT>1279205509</PLAYEDAT><TITLE>Down With Webster - Rich Girl$</TITLE></SONG><SONG><PLAYEDAT>1279205438</PLAYEDAT><TITLE>Swedish House Mafia - One - Original Mix</TITLE></SONG><SONG><PLAYEDAT>1279205124</PLAYEDAT><TITLE>Aaren San - Apes From Space (Dirtyloud Remix)</TITLE></SONG><SONG><PLAYEDAT>1279204920</PLAYEDAT><TITLE>Taio Cruz - Break Your Heart</TITLE></SONG></SONGHISTORY></SHOUTCASTSERVER>
  18. Ok I have done a couple of things and my script works. I just want to know to use something like str_replace to remove the last data after the indent in a array. So in the return example is $array[1] after being stripped by str_replace outputs: Skill 1: 69(indent)28673300. I want to remove the indent and last numbers. Code: $data = file("Matthew.txt"); $counter = 0; $array = array( "character-username = ", "character-skill = 0 ", "character-skill = 1 ", "character-skill = 2 ", "character-skill = 3 ", "character-skill = 4 ", "character-skill = 5 ", "character-skill = 6 ", "character-skill = 7 ", "character-skill = 8 ", "character-skill = 9 ", "character-skill = 10 ", "character-skill = 11 ", "character-skill = 12 ", "character-skill = 13 ", "character-skill = 14 ", "character-skill = 15 ", "character-skill = 16 ", "character-skill = 17 ", "character-skill = 18 ", "character-skill = 19 ", "character-skill = 20 ", "character-skill = 21 ", "character-skill = 22 ", "character-skill = 23 ", "character-skill = 24 "); $iii = 1; $output = str_replace($array[0],"",$data[1]); echo "Username: ".$output.'<br>'; for ($i = 95; $i <= 119; $i++) { $output = str_replace($array[$iii],"",$data[$i]); echo "Skill $iii: ".$output.'<br>'; $iii = $iii + 1; } Which Returns: Username: Matthew Skill 1: 69 28673300 Skill 2: 99 28675400 Skill 3: 99 32294500 Skill 4: 99 32300555 Skill 5: 99 28000000 Skill 6: 99 28263340 Skill 7: 99 28000000 Skill 8: 99 28000000 Skill 9: 99 28000000 Skill 10: 99 28000000 Skill 11: 99 28000000 Skill 12: 99 28000000 Skill 13: 99 28000000 Skill 14: 99 28020000 Skill 15: 99 28007000 Skill 16: 99 28000000 Skill 17: 99 28000000 Skill 18: 99 29342795 Skill 19: 99 28000000 Skill 20: 99 28000000 Skill 21: 99 28000000 Skill 22: 1 0 Skill 23: 1 0 Skill 24: 1 0 Skill 25: 0 0 Thanks ~AJ
  19. I did echo it back, I'll try that code. Why can't I use like use (below) it is easier for me to understand lol. Just make an array to get rid of the stuff I don't want lol. $data = file("Matthew.txt"); $data = str_replace("character-username = ","",$data[1]); echo $data; The code above returns: Matthew That code you posted above returns: Array ( [0] => [ACCOUNT] [1] => character-username = Matthew [2] => character-password = 53552e2db2937526b0766ce1e1eb1ffd [3] => [4] => [CHARACTER] [5] => character-height = 0 [6] => character-posx = 2558 [7] => character-posy = 3090 [8] => character-rights = 3 [9] => character-lastconnection = [10] => character-special = 4225 [11] => character-tz = -1 [12] => character-starter = 1 [13] => character-pouch1 = 0 [14] => character-pouch2 = 0 [15] => character-pouch3 = 0 [16] => character-pouch4 = 0 [17] => character-energy = 100 [18] => character-expLock = false [19] => character-taskID = -1 [20] => character-taskAmount = -1 [21] => character-jad = 1 [22] => character-Ahrim = 0 [23] => character-ce = 0 [24] => character-sp = 0 [25] => character-aa = 0 [26] => character-Verac = 0 [27] => character-Dharok =0 [28] => character-Torag = 0 [29] => character-Karils =0 [30] => character-Guthan =0 [31] => character-Barrows 0 [32] => character-brightness = 0 [33] => character-fighttype = 3 [34] => character-skill = 3 [35] => character-chat = 1 [36] => character-ancients = 2 [37] => character-pin = 0 [38] => character-pkPoints = 1059 [39] => character-saradomin = 0 [40] => character-zammykills =60 [41] => character-retaliate = 0 [42] => character-action = 0 [43] => character-pcpoints = 799 [44] => character-duelrating0 [45] => character-duelpoints0 [46] => character-assault = 1 [47] => character-donator = 1 [48] => character-bow = 100 [49] => character-shield = 100 [50] => character-tradeTimer = 0 [51] => character-tb = 0 [52] => character-q15 = 0 [53] => character-q14 = 0 [54] => character-q13 = 0 [55] => character-q12 = 0 [56] => [57] => [EQUIPMENT] [58] => character-equip = 0 6182 1 [59] => character-equip = 1 4359 1 [60] => character-equip = 2 1725 1 [61] => character-equip = 3 14013 1 [62] => character-equip = 4 6916 1 [63] => character-equip = 5 -1 0 [64] => character-equip = 6 -1 0 [65] => character-equip = 7 2497 1 [66] => character-equip = 8 -1 0 [67] => character-equip = 9 7461 1 [68] => character-equip = 10 2904 1 [69] => character-equip = 11 -1 0 [70] => character-equip = 12 -1 0 [71] => character-equip = 13 -1 0 [72] => [73] => [LOOK] [74] => character-look = 0 0 [75] => character-look = 1 3 [76] => character-look = 2 14 [77] => character-look = 3 18 [78] => character-look = 4 26 [79] => character-look = 5 33 [80] => character-look = 6 36 [81] => character-look = 7 42 [82] => character-look = 8 0 [83] => character-look = 9 1 [84] => character-look = 10 2 [85] => character-look = 11 0 [86] => character-look = 12 0 [87] => character-look = 13 0 [88] => character-look = 14 0 [89] => character-look = 15 0 [90] => character-look = 16 0 [91] => character-look = 17 0 [92] => character-look = 18 0 [93] => [94] => [sKILLS] [95] => character-skill = 0 69 28673300 [96] => character-skill = 1 99 28675400 [97] => character-skill = 2 99 32294500 [98] => character-skill = 3 99 32300555 [99] => character-skill = 4 99 28000000 [100] => character-skill = 5 99 28263340 [101] => character-skill = 6 99 28000000 [102] => character-skill = 7 99 28000000 [103] => character-skill = 8 99 28000000 [104] => character-skill = 9 99 28000000 [105] => character-skill = 10 99 28000000 [106] => character-skill = 11 99 28000000 [107] => character-skill = 12 99 28000000 [108] => character-skill = 13 99 28020000 [109] => character-skill = 14 99 28007000 [110] => character-skill = 15 99 28000000 [111] => character-skill = 16 99 28000000 [112] => character-skill = 17 99 29342795 [113] => character-skill = 18 99 28000000 [114] => character-skill = 19 99 28000000 [115] => character-skill = 20 99 28000000 [116] => character-skill = 21 1 0 [117] => character-skill = 22 1 0 [118] => character-skill = 23 1 0 [119] => character-skill = 24 0 0 [120] => [121] => [iTEMS] [122] => character-item = 0 9002 1 [123] => character-item = 1 1276 1 [124] => [125] => [bANK] [126] => character-bank = 0 4358 1 [127] => character-bank = 1 4336 2 [128] => character-bank = 2 14012 3 [129] => character-bank = 3 344 1 [130] => character-bank = 4 4326 1 [131] => character-bank = 5 14058 1 [132] => character-bank = 6 4332 1 [133] => character-bank = 7 4338 1 [134] => character-bank = 8 14014 2 [135] => character-bank = 9 4328 1 [136] => character-bank = 10 4362 1 [137] => character-bank = 11 4086 1 [138] => character-bank = 12 4334 1 [139] => character-bank = 13 14063 1 [140] => character-bank = 14 4342 2 [141] => character-bank = 15 4318 1 [142] => character-bank = 16 7612 8 [143] => character-bank = 17 4340 1 [144] => character-bank = 18 2435 27 [145] => character-bank = 19 4344 2 [146] => character-bank = 20 4348 1 [147] => character-bank = 21 4352 1 [148] => character-bank = 22 4330 1 [149] => character-bank = 23 2348 1 [150] => character-bank = 24 1334 1 [151] => character-bank = 25 996 2000045851 [152] => character-bank = 26 386 1013 [153] => character-bank = 27 4320 2 [154] => character-bank = 28 4360 1 [155] => character-bank = 29 4346 1 [156] => character-bank = 30 4322 1 [157] => character-bank = 31 4354 1 [158] => character-bank = 32 551 1 [159] => character-bank = 33 1541 1 [160] => character-bank = 34 747 1 [161] => character-bank = 35 2905 1 [162] => character-bank = 36 2492 1 [163] => character-bank = 37 6819 1 [164] => character-bank = 38 4566 1 [165] => character-bank = 39 4356 1 [166] => character-bank = 40 563 3010 [167] => character-bank = 41 557 5000 [168] => character-bank = 42 555 4000 [169] => character-bank = 43 566 4000 [170] => character-bank = 44 561 3000 [171] => character-bank = 45 556 4000 [172] => character-bank = 46 1049 1 [173] => character-bank = 48 4152 1 [174] => character-bank = 49 1043 1 [175] => character-bank = 50 651 1 [176] => character-bank = 51 641 1 [177] => character-bank = 52 6542 1 [178] => character-bank = 53 4098 1 [179] => character-bank = 54 4096 1 [180] => character-bank = 55 14047 1 [181] => character-bank = 56 14029 1 [182] => character-bank = 57 14051 1 [183] => character-bank = 58 14032 1 [184] => character-bank = 59 9005 1 [185] => character-bank = 60 14031 2 [186] => character-bank = 61 14067 1 [187] => character-bank = 62 14066 1 [188] => character-bank = 63 14039 1 [189] => character-bank = 64 14041 1 [190] => character-bank = 65 14064 1 [191] => character-bank = 66 7807 1 [192] => character-bank = 67 7808 1 [193] => character-bank = 68 7450 1 [194] => character-bank = 69 14049 1 [195] => character-bank = 70 4676 1 [196] => character-bank = 71 14040 1 [197] => character-bank = 72 4068 2 [198] => character-bank = 73 14071 1 [199] => character-bank = 74 14070 1 [200] => character-bank = 75 6571 1 [201] => character-bank = 76 14054 1 [202] => character-bank = 78 14050 1 [203] => character-bank = 79 14065 1 [204] => character-bank = 80 14061 1 [205] => character-bank = 81 14010 1 [206] => character-bank = 82 14053 1 [207] => [208] => [FRIENDS] [209] => character-friend = 0 3458605949762185758 [210] => character-friend = 1 904262259 [211] => character-friend = 2 918897639 [212] => character-friend = 3 41091004572 [213] => character-friend = 4 19021682 [214] => character-friend = 5 453997938233492 [215] => character-friend = 6 59658913159 [216] => character-friend = 7 3470371525163566 [217] => character-friend = 8 279971649 [218] => character-friend = 9 601731966 [219] => [220] => [iGNORES] [221] => [222] => [EOF] [223] => )
  20. Still Returns nothing D: $data = file_get_contents('Matthew.txt'); //$pattern = "/character-username = (.+?)character-password/s"; $pattern = "~character-username = (.+?)$~s"; preg_match($pattern, $data, $matches); return $matches[1]; [attachment deleted by admin]
  21. $data = file_get_contents('Matthew.txt'); $pattern = "/character-username = (.+?)character-password/s"; preg_match($pattern, $data, $matches); return $matches[1]; I tried this and it still returning nothing and I echoed $data and it has the file contents.
  22. 01.Introduction [Check] 02.PHP Overview [Check] 03.Mac Installation 04.Windows Installation [Check] 05.First Steps [Check] 06.Exploring Data Types [Check] 07.Control Structures Pt. 1 Logical Expressions 08.Control Structures Pt. 2 Loops 09.User-Defined Functions 10.Debugging 11.Building Web Pages 12.MySQL Basics 13.Building a Content Management System 14.Application CRUD 15.Building the Public Area 16.Conclusion
×
×
  • 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.