Jump to content

Manixat

Members
  • Posts

    164
  • Joined

  • Last visited

Everything posted by Manixat

  1. Heya, I was currently exploring facebook's graph API and as I was looking at this example status object I saw that the people who liked this are also an object and I was wondering how that object is being saved in the database?
  2. Ofcourse it would but it would also be written by somebody who actually knows what he's doing anyway I guess I found my answer, thank you guys!
  3. Yes, I know I can do that, but my page is running in background so my goal is to use as less CPU as I can that's why I wanna avoid doing loops and using 10+ replace methods
  4. Heya, is there a way to find different strings in a text and replace them depending on the found string using a single replace methog ? I believe my explanation is worse than bad so I guess I have to give an example: if I have this sentence "Scott is Bob's best friend and Tod's worst enemy" if I want to replace scott with greg, bob with jeremy and tod with simon I can do this text.replace(/scott/,'Greg').replace(/bob/,'Jeremy').replace(/tod/,'Simon'); but my question is if I can do something like this text.replace(/scott|bob|tod/,/greg|jeremy|simon/) Is it possible? EDIT: I know in this case I don't have to use regular expressions, but this is just an example, in my real code I have to use regex
  5. yeah that's obvious but that would be the solution if there's no way of detecting a click on the html element where there's nothing above it ( in the 3D schema )
  6. Hey, I want to place an advertisement on my pages' HTML tag BACKGROUND-IMAGE, but the problem is I can't figure out how to detect a click ?
  7. Hey, I have blown google's servers and yet haven't found the solution to my problem - HOW do I modify a page's content with an extension ??? Thanks in advance!
  8. so you mean to tell me that the sitemap file has to contain every single possible page and everytime a new ID ( row ) is inserted into a table, which will generate a new instance of a page, I have to add it to the sitemap ?
  9. I'm not sure where to post this but ... I want to know how sitemaps work, and I know the basics but I don't understand how is every page supposed to be in the sitemap, meaning that I might have like 500 million IDs in my database, how is that all going to go in the sitemap ?
  10. exactly what I needed ! Many thanks !
  11. Hello, I tried googling this but I ended up reading a bunch of confusing articles about php text watermark, what I need is a tutorial on how to stamp an image with another image ( site logo ). Can someone link me to a decent one or better yet explain ? Thanks in advance!
  12. Hey, I know this is not a php issue but in other sections of the forums I barely get any attention at all.. Anyway, is there some way for htaccess to not apply to a certain user, meaning IP or anyway a user can be recognized, and by user I mean myself/admin ?
  13. Hello freaks, I was just working on this function I needed for my website that converts a timestamp into a colored timer that runs down from green to red. So as I was working it turned out pretty good and I thought I should turn it into a plugin and share it with you guys. For all the help I've been given here that's the least I can do, so here it goes: It takes 3 parameters - Timestamp, Green constant, Color brightness. Timestamp is a unix timestamp Green constant is a value measured in seconds that will determine from where the coloring will start, everything greater than that constant will be colored green. Color brightness must be a value between 0 and 1 Returns an array of 2 elements, [0] being the time converted into Hours:Minutes:Seconds, [1] being the color in a rgb(x,y,z) format. function colored_timer(t,s,cm){ var e = new Array(); if(t>=0){ var r,g,m,c; c = t; e[0] = Math.floor(t/3600);t = t-(e[0]*3600); e[1] = Math.floor(t/60);t = t-(e[1]*60); e[2] = t; for(i=0;i<=2;i++){ if(e[i]<10){ e[i]="0"+e[i] } } m = 510/s; (c>=s) ? g=s : g=c; if(g>=(s/2)){ r=s-g; g=s/2; }else{ r=s/2; } e[0] = e[0]+":"+e[1]+":"+e[2]; e[1] = "rgb("+Math.floor(r*m*cm)+","+Math.floor(g*m*cm)+",0)"; }else{ e[0] = "Time's Up"; e[1] = "rgb(255,0,0)"; } return e; } Enjoy ! To test it out you can use this simple code: <script> var seconds = 10; setInterval(function(){ colored = colored_timer(seconds,10,1); document.getElementById('dgd').innerHTML = colored[0]; document.getElementById('dgd').style.color = colored[1]; seconds--; },1000); </script> <div id='dgd'></div>
  14. Manixat

    Nl2Br

    Oh I found out where the problem is, my submit form doesn't insert new lines into the database, if I add them manually they appear in the output as well. What might the problem be? I guess if stripslashes was removing the slash before \r\n I would still get "r" or "n" ? which I don't ? I'm really confused :/
  15. Manixat

    Nl2Br

    Well I suppose, but it still doesn't work, no new lines on my output :/ <div class='info'>".nl2br(htmlspecialchars($row['info']))."</div>
  16. Manixat

    Nl2Br

    Hello, Can someone explain to me how nl2br works because I cannot get it to work correctly I tried using it before escaping the input and after escaping the input and new lines are not shown in the database ? ( as <br> ) Here's some code if you'd like: $title = mysql_real_escape_string(stripslashes(nl2br($_POST["title"]))); $about = nl2br(mysql_real_escape_string(stripslashes($_POST["about"])));
  17. Hello freaks, I'm trying to create a timer that changes color depending on the time remaining. The easiest thing I thought I could do is have if statements but that would not lead to a smooth change in colors, so I figured I have to calculate the color, which led to the problem. How do I turn numeric values to hexadecimal color code ? More accurately - I need to have #00FF00 if the timer is equal to 60*60*24*31 or greater and run down to #FF0000? Any help is appreciated, Manix
  18. Ok so I'm getting pretty annoyed after 30 minutes of non-success, I have an array and I'm trying to match every element individually but it matches the whole string to the very end ??? $cities = array('Видин','Монтана','Враца','Плевен','Велико Търново','Русе','Разград','Силистра','Добрич','София област','Ловеч','Габрово','Търговище','Шумен','Варна','София','Перник','Кюстендил','Пазарджик','Пловдив','Стара Загора','Сливен','Ямбол','Бургас','Благоевград','Хасково','Кърджали','Смолян'); regexp: ,'(.*)' supposed to find - ,'Монтана' ,'Враца' etc. but instead returns the whole array ??? I also tried ,('.*') but the result was the same and ,'(\w*)' doesn't return anything
  19. I don't even have those last 2 parameters, will add them and respond shortly ! EDIT: Works like a charm! Thank you!
  20. Hello, I have this problem that is bothering me. When my users log in their data is stored in cookies but say they logged in www.mydomain.com then they decide to type in the whole http://www.mydomain.com/ and they have to log in again cause there is no cookie for that "domain" ? How can I make it read cookies regardless of the beginning of url ?
  21. basename(__FILE__) this causes an internal server error O.o I'm not quite sure I understand what you mean, I use relative paths ? Another thing I thought about is that this will not work out well with ajax
  22. Having the $_SERVER['REQUEST_URI'] checked would be the thing I'd go for, but the problem is I already have too many scripts and having to hardcode it to all of them will be lots of work, I was hoping there was a less painful way? Using htaccess makes "main" pages unable to access scripts as well :/
  23. Hello, I have this question as to how I can make my scripts so that they cannot be opened individually, only called by other scripts? eg. buddy_list.php is a page that facebook uses to load your friends, but if you attempt to open facebook.com/buddy_list.php it will load the "Page was not found" page
  24. Okay so I did the test, before escaping the input (raw $_post) has slashes before quotes which means that magic quotes is on, right? So from there my solution I guess would be to turn it off, but since I have no access to the server I googled about this htaccess method and all I found was this php_flag magic_quotes_gpc off And of course decided to use it, but then it gave me a server internal error So from here I guess I have to ask you how to disable it properly, or why not leave the input unescaped since it has magic quotes ? And about the "disappearing" content, I found out what the problem is, although I couldn't think of a solution, I have quotes at the value=" " attribute, but if the content contains quotes it closes, eg. value="Meet "Dave"" - and 'Dave' is left out of the value. I thought I could add slashes to the quotes but they appear aswell. Any Ideas?
  25. I am escaping it once in the beginning of the code. I'm not really familiar with magic quotes but I assume it is a server-side issue and I do not have access to the server configuration :?
×
×
  • 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.