Will Gresham 81 Master Poster

I cannot see a call to the mail_it function in the code you posted, but what you will need to do is change the $recipient value that is being sent to the mail_it function depending on which option is selected.

cguan_77 commented: thank you :) +0
Will Gresham 81 Master Poster

When referencing vars, you do not need a second $ :

$this->$servername = $server;

Would become

$this->servername = $server;

@tmash
The whole idea of Object Orientated programming is to make your code portable, not every server will have MySQL on localhost so defining this absolutely is not a good idea. The server address is passed to the script when the function is called.

Will Gresham 81 Master Poster
ggeoff commented: Useful advice +0
Will Gresham 81 Master Poster

Why not use the RAND function of MySQL?

$query = "SELECT * FROM tbl_admin WHERE id=5 ORDER BY RAND();

Also, if you only want one image at a time, you should add LIMIT 1 to the end of the query.

kvprajapati commented: Great! +6
Will Gresham 81 Master Poster

You can specify BCC addresses in the mail function, but that way would not allow you to send personalised emails..

As far as I am aware, mail would be the best way to do this.

Will Gresham 81 Master Poster
<?=$delay?>

look at this place and similar ones
what i can say (maybe I am not experienced in such things), but if you say this is php, then I think it is quite a bad code here. I think

That is an acceptable way to echo a variable within HTML code,

The problem is this line (Line 61):

<td><input type=text name=site value="<?=get_setting("site") size="20"?>" size=30></td></tr>

size="20" is within the PHP braces.

Will Gresham 81 Master Poster

An explode would be the quickest/easiest way to do this.

$liArray = explode("</li>", $string);

foreach($liArray as $key => $value) {
  // $value will contain the li string, do something with it here. 
}
Will Gresham 81 Master Poster

Please use code tags, it makes it easier to read your code.

Also, the code on the first page has a Delete statement, the code above does not. Which code are you using at the moment?

Will Gresham 81 Master Poster

yes, its cool too, but the process by ajax will be done in the backend.
page won't refresh while sending the mail.

Reread the first post and the title.

The OP wants a mailto link, not a PHP mail() function.

Will Gresham 81 Master Poster

Do you mean delete in an SQL query, or a unlink to delete files?

Will Gresham 81 Master Poster

As Atli says, Blowfish is an encryption cipher, not a hashing algorithm.
It is in the mcrypt library (http://php.net/manual/en/book.mcrypt.php)

There was a whole thread a while back discussing passwords and some good methods. I'll see if I can find it...

EDIT:
Thread is here:
http://www.daniweb.com/forums/showthread.php?t=178241

samarudge commented: Good link, fast reply, quite helpful =D +2
Will Gresham 81 Master Poster

Do you have phpMyAdmin?

If you do, copy the query from your script and run it directly in there.

You say 'It still didn't work', do you mean it does exactly the same, or are you getting additional/different errors after changing the code?

Will Gresham 81 Master Poster

Rather than:

$data = mysqli_query($dbc, $query);

Try this:

if (!$data = mysqli_query($dbc, $query)) {
    printf("Error message: %s\n", mysqli_error($dbc));
}

It should throw an error in the SQL statement.

Will Gresham 81 Master Poster
$data = mysqli_query($dbc, $query);

Should this be:

$data = mysqli_query($query, $dbc);

Having not used mysqli - I can't comment, but I think the first parameter should be the query, then the connection link identifier.

Nope, for some reason they swapped them for mysqli, although if no connection is specified, it will default to that last connection that was established I believe. :)
http://www.php.net/manual/en/mysqli.query.php

diafol commented: Thanks Will - didn't know that +4
Will Gresham 81 Master Poster

Paypal has a whole section of their website dedicated to this subject, along with their own support forums. You will probably get all the info you need there :)

Will Gresham 81 Master Poster

You would probably be better asking this in the HTML/CSS forum: http://www.daniweb.com/forums/forum143.html

Will Gresham 81 Master Poster

Does it do anything?

Do you get a blank screen, an error?

Will Gresham 81 Master Poster

i read the link you provided and didn't get a solution
maybe i am doing something wrong
and so i started this topic for someone to help me as i am stuck in time
thanks for your fast reply ..appreciated

so could someone plz get what is wrong with the supplied argument in line 42 ?
thanks in advance

The error you are getting tells you exactly what the problem is.
The problem is that the 'supplied argument is not a valid MySQL result resource'.

If you re-read the topic I linked to, you will see it tells you to add error-checking to your queries to tell you what they are not successful.
Add in the error checking and see what errors it gives you.

Will Gresham 81 Master Poster

Did you even read the 'Read Me' topic at the top of the forum list?
http://www.daniweb.com/forums/thread191031.html

Will Gresham 81 Master Poster

You cannot use AJAX if JavaScript is disabled.

Always try to write your code for non-JavaScript clients and then add AJAX afterwords.

AJAX should be used to enhance the page, it should not be the core of it.

Will Gresham 81 Master Poster
Will Gresham 81 Master Poster

Yep, im a nighthawk. Sleep in the afternoon instead of the night so i can be up when guys over the pound are coming back from work.

Same here.. I spend most of the night on here :)

But then I work graveyard shift in a very quiet callcenter so I have plenty of time to be bored :)

I also have done some photography, although not recently.. some of it is still up at http://stuff.elvenblade.com/camera if anyone is interested.

Will Gresham 81 Master Poster

the best solution is session..
because after a specified time the use automatically logged out so session is best option for security.

I am going to disagree with your reasons for using sessions over cookies, although Sessions are more secure in themselves:

This can also be done with Cookies, you can set the time they expire.
I assume you meant that they expire when the browser closes, but an auto timeout is not really required in most situations so can't really be used as the main point for using sessions..

The main advantage of sessions is that the session data is stored on the server, not on the client PC (Cookies store the data on the Client).
The only thing that is stored on the client is the session ID.

Will Gresham 81 Master Poster

A database would be more secure.

If your PHP compiler stopped working for any reason, your PHP code yould be displayed as plain text, meaning that your password would be visible.

However, if you have it in a database and the compiler stops working, then the user will not see the Admin password. Although they would see the database connection information.

The best way would be in a database, and setup access hosts in your database to prevent anyone other than Localhost making a connection (Also, make sure your database user password is not the same as any other password you use, a string or random numbers/letters/symbols for example)

Will Gresham 81 Master Poster

Post an example of the code you have already.

Will Gresham 81 Master Poster

Do you mean double as in it echos 1.15 or it displays 0.575 twice?

Will Gresham 81 Master Poster

Why thanks :) I'll be getting this camera soon [link], I can't wait. Those pictures were taken with my awful Samsung S570, it will be nice to use a real camera for once.

That is an expensive camera :-O

Pics do look really good though :)

Will Gresham 81 Master Poster

You only need one = on your mysql_connect statement.

Will Gresham 81 Master Poster

Rather than using

$date = date("d-m-Y");

Save the date as a timestamp in an int(11) field, do not save dates as DATETIME, DATE or any other date specific SQL type..
Since this will be a number, you can then sort by the date column in descending order to get newest to oldest :)

Simply use your $date = date("d-m-Y"); on the timestamp when you display the information.

Will Gresham 81 Master Poster

Use a while statement, like:

$query = mysql_query(query here...);

while($result = mysql_fetch_assoc( $query )) {
  echo "<tr><td>{$result['column_title']}</td></tr>"
}

That will output one line for each record retreived. Adjust the echo to your needs obviously

Will Gresham 81 Master Poster

Try this:

$q6 = "SELECT * FROM banners WHERE lang='{$_SESSION['lang']}' AND section='top' ORDER BY RAND() LIMIT 1";
Will Gresham 81 Master Poster

Use sessions, when a user signs in, create a session:

// Put this at the top of the page
session_start();

// Process the login then do this:
$_SESSION['logged_in'] = 1;

Then only allow access to the page to users who have an active session:

if(isset($_SESSION['logged_in'])) {
  // Continue with the page code
} else {
  echo "Please log in";
}
Will Gresham 81 Master Poster

$result

Assuming the fields are called email and username, use the following:
$result
$result

Will Gresham 81 Master Poster

Many problems with your code there...

There appears to be no protection on your query at all...
Try replacing this:

$id = $_GET['id'];

with this:

if (is_int($_GET['id'])) {
  $id = $_GET['id'];
  // Add the rest of the script here.
} else {
  // Display an error message, also stop processing.
  echo "Error message here";
}

Also, this line $sql="SELECT * FROM users"; is redundant, it does nothing...

Instead of this:

$result = mysql_query("SELECT * FROM users WHERE id=$id");

Try this I added a limit as I assume you will only be expecting one result:

$query = mysql_query("SELECT * FROM users WHERE id=$id LIMIT 1");
$result = mysql_fetch_assoc( $query );

You can then call the values from the DB using $result.

So to review, your code should look similar to this:

<?php

$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="login4"; // Database name

// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die(mysql_error());
mysql_select_db("$db_name")or die(mysql_error());
if (is_int($_GET['id'])) {
  $id = $_GET['id'];
  $query = mysql_query("SELECT * FROM users WHERE id=$id LIMIT 1");
  $result = mysql_fetch_assoc( $query );
  echo $id;
} else {
  // Display an error message, also stop processing.
  echo "Error message here";
}
?>

Also, as ardav said, you will need to add some logic to make sure that the user viewing this page actually has permission to do so, such as creating a session when they login, and check that a session exists when they access this page

Will Gresham 81 Master Poster

Your problem will be this line:

<form action='manager_employee_select.php?proc_employee_id=<?php echo $_POST['proc_employee_id']; ?>' method="POST">

This will put the proc_employee_id from the previous form as in the URL for this forms action.

Will Gresham 81 Master Poster

Add this code to the head of your document (Or in an external file if you use one)

<script type="text/JavaScript">
function checkValue() {
  if(document.getElementById('my_field').value == "default_value") {
    document.getElementById('my_field').value = "";
  }
}
</script>

Change my_field and default_value to the relevant values for your script.

Then add an onkeypress event to your input field for the function.

Will Gresham 81 Master Poster

Make a seperate page (profile.php perhaps) and use the unique field in the database (Usually an ID of some sort) in the query string, for example, profile.php?user=usersID.

In the profile.php page, pull the required data from the database and display it as required.

Will Gresham 81 Master Poster

What parse error?

It will usually give you something to go by, e.g. 'expecting x' or 'unexpected x'

Will Gresham 81 Master Poster

In delete.php do you actually have a mysql_connect statement?

From your code it would seem not...

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

Take a look at this line:

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

You are missing the = on href.

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

Look at your value attribute,:

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

This should be:

value="<?php echo $_SESSION["namevalue"]; ?>" />
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

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

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

My library is about 30GB which is just right for my 30GB iPod, I have recently removed all the stuff I don't listen to anymore (about 11 months since I reinstalled windows and I deleted the ones with 0 play count It was 60GB =O )

But then, 8GB of that is audiobooks...

Will Gresham 81 Master Poster

If you want to run in once a day, then that would be fine, if you are on a Linux server, a Cron job would be best.