Jump to content

XeroXer

Members
  • Posts

    80
  • Joined

  • Last visited

Everything posted by XeroXer

  1. [u][b]ToonMariner:[/b][/u] That sounded like a good idea. All my entrys start with [color=red]"<table"[/color] and end with [color=red]"</table>"[/color]. Can you help me how to do it more step by step?  ??? [u][b]chriscloyd:[/b][/u] My guestbook is done so that it uses a textfile and not mysql. Just because all people do not have acces to a mysql database. So that solution is out of the question...
  2. Hi there! In my guestbook it reads all entrys from a plain textfile. Now I was wondering if theres any way to make it pages instead of them all in one page. Like if entrys get over 25 it creates a new page with the other ones. And if it then get over a total of 50 it ones again creates a new page. The hard thing is for me to make it not print out the same entrys on every page. PLease help...
  3. Ok! How do I create a link that saves a cookie with the color information and then reloades the site to show the color they chose? All the questions is because the first time I ever used cookies with a php script was yesterday. :-) Because this would work to chek it right? [code]<head> <?php $css = "$_COOKIE[css]"; if $css == "red" { $stylecss = "style_red.css"; } elseif $css == "blue" { $stylecss = "style_blue.css"; } elseif $css == "green" { $stylecss = "style_green.css"; } elseif $css == "brown" { $stylecss = "style_brown.css"; } else { $stylecss = "style.css"; } ?> <link href="<?php echo $stylecss; ?>" rel="stylesheet" type="text/css"> </head>[/code] I know that I can use: [code]<?php setcookie("css", "red", time()+36000); ?>[/code] but not how to embed it into a link...
  4. But if I use cookies to save the theme they selected do I still need ?css=1 or can I make it any other way?
  5. [u][b]Hi there.[/b][/u] I am making a page where I want the user to be able to specify what look they want the page in. So that on the startpage there shall be different colored squares that they can click. And if they click the red one the design pick my [color=red][b]red.css[/b][/color] file to use. By doing this I use the [color=red][b]?css=1[/b][/color] and different numbers. Thought that creates a problem. I use the [color=red][b]?id=1[/b][/color] to choose what page to show. How do I do so that I can have more of these :-)... I have seen pages using [color=red][b]index.php?id=1&?css=3[/b][/color]. Is this easy to do or? Or maybe someone has a different idea on how to do the style switching? Maybe using cookies so that if they return to the page the style they chose is still used. Please post any tips you can think of...
  6. Ok. Can I somehow use them both for the best preformance? Or maybe test with cookies toi see if the user has them turned off and then use session? Then also how would I use them to get the current date and time into a cookie or session and how do I read it out of them the best way?
  7. I have a quiz on my site where people can go through a series of question answearing what they think. Now I want to add a timer so in the end they can see how long time it took for them to answear it all. I use just one file for this and use case 1: break; and so on. Now I want to know the best secure way to store the start time and endtime and also print it into a file. Because in the end of the test they can enter their name and a small message and they end up in the highscore. :-) Is there a way to do this so if the time is stored from the start and then I can store another one in the end and show the start and endtime to the people. If you don't undertsand what I mean say so and maybe I can explain better...
  8. Hi there. Now I have released my guestbook as version 1.0. It can be found at [url=http://php.xeroxer.com]http://php.xeroxer.com[/url]. Though for some further development I want to edit the admin area. Because of the way it prints into the textfile all the entrys end up in it's own row. Witch makes it so that I can print it out and create a text next to it with delete and edit. The thing I need help with is how will I make this. How can I print out the guestbook entrys on the site and with a delete or edit text next to it. And if you press the delete button it automaticly deletes the whole row and if you press the edit button it opens a new site with the guestbook form but the text from the entry is in the fields already. Also I would like to somehow unvisible store ip och the user that wrote the entry. This might be hard to understand but if someone does please help me...
  9. ok... how about if I am setting that text as a $ then? [code]$gbedited = "<meta http-equiv='refresh' content='3\;URL=$gbpageother'>Click <a href='$gbpageother'>here</a>"; [/code] Because I use that text multiple times to...
  10. How should I make that in a link? Because I use it in many places in the file I first det the function and then try to make it as a link: [code]<?php $gbpageother = "$_SERVER[SCRIPT_NAME]"; ?> <meta http-equiv='refresh' content='3\;URL=$gbpageother'> You will be sent back in 3 seconds. If not click <a href='$gbpageother'>here</a>[/code] This may look stupid to you but then please clear it out. How should this be done? [b]EDIT:[/b] Added to the point is that the above example does not work...
  11. [u][b]Hello![/b][/u] My guestbook is based on one file. Earlier today I got help regarding linking inside the file. Well now I need more help regarding that. Becuase people might wanna change the name of my file I added so it uses [color=red]$_SERVER[PHP_SELF][/color]. At the start of the file I set [color=red]$gbpage[/color] to [color=red]$_SERVER[PHP_SELF][/color] and then in the file use it like this: [code]<?php echo $gbpage; ?>?id=1[/code] The problem comes if people go first to [color=red]id2[/color] and then fron there to [color=red]id4[/color]. Then I want them to by one click or automatic refresh of the page get back to the start page. Let's say the file name is [color=red]index.php[/color]. Then they click a link to [color=red]index.php?id=2[/color] and from there [color=red]index.php?id=4[/color]. Then I want the page to go back to [color=red]index.php[/color]. But because I don't know what the filename is and [color=red]$_SERVER[PHP_SELF][/color] outputs [color=red]index.php?id=4[/color] I have a problem. Can I somhow use the [color=red]$_SERVER[PHP_SELF][/color] and remove the [color=red]?id=4[/color] automatic?
  12. Easier than I thought Thanks a lot... Though it should be $_GET['id'] and not $_GET['id')... :-)
  13. Hello again. Back with another problem. I want to make my guestbook into only one file. Therefore I want to link inside the own file. So I took from a tutorial this code: (part1) [code]<a href="index.php">default</a> <a href="index.php?id=1">id 1</a> <a href="index.php?id=2">id 2</a> <a href="index.php?id=3">id 3</a>[/code] (part2) [code]<?php switch($id) { case 1: echo "Number 1"; break; case 2: echo "Number 2"; break; case 3: echo "Number 3"; break; default: echo "No number between 1 and 3"; } ?>[/code] They said it should work on the site. But regardless of what link I press the result always ends up with the default. So is there another way this should be done. I just need to get my guestbook into one file. :-) Please help...  ???
  14. Thanks! My rows now look like this: [code]<?php //Set name $name = htmlentities(strip_tags($_POST['name'])); //Set email $email = htmlentities(strip_tags($_POST['email'])); //Set homepage $homepage = htmlentities(strip_tags($_POST['homepage'])); //Set message $message = nl2br(htmlentities(strip_tags($_POST['message']))); $message = str_replace(array("\r", "\n"), '', $message); $message = wordwrap($message, 50, "<br />", true); ?>[/code] That looks a lot better and I also added the lengthlimit on the textfields. Thanks for all the help. Will be back for more questions regarding other stuff :-)
  15. not that I can see. If you read the explanation of echo you can see an example: [code]<?php echo "This spans multiple lines. The newlines will be output as well"; ?>[/code]
  16. Just one last thing... :-) Is there any special order these should be taken in? Or can I make somethings do more on one row? This is my code for the message field right now: [code]<?php //Set message $message = $_POST["message"]; $message = strip_tags($message); $message = htmlentities($message, ENT_QUOTES); $message = nl2br("$message"); $message = str_replace(array("\r", "\n"), '', $message); $message = wordwrap($message, 50, "<br />", true); ?>[/code] And for name, email and homepage it's this: [code]<?php //Set name $name = $_POST["name"]; $name = strip_tags($name); $name = htmlentities($name, ENT_QUOTES); $name = wordwrap($name, 50, "<br />", true); //Set email $email = $_POST["email"]; $email = strip_tags($email); $email = htmlentities($email, ENT_QUOTES); $email = wordwrap($email, 50, "<br />", true); //Set homepage $homepage = $_POST["homepage"]; $homepage = strip_tags($homepage); $homepage = htmlentities($homepage, ENT_QUOTES); $homepage = wordwrap($homepage, 50, "<br />", true); ?>[/code] Does that look good or not? The message field is the only one that is a textarea. The other ones are just a "textrow". That is why I don't use the nl2br and str_replace with name, email or homepage Is that correct?
  17. If I use htmlentities and strip_tags on all fields will they still work? Name, Email, Homepage and Message. Those fields are in my guestbook. If I use both those functions on all those fields will still long homepage and mail adresses work?
  18. I have to use them all? I was going to check the quickref on php.net but the site is down as it seems. So I need the info on the functions. :-(
  19. [size=12pt][u][color=red][b]NEW QUESTION![/b][/color][/u][/size] Now I have another question still regarding my guestbook. Thought I'd post it here instead of creating a new thread. Now my flatfile guestbooks work almost as I want it. I have gotten control over the length of the text entered. I also got so it supports pressing 'enter' while writing a message. Now I need it to remove the html code and anything similar. :-) I want to strip the html code from the message before entering it into the textfile. Or just print it out plain html and not working. Because now people can enter what they like and ruin my guestbook. A javascript that makes something annoying or a few rows of html that changes everything. So please help me. [b]1)[/b] How do i strip of the html code before entering it into the file? [b]2)[/b] How do I print the file with the code intact but not working? [b]3)[/b] Witch one of these do you think I should use?
  20. Thank you once again. Now my guestbook works like a charm... :-)
  21. OMG that did the trick. Now they can press enter how many times they want. The message will still be presented the right way... Though the problem I edited in the other message can that be solved?
  22. Well thanks. That added the [code]<br>[/code] that I wanted. Though it did not remove the line added. The message still winds up in multiple rows in the textfile but now with [code]<br>[/code] after them. So that helped in someway but I still need the linebreaker that comes with 'enter' removed... [b]EDIT:[/b] I also need it to add a [code]<br>[/code] like a automatic linebreaker. If a person just types a loooooong message without any space the site expands. Is it possible to make it do automatic linebreaker if no space is found?
  23. Hi there... This is my problem: I am making a guestbook that uses a flat file. Just a simple one for my mother-in-law's homepage. The problem I am having is that when people enter a two rowed message the file bugs out. Well they can enter a two-row message if they just type and type. But as quickly as they press enter to change the row it doesn't work. They can still post the message but in the textfile that just makes a new line and I would like it to change it to:[code]<br>[/code] So what I would like to know is if I can get a normal 'enter' in a textarea to become a [code]<br>[/code] in the textfile? Plz help... ;D
  24. Hi there! This is what I want to be able to do. If I have a page. Let's say [a href=\"http://www.mywebpage.com/links.html\" target=\"_blank\"]http://www.mywebpage.com/links.html[/a]. And I want to get all the links from that page listed for me in plain text. So if the page has these one: [code]<a href="http://www.otherpage.com/1.html">1</a> <a href="http://www.otherpage.com/2.html">2</a> <a href="http://www.otherpage.com/3.html">3</a> <a href="http://www.otherpage.com/4.html">4</a> <a href="http://www.otherpage.com/5.html">5</a>[/code] I want to get out this: [code]http://www.otherpage.com/1.html http://www.otherpage.com/2.html http://www.otherpage.com/3.html http://www.otherpage.com/4.html http://www.otherpage.com/5.html[/code] Anyone have any ideas?
  25. Well it seeems the curl needs me to install something extra while the sockets does not. Witch means the sockets would be a better try. :-) I have never used sockets before. Could anyone help me with how to use it? How to use it in the above script to get it working. :-)
×
×
  • 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.