Jump to content

Cep

Members
  • Posts

    539
  • Joined

  • Last visited

    Never

About Cep

  • Birthday 11/27/1979

Profile Information

  • Gender
    Not Telling
  • Location
    On a boat in the middle of nowhere

Cep's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Ok so really bizarre, I turn the server on today and it all works? No code changes, nothing. I'll chalk this up to a mystery cache or Windows process.
  2. Hi, Well spotted, I am used to using mysqli you see! Anyhow I have removed that from my code but I receive the same error. I have re-granted permissions to the users in Mysql and flushed them again but still no luck. You do not think this has anything to do with IIS 7.5 do you?
  3. Unfortuantely I have tried "localhost", "machine name", "127.0.0.1". I have then tried all of them with the port number appended as well. I have even tried to connect with the Mysql Root user and even this is denied.
  4. Hi, I am getting frustrated beyond belief at the moment with trying to get a very simple script to run, I am using PHP 5.3.3 and MySQL 5.1 on a Win2k8 server with IIS7.5. Basically my script is connecting to a local database, running a single select query, returning those rows and building up a string from them. The problem is that I am receiving complete BS responses from PHP that the access is denied for the user being specified. This is complete rubbish since the user can connect via mysql, sqlyog, ASP.NET MVC without issue but for some bizarre reason it is not working via PHP. The code for the script is here : <?php $mysql = mysql_connect('127.0.0.1:3306', 'myuser', 'mypass', 'mydatabase'); if (!$mysql) { die(mysql_error()); $content = "<nobr></nobr>"; } else { $result = mysql_query('SELECT * FROM tblEventGroup'); $content = "<nobr>"; if ($result) { while($row = mysql_fetch_assoc($result)) { $content .= "<span>"; $content .= $row['GroupName']; $content .= "</span>"; $content .= "<a href=\"../Event/EventSearch?groupid="; $content .= $row['GroupId']; $content .= "\" target=\"_blank\">Book here</a> "; } } mysql_close($mysql); $content .= "</nobr>"; } ?> I cannot for the life of me understand what the problem is, the return error is Access denied for user 'myuser'@'localhost' (using password: YES)
  5. Your accepting your POST vars without first validating that the data being passed to your script is not malicious. What if I injected some nice little script into yours via your POST var, that would not be very good. Escaping is probably the wrong term to use with PHP but basically you should always html_special_chars() your POST vars or use a similar function. You take a performance hit but when it comes to security of an app over performance never take the later as the more important.
  6. To make it ever so slightly (so that you won't even notice) efficient you should change these lines header("Location: /new_directory/completed.php?ID=".$row["CompanyID"]); to header("Location: /new_directory/completed.php?ID={$row["CompanyID"]}"); The reason being interpretation is faster then concatenation. Other then that I don't see anything wrong either, except your not escaping your POST vars.
  7. Looking good gang Well done! Thanks for all the effort you put in!
  8. The instructions here are pretty good, http://www.tjitjing.com/blog/2006/05/php5-with-iis6-on-windows-server-2003.html With IIS there are a few extra little things you need to do, even with the installer. Remove all the PHP installations you have done and try to clean up any remnant parts before you carry out the above. The message that your reporting though seems to suggest the script is causing a timeout so you could increase this in the php.ini to see if it is the script (although with IIS there is a fixed time limit that cannot be changed for server response).
  9. Is the username a string? You may just need to add single quotes around your {$_SESSION['Username']} if that is the case.
  10. A single connection object can then be used throughout your code, as opposed to creating many additional connection objects which will eat up your resources. That would be the reason I guess.
  11. Cep

    MySQL help

    So let me get this straight, you asked a question about MySQL, in a PHP forum, for an Oracle database? I don't think you could get any more confusing, if this is Oracle you are writing the script for here is a tutorial on Oracle's SQL http://dbis.ucdavis.edu/courses/sqltutorial/tutorial.pdf
  12. You can't use the HTTP protocol call in opendir(), read this, http://uk3.php.net/manual/en/function.opendir.php
  13. The include requires a parameter it should be, <?php returnimages($dir); ?> Where $dir is your original directory for the images. I believe that is what is he is saying.
  14. Try something like this, <?php $filename = $configpath.'lastten.txt'; // Read in file if ($details = file($filename)===false) { $error = "Cannot open file {$filename}"; exit; } else // Change last index $details[9] = "My new string\n"; if ($result = file_put_contents($filename,$details)===false) { $error = "Cannot write to file ($filename)"; exit; } ?> I am not at a server to test this but using these two functions better then using the fopen methods.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.