Jump to content

xymcrush17

Members
  • Posts

    10
  • Joined

  • Last visited

xymcrush17's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello Need a help How to parse file_get_content into an array? <?php include_once('get_data.php');//simple_html_dom.php $postdata = http_build_query( array( 'id' => 'xxx', ) ); $opts = array('http' => array( 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata ) ); $context = stream_context_create($opts); $result = file_get_contents('http://localhost/test.php', false, $context); I want only get a text that in attribute <div id="console"> YYYY </div> based on $result text that i expect is YYYY thank in advance
  2. Yes, I do. I want to check word that exist in a line of file but it contains letter 'estroaroint'. for example we can find in the line of file like words STORE REST TRAIN EAST RESTORATION ..etc And Thanks for suggestion using Database.. Could you help what sql command to search it what I expect,please?
  3. I have a group of letter that consists letters like $words= 'estroaroint'; that can be arranged to be some words in my list $file = 'dictionary.txt' Here my expected result that on my words list: STORE REST TRAIN RESTORATION ...etc I searched on google and found like : $contents = file_get_contents($file); $pattern = preg_quote($words, '/'); $pattern = "/^.*$pattern.*\$/m"; if(preg_match_all($pattern, $contents, $matches)){ echo "Found matches:\n"; echo implode("\n", $matches[0]); echo strlen($matches); } else{ echo "No matches found"; } But that's not like as my expectation Thanks in advance Warm Regard
  4. Yes sure i hve checked via telnet, and not longer than it.. and in that code it connected fast to server before i added while statement to parse line.
  5. I just keep trying to get this work's at lease it works's <form method="get" > Username: <input type="text" name="user"><br> Password: <input type="password" name="pwd"><br> <input type="submit" value="Submit"> </form> <?php if (isset($_GET['user']) && isset($_GET['pwd'])) { $nick = $_GET['user']; $server = ""; $port = ""; $nickpass = $_GET['pwd']; $s = fsockopen( $server , $port, $errno, $errstr, 10 ); fputs( $s, "NICK $nick\n" ); fputs( $s, "NICK $nick\n" ); fputs( $s, "NICK $nick\n" ); fputs( $s, "PASS $nickpass\n" ); fputs( $s, "USER $nick $nick $nick $nick :$nick\n" ); while ($data = fgets( $s, 768 )) { flush(); $info = split( " ", $data ); //parsing data auth if ( strstr( $data, "Authentication failed." )) { echo "<pre>Not Connected</pre>"; } if ( strstr( $data, "Authentication successful. You are now logged in." )) { echo "<pre>Connected</pre>"; } } } ?> but its so long loading to connect to server.. would anybody help me how to make fast connect? thanks
  6. Hi everyone I need help how to check the authentication by sending username and password form to IRC <html> <title></title> <body> <form method="get" > Username: <input type="text" name="user"><br> Password: <input type="password" name="pwd"><br> <input type="submit" value="Submit"> </form> <?php $server = "XXXX"; $port = "XXXX"; $enable_password = true; error_reporting(0); if (isset($_GET['user']) && isset($_GET['pwd'])) { $username = $_GET['user']; $password = $_GET['pwd']; if (($username !== "") && ($password !== "")) { set_time_limit(30); if (!($socket = fsockopen($server, $port, $errno, $errstr, 10))) { echo "Cant Connect Server"; flush(); } else { if ($enable_password) fputs($socket, "USER " . $username . "\n"); fputs($socket, "PASS " . $password . "\n"); // here where i want to get output if the username and password that i input in form is connected,it will be printed "connected" and else is "not connected".. and i have try be add code in the next line below . //get $line $line = @fgets($socket, 1024); if (strstr($line, "Authentication successful. You are now Login")) { echo "Connected"; } else { echo "Not Connected"; } } } } ?> </body> but its not work..while i put correct user and password its still not connected. any suggest?
  7. @jcbones thank you for correcting.. i coded it with some refrence ive found in google between rertrive data and search . So the code looks so bad . And im searching for pagination in code search php. If youare not mind .. would you help me please. @barand I created table2 because There's duplicate value in uid colomn in table1.
  8. Hi everyone Here my PHP code .. its looking so bad,but work :s i have 2 table with the both row is same //PHP retrive data <? $id = isset($_POST['id']) ? (int)$_POST['id'] : 0; if($id > 0) { //Query the DB $db1 = mysql_query("SELECT * FROM table1 WHERE uid = " . $id); $db2 = mysql_query("SELECT * FROM table2 WHERE uid = " . $id); if($db1 === false && $db2 === false) { die("Database Error"); } echo " <center><b>Get UID '$id' </b></center><br>"; while ($row = mysql_fetch_assoc($db1)){ echo "UID :{$row['uid']} <br> ". "Username : {$row['username']} <br> ". "Phone : {$row['phone']} <br> ". "Email : {$row['acct_email']} <br> ". "--------------------------------<br>"; } while ($row = mysql_fetch_assoc($db2)){ echo "UID :{$row['uid']} <br> ". "Username : {$row['username']} <br> ". "Phone : {$row['phone']} <br> ". "Email : {$row['acct_email']} <br>" . "--------------------------------<br>"; } } ?> //php search <? $searchid = trim($_POST['name']); //check whether the name parsed is empty if($searchid == "") { echo "<center><h2>Please input Serial ID or Searching by Name</h2></center>"; exit(); } $query = "SELECT * FROM table WHERE username LIKE '%$searchid%'"; $query2 = "SELECT * FROM table WHERE username LIKE '%$searchid%'"; $results = mysqli_query($link, $query); $results2 = mysqli_query($link, $query2); if(mysqli_num_rows($results) >= 1) { echo " <center><b>Keyword '$searchid' is found </b></center><br><br>" ; $output = ""; while($row = mysqli_fetch_array($results)) { $output .= "User ID: " . $row['uid'] . "<br />"; $output .= "Username :" . $row['username'] . "<br />"; $output .= "phone: " . $row['phone'] . "<br />"; $output .= "Email: " . $row['acct_email'] . "<br /><br />"; $output .= "--------------------------------<br>"; } } if(mysqli_num_rows($results2) >= 1) { $output2 = ""; while($row = mysqli_fetch_array($results2)) { $output2 .= "User ID: " . $row['uid'] . "<br />"; $output2 .= "Username :" . $row['username'] . "<br />"; $output2 .= "Phone: " . $row['phone']. "<br />"; $output2 .= "Email: " . $row['acct_email'] . "<br />"; $output2 .= "--------------------------------<br>"; } echo "$output $output2"; } can anyone make this code more structure? ?
×
×
  • 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.