Jump to content

physaux

Members
  • Posts

    208
  • Joined

  • Last visited

    Never

Everything posted by physaux

  1. but I want to create links, meh I guess I overthought it, I'll just use the full url with slashes, no local linking. Thanks!
  2. Hey guys, I have url rewriting, so that: website.com/first/second/third becomes website.com?id1=first&id2=second&id3=third So essentially all the pages come from just one page, index.html. My question is, say if I am writing the php for a page, which for the user would appear as: website.com/first/second How can I send them to website.com/first/apple ? Here are the possibilities I was thinking of: first/apple website.com/first/apple //(what I think) index.php?id1=first&id2=apple index.php/first/apple Which one is right? I just want to link the to a page. Any suggestions/ tips in relation to this? Am I doing it right?
  3. Hey, I am using php to print out the html code to make a form.. It appears, but when I click the button nothing ever happens, doesn't go to my "action" page at all copied html code: <form action="index.php" method="post"> <input type="text" name="text1" id="text1" /> <input name="asd" type="text" maxlength="50" /> <input name="jhb" type="checkbox" value="" /> <input name="hjblk" type="checkbox" value="" /> <input name="lin" type="button" value="hjkkjk" /> </form> the file this text is on is NOT index.php, it IS test.html I can't see what is wrong with this!!! :confused: anyone see anything? -I'm using XAMPP, and firefox.. EDIT: ahhh type was not "submit"... stupid thing..
  4. My concern is not about storing them on the server, I have them all in a folder and the folder is emptied every 5 files that I create. I make the name unique only so that the users browser doesnt say "oh I already have this file", and show an old version. I did not put "nocache", because I do want a cache when the file name hasn't changed, but I want the cache ignored when there is an update, so that is why I change the file name. My quesiton had to do with the browser (or flash)? storing the xml files. What were to happen if I kept loading new ones each time they refreshed my page (it won't be that fast). I just don't want a "memory leak" issue. But I am sure browsers automatically delete cached xml files that haven't been used for a while, but I just wanted to check with you guys.
  5. Hey guys, I am using php to write a xml file on my server, that is then read in a flash file. I noticed my changes were not appearing, so after some research I decided that every time I update my xml file, I "timestamp" the name, which forces the user to always download the most recent one. My question is, are the old ones going to "build up" and be a problem, if I don't set them to expire some time? Here is the code that makes the unique file name: $name = "data_".md5(time()).".xml"; I then update the "pointer" in my html output, to point to the new xml file as the resource. This is working great. but yea, do I need to do expire stuff, or will the browser handle that for me? thanks! EDIT: I think I should mention the size of the xml is 36kb, and At most it would be updating once per 15 minutes EDIT2: Oh yea and if it is a good idea, could someone tell me how too? thanks!!
  6. Ah, that is awesome It worked! buuuut... That led me to realize that I actually outputted the wrong thing, I now output(like I wanted): <configuration> variable1 = "2" variable2 = "9" </configuration> but I was getting errors, and I finally realized I need to actually have it like this: <configuration variable1 = "2" variable2 = "9" > </configuration> So the new line is working, but now I need to put the "variables" inside of the "<>". I tried just printing the raw text, but it won't let me. It keeps html encoding the "<>", so I cannot use print to get this done. -I'm starting to think new lines was the wrong idea, i should have been doing attributes or something.. :confused: Any help? thankyou! EDIT: Ok nevermind, the proper solution was simple and well documented, so i got it now. Thanks
  7. So i am trying to write an xml file. I am trying to write a part like this: <configuration> variable1 = "2" variable2 = "9" </configuration> But my code gives me it all one line, without a linebreak: <configuration>variable1 = "2"variable2 = "9"</configuration> How can I make a linebreak? I have tried \n, it just prints out "\n". I have tried <br>, it just prints out "<br>" (I put them both with the var1 string, in the same brackets) Any suggestions? Here is my relevant code: $doc = new DOMDocument(); $doc->formatOutput = true; $l1 = $doc->createElement( "main" ); $doc->appendChild( $l1 ); $l2 = $doc->createElement( "configuration" ); $doc->appendChild( $l2 ); $l2->appendChild($doc->createTextNode('variable1 = "2"' )); $l2->appendChild($doc->createTextNode('variable2 = "9"' )); $l1->appendChild( $l2 ); $doc->saveXML(); $doc->save("write.xml") ;
  8. Is there a quick function that could do this, or do I have to make one? I have: myarray[1]['points'] = 4 myarray[2]['points'] = 8 myarray[3]['points'] = 32 myarray[4]['points'] = 2 ... myarray[64]['points'] = 52 The array has 64 elements, and will always have different numbers. How can I sort the array, so that the biggest number is first, but I still need to know its index. Anyone have any idea :confused:
  9. What data type should I use for string lengths of 25, 50, and 160 I was just using TEXT before, with a limit of 25,50,160 is that bad ? someone told me it is bad! :confused:
  10. Thanks, that really helped to clear stuff up!! :thumb-up:
  11. Hmm interesting thanks for the replies. It wasnt the "greater than or equal" mistake lol, but thanks for considering all the possibilities Ok, so I am trying to understand it. Here is a sample code where it is used. Could someone clear up for me what exactly is going on? <?php $employees [] = array( 'name' => 'Albert', 'age' => '34', 'salary' => "$10000" ); $employees [] = array( 'name' => 'Claud', 'age' => '20', 'salary' => "$2000" ); $doc = new DOMDocument(); $doc->formatOutput = true; ?> I can see that the first "=>" assigns an array, ok thats cool. But what is the second, "->" part do?? Thank you!
  12. Actually I just found this: could I just use hexdec() to put it to a decimal, then get a ratio using my percent, then put it back with dechex()? That is my plan now, unless anyone has some suggestions.
  13. How can I change a hex color code by a percent? Ex= [008E00-->ffffff] is proportional to [100-->0]? What I mean is like, imagine the following line (or color gradient): ffffff____________________008E00 Where white is at far left, and a shade of green is on far right. Now Imagine another line, right under that line: 0______________________100 I want a way of generating a hex color code, based on a number between 0 and 100. 0 would be WHITE 100 would be MY GREEN My theory is to just focus on the green component of the hex, 8E, then construct a hex code of that, by surrounding ti with two zeros on each side. So I guess my question comes down to how do I get a percentage of a hex number (I don't know much about hex numbers)... Thanks!!
  14. I can't seem to google for it effectively, and "arrows" isn't helping... So could someone tell me what this does? I have seen it in many sample codes. Thanks!!
  15. Hey guys, I am trying to get my cache system up and running. I don't want to query my database evertime a user wants something that is generic, and only update the "cache" of it when it changes. I plan on writing it to a file, but I need some advice... - each input has 5 fields, so what would be the best way to seperate them in a file? I know I would just use explode to read it back into an array, but I need the "dividing string" to be something that would not occure in the input. Such as [|] . But there is always a chance that might appear. so question A) What is the best way to format my file. (maybe i should "escape" my explode text with preg replace?) question B) What would be the best way to "update" the file, without having to rewrite it. Ex if I want my file to hold the 5 most recent values, When a new one appears, I have to kick out the oldest. How could I efficiently do this? thanks!
  16. Nevermind, google got my back on this 1 thanks for telling me about mod-rewrite!
  17. And is $_SERVER['DOCUMENT_ROOT'] the root of the public html, or the main root? Edit: Nevermind, I got it
  18. Can you explain what you mean exactly when you say I only need one file? Say each of my files can be generated from a "pageid" from a database, I thought I had to create many different pages like this: <?php $pageid = 8; include("genericpage"); ?> How do I do it like you are saying?
  19. I am creating a file that will be "included" in many places. How can I refer to the site root, so that I can effectively navigate to my desired paths with fwrite()? Is there any way to do this other than "www.mysite.com" will that work? thanks!
  20. Hey guys, I want to create new pages on my site. However, I want the pages to be like so: www.mysite.com/.../989said9asdua9s-the-title-of-my-page.html So I am trying to create a url with the title words in it. But I want to take precautions incase I end up making 2 pages with the same name. So i want the random number part (989said9asdua9s) to be unique for every title string. Would this work: check if the title is unique, if it is then the url is just: md4/5(title).urlencode(title).".html"; If the title is not unique, I add some random string/numbers to the title inside of the md4/5, and the url is: md4/5(title.randomString()).urlencode(title).".html"; //I would make randomstring as a function. So I would loop this until the url is unique. Does that sound like a good plan? or could something go horribly wrong that I do not see. I don't want the random string to be too long, and so is md4 or md5 right for this? or does anyone have any other suggestions? thanks!! EDIT: incase of appending random strings, I could just append something unique to the page, such as it's ID or whatever... So the question becomes, is md5/4 good for this? Is this a good idea? Is there a better way?
  21. You should mark the topic as "solved" since you figured it out
  22. Hey guys, I want to create a PHP file, and then chance its permissions. I am doing this because I want to "update" a file that will be included in other pages. I want to set a cronjob to do this once a day or such, so I need to be sure that the permissions will be set properly so that nobody else can activate/ see that file. Here is what I have so far: <?php $myFile = TEMPVARIABLESNAME; // is something like "temp.php" $filepermissions = TEMPFILEPERMISSIONS; // is a int value, such as 700 $fh = fopen($myFile, 'w'); $tempstring = '<?php'; //... $tempstring.= '?>'; fwrite($fh, $tempstring); fclose($fh); chmod($myFile, $filepermissions); ?> Which permissions level should I set for a file that I only want to be accessible from other files "include()"ing it? Any suggestions? thanks!
  23. Hmm I see. no offense, I just want a couple more people's opinions before i put it to "solved", but thanks!
  24. Hey guys, lets say I have about 2500 users, Each User can have say up to 100 "private messages" stored at a time. What is the best way to put this into a table? A-make a table for each user with a messageID or B- make a table for messages, and just link them to each member Which way would be better? A- would make LOTS of tables B- each query would access LOTS more messages than it needs to, and have to search through all of it for each user. Or is there a better choice C? Thanks!
  25. Hey, So i have user authentication using phpbb's thingy, and I was wondering. Any advice on how to create a button so that users can create a new post about an article, or join a post that is "tied" to an article. Ex: Article A exists, but nobody has clicked the button yet. Display= Click here to start a new post about this! Action= create a new post and "link" it to article. Ex2: Article A exists, and someone has already started a discussion. Display= Join the discussion, Click here! [also display last 2 posts or something] Action= Go to that post in forum any advice? EDIT: Whoops wrong category sorr!
×
×
  • 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.