Graphix 68 ---

You can replace strings doing so:

<script type="text/javascript">
var query="Wat is the question?";
query = query.replace(/?/, "");
</script>

Visit http://www.w3schools.com/jsref/jsref_replace.asp for more information

~G

Graphix 68 ---

I know 2 reliable ways to redirect visitors:

<script type="text/javascript">
window.location.href="http://example.com/redirect.html";
</script>

or you can redirect them using an .htacces file:

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(mypage.html)$ http://www.example.com/redirect.html [NC]

So if someone visits www.example.com/mypage.html, he will be redirected to http://www.example.com/redirect.html

~G

Graphix 68 ---

Perhaps try something like this?:

...
...Header HTML
...
<script type="text/javascript">
function entersubmit(event) { 
if (window.event && window.event.keyCode == 13) { 
return false;
} else { 
if (event && event.which == 13) { 
return false;
} else { 
return false;
} 
}  
} 
</script>
<form>
                  <p> 1.  The fundamental  building blocks of matter are atoms and _________.<BR> 
                  <input type=radio value="a" name="1" onkeypress="entersubmit(event)"> a. mass <BR>
                  <input type=radio value="b" name="1" onkeypress="entersubmit(event)"> b. protons <BR>
                  <input type=radio value="c" name="1" onkeypress="entersubmit(event)"> c. molecules <BR>
                  <input type=radio value="d" name="1" onkeypress="entersubmit(event)"> d. neutrons </p>
</form>
...
...Footer HTML
...

EDIT 1: Also keep in mind that the usage of caps is depercated in XHTML.

EDIT 2: I also don't get the question. Atoms are build out of neutrons, elektrons and protons. Molecules are build out of atoms. And mass is just a wrong answer. Isn't the question wrong?

~G

Graphix 68 ---

You're welcome :)

You decide wether the thread is solved or not, if you are satisfied with the answers given, you can mark the thread as solved by clicking the blue "Mark thread as solved" link on the bottem of the thread (only the maker of the thread can do this).

The most books i have read about php are in Dutch, so i can't really suggest any books in English. Perhaps you can search http://www.amazon.com or another booksite for a proper php book.

~G

Graphix 68 ---

Something like this?:

$page = "mypage"; // You enter the page here
if ($page == "list-album") {
include('myfirst.tpl');
} 
elseif ($page == "list-image") 
{
include('myfirst.tpl');
} 
else 
{
include("somethingelse.html.inc");
}
Graphix 68 ---

Do you mean something like this?:

....
....HeaderHTML....
....
<body>
<?php
if (!$_POST['submitbutton']) {
?>
<form method="post" action="testform.php">
Text1: <textarea cols="30" rows="4" name="text1"></textarea><br />
Text2: <textarea cols="30" rows="4" name="text2"></textarea><br />
Text3: <textarea cols="30" rows="4" name="text3"></textarea><br />
<input type="submit" name="submitbutton" value="Submit the form" />
</form>
<?php
} else {
//
// Retrieving the variables
//
$text1 = $_POST['text1'];
$text2 = $_POST['text2'];
$text3 = $_POST['text3'];
//
// Cleaning the variables to prevent injection
//
$text1 = mysql_real_escape_string($text1);
$text2 = mysql_real_escape_string($text2);
$text3 = mysql_real_escape_string($text3);
//
// Databaseconfig
//
$dbuser = "root";
$dbpassword = "";
$dbhost = "localhost";
$database = "main";
$dbconnection = mysql_connect($dbhost,$dbuser,$dbpassword)
 or die("Couldn't connect to server");
$db = mysql_select_db($database,$connection)
 or die ("Couldn't connect to database");
//
// Making and executing the query
//
$query = "INSERT INTO table (text1,text2,text3) VALUES ('$text1','$text2','$text3')";
$result = mysql_query($query) or die("Couldn't execute query");
//
// Showing the result
//
echo "
The following data has been saved in the database:<br />
Text1: ".$text1."<br />
Text2: ".$text2."<br />
Text3: ".$text3."<br />
";
}
?>
</body>
....
....FooterHTML....
....

~G

Graphix 68 ---

Actually it doesn't really matter wether you include HTML or you just write it manually in the script.

But be aware that when you either write or include things in the script such as databaseconfig or variableconfig. If due to a error, the server doesn't process the php scripts, they will be shown as regular html and then people will be able to read the php (including all the variables). They can then be able to use that to for example copy/adjust your database or get access to secure parts of the website.

To sum it up:

It doesn't matter if wether you include or write the <head>, <html> and <!DOCTYPE> tags in a php file. I recommend you always include configs that are either hidden from the user with .htacces or that are located above the webroot.

~G

Graphix 68 ---

Hi,

I have looked into the link but the code doesnt work in FF (first time ever that happend!) and works in IE. Although it does figure out which line and which column, it can't figure out what the current char is (and this is required if i want to substr the first part of the text, place a bb-code between, and then place the second part of the text next to it.)

~G

Graphix 68 ---

I am currently working on a small script that allows people to insert BB-codes to edit their text. They are able to click a button (for example underline) and then the bb-code will appear at the end of the textfield-value.

How can i retrieve the current position of the cursor within the textarea and then parse the bb-code within? This is a small part of the code:

<script type="text/javascript">
function addu() {
var message = window.prompt("Enter the underlined text below:");
if (message != "" && message != "null" && message != "undefined") {
var newtext = document.editform.text.value;
newtext += "\[u\]" + message + "\[/u\]";
document.editform.text.value = newtext;
document.editform.text.focus();
}
}
</script>
<img src="ubutton.jpg" onClick="addu()" />
<form action="edit.php">
<textarea class="editarea" name="text" id="text" cols="100" rows="33"></textarea>
<input type="submit" name="savebutton" value="save" />
</form>

Does anyone have a suggestion?

~G

Graphix 68 ---

It seems to me that you want to make a backup of your database. If you have acces to the mysql folder of the server and are able to open prompt:

Then insert this into prompt:

- Direct to the mysql folder:
C:
cd \xampp
cd \mysql
cd \bin

Or in short:

cd C:\xampp\mysql\bin

Then execute the following command:

mysqldump.exe --user=username --password=mypass databasename >path\back-upname

I have been using this method for some time, but if you dont have acces to such methods, i suggest you google a bit further on the problem.

~G

Graphix 68 ---

A few suggestions:

- How to debug your code
- How do you use an include() and how do you acces files beneath the webroot?
- How do you secure your site, what techniques can be used and what shouldn't you do.
- When should you use sprintf(), printf(), print(), echo() and how do you use them (%f,%d etc. and wether you should use single quotes(') or double quotes("))

~G

Graphix 68 ---

Instead of storing alot of code into a database and making extremely confusing code, couldn't you just make a file named "functions&objects.inc.php"? And then include this into your php-script:

<?php
// 
// Filename: functions&objects.inc.php
//
function sayHi() {
echo "Hi!";
}
var x = new Array();
?>
<?php
//
// Filename: myfile.php
//
include("functions&objects.inc.php");
sayHi();
var x[0] = "This is a value";
?>
Graphix 68 ---

Could you please post the full form? So we can adjust things so that it gets refreshed.

~G

Graphix 68 ---

Does none of you all know a solution to this problem? Doesn't there exist a special type of variable or a function that saves the enters? Can you atleast give me a tip on how to solve...?

Or do you have a alternative? I am currently searching for a rich text editor that can replace my own script, but i can't seem to find one that is able to be send via the submition of a form.

~G

Graphix 68 ---

I'm having a problem with IE, while it works in FF: the var doesn't save any \n aka enter.

I have the following code:

<script type="text/javascript">
function addu() {
var message = window.prompt("Enter the text that needs to be underlined below");
if (message != "" && message != "null") {
document.editform.text.innerHTML += "\[u\]" + message + "\[/u\]";
}
}
</script>
<img src="beheerimages/ubutton.jpg" onClick="addu()" /><br />
<form name='editform'>
<textarea class="editarea" name="text" cols="100" rows="20"><?php echo $row['bbtext']; ?></textarea>
</form>

Does anyone know a answer to this question? As soon as a user presses the ubutton.jpg image, the enters are deleted.

~G

EDIT: the \[ and \] are to prevent the auto-u of daniweb, in the script it is [ and ]

Graphix 68 ---

Perhaps i was a bit unclear :)

I upload my files at:

/public_html/

And my upload script is at:

/public_html/management/upload.php

And i want the files to be send to:

/public_html/images/

Better now?

Graphix 68 ---

How do you acces a folder beneath the current folder?

The upload script is at:

htdocs/mysite/management/upload.php

and i want the files to be uploaded at:

htdocs/mysite/images/

What should the directory be?

Graphix 68 ---

Welcome to PHP :)

To answer your question:

There are multiple php processors, but i think XAMPP is the best (free!) option. I haven't had any problems with it so far, you can download it at:

http://www.apachefriends.org/en/xampp.html

If you have created a php file, you need to copy it to the "htdocs" folder, found by default at C:/xampp/htdocs/ . I suggest you make a folder named "myphp" or something.

You can view the php file at: http://localhost/myphp/

Please keep in mind you will need to have the Apache service running (you can activate it at the XAMPP Control Panel)

~G

Graphix 68 ---

Try this? :

<?php
if (!$_POST['submit']) {
?>
<form action=test_insert.php method="post">
<table>
<?php for($i=0; $i<10; $i++)
{ ?>

	<tr>
	<td><input type="text" name="employee_id<?php echo $i; ?>" value="0" size = "2" ></td>
	<td><input type="text" name="task_no<?php echo $i; ?>" value="0" size = "2" ></td>
	<td><input type="text" name="discription<?php echo $i; ?>" value="0" size = "2"></td>
	<td><input type="text" name="mon<?php echo $i; ?>" value="0" size = "2"></td>
	<td><input type="text" name="tue<?php echo $i; ?>" value="0" size = "2"></td>
        <td><input type="text" name="wed<?php echo $i; ?>" value="0" size = "2"></td>
        <td><input type="text" name="thu<?php echo $i; ?>" value="0" size = "2"></td>
        <td><input type="text" name="fri<?php echo $i; ?>" value="0" size = "2"></td>
        <td><input type="text" name="sat<?php echo $i; ?>" value="0" size = "2"></td>
        <td><input type="text" name="sun<?php echo $i; ?>" value="0" size = "2"></td>
	<td><input type="text" name="total<?php echo $i; ?>" value="0" size = "2"></td>          
	<td><input type="text" name="week_no<?php echo $i; ?>" value="0" size = "2"></td>
	</tr>
<?php } ?>

</table>

<input name="submit" value="Submit" type="submit">
</form>
<?php
} else { // If the form is submitted
$conn = pg_connect("host=localhost port=5432 dbname=**** user=postgres password=****");
for ($i=0;$i<10;$i++) {
// All the variables:
$employee_id = $_POST['employee_id$i'];
$task_no = $_POST['task_no$i'];
$discription = $_POST['discription$i'];
$mon = $_POST['mon$i'];
$tue = $_POST['tue$i'];
$wed = $_POST['wed$i'];
$thu = $_POST['thu$i'];
$fri = $_POST['fri$i'];
$sat = $_POST['sat$i'];
$sun = $_POST['sun$i'];
$total = $_POST['total$i'];
$week_no = $_POST['week_no$i'];

$query = "insert into public.grid_data (employee_id, task_no, discription, mon, tue, wed, thu, fri, sat, sun, total, week_no)
Values
('$employee_id','$task_no','$discription','$mon','$tue','$wed','$thu','$fri','$sat','$sun','$total','$week_no') ";
$res = pg_query($conn, $query) or die(pg_last_error());
if($res){echo("Record added for : $employee_id<br />\n");}
} // End of for $i
} …
Graphix 68 ---

So you have a page that has a form, a second page that redirects to third, and a third page that handles the data?

Why don't you just implement the third page into the second? Or just change the action="" attribute in the form to the third page?

I don't understand why you want to redirect the page...?

You could also do the following (the data is transferred via url):

<script type="text/javascript">
function redirect() {
var somedata = document.form1.somedata.value;
var url = "http://example.com/page.php?somedata=" + somedata;
}
</script>

~G

Graphix 68 ---

Let me first tell you: NEVER give a password through a SESSION UNCODED. I also recommend you simply do the following:

- If a user has logged in (correctly) then a variable named $_SESSION is set "true" or "yes" and if it is needed in the rest of the pages, you also set a $_SESSION or a $_SESSION. If you still want to give a password through, please use md5(), sha1() or another encrypt function.

And at each page you do the following:

<?php
session_start();
?>
... other HTML
<body>
<?php
if ($_SESSION['auth'] == "yes") {
//
// You show the members only page
//
echo "You are now logged in and are able to see this!!!";
} else {
//
// You either show the login page or a link to the login page,
// example:
echo 'You are not logged in, please go to the <a href="login.php">login page</a>.';
}
?>
</body>
// Other HTML....

You can also put some javascript in it that redirects the user directly to the login page.

~G

Graphix 68 ---

Ok i have found the solution :) , here it is:

You make a file named "number.txt" in which you store the number. In PHP you retrieve the number and then +1's it if it isn't 4, else you set the number to 1. Then you save the new number into number.txt.

The code:

number.txt:

1

The form:

<form name="info" method="post" action="
<?php
//
// Opens and reads the file number.txt
//
$file="number.txt";
$filehandle = fopen($file, "r");
$number = fread($filehandle, filesize($file));
fclose($filehandle);
//
// Decides which number $nextnumber should be
//
if ($number < 4) {
$nextnumber = $number + 1;
} else {
$nextnumber = 1;
}
//
// Decides which survey will be showed
//
if($number == 1){
echo 'http://host/Task/survey.1.php'; }
elseif($number == 2){
echo 'http://host/Task/survey.2.php'; }
elseif($number == 3){
echo 'http://host/Task/survey.3.php'; }
elseif($number == 4){
echo 'http://host/Task/survey.4.php'; }
//
// Writes the new number into the file
//
$filehandle2 = fopen($file, "w");
fwrite($filehandle2, $nextnumber);
fclose($filehandle2);
?>
">

Greets, Graphix

Graphix 68 ---

Thanks for help, I completed the chat-program and it works perfectly.

Thread Solved :)

~Graphix

Graphix 68 ---

Ok thank you, it worked :). But i also have another question, i have a small problem with my chat-program: if the users presses enter it will reload and it will log out due to the onunload="leave_chat()" part. But if i delete the form i cant referer to the text input and as so cant retrieve the value typed in the textbox.

Eg:

<body onload="setInterval('retrieve_users()', 1500); setInterval('retrieve_messages()', 1500)" onunload="leave_chat()">
....
.... not relevant HTML
.....
 <form method="post" name="sendform" action="defaultchat.php">
  <input type='text' name='textbox' id='textbox' maxlength='255' size='75' /><input type='button' value='Send Message' onclick='send_message()' />
 </form>
Graphix 68 ---

Hi,

I am currently writing a chatprogram, and it works fine in FF but it doesnt refresh as it should every 1500ms (set with setInterval("retrieve_messages()",1500) in body tag) in IE. The object ajax is made in previous code.

I wrote the following code:

function retrieve_messages() {
    // Checks wether the object is available:
    if (ajax) {
        ajax.open('get', 'messageretrieve.php');

        // Sends request
        ajax.send(null);

        // Function that handles response
        ajax.onreadystatechange = setTimeout("show_messages()", 500);


    } else { // AJAX is not useable
        document.getElementById('warning').innerHTML = 'It is not possible to connect, please update your browser.';
    }

} // End of retrieve_messages()
// Function that shows the returned text into the messagebox
function show_messages() {
    // If everything is OK:
    if ( (ajax.readyState == 4) && (ajax.status == 200) ) {
        // Returns the value to the document
        document.getElementById('messagebox').innerHTML = ajax.responseText;
	}

} // End of function show_messages()

IE says that there is something not implemented on line 9 (ajax.onreadystatechange=.....), could somebody help me out?

~Graphix

EDIT: I am currently going to bed, i will be back tomorrow.

Graphix 68 ---

Ok i did some research on cookies and made a example script so you can see how to set, unset, and change value of cookies:

<?php
/* Name of script: cookietest.php
 * Description: shows how to (un)set cookies
 * Last edited: 12 septembre 2009
 * Made by Graphix
*/
setcookie('status','', time()+3600);
/* Changes value into FALSE if the falsebutton is clicked */
if ($_POST['falsecookie']) {
$_COOKIE['status'] = "FALSE";
}
/* Changes value into TRUE if the truebutton is clicked */
if ($_POST['truecookie']) {
$_COOKIE['status'] = "TRUE";
}
/* Unsets value into "" if the nobutton is clicked and then deletes cookie */
if ($_POST['nocookie']) {
$_COOKIE['status'] = "";
setcookie('status','', time()-3600);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Test</title>
</head>
<body>
<div align='center'>
<?php
/* Shows the value of the 'status'-Cookie */
echo "Cookiestatus: ".$_COOKIE['status']."<br /><br />";
?>
<form action='cookietest.php' method='post'>
<input type="submit" name='truecookie' value='Set cookie TRUE' />
<input type="submit" name='falsecookie' value='Set cookie FALSE' /><br />
<input type="submit" name='nocookie' value='Set cookie empty' />
</form>
</div>
</body>
</html>

Use this script on your own localhost and see how it works, then adapt it to your personal script

~Graphix

Graphix 68 ---

You might want to look through the following daniweb page:

http://www.daniweb.com/forums/thread59219.html#

Graphix 68 ---
<script type="text/JavaScript">
var line;
var word;
var word2;
var word3;
test = '';
word1 = "How";
word2 = " are";
word3 = " you?";
line += word1;
line += word2;
line += word3;
document.write(line);
</script>

Will result in:

How are you?
Graphix 68 ---

I think i found error:

echo '<br /><select name="quantity">';
echo'<option>1</option>';
echo'<option>2</option>';
echo'<option>3</option>';
echo'<option>4</option>';
echo'[B][I]</select>[/I][/B]<br />';
Graphix 68 ---

First of all: use code tags?

I dont quite understand the problem, i dont know alot of asp (your form-handler is a .asp file) or something but you want to pass down information through a form to a form-handlers i assume.

First of all, there is NO url-output if you use the POST-method, only the GET-method passes information through the url.

You should also make the following line:

echo "<form action=http://www.romancart.com/cart.asp method=post>\n";

into

echo "<form action=\"http://www.romancart.com/cart.asp\" method=\"post\">\n";

And also change

echo'<input type= hidden name=returnurl value="http://217.146.126.103/passenger.php">';

into

echo "<input type=\"hidden\" name=\"returnurl\" value=\"http://217.146.126.103/passenger.php\">";

Hope this helps,

~Graphix

Graphix 68 ---

I dont quite know what you mean with "auto-increment", do you mean the filename (e.g. the first user has unknown1.jpg and the second unknown2.jpg????)? Anyway, you can set a default value for a column by using DEFAULT in sql:

ALTER TABLE users ADD image DEFAULT 'unknown.jpg'

or,

ALTER TABLE users ALTER image SET DEFAULT 'unknown.jpg'
Graphix 68 ---

If your problem hasent been solved, I am personally very satisfied with XAMPP as it includes apache, mysql, filezilla and mercury in one. I haven't had any problems with it and you just place your files in the htdocs folder. You can download it at http://www.apachefriends.org/en/xampp.html.

You can place your files in the htdocs folder, for example:

The directory you store your files:
C:/xampp/htdocs/myphp/*

You can acces it by opening a browser and use as url:
http://localhost/myphp/*

Any questions?

~Graphix

Graphix 68 ---

This problem has been extensively discussed in the following thread:

http://www.daniweb.com/forums/thread214601.html

~Graphix

Graphix 68 ---
<html>
<head>
<title></title>
</head>
<body>
<?php
// Here you do the calculations, for example + 2
if ($_POST['calculatebutton']) {
$displaydata = $_POST['number'];
$displaydate = $displaydate + 2;
} else {
$displaydata = 0;
}
// The form
echo "
<form>
Number: <input type=\"text\" size=\"1\" name=\"number\" value=\"".$displaydata."\" />
<input type=\"submit\" name=\"sendbutton\" value=\"Send Form\" />
<input type=\"submit\" name=\"calculatebutton\" value=\"Calculate my number into a new one!\" />
</form>
";
?>
</body>
Graphix 68 ---
<?php
require_once("classes/class.session.php");
$sess=new SBase();
$values=$sess->getSession();
list($user, $loginlogout)=$values;
if($loginlogout=="Logout"){ // assuming that this means you are logged in
$response = "1";
}else{ // assuming that this means you are not logged in
$response = "2";
}
?>
<html>
<head>
<title>My php page</title>
</head>
<body>
<?php
if ($response == "1') {
echo "You are able to see this page, aint that cool!";
} 
if ($response == "2') {
echo "You are not logged in.... <a href=\"login.php\">Login</a>";
}
?>
</body>
</html>
Graphix 68 ---

Well i dont know what kind of login system you have, but i mostly use this:

<?php
if ($_SESSION['auth'] == "yes") { // this has been set at login.php
... The code if you are logged in
} else {
echo "You are not logged in, please click <a href="....">Here</a>";
}
?>

But as always i dont know how your programs look like and how they work, so this might not be compatible with the code that already exits, i think you should overthink this issue and then decide what you think is good for your site :)

~Graphix

Graphix 68 ---

I''ve had the same issue when i made a small forum for a website. I thought of the function ereg_replace():
Maybe you can use it?

<?php
$mytext = $_POST['myTextArea'];;
$mytext = ereg_replace("\[b\]","<b>", $mytext);
$mytext = ereg_replace("\[/b\]","</b>", $mytext);
echo $mytext;
?>
Graphix 68 ---

Problem number 1 (size):

You can set the size of the textarea with the following attributes:

cols="number"
rows="number"

A column (col) is one character (_)
A row is the amount of horizontal lines, for example:

I am superman

It has 1 row, and 13 columns.

E.g:

<textarea name="myTextArea" cols="20" rows="3">Text shown in textarea</textarea>

Problem number 2 :

First of all you define the type of input with the attribute type
Please visit the page from the w3c for more information:

http://www.w3.org/TR/html401/interact/forms.html#h-17.4.1

So if you want to make a submit button the code is:

<input type="submit" name="submitbutton" value="Submit this form" />
Graphix 68 ---

My above example shows that you just simply let him upload the file (see script) and then you store the img-filename into the database. Then in the profile you get the filename from the database and put the foldername infront of it. (for example: the URL to the file is www.example.com/images/myProfilePicture.jpg and when your profileview.php is in the same folder (www.example.com/profileview.php) it automaticly redirects the img with images/myProfilePicture.jpg as source to www.example.com/images/myProfilePicture.jpg )

Graphix 68 ---

Ok listen up, what he is trying to say is that in the database the enters are already stored but invisible, so on the page where you display the text you should put this where you want the text from the textarea to be shown making the \n into <br />:

$textfromtextarea = $row['message'];
$textfromtextarea = nl2br($textfromtextarea);
echo $textfromtextarea;

EDIT: i didnt see his last post.... Sorry that i posted almost the same again ;)

Graphix 68 ---

It cant reset a form when there is no form.... Duh?

<html>
<head>
</head>
<body>
[B]<form method="post" action="myhandler.php">[/B]
Text: <input type="text" name="textfield" /><br />
<input type="reset" name="resetbutton" value="Reset" /><input type="submit" name="submitbutton" value="Submit Text" />
[B]</form>[/B]
</body>
</html>
Graphix 68 ---

You do know that php is a background program the decides what should be shown in HTML and handles off forms, and does the actions that are appropiate to the given information. You can do that a html file form has a action on a php script, that it handles the form and then redirects the user to another HTML file (such as "thankyou.html")

Graphix 68 ---

Ok, leaving the permission issue, you have to add a new column to the table "users" named "image", here should be the file name of the image.

How the member sets his image:

<?php
if (!$_POST['uploadbutton']) {
?>
The image needs to be under 2,5MB and 850x850:<br />
<b>.jpg/.jpeg/.bmp/.gif/.pdf/.png</b><br />
Hij zal worden geupload in de map <b><i>fotos</i></b>.<br /><br />
<form enctype="multipart/form-data" action="image_upload.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="2500000" />
Choose a image to upload: <input name="file" type="file" /><br />
<input type="submit" name="uploadbutton" value="Upload Foto" />
</form>
<?php
} else {
// ==============
// Configuration
// ==============
$uploaddir = "fotos"; // Where you want the files to upload to
$allowed_ext = "jpg, gif, png, pdf, bmp, jpeg"; // These are the allowed extensions of the files that are uploaded
$max_size = "2500000"; // 50000 is the same as 50kb
$max_height = "850"; // This is in pixels - Leave this field empty if you don't want to upload images
$max_width = "850"; // This is in pixels - Leave this field empty if you don't want to upload images 
// Check Entension
$extension = pathinfo($_FILES['file']['name']);
$extension = $extension[extension];
$allowed_paths = explode(", ", $allowed_ext);
for($i = 0; $i < count($allowed_paths); $i++) {
 if ($allowed_paths[$i] == "$extension") {
 $ok = "1";
 }
}

// Check filesize
if ($ok == "1") {
if($_FILES['file']['size'] > $max_size)
{
print "Het bestand is te groot!";
exit;
}

// Check height and width
if ($max_width && $max_height) {
list($width, $height, $type, $w) = getimagesize($_FILES['file']['tmp_name']);
if($width > $max_width …
Graphix 68 ---

First of all: if you want to display text through php in the page you use either print() or echo()....

The code:

<table>
<?php
while ($row = mysql_fetch_array($result)) {
?>
<tr><td><?php echo $row['name']; ?></td></tr>
<tr><td><?php echo $row['description']; ?></td></tr>
<?php
}
?>
</table>
Graphix 68 ---

Well, perhaps it sounds a bit too easy but you could also insert the <pre></pre> tags within the data you save in the database:

<?php
$message = "<pre>";
$message .= $_POST['message'];
$message .= "</pre>";
$creator = $_SESSION['creator'];
$table = "messagetabel";
$q = "INSERT INTO $table (creator,message) VALUES ('$creator','$message')";
$r = mysql_query($q);
echo "
Your message:<br />
".$message."";
?>
Graphix 68 ---

The directory really shouldn't have 777 permissions. Why not give the directory normal permissions, and just chown it and the upload script to the webserver user??

R

Because php needs to have atleast permission 0777, so it is possible to upload a file into the folder so it can be accessed, else it will return a error that the folder doesnt have the permission and the file can't be uploaded.

~Graphix

Graphix 68 ---

This is what i suggest you could use as a upload page (named image_upload.php), you just need to insert what the max file size is,where the images should be stored (which folder) and which extensions are allowed:

if (!$_POST['uploadbutton']) {
?>
The image needs to be under 2,5MB and 850x850:<br />
<b>.jpg/.jpeg/.bmp/.gif/.pdf/.png</b><br />
Hij zal worden geupload in de map <b><i>fotos</i></b>.<br /><br />
<form enctype="multipart/form-data" action="image_upload.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="2500000" />
Choose a image to upload: <input name="file" type="file" /><br />
<input type="submit" name="uploadbutton" value="Upload Foto" />
</form>
<?php
} else {
// ==============
// Configuration
// ==============
$uploaddir = "fotos"; // Where you want the files to upload to - Important: Make sure this folders permissions is 0777!
$allowed_ext = "jpg, gif, png, pdf, bmp, jpeg"; // These are the allowed extensions of the files that are uploaded
$max_size = "2500000"; // 50000 is the same as 50kb
$max_height = "850"; // This is in pixels - Leave this field empty if you don't want to upload images
$max_width = "850"; // This is in pixels - Leave this field empty if you don't want to upload images 
// Check Entension
$extension = pathinfo($_FILES['file']['name']);
$extension = $extension[extension];
$allowed_paths = explode(", ", $allowed_ext);
for($i = 0; $i < count($allowed_paths); $i++) {
 if ($allowed_paths[$i] == "$extension") {
 $ok = "1";
 }
}

// Check filesize
if ($ok == "1") {
if($_FILES['file']['size'] > $max_size)
{
print "Het bestand is te groot!";
exit;
}

// Check height and width
if ($max_width && …
Graphix 68 ---

If you would like to show the stored data with the enters that were made you need to do the following:

Assuming that there are atleast 2 columns in the table called "creator" and "message":

<?php
$q = "SELECT * FROM messagetable";
$r = mysql_query($q);
while ($row = mysql_fetch_array($r)) {
echo "
<pre>
<b>".$row['creator']."</b>
$row['message']
</pre>
";
}
?>
Graphix 68 ---
$query = "SELECT * FROM $table WHERE Suburb='$suburb'";
$result = mysql_query($query);

But you will need to check wether the actual name of the column is Suburb and not suburb.

Graphix 68 ---

At first: you need to have a record of somekind that registers when the users change their profile, for this you either need a very large file (not recommended) or a database. For example, you can create a table with MySQL:

CREATE TABLE users (
user_id INT(6) NOT NULL AUTO_INCREMENT,
username CHAR(255) NOT NULL,
password CHAR(255) NOT NULL,
e-mail CHAR(255) NOT NULL,
lastupdate DATE,
PRIMARY KEY (user_id) )

After that you need to compare the lastupdate with the current date. If their profile hasent changed for 5 years, they would get a mail, for example you can also make a php-file that you need to open manually to send the mail:

<?php
// DB-selection/connection
$q = "SELECT * FROM user WHERE lastupdate < now()-(5*365*24*60*60)";
$r = mysql_query($q);
while ($row = mysql_fetch_array($r)) {
mail($row['e-mail'], 'Profile 5 year', 'You havent changed your profile within 5 years');
}
?>

I hope this helps you on the way