708 Posted Topics
Re: Do you have to use php authentication? A simple session login system would make it so you can stop people from getting images ect. from other peoples folders. | |
Re: Are you wanting a list of folders on the clients computer or the server? If server, then you can use php, html, and some javascript to create a pop-up kind of like that (same functionality). | |
Re: You haven't defined $siteconn within the function. Mostly likely you need to put [icode]global $siteconn[/icode] at the top of the function. [code] function CreateMenu($main, $limit) { global $siteconn; [/code] | |
Re: How I avoid this is by submitting the form to the same page. After the login is successful I use the header() function to redirect the members area. If they press back there won't be any post data to give that "Web page has expired" crap. Also, put some logic … | |
Re: Why are you making a new table for each post? I think you don't understand how a database works. You might want to research that a bit before trying to create a blog/cms. | |
Re: What do you mean by php can't display image? Are you trying to serve images files with php? | |
Re: I have a website I am building right now, that needs something like this. When I get to that point in development, I will let you know how it goes. Also, how did you do it? | |
Re: Yes you will have to pass it to every class. You can use global but its not recommended. If you really want the best solution, look into the singleton method. Its what I have been using for a while now and it has saved me so much development time. | |
Re: I would use post for something like this. I am not sure how the url handles newlines. Also, mysql_real_escape_string messes up line breaks. You need to run nl2br before inserting into the database. | |
Re: Its pretty secure. Adding more info and creating extra session is unnecessary overhead. The best way to prevent this is to run session_regenerate_id(true). [kireol explains everything nicely, I posted at the same time. Didn't see that post] | |
Re: i don't think its possible. why do you need to anyway? | |
Re: How about process the form on the same page. Why does it need to be submitted to another page? | |
Re: According to wikipedia (I know, not the best place for info) 3-tier consists of the presentation tier, application logic (business logic, ect) tier, and data tier. This is pretty much the workings of a webserver. Presentation tier is anything outputted to the browser, application logic is the php code itself, … | |
Re: [code] $array = array(); [/code] That will clear an array. | |
Re: What is this for? School? Why not search for a mysql tutorial. It will show you everything you need to know. | |
Re: [QUOTE=cwarn23;864640]Also, you may want to note that the following script commonly used will cause an error on some servers: [CODE=php]//mysql connections $result=mysql_query('SELECT * FROM `table`'); while ($row=mysql_fetch_array($result)) { echo 'test didn't work. There shouldn't be any rows in the table.'; break; }[/CODE] Instead the following should be used: [CODE=php]//mysql connections … | |
Re: Error is: [code] echo"<th>".{$data['engword']}."</td>"; [/code] and you don't need () around the stripslashes function. | |
Re: I would have to better understand how its used, like in what type of application, before I can help clean it up. I personally can't think of any reason for it. | |
Re: Its called pagination. Do a google search and it should provide you with everything you need. | |
Re: Just have php echo out the xml. Its pretty easy. Loop through the db records and display them in a xml format. Send the proper headers and you have an dynamic xml file. | |
Re: Look into mysql joins or using the where clause and table aliases. Ex. [code] SELECT * FROM trip t,seat s,user_information u WHERE t.id = s.id AND t.id = u.id [/code] | |
Re: I am not a c++ guy but since the languages are similar I thought I'd give it a try. There are a few things I don't know yet, they are commented. If you can explain what they do, I can probably tell you the equivalent in php. [code] function print_combinations( … | |
Re: How about not using iframes? They aren't recommended and are bad for seo. | |
Re: Yes and no. Certain server configurations may allow them to hack variables (register_globals), but most servers have this turned off since its deprecated and is soon to be removed as of php6. You can disable this in the php.ini (and you should just as added security). As long as you … | |
Re: Try this: Change [code] $thumbnail = "<img src= ".$thumb_image.">"; echo $thumbnail; echo " image thumbnail "; [/code] to [code] header('Content-Type: image/jpeg'); echo $thumb_image; exit; [/code] Thats usually what I use to output images, but you have used some different functions which I am not familiar with. | |
Re: Can you explain what you are doing (not the table structure)? That way we can make sure the table setup is correct and there is not an easier way. | |
Re: You are not even running the update query. Its just a string. You need to put it into the mysql_query function. If you run into problems like this again, take a break and then come back and look at the code again. You will see silly mistakes like that. You … | |
Re: On line 74 there is an extra ". This could be making the form fail. I didn't look at the rest of the code very much, so there might be another problem. | |
Re: [QUOTE=BzzBee;867920]$answer1=$_REQUEST['chk1']; $answer2=$_REQUEST['chk2']; $answer3=$_REQUEST['chk3']; $answer4=$_REQUEST['chk4']; for example [CODE] if($answer1=='yes') { $question_area=2; } if($answer2=='yes') { $question_area=3; } if($answer1=='yes') { $question_area=4; } <form name="frm" action="" method="post" > <? if($question_area==2) { ?> here is question2? <input type="checkbox" value="yes" name="chk1" /><br /><br /> <input type="checkbox" value="no" name="chk1" /><br /><br /> <input type="submit" name="btn" value="Submit" /> … | |
Re: What about the array_count_values() function? I have never used it, but I seems to be what you are looking for. Does anyone on this forum check php.net at all? Here is the hard way: [code] $array = array( 140,123,34,140,23,123,140,140,123 ); $data = array(); foreach( $array as $val ) { if … | |
Re: Why are you putting global in the if statement. That doesn't need to be there. You are also trying to get $_POST variables without them being set since the form hasn't been submitted. This will throw a warning of undefined index. This code: [code] '<form action="<?php echo $PHP_SELF;?>" method="post">' ; … | |
Re: That means that your time string is invalid. It can't read it. Have you looked at [url=http://us2.php.net/strtotime]php.net[/url]? | |
Re: Be aware that hover in css on non anchor tags does not work well on all browsers. I had this problem with my last site. | |
Re: Just a guess, but are you wanting something like this [code] <?php $array = array(); $query = mysql_query( "SELECT advertisement.adver_name, customer.number_customer FROM advertisement INNER JOIN customer ON advertisement.adver_id = customer.adver_id" ); while( list( $name,$number ) = mysql_fetch_row( $query ) ) { $array[$name] = $number; } print_r( $array ); ?> [/code] | |
Re: [search]FCKeditor[/search] is free. [search]TinyMCE[/search] is also I think. Not all features are though if I remember correctly. Here is a comparison chart: [url]http://geniisoft.com/showcase.nsf/WebEditors[/url] You can find so much using a search engine such as google. | |
Re: First of all, why? I would just insert the data, then use mysql_insert_id() to get the id. But if you really need to get it before, here is a function: [code] function getNextID() { $query = mysql_query("SELECT `id` FROM `table_name` ORDER BY `id` DESC LIMIT 1") or die(mysql_error()); if ( … | |
Re: Here is an session login example I made a few months ago. [url]http://www.daniweb.com/forums/post832028-20.html[/url] and [url]http://www.daniweb.com/forums/post832231-23.html[/url] Take a look and see if it clears up any confusion. I know this doesn't answer your question, but I figured it might help you create a better login system. | |
Re: You most likely have a problem with your query. Replace: [code] $result = mysql_query($query); [/code] with [code] $result = mysql_query($query) or die(mysql_error()); [/code] This will show the error. | |
Re: Putting the files outside the public folder is the right thing to do. Yes, you have to put the php.ini file in the directory, thats the only way it will work. You will need to put an .htaccess file in there too so it will disallow viewing of the php.ini … | |
Re: Since you seem to have things figured out for the most part this may not be of use to you. I needed a good email class for my projects, so I made one. Its attached. All you have to do to add uploaded attachments, is use a form with input … | |
Re: You made a huge security risk for yourself. Including pages based on $_POST data without proper validation can lead to serious security risks. I can include files from other servers and get sensitive information. I have been using this kind of method for awhile, a little more complex but the … | |
Re: Is there set directories for uploading, or will folders be added/deleted ect? ![]() | |
Re: That would be a waste of time really. Its easier to use arrays and dynamic variables. You can do: [code] foreach( $_POST as $key => $val ) { ${$key} = mysql_real_escape_string( htmlentities( $val ) ); } [/code] that will put all the post data into usable variables. | |
![]() | Re: I would put them into functions, since you are probably going to be using this code often. [code] <?php session_start(); function addProductToSession( $id,$code,$name ) { $recView =& $_SESSION['recently_viewed']; if ( count( $recView ) == 5 ) { array_shift( $recView ); } $recView[] = array( $id,$code,$name ); } function getRecentlyViewedProducts() { … ![]() |
Re: [QUOTE=cwarn23;857505]Isn't that code meant to be the following: [CODE=php]$this->$error->trigger('noRoute','URL Has No Matching Route',array('URL'=>$url),'404');[/CODE] The code above will only work if $error is a method of $this and trigger() is a method of $error. Also you forgot a dollar sign for the middle variable.[/QUOTE] Why does he need a dollar sign? … |
The End.