Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. Shouldn't it just be i not $i, as you are doing this on the JS side of things?
  2. Create a script called print.php which takes in the information needed to generate the report. Once you have that, generate just a simple table and then you should be able to have an easy clean version to print. So the print button would just open a new window, which points to your print.php, you could potentially store the information in session and regenerate it that route, or just do a re-query.
  3. http://lmgtfy.com/?q=css+input
  4. Use CSS to style it.
  5. Cameras are serious! I use a Cannon Super Deluxe Ultra D with a 50GP per second shutter speed.
  6. Sometimes the error says a line, but it could be the surrounding. Post 5 lines before that line and 5 after to give us a better idea of what is going on. As an alternative test, you can assign the preg_replace section to its own variable and test it that way and if the error is still thrown on the line the preg is on, then yea. Something is up. However, it does not seem that it is there, given I did ran this code locally and it went through just fine and echo'd bad. $username = 'test_'; if ($username != preg_replace("/[^a-zA-Z0-9\s]/", "", $username)) echo 'bad'; What would be a better idea, is post the username you are testing plus the 5 lines before and after the offending line.
  7. Why not just set the include to assign the data to $_SESSION['content'] instead and remove the middle man? At anyrate, that is not how you use includes, includes execute the code. So you would need to do: include('includes/inc_records.php'); $_SESSION['content'] = $content;
  8. In your httpd.conf or vhost file the option "MultiViews" is set, remove that and it should work. For more information on that, look up content negotiation
  9. You can use one file or multiple. If you use one file you would need a way to identify the file. If you use individual files, well you just name them differently. The shared text potentiality could cause problems, but it depends on how accurate you want it to be.
  10. Seems like it is because of the w flag, try this: $counter = file_get_contents('counter.dat'); $counter += 1; $fh = fopen('counter.dat', 'w'); fwrite($fh, $counter); fclose($fh); Should work.
  11. Remove the /n from the first RewriteRule ?
  12. 1: Security wise, nothing. You are defining your variables and not allowing the user to set anything. So it is fine. 2: To incorperate a download counter, non-database driven, simply write it to a text file and just open / increment it each time. This is really trivial: $fh = fopen('counter.dat', 'w'); $counter = fread($fh, 1024); $counter++; fwrite($fh, $counter); fclose($fh); Should do it for you.
  13. Well yea, you have to something with the $data array to display data or else it will be blank. To save you some looking up the ? : is the ternary operator.
  14. You need an echo statement here: else { echo "Error processing form. Please contact the webmaster"; } And you should call exit after the location call: if ($forward == 1) { header ("Location:$location"); exit; } Other then those two minor issues it looks fine.
  15. If you want this functionality you will need to look into an SMS Server or SMS Gateway, mind you it will cost a pretty penny to get started up with it.
  16. It will be far more efficient to query them all at once. $result = mysql_query("SELECT oid, psc9 FROM tblquestions ORDER BY oid LIMIT 100") or trigger_error("Question select failed with error: " . mysql_error()); if ($result !== false) { while ($row = mysql_fetch_assoc($result)) { echo 'Question: ' . $row['oid'] . ' psc9: ' . $row['psc9'] . '<br>'; } }else { echo 'The query returned an empty response, see the errors if any to resolve.'; } That should pull up all your rows sequentially for 100 rows.
  17. mysql_connect returns a link, you will just assign that out and then use that link when querying IE: $db1 = mysql_connect('data', 'data', 'data'); mysql_select_db('database1', $db1); $db2 = mysql_connect('data2', 'data2', 'data2'); mysql_select_db('database2', $db2); mysql_query('SOME SQL STATEMENT', $db1); mysql_query('SOME OTHER SQL STATEMENT', $db2); For a rough example. If it is connecting to the same MySQL Server, you can just invoke the mysql_select_db after you queried the first database and change the database to the second one instead of opening a new connection.
  18. I would highly suggest NOT using regex for this. You will be better off with something like PHP Tidy or HTMLPurifier to handle this for you. In there you can set the allowed tags etc and it will properly format your HTML and remove anything you do not necessarily want.
  19. Write a looping code that reads the rows in one by one and formats them in that way...
  20. First up what is the point of checking if $row['reg'] == $_GET['reg'] ??? Of course they will be equal, MySQL would not have pulled it out any other way, so I would remove that check. Here is an updated version of your code, complete with SQL Injection prevention. <?php // Escapes the values to prevent SQL Injection, if set, else set to null $email = !empty($_POST['email']) ? mysqli_real_escape_string($cxn, $_POST['email']):null; $reg = !empty($_GET['reg']) ? mysqli_real_escape_string($cxn, $_GET['reg']):null; if (!empty($reg) && !empty($email)) { $sql = "SELECT reg FROM sales WHERE email='$email' AND reg='$reg'"; $result = mysqli_query($cxn,$sql) or die ("Couldn't execute query sales statement"); $data = array(); //This way we can hold multiple results while($row = mysqli_fetch_assoc($result)) { $data[] = $row['reg']; } }else { echo 'Sorry, Reg and Email are required to process.'; } ?> I did not read through the entire thread, but will do that now to see if that was the problem or not. EDIT The problem was with that if Statment. Chances are your MySQL database is setup to be Case Insensitive, meaning that it would match A and a as if they were equal. PHP is CaSe SeNSiTiVe on checks, thus if one character was upper case or lower case and was not that way in the database, it would fail. That would be my guess as to why your code never worked to begin with.
  21. Without some type of ActiveX Control, like flash or java running, this will be impossible to achieve. So basically, PHP cannot do this without a 3rd party ActiveX control. Sorry mate.
  22. Pretty basic, but your main issue is that you keep reseting the counter to be 1 each iteration. $result = mysql_query("SELECT * FROM comments WHERE quoteid = ".$_REQUEST['quoteid'].""); $counter = 1; while($row=mysql_fetch_array($result)){ $date = $row[date]; $name = $row[name]; $email = $row[email]; $quoteid = $row[quoteid]; $comment = stripslashes($row[comment]); $commentid = $row[commentid]; $counted = $counter++; Moving the $counter variable outside of the loop will prevent this behavior from resetting.
  23. Generally for attaching files, it is recommended to go with PEAR::Mail as it handles MIME types much better or something like phpMailer. If you want to do this on your own, I would suggest looking at the source code of phpMailer and see how they handle the attachments and follow their lead, or just use their class to begin with. Also of note, you can look at the manual for mail as it gives information on how to attach files as well. Just requires a bit if reading and trial / error in a small scale on your part to get it right.
  24. I think you would want a hash. I would not really bother trying to do encryption. What would be a better method is have two tables in your SQL Database, one that references the files and one that has "allowed" the allowed table would store the hash and the link to the files table. When a user requests that hash it pulls it up and then you can have it delete after x minutes so then that hash is no longer valid to prevent hotlinking / people giving away the link. A simple random md5 or sha1 hash should suffice, just make sure to salt it up and randomize it with something like microtime.
  25. INSERT INTO table_name (col1, col2) VALUES ('001', 'Testing1'), VALUES ('002', 'Testing12'), VALUES ('003', 'Testing123'); Of course you will need to tailor that to your table and column names.
×
×
  • 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.