Jump to content

freakstyle

Members
  • Posts

    109
  • Joined

  • Last visited

    Never

Everything posted by freakstyle

  1. what happens the third, fourth, fifth, nth... you should be testing this more then a few requests, while also keeping track of each one's request time. you can also write a little timing call to output the script time at different points in the script, which helps isolate areas in the script that cause increased time. test with a simple html file too, see if you get the same behavior. get in there and start seeing whats happening, you need a bit more data to find the issue you may be having. perhaps you are looking at it using IE 5.5 on a virtual windows ME instance using a macbook pro clone... that might cause an issue.
  2. There's no right or wrong way here. If you want to make less upkeep, serializing the data is helpful as you can handle it dynamically. In this, you should keep a set of static fields that are always going to exist, first_name, last_name, email_address, address, city, state, postal_code. Then serialize the rest of the data that is more meta data to that user. Don't forget to make sure you validate any form data before saving it into the database, automation is nice but it should not come before security. Also if you are serializing data keep in mind that you can't do pull users up by that information. like, get all users who checked this box. In order to achieve that you would need to get a result of all the users then check for that data through iteration. How i approach this is having a user table with those basic fields i mentioned and a profile table which has the full fields. cheers.
  3. or: <?php echo '<pre>'; print_r($some_array); exit('printed nicely as source me'); ?> or you can create your own print function to reuse it elsewhere.
  4. so it's just about saving images. in that case, i'd suggest keeping them organized with a nested directory structure. One that defines the type of images in the folder. lets use a typical set up for images on a website. /images ( no images in this dir, just sub directories ) /images/buttons /images/titles /images/cars /images/cars/blue How far you go into your nesting is a consideration that you must make. It's easy to keep them all categorized in deep nested sets, but if there's only going to be one image in each directory for the next year or five it's not worth it. As for how many you should keep in a directory, again OS is a big factor here... ie using windows will add more overhead. But again, how are you searching for the images? is this just you looking for an image to embed in some html or are you building a script / app that will need access to read and or write images to the filesystem? If it's the later, then look up times can be increased by a single directory with 100k images. A basic reason is most of the time you are going to read the directory files alphanumerically, making requests for 'zanky.jpg' longer then 'apple.jpg' in one directory. you shouldn't notice this difference under normal circumstances, but it is there.
  5. so you have a link inside content to another url. the content is manged through an administration interface, assumed. what is it that you are looking to maintain in the content of the document? You mention links, however what about them do you need to maintain and why? do you need to update them when a document is no longer active or it's been deleted? do you need to change attributes in the href based upon some other logical sequence? w/o knowing specific needs you could... - have a script in the admin tool that can be ran by an admin user to clean up existing content. which then grabs the content, parses out the links from the text and makes changes as determined by your business logic. - use javascript after the document is rendered to modify links that need to be modified
  6. The best way to keep it organized is to start with an organized structure. Ie put files in directories that make sense for what they contain. /javascript ( put all javascript in there ) /classes ( put all php classes ) /classes/plugins (you get the idea by now i bet) Since thats not really where you are at though we'll move on.. What is it, exactly that you want to know how to map? you mention 'website', 'its functions', 'my development work flow' all of which are completely different data, so finding one piece of software won't happen in this instance. sorry to be blunt but it's just too abstract. To track your web pages, links titles etc, use a site map builder... such as: [http://www.xml-sitemaps.com/] To track functions, use a documentation tool such as: [http://www.phpdoc.org/] To track your development work, use version control such as: [http://subversion.apache.org/packages.html] You could also use Zend Studio to help locate code that is referenced in different files, it can help in your actual development work, but not with tracking perse. Good luck.
  7. Where you have your subversion really doesn't matter as long as it's on a supported os. [http://svnbook.red-bean.com/en/1.5/svn.intro.quickstart.html] How you access subversion depends upon where you keep it though. It's a good idea to have subversion on it's own box with a solid backup plan in place. Placing it on your web server for either development or production level applications / sites is a risk you shouldn't take if you don't need to. Do you need to provide web access to subversion? that would also limit where you can place subversion. Once you have subversion set up, be sure to create a standard convention for your files in there. Getting that hashed out before you start adding your sites / applications to the repos is a good idea. Good luck
  8. whats the domain name? maybe someone here will give you an offer
  9. The architecture of your application has no bearing on what services you can access an api for. What i think will work best for you is to build that site from a framework which has the features (modules) to support the functionality you need in your site / application. I would suggest checking out php frameworks instead of trying to create something custom. Check out Zend, cake, code ignitor, etc.. Good luck.
  10. Hi there, it sounds like you just need to set the expectation that users will be contacting them through your site. If they decide to flag those emails as spam, then they won't be using the service you are providing. You can't stop users from that, but you can make sure they understand what is being sent. When a user signs up they have to confirm they agree to get emails from other users, keep that setting and allow them to change it can go along way for helping your users control what they get. past that, i'd suggest you set the subject of the email, and an introduction. like "Review for your Ad" "Hi so and so, we have received a request from userB which contains the following details: Good luck
  11. HI There, what is it that you are trying to do with your interface? A database table doesn't have anything to do with that interface as you have it noted, so i'm not sure what your looking for. your method setOwner should not be asking if $subscriber is the interface, you can't instantiate an interface you can only implement one. I don't know if your class was more of an example or not, but it would be cleaner to use php's magic methods __get, __set, etc.. You can still define these in your interface, it just looks like you have methods defined that do pretty much the same thing, just dealing with different data.
  12. It really depends on your operating system and application needs. Having many nested directories can have adverse affects on your servers ability to maintain a speedy indexing service. More important questions: What's your need to have the application set like this? How are you accessing the data contained in those directories? Can you use a database instead, it sounds like your replicating database functionality manually... but then again you didn't really say much about what the overall goal is. good luck
  13. what is the difference between a menu and a submenu, in terms of the data required to be saved? Generally speaking you should just have one table menu, and account for relationships in the that one table. So you could have 'parent_id', and if the menu is a 'submenu' it's parent_id would be the 'id' of the menu item that it relates to. If you delete a child you don't need to delete the parent, the children are independently saved and removed from their parents. For menus, I find using a tree structure to be the most effective in my processes and the life cycle of the applications. Good luck.
  14. Or: echo '<a href="javascript:ajaxpage(' . \'addcustomer.php\', \'body\'); . '"><span><img src="images/user_add.gif" /> Add Customer</span></a>';
  15. The solution has been given a few times. here's the updated code for you to just copy and paste. that error will be removed, can't account for any other errors you may have, but that specific one you mentioned is easily resolved by one character added to the end of line 49. <?php $m1 = $_POST['m1']; $m2 = $_POST['m2']; $e1 = $_POST['e1']; $e2 = $_POST['e2']; $pc = $_POST['pc']; $br = $_POST['br']; $cn = $_POST['cn']; $fn = $_POST['fn']; $bld = $_POST['bld']; $eld = $_POST['eld']; if (eregi('http:', $bld)) { die ("Naughty Naughty! "); } if(!$e1 == "" && (!strstr($e1,"@") || !strstr($e1,"."))) { echo "<h2>Error - Enter valid e-mail</h2>\n"; $badinput = "<h2>Form Not Sent</h2>\n"; echo $badinput; die ("Go back! ! "); } if(empty($m1) || empty($e1) || empty($bld )) { echo "<h2>Error - fill in all fields</h2>\n"; die ("Use back! ! "); } $todayis = date("l, F j, Y, g:i a") ; $m1 = $m1; $subject = $m1; $cn = stripcslashes($cn); $message = " $todayis [EST] \n Main Tenanat Name : $m1 \n Secondary Tenant Name: $m2 \n Primary Tenant Email: $m1 ($e1)\n Secondary Tenant Email: $e2 \n Property Code: $pc Bedrooms: $br Coordinator Name: $cn \n Firm Name: $fn \n Begin Lease Date: $bld \n End Lease Date: $eld \n" $from = "From: $m1\r\n"; mail("no-reply@edgeofamericaenterprises.org,", $subject, $message, $from); ?> <p align="center"> Date: <?php echo $todayis ?> <br /> Thank You : <?php echo $m1 ?> ( <?php echo $e1 ?> ) <hr /> </p>
  16. Here's a basic example: <?php // Start the session. session_start(); $data = $_POST; if(isset($data['submit']) && !empty($data['submit'])) { // Set the posted data to a unique key in the global session data array. $_SESSION['posted_values'] = $data; } ?> <!--// Input fields shown how to set the value from the session and then the submit button to go along with my form check above. //--> <form> <input type="text" name="email" value="<?= isset($_SESSION['posted_values']['email']) && !empty($_SESSION['posted_values']['email'])? $_SESSION['posted_values']['email'] : null; ?>" /> <input type="submit" value="submit" name="submit" /> </form>
  17. is your form able to post to that page? so before your conditional place: echo '<pre>'; print_r($_POST); exit('debug post'); do you see your form data in there?? Another thing to test is the alert, try adding it to the template js statically just to test that you can set the alert like that. Just to set the record, the colon used in place of the curly brace is not specific to php5. It is just an alternate way to write the control structures. Typically this alternative syntax is helpful for front end developers so you'll see it in view logic that designers and UI developers will potentially be working in. Reference: [http://theserverpages.com/php/manual/en/control-structures.alternative-syntax.php]
  18. doesn't matter if you have a select query or an insert, the syntax is what i was highlighting. Notice how a variable is not inside the double quoted string. However that does moot my comment on duplicate strings. as for the error, if it's a php error, it will give you more information. Did you check your table to see if you have that string in there in one of the rows? Does the error happen before or after you send your query? that should be an easy one to test, just place an exit(); before your mysql calls.
  19. How you implement this feature really depends upon your website architecture. Do you have an off the shelf cms app, framework etc.. When you say a "user" do you mean someone who logged into your site, and you have a database of user data to pull from? Perhaps you just want any visitor to have that option? If that's the case then you need to determine how you want to approach the saving of that data and how it relates to the visitor. IE, do you want to create a database of user data and use the visitors Ip address as it's unique id? Maybe a cookie based solution would work better for you, this allows the data to be saved in the users browser for a variable length of time. Once you determine how and where you can or want to save that type of data for the user, you have to determine how a page is displayed and how do you want the user experience. Do you want the user to be redirected to another page if they land on the page they didn't want again? Do you just need to hide links to the pages? Do you want to alert the user they choose not to see that page, before or after you redirect them? Keep in mind too, that if you allow a user to set a preference like that, you should have a way for them to change that if they need to. Good luck
  20. The error you are getting is happening because the method you are trying to use in the service does not exist. I attempted to look at the wsdl but found no valid service exists at that url. So either the service is not up or the method you are calling 'getStockQuote', is not a valid method for that service. Good luck.
  21. What's your problem though? is the cookie not available in page requests after it's set, is it being removed too soon, is it not being set? What happens if you set the cookie, and then print out the cookie right after it? Does that work at least?
  22. can you post the full error message, with line number or is this error generated from mysql? if it's mysql, it looks like your saving a value of 'Array[1]' in a database field that does not allow for duplicate values. Look at the data in your database and you should see this pretty clearly, if you see that string in your table you've found where it's failing. You should update your syntax: $string = "SELECT * FROM foo WHERE id IN ('" . $dataArray[$i][0] . "')"; Also, in your IN condition you have repeated values for some reason, i see 0 in there at least a dozen times, you only need it once, think of it like keys in an array. Good luck.
  23. step 1. create a function that saves one image, use the code you have embedded into the page and make a function out of it. step 2. loop over your image data and call that function each time passing along the data it needs to create your image. **** Looking at what you wrote, I'm not too sure you even have one working, as the data passed for your fields "imagefile" should be a numerically indexed array. ie: for($i = 0; $i < count($_FILES['imagefile']); $i++) { $file_name = $_FILES['imagefile'][$i]['name']; } // Not: $file_name = $_FILES['imagefile']['name'];
  24. Outside of using a framework I follow some simple rules. /_includes This holds all scripts that should not be accessed directly from your browser, ie your library code base, header files, footers, search scripts, helpers, etc... /javascript /css No other directory exists unless it's an actual page. In my includes i have things like: /_includes/elements -> inline elements, like a photo gallery /_includes/helpers -> procedural and OO files, typically procedural will be in one file OO is one class per file. /_includes/models -> data access classes /_includes/controllers -> scripts to process form actions /_includes/forms -> html forms /_includes/third-party -> code base brought in for specific tasks. There's no right or wrong answer, just be consistent across your projects and find what works best for you.
  25. The error is saying that you are not passing the variable "id" along with the form. Looking back through your posts it is unclear as to why you would want a user to set the id of the post, if that's the use you intended it to have, then you simply need to add a new text input field with the name "id" and allow users to enter the id for that post. Typically the post id would be set incrementally in your database table. I don't see your table schema anywhere so we can't help with that side of it. The script below will output the contents of the posted data from your form, in case you aren't sure how to do that. echo '<pre>'; print_r($_POST); echo '</pre>'; Good luck.
×
×
  • 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.