Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. well its should be UK Pounds but i accepts anything lol
  2. Okay heres a soultion, not 100% perfect but works well <?php $URLarray = array( "http://uk2.php.net", "http://gfdghdsfghsdgfhsdghj.net", "http://www.phpfreaks.com/" ); echo "<table>\n"; echo " <tr>\n"; echo " <td>\n"; echo "URL"; echo " </td>\n"; echo " <td>\n"; echo "Time"; echo " </td>\n"; echo " </tr>\n"; foreach($URLarray as $URL) { echo " <tr>\n"; $mtime = microtime(); $mtime = explode(' ', $mtime); $mtime = $mtime[1] + $mtime[0]; $starttime = $mtime; if( url_exists($URL) ) { $data = file_get_contents($URL); unset($data);//dump $mtime = microtime(); $mtime = explode(" ", $mtime); $mtime = $mtime[1] + $mtime[0]; $endtime = $mtime; $totaltime = ($endtime - $starttime); $UrlResults[$URL] = array("Access" => true, "Time"=>$totaltime); echo " <td>\n"; echo "$URL"; echo " </td>\n"; echo " <td>\n"; echo "$totaltime seconds."; echo " </td>\n"; }else{ $UrlResults[$URL] = array("Access" => false); echo " <td>\n"; echo "$URL"; echo " </td>\n"; echo " <td>\n"; echo "Failed"; echo " </td>\n"; } echo " </tr>\n"; flush(); } echo "</table>\n"; //Results from loop (if you want) //foreach($UrlResults as $URLs => $Tests) //{ // echo "$URLs: "; // if($Tests['Access']) // { // echo "Works access time:".$Tests['Time']; // }else{ // echo "Failed"; // } // echo "<br />"; //} function url_exists($strURL) { $resURL = curl_init(); curl_setopt($resURL, CURLOPT_URL, $strURL); curl_setopt($resURL, CURLOPT_BINARYTRANSFER, 1); curl_setopt($resURL, CURLOPT_HEADERFUNCTION, 'readHeader'); curl_setopt($resURL, CURLOPT_FAILONERROR, 1); $x = curl_exec($resURL); $intReturnCode = curl_getinfo($resURL, CURLINFO_HTTP_CODE); curl_close ($resURL); if ($intReturnCode != 200 && $intReturnCode != 302 && $intReturnCode != 304) { return false; }else{ return true ; } } function readHeader($data) { return $data; } ?> that will be $15 please, Just kidding the flaw is it downloads the html not the images, of course you can remove the $data = file_get_contents($URL); unset($data);//dump code to check the resolved rate instead of page download time, that will also work.. i hope this help
  3. last bug i can see if(($totalrows - ($limit * $vpage)) > 0){ $pagenext = $vpage++; echo("<a href=\"http://www.crikeygames.com.au/conflictingforces/index.php?page=attack?vpage=$pagenext\">NEXT".$limit."</a>"); }else{ to if(($totalrows - ($limit * $vpage)) > 0){ $pagenext = $vpage++; echo("<a href=\"http://www.crikeygames.com.au/conflictingforces/index.php?page=attack&vpage=$pagenext\">NEXT".$limit."</a>"); }else{
  4. quick example, maybe usless (untested) <?php $data = file_get_contents('http://www.example.com/'); //Find <a> tags preg_match_all('%<a.*</a>%i', $data, $result, PREG_PATTERN_ORDER); $aTags = $result[0]; //Loop through tags foreach($aTags as $aTag) { //find titles if (preg_match('/title=([\s"\'])*(.*?)\1/i', $aTag, $regs)) { $title = $regs[2]; } else { $title = ""; } //find href if (preg_match('/href=([\s"\'])*(.*?)\1/i', $aTag, $regs)) { $href = $regs[2]; } else { $href = ""; } //display results echo "found: $href with the title: $title"; } ?>
  5. the strange thing is $query_count = "SELECT count(*) FROM cf_users"; $result_count = mysql_query($query_count); $totalrows = mysql_num_rows($result_count); hasn't changed! ok try changing to $query_count = "SELECT count(*) as totalcount FROM cf_users"; $result_count = mysql_query($query_count); $tmp = mysql_fetch_array($result_count); $totalrows = $tmp['totalcount'];
  6. try SELECT count(*) FROM cf_users in phpmyadmin see what happens
  7. do you have an example of what you want to pull out i assume your looking for a url and pulling out the title, maybe searching for href would be better!
  8. at this part // workout the page pagination limits etc $limit = 5; $vpage = (int)$_GET['vpage']; $query_count = "SELECT count(*) FROM cf_users"; $result_count = mysql_query($query_count); $totalrows = mysql_num_rows($result_count); add this below echo $totalrows; see what we get
  9. did he solve it ?, you could of still used that thread.. a few bucks.. humm maybe i would wait for it to be move to the freelance section...
  10. found a slight bug do you mean the links not showing ? try the below <?php // display information for each player in a table $link = mysql_connect( "localhost", "ace_ACE", "*****" ); if ( ! $link ) { die( "Couldn't connect to MySQL: ".mysql_error() ); } mysql_select_db( "ace_cf", $link ) or die ( "Couldn't open 'ace_cf': ".mysql_error() ); // workout the page pagination limits etc $limit = 5; $vpage = (int)$_GET['vpage']; $query_count = "SELECT count(*) FROM cf_users"; $result_count = mysql_query($query_count); $totalrows = mysql_num_rows($result_count); if(empty($vpage)){ $vpage = 1; } $limitvalue = $vpage * $limit - ($limit); $query = "SELECT * FROM cf_users LIMIT $limitvalue, $limit"; $result = mysql_query($query) or die("Error: " . mysql_error()); if(mysql_num_rows($result) == 0){ echo("Nothing to Display!"); } //print "<p>$num_rows people have money</p>\n"; echo '<div id = "attack"> <table align="center" class = "fix"> <tr> <td colspan="4"> <center><b>Players</b></center> </td> </tr> <tr> <td><b>Name</b></td> <td><b>Rank</b></td> <td><b>Race</b></td> <td><b>Money</b></td> </tr> <tr> <td colspan="4"> </td> </tr>'; while ($a_row = mysql_fetch_assoc( $result ) ) { $all_name = stripslashes($a_row['username']); $all_rank = stripslashes($a_row['rank']); $all_race = stripslashes($a_row['race']); $all_money = stripslashes($a_row['money']); // change the players race from a integer into a string if($all_race == 0) { $all_race = "British SAS"; } elseif($all_race == 1) { $all_race = "Navy Seal"; } elseif($all_race == 2) { $all_race = "Russian Spetsnaz"; } elseif($all_race == 3) { $all_race = "Australian SAS"; } echo ' <tr> <td>' . $all_name . '</td> <td>' . $all_rank . '</td> <td>' . $all_race . '</td> <td>$' . $all_money . '</td> </tr>'; } echo '</table>'; echo '<center>'; if($vpage != 1){ $pageprev = $vpage--; echo("<a href=\"http://www.crikeygames.com.au/conflictingforces/index.php?page=attack&vpage=$pageprev\">PREV".$limit."</a> "); }else{ echo("PREV".$limit." "); } $numofpages = $totalrows / $limit; for($i = 1; $i <= $numofpages; $i++){ if($i == $vpage){ echo($i." "); }else{ echo("<a href=\"http://www.crikeygames.com.au/conflictingforces/index.php?page=attack&vpage=$i\">$i</a> "); } } if(($totalrows % $limit) != 0){ if($i == $vpage){ echo($i." "); }else{ echo("<a href=\"http://www.crikeygames.com.au/conflictingforces/index.php?page=attack&vpage=$i\">$i</a> "); } } if(($totalrows - ($limit * $vpage)) > 0){ $pagenext = $vpage++; echo("<a href=\"http://www.crikeygames.com.au/conflictingforces/index.php?page=attack?vpage=$pagenext\">NEXT".$limit."</a>"); }else{ echo("NEXT".$limit); } mysql_free_result($result); echo '</center>'; echo '</div>'; ?>
  11. when looking for the protection remember thats statements like are only true of the system is NOT reversed.. These system have all been hacked. Zend Encoder * SafeGuard 3.6 ionCube up to 6.5 SourceGuardian * phpcipher * codelock * SourceCop (all version, from what i know - useless) unsure of version, i'm sure theirs been a few new releases since i last checked
  12. has to be a problem in the code then..
  13. your need to post the full code, of what you have done
  14. i think you want something like this <?php $lines = file("newsadd.txt"); $lines = array_reverse($lines); foreach ($lines as $line) { $pieces = explode("|", $line); if($pieces[5] == "other") { echo htmlspecialchars($line)."<br />\n"; //}else{ // echo ""; } } ?>
  15. if allow_url_fopen is on then you need to check allow_url_include
  16. mybad, i missed one change if($page != 1){ $pageprev = $page--; to if($vpage != 1){ $pageprev = $vpage--;
  17. IonCube Encoder does not offer any protection against oparray_dumping or oparray disassembly but then again nor does ZendEncoder, its alittle better but with a littel time to can decrypt the opcodes, short and simple, if you give the source to someone they will hack it after X time.. its just how long X takes..
  18. the 2 ways i use are #1 a database (easy) #2 many files (one for each language) on option 2, your only need to write the array contents <?php $lang = array('welcome' => 'Welcome to site', 'other_message' => 'Some other message' ); ?> but still its the whole file.. if its a configuration file, then its a bad idea, if its just the language file, then thats fine.. unless its going to happen many times (multiple people opening the file at ones will cause major problems) thats way i asked why they are doing it Personally when i language files, i write one in English and send that to be translated to XYZ languages, if the customer whats to change it themselfs i nomally go for a database.. of course if its a short amount of text then one file is fine, i just put all the arrays into thats file, but the idea is still the same.
  19. no idea what you mean.. <?php if($pieces[5] == "other") { echo "other found"; }else{ echo "no other"; } ?>
  20. $lang['welcome']= "New data"; mis-read your need to write the whole PHP file again.. kinda bad idea.. a database would be better.. why would you want to do this ?
  21. well you could use a JOIN, like this **UNTESTED <?php $pac = mysql_query("select packages.* , res.pac_name as PacName from packages LEFT JOIN reservation AS res ON packages.pac_id = res.pac_id"); while($rows=mysql_fetch_assoc($pac)) { ?> <tr> <td><? echo $rows['Res_id'];?> </td> <td><? echo $rows['check_in'];?> </td> <td><? echo $rows['night_per_stay'];?> </td> <td><? echo $rows['R_no']; ?> </td> <td><? echo $rows['PacName']; ?> </td> <td><? echo $rows['Cid']; ?> </td> </tr> <?php } ?>
  22. what are you trying to do ? also <td><? echo $rows['$p']; ?> should be <td><? echo $rows[$p]; ?>
  23. as you can add spaces/returns to the word script and it will still run, i have tried to also block that.. requires testing try this <?php $text = ' hello all <script language="javascript"> alert("Goto www.phpfreaks.com"); </script>'; //test2 $text = ' hello all <script language="javascript"> alert("Goto www.phpfreaks.com"); </scr ipt>'; $$text = preg_replace('%<s\s*c\s*r\s*i\s*p\s*t\s*[^>]*>.*(?=\s</s\s*c\s*r\s*i\s*p\s*t\s*[^>]*>)\s</s\s*c\s*r\s*i\s*p\s*t\s*[^>]*>%sim', '', $text); ?>
  24. RegEx has LOTS of advantages, the question isn't a bad question but it really all depends on what you want to do. If you don't need fancy matching rules, then explode is fine (in some cases better) but if you need 20 explode's to pull one thing out then regex it probably better! PS: Bad programmer rarely know they are bad, thats what makes them bad.. your probably just inexperanced.. but pratice makes per..... well longer nights and increased the price of coffee and/or red bull
  25. yes you have my permission!! what are you asking ?
×
×
  • 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.