Jump to content

d22552000

Members
  • Posts

    535
  • Joined

  • Last visited

    Never

Everything posted by d22552000

  1. nevermind, I found the issue. The two spaces in my regex were the issue. Hmm... Well, it is not causing any errors at all... hence my confusion. I'll give you the source, the issue, the intended result, and finally a link to the actual result. 1. The source: $page = preg_replace('/(<img src=\") (.*?) (\")/eis', "'<img src=\"image.php?r=' . urlencode('\\2') . '\"'", $page); $page = str_replace("\r", "", $page); $page = str_replace("\n", "", $page); $page = str_replace(" ", " ", $page); $page = str_replace("> <", "><", $page); $page = trim($page); echo $page; 2. The issue: It's not replacing anything. 3. The intended result: It should take things like... <img src="images/dark.png" alt="" /> and turn them to <img src="image.php?r=urlencode(images/dark.png)" alt="" />... 4. The actual result: http://project-ddl.org/mpm/index.php
  2. I want a number like this (since it is the total time taken to display the page) 4.1615 (or something like that) I even tried printf("The page took %f seconds to load",$totaltime,"formatstring");
  3. Well, I have a problem with rounding time + microtime. You will see what I mean below. After much debugging I wrote this stupid thing, even though... IT USED TO BE ABLE TO JUST WRITE "echo $totaltime;" It for some reason does this now... (THE PAGES TAKE ABOUT 4 SECONDS TO LOAD) if ($totaltime<1) { $TEMPORARY = $totaltime; $NEW = round($TEMPORARY,6); echo "DEBUG MODE<br />"; echo "COME ON...: " . round($NEW) . "<br />"; // THIS ECHOS 0 echo "NEW: $NEW<br />"; // THIS ECHOS 4.6E-5 echo "OLD: $totaltime<br />"; // THIS ECHOS 4.60555267334E-5 } PLEASE HELP ME!!! (need it asap, this is on a PRODUCTION BOX (PHP 5))
  4. Well, I am making a web proxy, and I need to replace the url's the website (all of them) to point to sim_post.php?u=serializedurlhere . (Including images and scripts.) so I took a look around the web and tried to create a preg_replacement, it failed. Here is the error: Parse error: syntax error, unexpected '.', expecting ')' in C:\WOS\www\sim_post.php(22) : regexp code on line 1 Fatal error: preg_replace() [<a href='function.preg-replace'>function.preg-replace</a>]: Failed evaluating code: '/sim_post.php?u=/'.'\['.serialize(.'2'.).']' in C:\WOS\www\sim_post.php on line 22 and this is the php code: $pattern = "/(<a href=\")(.+?)(\")(\s*)(>)(.+?)(<\/a>)/e"; $replace = "'/sim_post.php?u=/'.'\\['.serialize(.'2'.).']'"; $page = do_post($_POST['url']); preg_replace($pattern, $replace, $page); I really do not know how to use regexp, and took a source to make links indexes from a google search. To be honest, it may be easier to create a whole new pattern and replacement, in comparison to trying to fix mine. I suck at regex ><.
  5. I AM kicking myself right now, trying out the new code... Ya it works... *sigh*...
  6. Well, I have uploaded and stored images in a database, and they store fine. I also have them shown on the page, which does not work with the <img tag, in FF it just shows the alt="" text, and in IE it shows a small X (picture not found error). When I go to the EXACT url outputted by the page, I see the image fine, in both internet explorer and in fire fox. Here is my code for uploading the images: WORKING $tmpName = $_FILES['file']['tmp_name']; $fileName = addslashes($_FILES['file']['name']); $fileSize = addslashes($_FILES['file']['size']); $fileType = addslashes($_FILES['file']['type']); $message = trim(addslashes($_POST['msg'])); $subject = trim(addslashes($_POST['sub'])); $theSize = getimagesize($tmpName); $ip = $_SERVER['REMOTE_ADDR']; if (empty($message) || empty($subject)) { $status = "Fields were left empty!"; } $fp = fopen($tmpName, 'r'); $content = fread($fp, filesize($tmpName)); $content = addslashes($content); fclose($fp); $res = mysql_query("INSERT INTO `image` ( `ID` , `MSG` , `DATA` , `SIZE` , `TYPE` , `NAME` , `IPADDR` , `SUBJECT` , `IMGSIZE` ) VALUES ( NULL , '$message' , '$content' , '$fileSize' , '$fileType' , '$fileName' , '" . $ip . "' , '$subject' , '" . addslashes($theSize[3]) . "' );") or die(mysql_error()); Here is the code for showing the images: WORKING $res = mysql_query("SELECT * FROM `image` WHERE `ID` = '" . $_GET['img'] . "';"); while ($row = mysql_fetch_assoc($res)) { header("Content-length: " . $row['SIZE']); header("Content-type: " . $row['TYPE']); print $row['DATA']; exit(); } Here is the code that makes the image tags and tables: NOT WORKING? $res = mysql_query("SELECT * FROM `image` ORDER BY `ID` DESC LIMIT 30;"); while ($row = mysql_fetch_assoc($res)) { echo " <tr> <th class=\"postblock\"><img alt='" . $row['ID'] . "' scr='index.php?img=" . $row['ID'] . "' " . $row['IMGSIZE'] . "></th> <th class=\"reply\"><big>" . $row['SUBJECT'] . "</big><br />" . $row['MSG'] . "</th> </tr> "; } Can you please tell me why it does not work? This is what it outputs to the browser: <tr> <th class='postblock'><img alt='6' scr='index.php?img=6' width='200' height='200' /></th> <th class='reply'><big>{subject}</big><br />{message}</th> </tr>
  7. function buttoncase(id) { var i = document.getElementById(id); var a = document.getElementById("is" + id); if (a = true) { i.class = "buttons"; a.value = "false"; //PICK ME, I'M LINE 7 } else { i.class = "buttons2"; a.value = "true"; } } I have made hidden form tags for all my isname fields, and yet I get: "Line 7, character 5, expected identifier"
  8. You pages load really slowly, server usage problems? You should probably do something about it... Your php source isn't showing as far as I know.
  9. It won't load for me so I don't know. Make sure your file has a .php ending, and the file starts with <?php and ends with ?>.
  10. Try this: $url = 'http://www.whateverurl.com/img.jpg'; $source=fopen($url,"r"); while (!FEOF($a)) { $a = $a . fread($source,512); } fclose($source); $destination=fopen("myupload/newfile.jpg","w"); fwrite($destination,$a); fclose($destination);
  11. One of my replacement scripts is not working, here is my php code: $_POST['message'] = preg_replace('/\[font=\"(.+?)\"\](.+?)\[\/font\]/', " <font face=\"$1\">$2</font>", $_POST['message']); $_POST['message'] = preg_replace('/\[color=\"(.+?)\"\](.+?)\[\/color\]/', " <font color=\"$1\">$2</font>", $_POST['message']); When I feed it this: [font="Courier"][color="Yellow"]test[/color][/font] It shows the string as is, and does not evaluate my replacement. Is there something wrong with my pattern? All of my other ones have worked like links, images, and b, i, u, but these two above don't work. I tried it both WITH escaping the " and one WITHOUT escaping the " and still it doesn't process it. I know the script is going through these lines as I tried putting an echo between them, and the echo is shown. Please tell me what is wrong.
  12. Well here is my php code, yes it has tabs so it will mess up here but the code is fine, the bottom regexp replacements for the url both work, its the top eight that return errors. Submitting Message... [center] Testing [/center] Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash Please tell me what is wrong. echo "Submitting Message...<br />" . $_POST['message']; $_POST['message'] = htmlspecialchars($_POST['message']); ############################################################ $_POST['message'] = preg_replace("\[b\](.+?)\[\/b\]", " <strong>$1</strong>", $_POST['message']); $_POST['message'] = preg_replace("\[i\](.+?)\[\/i\]", " <em>$1</em>", $_POST['message']); $_POST['message'] = preg_replace("\[u\](.+?)\[\/u\]", " <u>$1</u>", $_POST['message']); ############################################################ $_POST['message'] = preg_replace("\[img\](.+?)\[\/img\]", " <img alt=\"$1\" src=\"$1\" />", $_POST['message']); ############################################################ $_POST['message'] = preg_replace("\[left\](.+?)\[\/left\]", " <div align=\"left\">$1</div>", $_POST['message']); $_POST['message'] = preg_replace("\[center\](.+?)\[\/center\]", " <div align=\"center\">$1</div>", $_POST['message']); $_POST['message'] = preg_replace("\[right\](.+?)\[\/right\]", " <div align=\"right\">$1</div>", $_POST['message']); ############################################################ $_POST['message'] = preg_replace("/([a-zA-Z]+:\/\/[a-z0-9\_\.\-]+". "[a-z]{2,6}[a-zA-Z0-9\/\*\-\?\&\%\=\,\.]+)/", " <a href=\"$1\" target=\"_blank\">$1</a>", $_POST['message']); $_POST['message'] = preg_replace("/[^a-z]+[^:\/\/](www\.". "[^\.]+[\w][\.|\/][a-zA-Z0-9\/\*\-\?\&\%\=\,\.]+)/", " <a href=\"http://$1\" target=\"_blank\">$1</a>", $_POST['message']); ############################################################ $_POST['message'] = trim(addslashes($_POST['message']));
  13. Thankyou, it worked, but it was too jerky. So I had to resort to putting the dv in a frame at the top of the page ><
  14. ok this is solved, I figured it out. Turned out that when php include()s a file, it locks it from reading by any other process id. EVEN if you do include_once() it still locks said file from writing. THis was freezing hte script because every other page on the server happened to use the same inc/conf.php file in it's header.
  15. but it says object required in IE7. AAAAARRRRRRRRRRRRRRRGGGGGGGGGGGGGHHHHHHHHHH I hate IE7, but my site needs to be crowse browser compatible
  16. use this: <a href="javascript:PlayerpopUp(\''.$item['nsstream'].'\')">
  17. just a side note, why don't you open yoru conenction on 80, bind a listener, and then send from that socket on port 80 ? That would then be artificially bypassing their port blocks by sending on their port 80.
  18. no there is not a way of doing this (with php) because php does not do anything in your script until it recieves the file. If you were using another language, you could have it recieve one packet of the file, send one packet of the file, delete that packet, and repeat. But php cannot do this.
  19. When this script is running, and someone is download a file, ALL other php-cgi.exe requests wait for this script to end, before executing. How can I fix this? Direct Download Script: <?PHP function getfile($TYPE,$B,$PATH) { mysql_query('UPDATE `filepirate`.`FILES` SET `Downloads`=`Downloads`+1 WHERE `ID`='.$_GET['id']) or die(mysql_error()); header('Content-Disposition: attachment; filename="'.$B.'"'); header('Content-Description: File Transfer'); header('Content-Length: '.filesize($PATH)); header('Content-type: '.$TYPE); header('Connection: close'); readfile($PATH); exit(); } function eror($RET) { echo $RET; die(); } $NAME = $_GET['id']; /* MYSQL CONNECTION */ mysql_connect('localhost','root',''); $r = mysql_query("SELECT * FROM `filepirate`.`FILES` WHERE ID=$NAME;") or eror(mysql_error()); while(list($ID,$B,$PASS,$DESC,$TYPE,$DOWN)= mysql_fetch_row($r)) { $PATH = './Files/'.$ID; if (file_exists($PATH) && !empty($_GET['id'])) { if (!empty($PASS)) { if (!empty($_POST['pass'])) { if ($PASS==$_POST['pass']) { getfile($TYPE,$B,$PATH); } else { eror('Invalid Pass. Pass Not Right'); } } else { eror('No Password Entered'); } } else { getfile($TYPE,$B,$PATH); } } else { eror('Invalid File. File Not Here!'); } } ?> (I had to get rid of my indentation because of this forum f***ing up the spaces, replacing them with Why when this is running, does the entire website 'wait' ?
  20. statica.style.top=currentpos+"px" statica.style.left=5+"px" When I put that in my script, it f***s up and says it expects an object at the "s" in "statica.style.top".. .. My full script is here: <script type="text/javascript" language="JavaScript1.2"> var speed=50 var currentpos=0 var statica=document.getElementById("asvesee"); function scrollwindow(){ if (document.all) currentpos=document.body.scrollTop+speed else currentpos=window.pageYOffset+speed window.scroll(0,currentpos) // I am trying to put statica movement HERE. } function startit(){ setInterval("scrollwindow()",50) } </script> <div id="asvesee" style="position:absolute; border:1px solid black; background-color: lightyellow; width: 425px;"> <a href="javascript:startit()">Auto-Scroll Progress</a><br /> Remember, you can close this page, and the upload will continue!<br /> Please email damon.underground@gmail.com with bugs and feedback. </div> This is a VERY simple script to auto-scroll the window, and doesn't quite work on all browsers, but I suck at javascript (as you can tell by my simple question) Please tell me why it won't work, and how to fix it. BTW: This error comes up in IE7.
  21. I didnt know they did smtp redirection THANK YOU!!!!!
×
×
  • 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.