Will Gresham 81 Master Poster

Since HTML is client side, it cannot directly access a PHP script, so you will need to send a request to a PHP script on your server, which can be done either by reloading the page, sending the details to PHP in the query string or by POST. Or you can, as you say, use an AJAX implementation.

Will Gresham 81 Master Poster

If you mean 'how do I get a domain such as www.daniweb.com' you will need to pay for and register it with a company who provide domains, and Google will give you hundreds.

And as network18 said, if that is what you mean, PHP forum is not the place for this question.

Will Gresham 81 Master Poster

You can enable short tags, however, there are other servers (like yours) which do no have the short tags option on.

This means that if you deploy the code onto another server, it may not run.
As pritaeas says, it is recommended to the the full <?php opening tag. There is no real reason not to use them.

Will Gresham 81 Master Poster

Take a look at this line:

echo "<a href 'stats.php'>$fname</a>";

You are missing the = on href.

Will Gresham 81 Master Poster

When you upload the image, get the files location.

Store the file location into the database and when the profile page is viewed, echo a img tag with the location field as the 'src' value.

The other way would be to actually save the data from the image into a DB field, although I have never successfully done this so I cant help you if thats what you want to do.

Will Gresham 81 Master Poster

Reuse an old thread maybe?

You have 4 other threads on the same subject on the first 2 pages of this forum....

As for the query, post some code or we will be guessing at the problem.

Will Gresham 81 Master Poster

I don't have much choice about the hours I am awake, as I work the graveyard shift (9:30PM - 9:30AM) so I guess I would have to say nights :)

Will Gresham 81 Master Poster

I think $query = "insert_into should be $query = "insert into I dont do Postgres though, although I assume it is simialr to MySQL

Will Gresham 81 Master Poster

Great find there !

Will Gresham 81 Master Poster

A slight change in style, listening to Kings of Leon at the moment. :)

Will Gresham 81 Master Poster

Currently I play no instruments, although in the past I played Brass instruments, mainly the Tuba and Baritone [horn].

I was let loose on both a guitar and a piano in the past, and I basically murdered them... the sounds produced could not be classed as music. If I go back to instruments, I will likely play Brass, although I wouldn't mind learning to play the Piano :)

Will Gresham 81 Master Poster

If I lost my iPhone I would miss the phone part, but I doubt I will have to as I have every phone I have ever owned sat in a drawer incase I ever need them......

I also have a 30GB iPod sat with the phones which got replaced with my iPhone.

So unless I suddenly lost all of them I wouldnt need to worry, but I would miss the phone most.

Will Gresham 81 Master Poster

You will ideally need a Database to store the information in, there are a number of calendar and diary scripts available if you search Google.

Will Gresham 81 Master Poster

Strangely enough, a google search comes up with guides for what you want to do:
Click

Will Gresham 81 Master Poster

Add hidden fields to the form with the Submit button, the values can then be retreived using $_POST or $_GET in PHP.

Will Gresham 81 Master Poster

Well I think you mis-understood exactly what I meant. The process I was refering to was that javascript encodes the data first then php decodes it then php re-encodes the data.

I would agree with digital-ether on this.

I always browse in Firefox with NoScript enabled (which means JavaScript is disabled for untrusted or unknown sites)

Lets say I visit your site with Javascript off, I enter a password which is not encoded before sending, meaning that your PHP script will get an unencoded password and will try to decode it.

Also, if you are encoding with JavaScript, an unfriendly user would be able to see exactly what you are doing and could reverse it anyway.


As a rule of thumb, I use JavaScript to make things 'pretty' after I have completed a project. I would never rely on JavaScript to handle even the smallest part of the security on any of my sites.

Will Gresham 81 Master Poster

Your script can be as secure or insecure as you want.

Generally, the end user would not see constants or any of the actual code as this is executed on the server. All the end user should see is the output of any functions in your script.

If you are worried that a function may output some important data, use an @ symbol before it to suppress the standard errors: @mysql_connect("...", "...", "..."); Or better, add error handling into your code to make sure that if an error occurs then you have a specific response for it.

darkagn commented: Good points +6
Will Gresham 81 Master Poster

Either the password you are using is wrong, or there is no permission for user 'admin' on local machine to access the database.

Check your username/password for the DB and also check the user has got the correct permissions.

Will Gresham 81 Master Poster

On a low traffic site, files are an acceptable solution, although for larger amounts of data or if you get alot of simultaneous requests, a database will be faster (see this for pros/cons of each)

Take a look at the links in my last post as these explain the mentioned functions.

Will Gresham 81 Master Poster

When you say a text list, will this be a text file or a database?

If it is a text file, use fopen etc to read the contents of the file, split the contents of the file into an array (for example explode) then search the array with in array to see if the value exists.

If it is a database, simply search the database for the value.

Will Gresham 81 Master Poster

Look at your value attribute,:

value = <?php echo $_SESSION["namevalue"]; ?> />

This should be:

value="<?php echo $_SESSION["namevalue"]; ?>" />
Will Gresham 81 Master Poster

Please search first, this has been covered numerous times and is information readily availble on google.

http://uk2.php.net/manual/en/function.mail.php

Will Gresham 81 Master Poster

You can use the newline character in PHP, or you can replace that period you removed and add the tag:

print($start . "multiplied by" . $times . "=" . $answer . "<br />") ;

Providing you keep an eye on your quotes and you make sure you escape them properly, you can add any HTML tak into PHP code within quotes.

Will Gresham 81 Master Poster

Take a look at the last few characters on line 16, you hae an extra period in there.

Periods are used to join strings, as there is nothing following the final value in the print() statement, you do not need a trailing period.

Will Gresham 81 Master Poster

Take a look at the move_uploaded_file function in PHP:
http://us3.php.net/manual/en/function.move-uploaded-file.php

Will Gresham 81 Master Poster

I do not use my iPhone as an alarm, it doesn't work, I fall back asleep, I do use a Clocky though (Google explains) as this is much more efficient in waking me...

Will Gresham 81 Master Poster

URL rewrites are good for translating set patterns, for example:
www.site.com/products.php?catagory=1&product=32&viewmode=2

to:
www.site.com/products/cat1/item32/2

But if you are using unknown folder structures or varying structures, then it will not be suitable unless you have numerous (and probably complex) rewrite rules.
Also, if you want all files to translate to site.com/file.php then you will need to make sure that every single file has a unique name.

ReWrites are best used for SEO, to the end user they make little difference.

Will Gresham 81 Master Poster

You will want rewrites to do this.

This will be fairly simple if the 'folder/folder/folder' is always the same, but if you have alot of sub directories then you will need more than just /file.php in the final URL

Take a look at http://www.sitepoint.com/article/guide-url-rewriting/

Will Gresham 81 Master Poster

First, I would not suggest taking POST variables (or $_GET or $_REQUEST etc..) and put them straight into sessions for use later, I would suggest you look into checking/sanitizing the results to ensure that they are what is expected. Especially if you are then using these values to query a database.

Can you post the actual code that is causing the problem? Your post indicates that it is the code after this that is causing the problem..

Also, try to use code tags, makes it easier for us to separate the code from your question.

Will Gresham 81 Master Poster

Excellent!

You made it to Speed Level 4 (out of 5)

52 out of 63 correct

Will Gresham 81 Master Poster

For me, 2.

Although you might want to rethink the thread name, I am not sure how you can use multiple computers simultaniously at a different time.... :P

Will Gresham 81 Master Poster

Can you post your actual code, as what you have posted will not work - this is not correct PHP syntax.

Will Gresham 81 Master Poster

how can i use php/mysql.

Simple:

mysql_connect("DB_SERVER", "USEERNAME", "PASSWORD")or die(mysql_error());

Google helps.

Will Gresham 81 Master Poster

If you are going to use karuppasamy's example, I would make sure you add some protection, check that the values passed are actually numbers. Otherwise you may find that your database is open to attack.

Also, JavaScript is overkill here, no point using it when the same can be acheived simply using HTML and PHP.
1. Make sure all the checkboxes have the same value for name and add [] to indicate it is an array to PHP and set the value to the id of the database row. e.g.

<input type="checkbox" name="foo[]" value="1">
<input type="checkbox" name="foo[]" value="2">

2. In PHP add something along the line of a foreach to see if the box was checked, something like:

foreach($_REQUEST['foo'] as $checkboxVal) {
  // Check the value is a number
  if(is_int($checkboxVal)) $tmpDeleteRecords .= $checkboxVal . ", ";
}
// Remove the last 2 characters (space and ,)
$deleteRecords = $substr_replace($tmpDeleteRecords,"",-2)

You can then use the returned $deleteRecords in your SQL query to. Although the code above is untested and from memory, so you will need to review before using.

Will Gresham 81 Master Poster

The best way I know would be to use a database.
You can look into the file functions in PHP, fopen, fread, fwrite etc... But I would use a database over this any day.

Also, about this:

I don't want to use MYSQL or JavaScript to show the content. So basically a person can view the page without JavaScript enabled.

Hate to break it to you, but TinyMCE uses a lot of JavaScript, take a look at their examples page (http://tinymce.moxiecode.com/examples/full.php) with JS turned off.

Will Gresham 81 Master Poster

It looks like you have Object Oriented code there, if the file in question called by another file (include, require....)?

Will Gresham 81 Master Poster

You will need to make slight alterations to your SELECT statement for each query to get the desired results. So when the link is clicked the selected options will need to be passed to PHP (using Session data, POST, Query String etc)

To select only 1 value from a column, use a WHERE in your query: e.g.

mysql_query("SELECT * FROM `cars` WHERE `make` = 'some_value'")or die(mysql_error());

By arrow selector I assume you mean sort ascending/descending? If so, use ORDER:e.g.

mysql_query("SELECT * FROM `cars` WHERE `make` = 'some_value' ORDER BY `price` ASC")or die(mysql_error());
Will Gresham 81 Master Poster

If I understand what you are doing, it seems you are trying to call PHP scripts with a JavaScript function, this will not work without either:
1. Reloading the page
2. Implementing an AJAX type script to make a call to the PHP script.

There are plenty of guides online on creating AJAX scripts. This would probably be the best option for what you want to do.

Will Gresham 81 Master Poster

All you need is either a server supporting PHP.

Or if you want to develop on your home PC, you will need both Apache HTTP server (apache.org) (Or another server) and the PHP package from php.net. Plenty of guides online on how to install and configure these.

Will Gresham 81 Master Poster

Haha, back on topic now :)

Never really liked Westerns though...

A couple more good films:
Donnie Darko
Crocodile Dundee
and Final Fantasy VII: Advent Children (If you haven't yet seen the extended Blu-Ray, watch it!)

Will Gresham 81 Master Poster

Shawshank Redemption is up there at the top of my list :)

William Hemsworth commented: Yah. +11
Will Gresham 81 Master Poster

Do you have more than one SQL query?
In an error, MySQL will echo the query, but in the error you posted the ip and adid values are swapped.

I can't see anything wrong with your code there.

Will Gresham 81 Master Poster

If you are trying to get values from a form, why not use the $_POST and $_GET vars in PHP... Any data from the form will be in these.

Using JavaScript is all well and good until you come across a browser which either has JavaScript disabled or does not support JavaScript.

Will Gresham 81 Master Poster

Posting some code might help...

Most likely not clearing Sessions or Cookies, but possibly something else.

Will Gresham 81 Master Poster

You would ideally need a database for this which has a table in it for Users and columns for a minimum of Username, Password and User ID.

Will Gresham 81 Master Poster

IMAP is what you are looking for

http://uk.php.net/imap

Will Gresham 81 Master Poster

What nav33n said.

Also, if you want to search for values which I guess you will do for a dictionary, look into the LIKE operator for your SQL query.

Will Gresham 81 Master Poster

You need to escape certain characters otherwise they do funky things to your PHP.

Best way is to escape them (or convert them to HTML enitities) when they are put into the database (Otherwise they may run riot on the database) and then unescape any escaped characters when you echo them.

There is plenty of info around on escaping/sanitizing strings.

Will Gresham 81 Master Poster

Might help to state what the problem is. I don't want to sit here looking through your code without knowing what I am looking for.

Also, use code tags.

Will Gresham 81 Master Poster

Wouldn't it be a good idea to re-use your previous thread which is still on the front page.

And if you post your code then people may be able to point out where you are going wrong.

Although, this is the example given by php.net:

<?php
$zip = new ZipArchive();
$filename = "./test112.zip";

if ($zip->open($filename, ZIPARCHIVE::CREATE)!==TRUE) {
    exit("cannot open <$filename>\n");
}

$zip->addFromString("testfilephp.txt" . time(), "#1 This is a test string added as testfilephp.txt.\n");
$zip->addFromString("testfilephp2.txt" . time(), "#2 This is a test string added as testfilephp2.txt.\n");
$zip->addFile($thisdir . "/too.php","/testfromfile.php");
echo "numfiles: " . $zip->numFiles . "\n";
echo "status:" . $zip->status . "\n";
$zip->close();
?>