Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. <?php $string = "test <script>tasetsetasetst</script> test2<script>tasetsetasetst</script>"; $string = preg_replace('%<script(.+?)<\/script>%is', '', $string); echo $string; die(); ?> Try that. Word between tabs topic for more in-depth information on regex.
  2. premiso

    Unlink

    Did it display any messages? Such as "The permissions for the file" or "the file should be erased" If so please post those. If not, it never makes it to that point in the script and you have an error somewhere...
  3. You find the (Results ) and grab everything between there. You can then split/explode it at "about" and viola you have your number. Since I am not good at regex, here is an alternative way: <?php $string = "some site that has (Results 1-10 of about 50) ok"; $string = explode("(Results", $string); $string = explode("of about", $string[1]); $string = explode(")", $string[1]); $number = $string[0]; echo $number; ?> Given that there is no html code in that phrase on the site, it should work.
  4. Correct. As far as going to another computer and making a cookie, it may or may not work. It depends on the interval your garbage collector is ran, cause that clears out the sessions. Give it a try and see, I would be interesting if it would work. What you can, alternatively do, is set sessions to timeout at x time, in php and via a database. So if the user inactivity has reached x minutes and they are trying that sessionhash it would return that they need to re-login cause they are not valid. Another way is, which corresponds with the DB of the session hash, is make it so that each login you store that hash in the DB, if the hash does not match the one in the DB, then they are not valid, so if someone copied this cookie before he logged out, then he logged out/closed the browser, and logged back in, the old hash is no longer valid. But the chances of someone grabbing that cookie with that sessionid and re-creating the cookie is slim, unless the user has spyware/trojan. And if so, this only effects their account and they should learn to install software to prevent/remove that kind of stuff.
  5. <?php $string = "test <script>tasetsetasetst</script> test2"; $string = preg_replace('/<script(.*)<\/script>/i', '', $string); echo $string; die(); ?> Works fine for me.
  6. You set the third parameter to be an array that contains the match(es).
  7. preg_match would be the way to go! GOGO REGEX!
  8. You would have to have the password to decrypt it, and invoke that command. Not sure if FPDF has the functionality of entering the password.
  9. premiso

    Unlink

    Ok, is there an error coming out, or is it just not deleting the file? If an error, post it here. $logoname = $row["logotipo"]; if (file_exists($logoname)) { $fileinfo = substr(sprintf('%o', fileperms($logoname)), -4); echo 'The permissions for the file ' . $logonname . ' are: ' . $fileinfo . '<br />'; if (unlink($logoname)) { echo 'The file ' . $logoname . ' should be erased.<br />'; }else { echo 'The file ' . $logoname . ' was not erased.<br />'; } }else { echo 'The file does not exist!'; } Add the above in there and run the script and report back what it outputs.
  10. You would need to do that for any text being input to your DB, so any POST that is not a numerical character should be mysql_real_escape_string. If you want the quotes to "not" affect the query, you can do htmlentities on the code before inserting it into the DB, but escaping the data properly should work just fine.
  11. http://techpatterns.com/downloads/javascript_cookies.php Google is your friend.
  12. print_r($_SESSION); print_r should do the trick, or even a foreach if you want to format the display.
  13. Why not use preg_replace instead of str_replace As I do not think str_replace allows for regex...and for something "that" complicated, it would be better to use the preg function instead.
  14. premiso

    Unlink

    Alright, jo. Post the code where you unlink the file. I fail to see any code like that up there. Better yet, post your full working code for us and I will see if we cannot get this solved for you.
  15. I never really understood the JOINS. I guess I should read up on it. Found this tid bit which may help you: From : http://www.w3schools.com/Sql/sql_join.asp Also found this in Wiki http://en.wikipedia.org/wiki/Join_(SQL) I am going to do some reading now EDIT: The join in the code I gave you is considered an "INNER JOIN" as an fyi
  16. Post your code. You have output before the header call. Simple as that.
  17. simplexml Would be my answer.
  18. SELECT g.title, s.name AS sysname FROM games g, game_collections gc, game_systems gs, systems s WHERE g.game_id = gs.game_id AND gs.system_id = s.system_id AND gc.gs_id = gs.gs_id AND gc.member_id=22 AND s.system_id=6 ORDER BY g.title ASC See if that works.
  19. != should be <> MySQL is weird that way. Give it a try and see if that works.
  20. If you need a stripper, give me a call.
  21. <?php session_start(); include("connect.php"); if(isset($_SESSION['loggedin'])){ ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>The New Rev-FM 94.3</title> <link href="css/login.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> <!-- function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> <link href="p7vscroller/s5/p7VSC05.css" rel="stylesheet" type="text/css" media="all" /> <script type="text/javascript" src="p7vscroller/p7vscscripts.js"></script> <script type="text/javascript" language="JavaScript1.2" src="stmenu.js"></script> </head> <body onload="MM_preloadImages('css/images/listenliveovr.png','css/images/surgery.png','css/images/fostercharitable.png')"> <div id="container"> <div id="topcontent"> </div> <div id="contentbg"> <div id="menubg"> <div id="menu"> <script type="text/javascript" language="JavaScript1.2"> <!-- stm_bm(["menu5574",730,"","blank.gif",0,"","",1,0,250,0,1000,1,0,0,"","900",0,0,1,2,"default","hand",""],this); stm_bp("p0",[0,4,0,0,0,7,5,0,100,"",-2,"",-2,50,0,0,"#999999","transparent","bg_01.gif",3,1,1,"#000000"]); stm_ai("p0i0",[0,"Home","","",-1,-1,0,"index.html","_self","","","","",5,5,0,"","",0,0,0,1,1,"#FFFFF7",1,"#993333",1,"","bg_02.gif",3,1,0,0,"#FFFFF7","#000000","#FFFFFF","#FFFFFF","bold 9pt Arial","bold 9pt Arial",0,0]); stm_aix("p0i1","p0i0",[0,"Jocks","","",-1,-1,0,"jocks.html","_self","","","","",5,5,0,"","",-1,-1]); stm_bpx("p1","p0",[1,4,0,2,0,5,0,0,80,"progid:DXImageTransform.Microsoft.RandomDissolve(,enabled=0,Duration=0.30)",12,"progid:DXImageTransform.Microsoft.RandomDissolve(,enabled=0,Duration=0.30)",12,80,0,0,"#666666","#000000",""]); stm_aix("p1i0","p0i0",[0,"Dave Dodson","","",-1,-1,0,"daved.html","_self","","","","",0,0,0,"","",0,0,0,0,1,"#F9E0CA",1,"#666666",0,"","",3,1,0,0,"#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","9pt Arial","9pt Arial"]); stm_aix("p1i1","p1i0",[0,"Natalie Steele","","",-1,-1,0,"steele.html"]); stm_aix("p1i2","p1i0",[0,"Justin Tenery","","",-1,-1,0,"jt.html"]); stm_aix("p1i3","p1i0",[0,"Tommy Jenkins","","",-1,-1,0,"bone.html"]); stm_aix("p1i4","p1i0",[0,"Danny Del Rossi","","",-1,-1,0,"ddrossi.html"]); stm_aix("p1i5","p1i0",[0,"Big G","","",-1,-1,0,"bigg.html"]); stm_ep(); stm_aix("p0i2","p0i0",[0,"Contests","","",-1,-1,0,"promos.html","_self","","","","",5,5,0,"","",0,0,0,1,1,"#FFFFF7",1,"#993333",1,"","bg_02.gif",3,1,0,0,"#FFFFF7","#000000","#FFFFFF","#FFFFFF","bold 9pt 'Arial','Verdana'"]); stm_aix("p0i3","p0i0",[0,"Events","","",-1,-1,0,"","_self","","","","",5,5,0,"","",-1,-1,0,1,1,"#FFFFF7",1,"#993333",1,"","bg_02.gif",1]); stm_bpx("p2","p1",[]); stm_aix("p2i0","p1i0",[0,"Concerts","","",-1,-1,0,"concerts.html"]); stm_aix("p2i1","p1i0",[0,"Community Calendar","","",-1,-1,0,"calendar.html"]); stm_ep(); stm_aix("p0i4","p0i3",[0,"Media"]); stm_bpx("p3","p1",[]); stm_aix("p3i0","p1i0",[0,"Photo Gallery","","",-1,-1,0,"photos.html"]); stm_aix("p3i1","p1i0",[0,"Video","","",-1,-1,0,"video.html"]); stm_ep(); stm_aix("p0i5","p0i3",[0,"Advertising"]); stm_bpx("p4","p1",[]); stm_aix("p4i0","p1i0",[0,"Media Kit","","",-1,-1,0,"kit.html"]); stm_aix("p4i1","p1i0",[0,"Staff Login","","",-1,-1,0,"staff.php"]); stm_aix("p4i2","p1i0",[0,"Remotes","","",-1,-1,0,"remotes.html"]); stm_aix("p4i3","p1i0",[0,"Contact Sales Staff","","",-1,-1,0,"contact.html"]); stm_ep(); stm_ep(); stm_em(); //--> </script> </div> </div> <div id="content1"> <br><br></br></br><br><br></br></br> <div id="login"> Welcome to the media Kit!! </div> </div> </div> </div> <div id="botcontent"> </div> <div id="footer"> <a href="index.html">HOME |</a> <a href="jocks.html">JOCKS |</a> <a href="promos.html">CONTESTS |</a><br /> <br /> <a href="links.html">Link Us</a> <a href="ads.html">Advertising</a> <a href="policy.html">Privacy Policy</a> </div> </div> </body> </html> <?php } else { // this is not being closed at the end. if(isset($_POST['login'])){ $username = $_POST['accountname']; $password = $_POST['password']; $query = "SELECT * FROM users WHERE username = '$username' AND password = '$password'"; $check = mysql_query($query) or die(mysql_error()); $num = mysql_num_rows($check); if($num == 1){ $_SESSION['loggedin'] = 1; echo "logged in!"; } else { echo "error"; } }else{ echo "You must log in to view this page."; } }// added by premiso to correct a syntax issue. ?> It is not that we do not like it, it is ok, as long as it is necessary. In this case it was, cause you were not closing the "else" statement bracket to your first if.
  22. Put this at the top of the page and see what is displayed: error_reporting(E_ALL); ini_set("display_errors", 1); Also you do not have session_start or mysql_connect at the top of your page.
  23. Make sure that you do not have any white spaces at the top of your script: Invalid: <?php ?> Valid: <?php ?>
  24. Well since you brought it up maq....
  25. If you put on "E_WARNINGS" to display as your errors, you will get one if the page did not actually post a key called "input" Using isset, will ensure that there is a variable and will avoid getting e_warning messages sent to your log everytime the page is called. That and instead of using str_replace (which you are missing the replacement parameter), trim would be much better as it only trims out the whitespace. The input from the form could be valid with spaces.
×
×
  • 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.