-
Posts
3,584 -
Joined
-
Last visited
-
Days Won
3
Everything posted by JonnoTheDev
-
Will look later. You should be able to extend the regex to capture the entire image tag with all attributes. The example was just to start you off. A useful tool is regex buddy http://www.regexbuddy.com/ Get a copy of this.
-
Help with session/users - need an explanation
JonnoTheDev replied to pnyx's topic in PHP Coding Help
Sessions may be hard to grasp at first for a noob. Read this, hopefully it will give you a better understanding of how php uses sessions. http://php.about.com/od/advancedphp/ss/php_sessions.htm -
Here you go. Use this as a starter $url = "http://www.test.com/"; $html = '<img src="http://www.test.com/images/x.jpg"><br /><img src="images/y.jpg"><br /><img src="images/abc.jpg">'; $result = preg_replace('%<img src="([^http://])([a-zA-Z0-9\\./-_ ]+)"%', '<img src="'.$url.'$1$2', $html); print "Original html:<br />"; print "<xmp>".$html."</xmp>"; print "New html:<br />"; print "<xmp>".$result."</xmp>";
-
Ah so you are not extracting the images paths. You are storing the entire page html and want to replace the src attribute within the html.
-
like a php condom
-
Dont understand If you have the url that you are scraping image paths from then why can this not be prepended to the src attribute if it doesn't already exist? That is what you are trying to do from your initial post.
-
Check the permissions, ownership of the directory
-
yes you will - do not use it put L'enveloppé.html into a google search and you will see the urls used for this keyword
-
Objects can be stored in sessions also $_SESSION['drink']->getName();
-
Personally I wouldn't do it like that. If all the image sources are from the same url i.e. http://www.xyz.com/images then I would just add it on later. Extract all the paths from the img src, then check if the url is included i.e. $url = "http://www.xyz.com/"; $src = "images/x.jpg"; // if the src is not absolute prepend with the url if(!strstr($src, $url)) { // will give me http://www.xyz.com/images/x.jpg $src = $url.$src; }
-
You may want to put some of the code into functions to avoid duplication. i.e. function payment($value) { // code here // return value return $x; } // sandra payment $sandra = payment($math1); // tomas payment $tomas = payment($math2); You get the idea
-
[SOLVED] keep getting errorfiletype message when type is .jpg
JonnoTheDev replied to jesushax's topic in PHP Coding Help
set this to no $limit_ext = "yes"; $limit_ext = "no"; -
[SOLVED] rewrite depricated SESSION code
JonnoTheDev replied to phpdragon's topic in PHP Coding Help
$ses_basket_name[0] = $basket; $_SESSION['ses_basket_name'] = $ses_basket_name; Anything that has been registered as a global variable with session_register(); you will have to track down -
[SOLVED] rewrite depricated SESSION code
JonnoTheDev replied to phpdragon's topic in PHP Coding Help
session_register() is depreciated. Data added to a session should be assigned like: $_SESSION['name'] = $x; So in your case session_register("ses_basket_items"); $_SESSION['ses_basket_items'] However you may be able to work around this by enabling global variables but this is not recomended. To do this add the following to an .htaccess file php_flag register globals on -
You could but you could end up getting banned if you make lots of requests. Search for an API
-
Need an interface to add/delete/modify products...
JonnoTheDev replied to Omzy's topic in PHP Coding Help
I explained briefly in previous posts to your questions As I said you use the cars primary key ID Lets do a database: cars ===== carId make model name images ===== imageId carId filename Put the carId in a hidden field in the upload form You dont have 10 fields in the cars table. You store images in the images table and use the carId as the join. I can store any number of images I want. No, when the image is uploaded and resized store the image in a thumbs/ directory with the same filename as the biggest image. -
I like gold, gold stars are always nice
-
Need an interface to add/delete/modify products...
JonnoTheDev replied to Omzy's topic in PHP Coding Help
OK when a user clicks on a car you will have the id of the car in the url car.php?carId=123 Get all images from the database from carId 123 and display them on the page. You can use a bit of javascript to do a popup link. You could pass the filename within the link so on the popup page all you need is print "<img src='images/".$_GET['filename']."'>"; -
Need an interface to add/delete/modify products...
JonnoTheDev replied to Omzy's topic in PHP Coding Help
Store the filenames in a db table after upload against the id of the car images ===== id carId filename so your cms link could be /car-images.php?carId=123 -
As all your other pages are called from the $_GET['page'] variable you could use this as a condition. Not had a look at the code but guess I dont need to. Easy if(!strlen($_GET['page'])) { include('ads.php'); }
-
Security terms - doesn't make a difference where the validation takes place. It all depends on the structure of your code. You may have objects taking care of validation. The validation code may be in an included file used on various pages. If its a simple form. I would place the validation code right at the top of the page. This makes it easier to display the errors on the same page and also redirect the user after the form has been submitted if required.
-
Are you on a shared server? Read the following: http://www.sixapart.com/movabletype/kb/dynamic/open_basedir_re.html
-
I wouldnt have guessed it was cold to hot at first glance, just is 5 different colours