Jump to content

kevinkorb

Members
  • Posts

    52
  • Joined

  • Last visited

    Never

Everything posted by kevinkorb

  1. ######################################### ######################################### $file='download/new.txt'; $type='text/plain'; header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); header("Content-Type: ".$type); header("Content-Disposition: attachment; filename=\"".basename($file)."\";" ); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize($file)); readfile($file);
  2. Just use the full path to the site root, or use the relative path. So if the file is in the same directory as your php script calling it just use read("myFilename.txt"); Or if it's in the parent directory... read("../myFielname.txt"); Get it? If not let me know where your file is in repect to the site root and where your php file is in respect to the server root and I'll tell you what to do.
  3. Actually the mail() not returning an error didn't mean it successfully left your server, it just means the command ran correctly. If there was a problem with the email address, or the mail server the email address was hosted on then you would find those errors in your maillog. If you're on a *nix look at /var/log/mail.log or something similar. The main things about not getting caught as spam is keep very few images, a decent amount of text. As far as testing on an account with anti-spam software, I'm have no good recommendations on that. Sorry.
  4. That's your problem, it's not finding your file at: $file='/path/new.txt'; where is your path pointed to? It is being pointed from the server root and not your site root correct?
  5. Really it depends on how your data relates to each other. However following good database normalization techniques, and proper indexes is typcially the way to go.
  6. What happens when you do this? $file='/path/new.txt'; $type='text/plain'; if(file_exists($file)) { header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); header("Content-Type: ".$type); header("Content-Disposition: attachment; filename=\"".basename($file)."\";" ); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize($file)); readfile($file); } else { die("FILE $file does not exist"); }
  7. Try this: $result =mysql_query("UPDATE user_name SET active = 'yes' WHERE iamlink = '$accode' AND username = '$un' AND email = '$em' ") or die(mysql_error());
  8. Your select doesn't check the username though....
  9. It is saying that it's not updating your rows. Check your user_name table to make sure that it has those values. SELECT * FROM user_name WHERE iamlink = '37e48acbb43dda0568b8867381227f12' AND username = 'testusername' AND email = 'testemail' When you run this, do you get any rows back?
  10. Another thing you need to look out for is escaping your data. Since you're getting data from the user $_GET etc. Escape that using... $accode = mysql_real_escape_data($_GET['code']); $em = mysql_real_escape_data($_GET['email']); $un = mysql_real_escape_data($_GET['username']); Then they can't use 'SQL Injection'
  11. Try this and see if it helps you out. <code> <?php // Grab url get $accode = $_GET['code']; $em = $_GET['email']; $un = $_GET['username']; //CONNECTION include('../always/comms/data.php'); mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to database'); $dbname = 'iam_user'; mysql_select_db($dbname); $query = "SELECT * FROM activation WHERE ac = '$accode' AND email = '$em' "; $loginres = mysql_query($query); $numrows = mysql_num_rows($loginres); if ($numrows > 0) { $result =mysql_query("UPDATE user_name SET active = 'yes' WHERE iamlink = '$accode' AND username = '$un' AND email = '$em' "); echo mysql_affected_rows($result)." Affected rows for $accode - $un - $em"; $result = mysql_query("UPDATE activtion SET activated = 'yes' WHERE ac = '$accode' AND email = '$em'"); echo mysql_affected_rows($result)." Affected rows for Activation $accode - $em"; //header('Location:../registration/?reg=choose'); } else { //header('Location:../registration/?reg=wrongcode'); } ?> </code>
  12. Also look at your mail logs, it will help you see if your sendmail failed on sending email messages. Another thing you can do is just test your messages to different mail servers that run anti-spam software. Most of the servers that detect the spam will add that data and the spam score to the emails and then you can see why they thought it was spam.
  13. Clarify a little more what you expect to happen, and what is happening in more detail. Thanks.
  14. TRUNCATE TABLE 'tablename' That will clear all data and reset your auto_increment value.
  15. Change Your Updates to Selects to make sure that you're getting rows to update. That should then be able to figure out where your problem lies.
  16. I noticed that after being on your home page for a little bit my browser had downloaded 2Megs. Your images are very large, I would optimize them. Your PHP is probably fine.
  17. We're using .htaccess to fire off our auto_prepend_file in php. We're using subversion and we don't want to have to change the .htaccess file every time it changes hands, we want apache to know based on the document root that our prepend file is always located at DOCUMENT_ROOT/includes/prepend.php How is this done? Is it possible? Thanks in advance.
  18. I have apache 2.2.4, php 5.2.4, mysql 5.0.37 installed on Windows Server 2003. My clients were complaining that they could not log into the system, and others said they could do a few things, however shortly the page would halt in the middle. The server cpu load was about 1% I had more than a Gig of free memory, there is nothing in my Apache Error Log. I restarted mysql and everything stayed the same. I then restarted apache and everything magically went back to normal. I'm not sure how to go about troubleshooting this problem as I'm not very familiar with Apache on Windows but this project forced me to go with windows. Any ideas of what could have happened and things to check? thanks in advance.
  19. I figured it out. I copied my php.ini file to the same folder and then gutted the extensions except for mysqli (which I will defiantly need). Then to call the php script I used: php -c php.ini test.php It worked. I'm chalking it up to an extension(s) that isn't compatible with the php cli for windows. Way too much fun for what I wanted to do.
  20. I can create a simple .bat file containing... php d:\www\vhosts\mydomain.com\myfiletoautomate.php and then Schedule that through the task scheduler. That part is easy, its just getting php to play nicely in the command line format that is the problem.
  21. That does work, however I'm looking for a 'best practices' solution. The box is going to be working very hard to begin with (The mysql database is at about 25 million rows in 130 tables) the budget is decent for the project, I would really not want to resort to ie for automated tasks. You solution would work, however I'm looking for a bit more. Thank you.
  22. I have PHP 5.2.3 running on Windows Server 2K3. Everything works fine through apache, however I'm creating some automated tasks and wanted to us Windows Task Scheduler to run them through the command line. Test 1: - Send simple email: <code> <?php mail("kevin@mydomain.com", "test email sub1", "test body", "From: testserver@test.com"); ?> </code> Now I tried running that three different ways. (I have a copy of the php.ini in the same folder as the script I'm running) I tried: php test.php php -n test.php php-win test.php The only one that completed and sent the email was php -n test.php. Then I ran a simple test to try to connect to my database. After trying to run it every way I thought I could, the error message came back that it couldn't instantiate the mysqli class. So I imagine it is a php.ini problem, however I'm not able to resolve it in any way. Any ideas? thanks
  23. Actually in PHP 4.3+ you can include http requests in includes unless allow_url_fopen is set to On.
  24. Basically I have this code $myFile = $_GET['file']; include("/www/mySite.com/include_$myFile"); How would I access a file http://www.different_server.com/inject.txt into here? Is this possible? Thanks.
  25. What you are doing is correct. however that won't output anything, it just puts it in a variable... but to create your table you'd just need. [code=php:0] <?php $query = "YOUR QUERY"; $result = mysql_query($query); echo "<table>\n"; while($row = mysql_fetch_assoc($result)) {   echo "<tr><td>{$row['field_1']}</td><td>{$row['field_2']}</td></tr>\n"; } echo "</table>\n"; ?> [/code]
×
×
  • 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.