Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. full code to create CREATE TABLE `vote` ( `choice` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY , `charity` VARCHAR( 50 ) NOT NULL , `votes` INT( 11 ) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1
  2. the problem seam to be choice in vote `choice` int(11) NOT NULL default '1' should be `choice` int(11) NOT NULL AUTO_INCREMENT = 1 if you use PMA (PhpMyAdmin) change choice to AUTO INCREMENT, and it should be fine
  3. Can you post the error, you may also try $tries = " SELECT tries.playerID, players.playerFirstName, players.playerLastName, COUNT(tries.playerID) as triesscored FROM tries JOIN players ON tries.playerID = players.playerID WHERE tries.teamID = '".$team."' GROUP BY tries.playerID ORDER BY triesscored DESC"; OR $tries = " SELECT tries.playerID, players.playerFirstName, players.playerLastName, COUNT(tries.playerID) as triesscored, players.playerID FROM tries, players WHERE tries.playerID = players.playerID AND tries.teamID = '".$team."' GROUP BY tries.playerID ORDER BY triesscored DESC"; EDIT: D'oh too slow!
  4. yes 2. should be <?php while ($row = $result->fetch_object()) { print "<a href='view.php?qid=".$row->id."'>View</a>"; } ?>
  5. try passing the array via a function, instead of hoping iy will be picked up.. as for the SQL Injection.. you should always from from the basis, accept whats needed, not (in your case) don't accept the folloing..
  6. Okay, heres an example $data = preg_replace('/onmouseover="[a-z0-9()_-]*"/si', '', $data);
  7. try this <?php $lines = file("newsadd.txt"); $lines = array_reverse($lines); foreach ($lines as $line) { $pieces = explode("|", $line); if(strtolower($pieces[5]) == "other") { echo htmlspecialchars($line)."<br />\n"; }else{ echo "DEBUG:".$pieces[5]."<br>"; } } ?>
  8. probably because very few sites support remote include
  9. erm.. no it would be <input type='text' name='data' id='data' size='45' value='<?php echo $lang['welcome']; ?>'>
  10. true, but you could have the lang.php file open the database and create the array and then refer to that. so it would still seam exactly the same as having the array you suggested
  11. try this function strsplit($data) { return preg_split('/./si', $data); } EDIT: i check php.net to check if preg_split was support by 4 (just had to check) and found this <?php $str = 'string'; $chars = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY); print_r($chars); ?>
  12. you sure you want to do it this way.. a database it easier to manage.. i don't have time to explain it at the moment if you can write a form and post it, i'll try to get some time in the morning (i'm in the UK) and write a basic versioin
  13. OK done please note the multiple sites (no comma on the last one) <head>Test Cheker 1.0v</head> <script language="javascript"> function display(id ,str) { document.getElementById(id).innerHTML = str; } </script> <body> <?php $URLarray = array( "http://www.phpfreaks.com/", "http://www.ebay.com/", "http://www.myspace.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"; //URLS foreach($URLarray as $K => $URL) { echo " <tr>\n"; echo " <td>\n"; echo " $URL"; echo " </td>\n"; echo " <td>\n"; echo " <div id='$K'>please Wait</div>"; echo " </td>\n"; echo " </tr>\n"; ob_flush(); flush(); } echo "</table>\n"; //Times foreach($URLarray as $K => $URL) { $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 " <script language='javascript'>display('$K', '$totaltime seconds');</script>"; }else{ $UrlResults[$URL] = array("Access" => false); echo " <script language='javascript'>display('$K', 'Failed');</script>"; } ob_flush(); flush(); } 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); curl_setopt($resURL, CURLOPT_TIMEOUT, 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; } ?> </body>
  14. phpinfo(); to check its installed
  15. thats for the update just read the array into form elements and to update run a script like the above example to add elements your need to update this part //update NewLang //ie $NewLang['Extra'] = "New Data";
  16. it should display them as they are done, (hence the flush() try changing flush(); to ob_flush(); flush(); as for the timeout it depends on whats the slow part, comment out the following code $data = file_get_contents($URL); unset($data);//dump see if its quicker as for the curl try adding this curl_setopt($resURL, CURLOPT_TIMEOUT, 1); Works for me <head>Test Cheker 1.0v</head> <body> <?php $URLarray = array( "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); curl_setopt($resURL, CURLOPT_TIMEOUT, 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; } ?> </body>
  17. MadTechie

    Banner

    i'm not 100% what you what to do.. but i'm sure i have seen thats code before
  18. depends how much free time do you have ? whats the fear (for lack of a better word) of the rewrite, don't think of it as a page you site and wait for 5 seconds, and then get passed to a new page, its not a redirect (kinda)
  19. ahh true my personal pref would be.. exec("isostuff\daemon.exe -mount 0, isostuff\\$isoName"); i think you won that one BlueSkyIS ..
  20. i assume you mean this \" will be a escaped quote.. so you were missing a end quote <?php //Mounts ISO once selected function mount($isoName) { exec("isostuff\daemon.exe -unmount 0"); exec("isostuff\daemon.exe -mount 0, isostuff $isoName"); } ?> or exec("isostuff\daemon.exe -mount 0, isostuff \"$isoName\"");
  21. wrong. no one, not even spiders can tell a rewrite. you may be thinking redirect. FYI: I am an SEO expert. Assuming the rewrite doesn't cause an error, that true (clients are unaware as its server based) Sorry my silly 2pence lol
  22. your probably have tp do something like this <?php $filename = 'lang.php'; include $filename; $handle = fopen($filename, "r"); $contents = fread($handle, filesize($filename)); fclose($handle); $NewLang = $lang; //update NewLang //ie $NewLang['Extra'] = "New Data"; $NewContents = ""; $NewArray = ""; foreach($NewLang as $K => $V) { $NewArray .= "\"$K\" = \"$V\", "; } $NewArray = trim($NewArray, ","); $NewContents = '<?php'; $NewContents = '$lang = array('; $NewContents .= $NewArray; $NewContents .= ')'; $NewContents .= '?>'; //write back to file if (is_writable($filename)) { if (!$handle = fopen($filename, 'w')) { echo "Cannot open file ($filename)"; exit; } if (fwrite($handle, $NewContents ) === FALSE) { echo "Cannot write to file ($filename)"; exit; } fclose($handle); } } ?>
  23. can you post that section of code you probably have something like <table width="92%" border="0" align="center" cellpadding="0"> <tr> <td><?php echo "<?php echo "blar "<hr />"; ?> </td> or <?php echo '<table width="92%" border="0" align="center" cellpadding="0"> <tr> <td><?php "<hr />"; ?> </td>';
  24. in your example above you could fix it like this foreach($match[1] as $K => $url ) { $fulldesc = $desc[1][$K]; echo urldecode($url); echo "\| $fulldesc<br>"; } BUT.. if a description is missing it will mess up.. my code will not have this problem, but for the output change this echo "found: $href with the title: $title"; to this echo urldecode($href)." | $title";
×
×
  • 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.