Jump to content

d22552000

Members
  • Posts

    535
  • Joined

  • Last visited

    Never

Contact Methods

  • MSN
    d22552000@hotmail.com

Profile Information

  • Gender
    Male
  • Location
    Canada, ay?

d22552000's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  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.
×
×
  • 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.