Jump to content

BloodyMind

Members
  • Posts

    98
  • Joined

  • Last visited

    Never

Everything posted by BloodyMind

  1. you can set a session variable, that the order with ID XXXXX was processed or reached some state, and skip the process to the next step
  2. I would recommend storing only the product ID, and retrieve the price from the database I assume every product has an ID and the order page, which set this product to purchase The order page has to set the purchased product ID with the new ID not the existing one, in case the user had returned and picked another product
  3. @fugix What version are you using, because its closed by default since php 5.2, and you have to have both directives on allow_url_fopen and allow_url_include it was closed because it is a major security risk, if you got it @fugix try to close it, for your server's security for reference, study something from the manual: http://php.net/manual/en/filesystem.configuration.php
  4. you cannot include a URL you should include a file not a url, for instance /var/www/a-file.php you can include that file, but force the $_GET with the keys you want. and you cannot use return without a function if you want to use job-details both way, then force the $_GET vars $_GET['job']='jobname'; $_GET['city']='thecity'; include_once 'php/job-details.php'; but if you don;t need to execute job-details.php directly from the browser, then just set the job and city vars as normal variables not $_GET and read them in the other file. I'd recommed that you read more about php I hope my reply was helpful Goodluck
  5. Here is my the expression I'm trying which is logical, but it fails #<div[^>]*>(?!(<div))</div># any help will be really appreciated
  6. Here is the final code so everyone who come accross this problem benefits from it: $str = " <html> <head><title>Testing RegEx</title> <style type='text/css'> .p{ font-color:red; } </style> </head> <body> <p> Regex is <b> awesome </b>.peep, creep</p> <p> Another paragraph <ul> <li><a href='#' ><img alt='dzzd' /></a></li> <li><a href='#' ><img alt='dzzd' class='omar' /></a></li> <li><a href='#' ><img alt='dzzd' class='omarr' /></a></li> </ul> </p> <b>aweful</b> </body> </html> "; // match the ul that has li>a>img $exp="#<ul>.*?(<li>(<a(.*?[^>])>)(?>(.*?)</li>))+.*?</ul>#Uis"; $replaced = preg_replace_callback($exp,adjustImages,$str); // remove the list: ul li function removeList($groups){ $groups[0] = str_replace(array('<li>','</li>','<ul>','</ul>'),'',$groups[0]); return $groups[0]; } // add the desired class to the img tags function addClass($groups){ return preg_replace('/(<img\b[^>]*) /Uis', '$1 class="thumb" ', $groups[0]); } // remove the existing classes function removeClasses($groups){ return preg_replace('/(<img\b[^>]*) class=\'[^\']+\'([^>]*>)/Uis', '$1$2', $groups[0]); } /** * Remove any classes from img tags, * add the desired class to the images * remove the lists */ function adjustImages($groups){ $groups[0] = addClass($groups); $groups[0] = removeClasses($groups); $groups[0] = removeList($groups); return $groups[0]; }
  7. Thanks so much, I've managed to run the main match 2 times, one to remove the class, and one to add the correct one You really saved alot of my nerves thanks so much
  8. you are right, and I've been for like 4 days trying to get it to work, but I don't wanna waste all the time, on nothing, I may do your solution for now, but my solution will be faster since, you don't have to manipulate the html each time it is loaded, you will modify it for once and then it will work normally all the way.
  9. I'm building a wordpress plugin, so I want the user to put an image list, and I later put on a jquery plugin to expect this <ul> <li><a><img attr1='val1' class="a"></a></li> <li><a><img attr1='val1' ></a></li> </ul> and matches this structure, if it matched, I would replace the class attribute if it exists with myclassname and if it doesn't it adds it to the img tag consider this input: <html> <head><title>Testing RegEx</title> <style type='text/css'> .p{ font-color:red; } </style> </head> <body> <p> Regex is <b> awesome </b>.peep, creep</p> <p> Another paragraph <ul> <li><a href='#' >dzzd</a></li> <li><a href='#' ><img alt='dzzd' /></a></li> <li><a href='#' ><img alt='dzzd' class='omar' /></a></li> <li><a href='#' ><img alt='dzzd' class='omarr' /></a></li> </ul> </p> <b>aweful</b> </body> </html> What I have done so far is the following $exp="#<ul>.*?(<li>(<a(.*?[^>])>)(?>(.*?)</li>))+.*?</ul>#Uis"; $replaced = preg_replace_callback($exp,addClass,$str); function addClass($groups){ $patt = '#<img(.*)(?!class)(.*)/>#Uis'; return preg_replace($patt,'<img $2 $3 class="myclassname"',$groups[0]); } I'm trying to match anything in the tag that is not class='anything' then match class='anything' then match anything after class='anything' but I can't get it to work, I've read that the negative look-ahead assertions will help, but I'm trying to learn how to use it so any help will be really appreciated
  10. check the encoding of the html and the db collation or encoding It should be one of these UTF-8 or Latin_Swedish_general can u explain more?
  11. I find it alot in job postings....though it is a bit complicated, I would recommend this book: "Beginning Zend Framework" if you are willing to use it I found out that it is one of the most required one and also Symphony
  12. I've got the same problem but my difference that, it sets the script path correcty, but I don't want it to try to load it from the controller path e.g. my case: the view: zf/news.phtml controller name: artist $this->view->setScriptPath(realpath(APPLICATION_PATH . '/..')); $this->render('news'); I get this error: script 'artist/news.phtml' not found in path (<MY ROOT PATH>) so it tries to put in the controller's folder, and I want to remove it any ideas ?
  13. it says what is really happening, "Access denied for user 'SYSTEM'@'localhost' (using password: NO)" the username or password is wrong if you're not sure what to do, just create a new user using the mysql console, or with phpmyadmin and grant it the privileges on this database
  14. If I were you I would have set the session name outside and assign it to a class property through the constructor or directly (after instantiation) if you're not going to use the rest of the class so often and will use this method alot, just make it a static method for quicker access and less code try not to think too much of OOP in design in the very beginning, you'll learn more by practice. It's vague in the beginning like the abstract class concept didn't make any sense to me in the beginning, after that when I needed it. I understood.
  15. obfuscate the code, google for a php obfuscator or something
  16. converting the code to machine language binary/ASCII for more info : http://en.wikipedia.org/wiki/Compiling
  17. no, there is no exe on linux, ZendGuard compiles the code into binary I guess, I never used it though, obfuscating worked fine for me
  18. you can obfuscate the code, or compile it
  19. he meant that explain what you want to do in words, I don't understand either
  20. It can be search engine friendly by using apache mod_rewrite but this is another topic, you'll have to search for some tutorials .. you can do this in the very beginning in your script but I prefer doing it in a separate configuration file <?php // server base directory define('BASE_DIR','public_html/'); // local base directory define('BASE_DIR','www/hosting/'); require(BASE_DIR . 'include/header.php') ?> comment any of the defined statements u don't use e.g. on the server comment the define statement of the local directory
  21. I would recommend using constants as base directories and its always better to use absolute paths than relative paths and its faster It's also better to include files from an index page, its much easier to include since u don't have to calculate where are u now in the application so if you did: index.php <?php require('include/header.php'); require('cart/h/h_shop.php'); ?> and manage it with get variables for instance you want the index.php to load the h_shop script you can call do this: <?php require('include/header.php'); if($_GET['go'] == 'shop'){ require('cart/h/h_shop.php'); } ?> and call it index.php?go=shop you will need to use a switch statement if you got many pages hope that helped
  22. I've got an open source LMS that contains TinyMCE as an editor I want to embed FLV in tinyMCE through the media plugin TinyMCE has no documentation at all, their wiki is not useful at all does anyone knows how to modify the embedded code through the media plugin in tinyMCE ? or have a solution ?
  23. Thank you very much. You saved the rest of my day.
  24. I have this function working on my localhost: running perfectly CREATE DEFINER=`MYUSERNAME`@`localhost` FUNCTION `member_networth`(`member_id` double) RETURNS double BEGIN DECLARE networth DOUBLE; SELECT total_net_worth INTO networth FROM member_balance mb WHERE mb.member_id=member_id ORDER BY balance_date DESC LIMIT 1 ; RETURN networth; END When I tried to import it on the server or write this SQL into PMA on the server I doesn't work giving me the following error: SQL query: CREATE DEFINER = `MYUSERNAME`@`localhost` FUNCTION `member_networth` ( `member_id` double ) RETURNS double BEGIN DECLARE networth DOUBLE; MySQL said: Documentation #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3 any help will be appreciated
×
×
  • 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.