
thankqwerty
Members-
Posts
21 -
Joined
-
Last visited
Never
Everything posted by thankqwerty
-
wait wait, maybe i'm wrong ....... ??? :-\
-
Hi there, i wanted to make something like the commenting system in youtube, i.e. the users can click "reply" to a specific comment and a comment form pops out. I know how to make the comment form appear and disappear using javascript, but i'm not sure with having so many forms in the same page. my experience is that if u have 2 forms with elements that share the same name then the information would mess up, for example. <--? Form 1 --> <form action="comment.php" method="post"></br> Title: <input type="text" name="title" size="50"/></br> Comment: </br> <TEXTAREA type="text" wrap="physical" NAME="content" COLS=150 ROWS=10></TEXTAREA> </br> <input type="submit" value="submit"> </form> .. .. .. <--? Form 2 --> <form action="comment.php" method="post"></br> Title: <input type="text" name="title" size="50"/></br> Comment: </br> <TEXTAREA type="text" wrap="physical" NAME="content" COLS=150 ROWS=10></TEXTAREA> </br> <input type="submit" value="submit"> </form> Since both forms have "title" and "content" and when i submit something using form1, it will turn out to be empty data. This problem goes away if i name the elements in the 2 forms differently, but then it'll require different action page as the $_POST values have different names, even though the structure of data is the same. Is there anyway to get round this???
-
Hi all, what would be the best way to make a treeview to show the structure of my website? Providing the information i need is stored on mySQL?
-
thank you very much
-
so i just do it like normal generating html (using echo)?
-
Hi all, i'm a newbie of javascript. I want to make a treeview showing the structure of my website using javascript. I would like to ask how can i pass the information from mySQL to javascript? Or do i just draw everything (the treeview) using PHP like normal, then expand and close each branch using javascript?
-
Thank for the reply. In that case would it be better to use session? So i click something in the menu which pass the requested page to session, and i can avoid leaving a mess in the URL. But if i'm leaving the URL clean is that means i won't able to use mod-rewrite later (after i learn it ><!) to give each of the page a clearier URL. (i suppose if i use session all the link would appear to be main.php, instead of index.php or news.php or project.php). Is that mean if i'm going to use mod-rewrite later i should stand the mess in the URL for now?
-
I have made a frame for my website, which contain some of the usual elements i.e. header, menu, .... etc. At the moment i program it in the following way. 1) The frame includes "header.html" (which contain the logo.... etc) and "menu.html" which are the same for all pages, then the contents for different pages i.e. index.php, news.php, projects.php .....etc 2) each page, for example the index page, i need to have a file for frame-index.php which combines header.html, menu.html and index.php. Then index.php to store the actual content of the idex page. 3) so i need 2 files frame-index.php+index.php for the index page, and the same for the project page and news page.....etc. And if i want to change the design of the frame i'll have to change each of the frame-XXXX.php files. Which doesn't seem very efficient to me. What would be the better way?
-
[SOLVED] A conceptual question about website and database
thankqwerty replied to thankqwerty's topic in PHP Coding Help
Thanks again, so i guess no new file is created. -
[SOLVED] A conceptual question about website and database
thankqwerty replied to thankqwerty's topic in PHP Coding Help
Thank you very much for the reply. I'll read through it, though it looks like a bit tough for me at the moment. Would u tell me what is the advantage of doing this (since i see every major sites do it this way)? ??? -
Hi, i'm trying to make a website that i can post articles and stuff. I managed to store the articles in my database and displaying them .... etc, which are all fine. At the moment i'm using $GET and php to generate the page with the desired article. The link to any specific article would be something like http://localhost/database/display.php?num=6. Where the articles themselves has no real link. So my questions are: 1) how can i make it like the BBC for example, where every page has a link to a real file? (should i create a html file everytime when a new article is posted) 2) if i create a new html file for every new article, what should i store in those files? Since all the information are stored in the database already. 3) is there any downside for what i have at the moment?
-
XAMPP setting difference for linux and XP
thankqwerty replied to thankqwerty's topic in Apache HTTP Server
I put in what you suggested. They both start with, <?php ini_set ("display_errors", "1"); error_reporting(E_ALL); session_start(); ?> <html> "Lacking all your code to be able to duplicate the problem, my next best guess is a register_globals problem (variables of the same name overwriting each other.) What does a phpinfo(); statement show for the register_globals setting on each system?" I don't understand that, sorry i'm too noob. -
XAMPP setting difference for linux and XP
thankqwerty replied to thankqwerty's topic in Apache HTTP Server
ok, i just put the two lines in but no different ??? :'( -
XAMPP setting difference for linux and XP
thankqwerty replied to thankqwerty's topic in Apache HTTP Server
Just to make my problem clear, I run the same exact codes on a windows system and a linux system with the same version of XAMPP, but only the window one works. This is the 1st page where the session values are defined. I tested the variables in this page and they all work fine. <?php session_start(); ?> <html> <body> .. .. .. .. if ($redo != 0) { $_SESSION['redo'] = $redo; $_SESSION['username'] = $_POST["username"]; echo '<META HTTP-EQUIV="refresh" CONTENT="0;register.php" />'; } .. .. </body> </html> This is the code for the page that i have problem with. Where the value of session passed from the other page is lost. <?php session_start(); $redo = 0; if (isset($_SESSION['redo'])) { $redo = $_SESSION['redo']; if ($redo == 2) $usr = $_SESSION['username']; } $redo = $_SESSION['redo']; ?> <html> <body> <h1>User register</h1> <form action="checkinput.php" method="post"> <font size="4" face="Times"> User Name: <input type="text" name="username" value="<?php if ($redo == 2) echo $usr;?>"/> <?php if (($redo == 1)||($redo == 3)) echo " Sorry, the user name is taken.".'</br>'; else echo '</br>'; ?> </br> Password: <input type="password" name="pwd" size="50"/> <?php if (($redo == 2)||($redo == 3)) echo " Please input the password correctly.".'</br>'; else echo '</br>'; ?> </br> Comfirm Password: <input type="password" name="cpwd" size="50"/> </br> <input type="submit"> </form> </font> </body> </html> -
Hi all, I'm using XAMPP on my computers to setup a local server to test my code (both on linux and XP), I installed both at the same time (so the two should be the same version) i did not change any of the default setting. The problem is that my website contains a bit session, my code works perfectly fine on the XP system, whereas on the linux system the information that i store with session can't carry on to the other page. the php.ini file for my xampp of my windows system [session] session.save_handler = files session.save_path = "C:\xampp\tmp" session.use_cookies = 1 session.name = PHPSESSID session.auto_start = 0 session.cookie_lifetime = 0 session.cookie_path = / session.cookie_domain = session.serialize_handler = php session.gc_probability = 1 session.gc_maxlifetime = 1440 session.bug_compat_42 = 1 session.bug_compat_warn = 1 session.referer_check = session.entropy_length = 0 session.entropy_file = session.cache_limiter = nocache session.cache_expire = 180 session.use_trans_sid = 0 session.hash_function = 0 session.hash_bits_per_character = 4 url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset=" the php.ini session setting of xampp of my windows machine [session] session.save_handler = files session.save_path = /tmp session.use_cookies = 1 session.name = PHPSESSID session.auto_start = 0 session.cookie_lifetime = 0 session.cookie_path = / session.cookie_domain = session.serialize_handler = php session.gc_probability = 1 session.gc_maxlifetime = 1440 session.referer_check = session.entropy_length = 0 session.entropy_file = session.cache_limiter = nocache session.cache_expire = 180 session.use_trans_sid = 1 url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry" any suggestion???
-
Hello all, I want to redirect to two possible pages depending on some condition so i have : <?php if ($a>$b) echo "<META HTTP-EQUIV="refresh" CONTENT="0; A.php">"; else echo "<META HTTP-EQUIV="refresh" CONTENT="0; B.php">"; ?> but the out is simply <META HTTP-EQUIV="refresh" CONTENT="1; A.php"> where the page is not redirected. Is there any other to handle this?
-
thank you all for the replies. So as i understand it is that i generate a random salt for each of the user account (which will also be stored in the user database) then, combine the salt using md5() with the user password to get a random-looking string and store that into the database. And each time when an user want to logon, the php code would retrieve the user's salt from the database and combine it with user password (which the user input) to check with the coded-password in the database, right?
-
Hello all, I'm new to php and mysql and everything ..... I'm trying to set up a registry for my site. So i suppose i'll need to create a new table to save all the user information. My question is how can i hide the user passwords from myself and any administrators in the mysql admin screen for example?
-
Hi, I'm new to php and everything, and i just made a simple message broad website, at the moment the messages are stored in the database with user, time, content ..... etc, but anyone can use edit any post using whatever name they want. So I now want to make a user registry but i have problem with the concept of it. I know i can setup new users account in mysql, is that mean i should do that for each of the user of my website? Are there any build-in functions in php or mysql that have privilege control? Or am i supposed to .... for example save the user name and password in the cookie and check everytime when the user want to post something or edit a post? which means i'll have to do all the privilege check myself .... >.<! -------------- another question is that, i only know how to send information from one page to another via <form> + <input> or putting it at the end of the forward link in form of $_GET. Is there any other way?? For example, if i want to pass the name of the database an user is currently using from one page to another, i can't use <form> because it's not user input, and i don't want to use $_GET because i don't want to reveal the name of the database to normal users. What would be the better way to pass the information?
-
Thanks a million didn't know i can use echo that way!
-
Hi I'm a beginner at writing website and everything. I have the following problem. I want to write a very simple page which the users will input their I.P. address using html form. And i can do that with the code below. <form action="update.php" method="post" > IP: <input type="text" name="IP" > <input type="submit" value="submit"> </form> Now i want it to have different default value. I know i can set a default value for the input box by : IP: <input type="text" name="IP" value="128.243.0.0"> But i don't know how to make the default IP as a variable. For example if i want the default value to be the user's IP. (I know i can get the user's IP with $_SERVER['REMOTE_ADDR']). Is there any way that i can define a string in php then call it in the input tag? Thank you.