Jump to content

JonnoTheDev

Staff Alumni
  • Posts

    3,584
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by JonnoTheDev

  1. Easy $words = explode(":",$a); print_r($words); You can then loop through the$words array
  2. yes you are you just aren't realising it. $this-> is a property/method reference within an object $result = mysqli_query($this->LINK,$sql);
  3. You should not be passing the value of the cookie through the URL - you dont need to. You are better organising your templates in a better directory structure. Lets say I select a view on your website. The option values are 1,2, and 3. If I select 2 then a cookie is set with the value of 2. So lets organise your templates in the following way: templates/ 1/layout_default.php 2/layout_default.php 3/layout_default.php Now in your include function I use this value. include('templates/'.$_COOKIE['value'].'/layout_default.php'); I would also recommed using a template engine such as smarty as it will make things a lot easier. http://smarty.net
  4. Yes, when the user selects a view you can then set a cookie. Use the cookie value to display the appropriate template. If no cookie is set then use a default template. Look at cookies.
  5. Look at these tools Mencoder, Mplayer, FFMpeg-PHP Remember there is always an open source version of everything. Flash Media Server alternative is RED5 http://osflash.org/red5
  6. Yeah, forget using php's native mail() function for email with attachments. PEAR::Mail_mime is so easy to implement and will get rid of all that horrible base 64 file encoding malarkey
  7. Up to you but as to why: More up to date Improved functionality (the i stands for improved) Allows you to use the functions provided in MYSQL 4.1 and above Object orientated interface and so on
  8. They dont do the same thing entirely. mysql_real_escape_string() escapes special characters used in queries but will not store the slashes in your db row. Forget addslashes() it is a poor function in my opinion and requires the use of stripslashes() when using output. If you want to be even more secure switch to the mysqli extensions and use parameterized querys: <?php $connection = new mysqli("localhost","user","pass","db"); $query = $connection->prepare("SELECT * FROM table WHERE id = ?"); $query->bind_param("i", $id); $query->execute(); ?> Running your function above through every input value is going to slow things down.
  9. mysql_real_escape_string() on its own would have done the job. Also make sure that you database user only has the privileges that are required. http://uk3.php.net/manual/en/function.mysql-real-escape-string.php
  10. Never used it. Youll have to use the docs
  11. http://devzone.zend.com/node/view/id/627
  12. // dont use isset() - bad function <?php // make sure you have this at the top of every page using sessions session_start(); if(strlen($_POST['submitted'])) { if(strlen($_POST['accept'])) { // store all post values into session array foreach($_POST as $key => $val) { $_SESSION[$key] = $val; } // checkbox has been ticked - redirect to page 2 header("Location:order.php"); exit(); } else{ // you can print this error somewhere on the page $error = "Please accept our terms and conditions"; } } ?>
  13. You may also need to save the POST values into a session so you can recover them on the 2nd form i.e. session_start(); // validation part // if all fields are correctly filled in foreach($_POST as $key => $val) { $_SESSION[$key] = $val; } // redirect to page 2 Then on the 2nd page you can recover the values session_start(); // prints the name entered on page 1 print $_SESSION['name'];
  14. You need the form to submit to the processing page (or have it submit to the same page and put the php validation at the top): if(strlen($_POST['accept'])) { // checkbox has been ticked - redirect to page 2 header("Location:page2.php"); exit(); } else { print "Please accept our terms and conditions"; } Something along those lines
  15. You just need to organise your data into tables. Read up on normalisation. Then you can write the queries to search your records. i.e members =========== memberId levelId name email username password created levels =========== levelId title price
  16. SELECT DISTINCT will only work with an individual field, use a GROUP BY claus
  17. Your XML is invalid
  18. Nothing at all. Only your public IP can be got at which is the IP assigned by your ISP. You do not browse on a private IP such as 192.168.x.x Why would you want this address anyhow. It will not give you any information on who the person is?
  19. Place an index on A email field. Select rows from B. Loop through rows and delete from A where email address = B row email You are better running through the command line. Dont try in a web browser.
  20. http://www.swiftmailer.org/
  21. Not possible for anything to see this address. It is a private IP on your local LAN.
  22. You cannot print an array using print. you can however use print_r(); You must implode the array before it can be printed as a string.
  23. Then i would suggest storing your data back into another array via your loop and then concatenating using implode(): // build up an array so it looks like $array = array('ab','cd','ef','gh'); // produces ab_cd_ef_gh print implode("_", $array);
  24. You must be doing it wrong. Example <input name="items[]" type="checkbox" value="1" /> <input name="items[]" type="checkbox" value="2" /> <input name="items[]" type="checkbox" value="3" /> // Processing part foreach($_POST['items'] as $item) { // do something with the selected item }
×
×
  • 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.