Jump to content

jcbones

Staff Alumni
  • Posts

    2,653
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by jcbones

  1. Not sure what OS you have, but here is a tutorial for changing permissions in Win7 http://http://www.sevenforums.com/tutorials/122666-permissions-allow-deny-users-groups.html
  2. Actually, I just looked at the code snippet above, and that is totally wrong. You should change that to: $message = "Dear attorney {$row['first_name']} {$row['middle_name']} {$row['last_name']}:";
  3. You are already providing the user's name, from the database, in your email. here $message = "Dear attorney ".<?php echo $row['first_name'].' '.$row['middle_name'].' '.$row['last_name'];?>:." or, else I am mis-understanding your question. also, please use the [ code ][ /code ] blocks to post your code. <> on the editor, It makes it easier to read.
  4. No, simply fix your query statement, and then fix your indexes. Simple fix: change "SELECT email_addr FROM newsletter_emails WHERE id = :userId" To: "SELECT id,email_addr FROM newsletter_emails WHERE id = :userId" Then Change $myPost = new nlEmails($row["id"], $row['email'], $DBH); To $myPost = new nlEmails($row["id"], $row['email_addr'], $DBH);
  5. No, he is stating that you are only getting the email_addr from the database query, but then you are trying to access id and email from the returned values. They don't exist, because you didn't ask for them from the database. Actually, one of those indexes (email) isn't even in the database.
  6. Well, from your example, the mysqli_get_host_info($dbc) returned 'localhost via TCP/IP', but specifically according to documentation Manual says Otherwise your example shows the connection to the database through mysqli, and IF IT FAILS the script dies (exits, quits) while outputting the the returned values of mysqli_connect_errno() and mysqli_connect_error(). Which are sequentially: mysql_connect_errno() mysql_connect_error()
  7. Note* you should also be using a fully qualified URI in the header function. From the manual
  8. What you would need to do is first pull the image names from the database, then save the new images using those same image names. It will overwrite the old images with the new ones, no need to change the database at all.
  9. I am not sure I understand the question. You want to rename image files that exist on the server? and then change them in the database so they match? If so, there should never be a need to do that. You should be creating a unique image name for each image uploaded. The user never needs to know this name, only the browser. The only thing the user would need to know is the captions, comments, etc. To answer the question explicitly = rename()
  10. http://www.git-scm.com/ is your friend. Learn it, use it, it's invaluable. I think everyone has had to learn that lesson, with me, it was losing a hard drive.
  11. AFAIK, rows are not the problem, it is the amount of data being stored. While rows definitely are a consideration in this, the greater consideration is the amount of data stored as a whole. You could go with scaleDB which is an extension to MySQL, that handles large amounts of transactions, as well as a large data. Then you have NoSQL, but I don't think that would be a good fit unless you are using a bunch of concurrent users. You could very well stay with MySQL with no extensions and be perfectly fine. Depending on if you are writing to a hard drive, or a SSD, or a dedicated DB server. A lot depends on the architecture here. If it were me, I would get it up and running, do extensive testing to see if the database holds up. Perhaps picking a short interval (1 week?) for an archive interval. Only when/if it starts to bottleneck would I look at scaling up or scaling out.
  12. Make sure your storage folder has the right permissions, or the images will not be moved. AS far as JOINs go, the rule of thumb is a JOIN returns records that exist in both tables, but a LEFT JOIN returns all the results from the left table even if they have no corresponding result in the other table. Your image table should store one image per row, then you would join the data. SELECT d.name, d.price, i.photo FROM listingsdata AS d JOIN listingimages AS i ON d.id = i.data_id WHERE whateverSearched = 'blah' This all depends on foreign and primary keys of course.
  13. Copy the exact error, because this script gives me no syntax errors.
  14. Just as a note, perhaps it will help in the future: if ($credits <= 0) { //not enough credits - show message and redirect echo "You have no remaining credits. You will be redirected to purchase more."; header( "Refresh:5; url=purchase.php", true, 303); exit(); } else { The "else" statement is not needed here. As you will be exiting the script if the "if" statement does run. So the else will never be reached. Just less bracketing to worry with.
  15. You are missing a closing brace { for this statement. if($result) {
  16. I'm in disagreement with the last post, I think the way it is will process faster, and is more readable.
  17. You may want to point your anchor tag to the full url, is what I am saying.
  18. Should these <li ><a href="<?php echo $path . $file; ?>" rel="lightbox"><img src="timthumb.php?src=<?php echo $path . $file; ?>&h=194&w=224&zc=1&q=100" /></a></li> links not point to the same source? You want the link to an actual file, but you are generating the thumb. While that is theoretically correct, are you sure that you are pointing the link at the correct source?
  19. Somewhere you have moved the internal index pointer to the last element of the array, which ironically is numbered as 1, while 2 comes before it. That would mean that you are setting the indexes. If you need to get both again, you could use reset().
  20. Looks to be truncated by the database, due to column size constraints. You would need to look at your database table structure for that.
  21. Also, you need to secure that script. Anyone could upload a php file to it, and do massive amounts of evil with it.
  22. While PHPmailer is a great little application, it's documentation is something to be desired. $mail->IsSMTP(); // telling the class to use SMTP $mail->Host = "mail.yourdomain.com"; // SMTP server $mail->SMTPDebug = 2; // enables SMTP debug information (for testing) // 1 = errors and messages // 2 = messages only $mail->SMTPAuth = true; // enable SMTP authentication $mail->Host = "mail.yourdomain.com"; // sets the SMTP server $mail->Port = 26; // set the SMTP port for the GMAIL server $mail->Username = "yourname@yourdomain"; // SMTP account username $mail->Password = "yourpassword"; // SMTP account password
  23. In case the answer is no, and because, well, I'm just that kind of guy today. This is working code <?php if ($_SERVER['REQUEST_METHOD'] == 'POST') { //if there was a post request sent to this page. $allowedExts = array('gif', 'jpeg', 'jpg', 'png'); //list of allowed extensions $temp = explode('.', $_FILES['file']['name']); //break the file name on the periods (dots). $extension = strtolower( end($temp) ); //return the last element as the $extension. $file_location = null; //define variable. $newfilename = null; //define variable. if ( $_FILES['file']['size'] <= 200000 //if the file is slightly less than 2 mb. && in_array($extension, $allowedExts) ) { //and the extension is allowed. if ($_FILES['file']['error']!= 0) { //but the file throws an error. $error[] = 'Return Code: ' . $_FILES['file']['error'] . '<br>'; //log the error. } else { //else the file throws no error. $length = 20; //NO IDEA. $newfilename = md5($_FILES['file']['tmp_name'] . time()) . '.' . $extension; //create our own unique filename. if(!move_uploaded_file($_FILES['file']['tmp_name'], 'upload/' . $newfilename )) { $error[] = 'Unable to move file!'; } //move the file. $file_location = '<a href="http://www.--.com/upload/' . $newfilename . '">' . $newfilename . '</a>'; //log the location of the new file. } } else { //if we are over 2mb, or the extension is not allowd. $error[] = 'Invalid upload file'; //log the error. } $description = $file_location . "<br /> \n http://www.--.com/upload/$newfilename"; //description appends the file location, onto a text string about the file location. } ?> <html> <head> <title>PHP Test</title> </head> <body> <?php if(!empty($error)) { //if there are errors foreach($error as $err) { //go through them echo $err . '<br />'; //print them to the screen. } } elseif(!empty($description)) { //else if the description is not empty. echo $description; //print it to the screen. } ?> <form action="" method="post" enctype="multipart/form-data"> <label for="file">Filename:</label> <input type="file" name="file" id="file"> <input type="submit" name="submit" value="Submit" /> </form> </body> </html> If I were to go live with this, I would add a few more checks into the script for security. I would even be tempted to re-create the image, just to make sure someone didn't comment some code in it.
  24. Did you get this resolved, or do you still need help?
  25. Welcome!
×
×
  • 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.