-
Posts
3,584 -
Joined
-
Last visited
-
Days Won
3
Everything posted by JonnoTheDev
-
Easy $words = explode(":",$a); print_r($words); You can then loop through the$words array
-
please validate this sql injection prevention method
JonnoTheDev replied to s0c0's topic in PHP Coding Help
yes you are you just aren't realising it. $this-> is a property/method reference within an object $result = mysqli_query($this->LINK,$sql); -
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
-
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.
-
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
-
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
-
please validate this sql injection prevention method
JonnoTheDev replied to s0c0's topic in PHP Coding Help
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 -
please validate this sql injection prevention method
JonnoTheDev replied to s0c0's topic in PHP Coding Help
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. -
please validate this sql injection prevention method
JonnoTheDev replied to s0c0's topic in PHP Coding Help
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 -
Never used it. Youll have to use the docs
-
http://devzone.zend.com/node/view/id/627
-
// 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"; } } ?>
-
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'];
-
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
-
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
-
SELECT DISTINCT will only work with an individual field, use a GROUP BY claus
-
Your XML is invalid
-
Ip address of a computer behind a router
JonnoTheDev replied to xstevey_bx's topic in PHP Coding Help
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? -
Find and Delete 4000 email records (without IDs) ?
JonnoTheDev replied to ianh's topic in MySQL Help
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. -
http://www.swiftmailer.org/
-
Ip address of a computer behind a router
JonnoTheDev replied to xstevey_bx's topic in PHP Coding Help
Not possible for anything to see this address. It is a private IP on your local LAN. -
[SOLVED] Dynamic Form posting values for processing
JonnoTheDev replied to nostrodamned's topic in PHP Coding Help
Correct. -
Print elements of an array and concatenate them in a string
JonnoTheDev replied to g_p_java's topic in PHP Coding Help
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. -
Print elements of an array and concatenate them in a string
JonnoTheDev replied to g_p_java's topic in PHP Coding Help
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); -
[SOLVED] Dynamic Form posting values for processing
JonnoTheDev replied to nostrodamned's topic in PHP Coding Help
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 }