Jump to content

joel24

Members
  • Posts

    760
  • Joined

  • Last visited

Everything posted by joel24

  1. try if($checkuser !== 0) also have you tried exit($checkuser); to see what is being returned?
  2. To send one ID to the corresponding email; use a while loop to cycle through the ids from the database and then use the mail() function to send an email to each. Or if you want to send all the ids to one email; use a while loop to cycle through the ids and add it to a string which will be emailed using mail();
  3. javascript will not be able to edit the file, you need to run a PHP script to edit the file. I was talking about java (not javascript) for use on your HDD, though PHP would be the easiest choice. Use php. Are you trying to edit the entire web-pages HTML and then save it - or just some text? Use file_get_contents() to retrieve the file's HTML, echo it into the ckeditor textarea, edit it, and when you post it back use file_put_contents() to write the file
  4. You need to write some PHP / Java etc to modify a file on your hard drive, the ckeditor sample is just a sample of the text editor's features.
  5. //here's the sql to count distinct views for the current image SELECT COUNT(DISTINCT ip) as `count` FROM `imageViews` WHERE imageID='$currentImage'; //each time someone views the image, run a sql code to store their IP address, the time/date and the imageID in the sql table.
  6. if they're the same price, then you'd just need $price = count($_POST['whatever']) * $bookPrice;
  7. if you want to distinguish between views per I.P. address you'll need a table with IP datetime imageID And make IP / imageID a composite primary key and use a INSERT ON DUPLICATE UPDATE query which will update the view datetime and just leave one view per IP OR you can have a unique auto_increment primary key and store every image view and then use a mysql query to select distinct
  8. put set_time_limit(15); at the top of your script and it will ensure the script runs for a total of 15 seconds before timing out. To generate a prettier timeout message, use register_shutdown_function and have a global variable to tell whether it was successful or not as the shutdown function will be called regardless... haven't tested this but the logic is there <?php function shutdown_function(){ global $gotFile; if (!$gotFile){ exit("Could not receive file in time!"); } } #15 second time limit set_time_limit(15); #haven't got file yet $gotFile = false; #shutdown function register_shutdown_function(‘shutdown_function’); #suppress errors and get if ($x = @file_get_contents("http://www.example.com/rss.xml")) { $r = @new SimpleXMLElement($x); $gotFile=true; } ?>
  9. use set_time_limit() and suppress the errors i.e. #15 second time limit set_time_limit(15); #suppress errors and get if ($x = @file_get_contents("http://www.example.com/rss.xml")) { $r = @new SimpleXMLElement($x); } else { $error="Could not fetch contents..."; }
  10. put all the email sending code within the if where "echo 'CAPTHCA is valid; proceed the message';" is. then change 'echo 'CAPTHCA is not valid; ignore submission';" to a prettier error message for the user to view. Either that or have a look at google's reCAPTCHA
  11. AFAIK, you'll need to use the mysqli class's multi query
  12. $newstring = '$search = mysql_query("SELECT * FROM cmscbesalke.game where gameTitle = '".$gametitle."'");'; why are you setting the variable within a sting? unless you are using eval()? $search = mysql_query("SELECT * FROM cmscbesalke.game where gameTitle = '".$gametitle."'");
  13. //change timezone php putenv('TZ=Australia/Sydney'); and to change it in your mysql database //get offset, including daylight savings because mysql won't $currentOffset = "+".(date("Z") / 60 / 60).":00"; //timezone mysql $update_tz = @mysql_query("SET time_zone = '$currentOffset'") or die(mysql_error());
  14. thats because you are only calling the single next element with .session class... jQuery(this).children(".sessions").slideToggle(500); //or jQuery(this).nextAll(".sessions").slideToggle(500);
  15. joel24

    $_GET

    www.domain.com?id=yourIDVariable //to retrieve $id=(isset($_GET['id'])?$_GET['id']:false;
  16. <?php if (isset($_POST['form'])) { #send the email $order=''; $order.=(isset($_POST['shirts']))?"shirt: {$_POST['shirts']} - size:{$_POST['shirtSize']} - colour: etc etc":''; mail('youremail@domain.com','New Order',$order); } ?> <form method='POST'> <h1>Shirts</h1> <select name='shirts'> <option value=''>Please Select</option> <option value='shift2'>Shirt 2</option> <option value='shift3'>Shirt 3</option> </select><br/> <h3>Size</h3> <select name='shirtSize'> <option value=''>Please Select</option> <option value='small'>Small</option> <option value='large'>Large</option> </select> <input type='submit' name='form' value='Submit' /> </form>
  17. if the form is on a single page and not requiring a login, you don't need a session... just <?php if (isset($_POST['form'])) { #send the email mail(); } ?> <form> <input type='checkbox' name='products' value='productID1'/> Product 1 <br/> <input type='checkbox' name='products' value='productID2'/> Product 2 <br/> <input type='submit' name='form' value='Submit' />
  18. try this from http://forums.mysql.com/read.php?20,194872,194872 SELECT SEC_TO_TIME(SUM(SECOND(time_utilization))) FROM tracker;
  19. use simpleXML... have a look at the examples
  20. export the access file as a CSV, create the new table on your server, upload the csv file and read it into the database using the load data infile function
  21. you don't need a comma after the last line Prod_Waiting`='$prodperiod', #remove this comma. WHERE
  22. joel24

    Login help

    the session is for each browser, not computer. the back button will load the site from the browser's cache so it won't contact the site, hence you won't be able to update the session... unless you were to call the content with an ajax request, but I think you'll be finding the juice isn't worth the squeeze... why would you want to record if a user refreshes the page or clicks the back button?
  23. change the mysqli to normal normal mysql queries... you'll obviously have to change some of the arguments you pass to the mysql function
  24. set up XAMPP on your computer. You can run PHP scripts and have a MySQL database all running locally. Javascript is not allowed to write to the harddrive (update files) for obvious security reasons.
  25. joel24

    Login help

    I wouldn't bother making it easier, typing a username / password isn't a very demanding task; if they do it wrong then they can do it again. if you persist to have it that way though, you can do something like this. <form method="post" action=""> <label>Username:</label> <input type="text" name="username" value='<?php echo (isset($_POST['username']))?$_POST['username']:''; ?>' > <br /> <label>Password:</label> <input type="password" name="password"> <p> <input type="submit" value="Login" name="Login" /> <input type="reset" value="Reset" name="Reset" /> </p> </form>
×
×
  • 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.