Jump to content

rlelek

Members
  • Posts

    41
  • Joined

  • Last visited

    Never

Everything posted by rlelek

  1. Well, I did some more poking around, and found the solution. Apparently, one of those many FireFox add-ons was making an additional request to the same page (for debugging purposes I'm sure). :facewall: Must have been one of those early-morning moments! For those of you that have issues with anything, try disabling FireFox Add-ons or try using a different browser! Ryan
  2. Greetings all, I'm completely stumped...so I'd like to run this issue by you guys (and gals!). I have encountered an odd issue, and I have no idea why this is doing what it's doing. When I execute the following code, all by itself, in an "index.php" file (with no other files around...completely isolated!) I get a result of "testtest" $log_file = 'all.txt'; $handle = fopen($log_file, 'a'); fwrite($handle, 'test'); fclose($handle); Note: I delete the file each time I execute the script (in a browser). I am also the only one running this script. I've tried running on PHP 5.2.x and PHP 5.3.x I have also tried on my machine as well as a separate, remote machine. Is the script running twice? If so, what's causing it? Any help is appreciated as always! Ryan
  3. Agreed, do not build your own. Shop around and be sure your hoster allows streaming video. Scale when you are ready.
  4. Hello, It's odd that you were instructed to have 4 corner images (vs 2 images with 2 corners). Normally What i'd do is this... <div class="top_two_corners"></div> <div class="content">Content goes here</div> <div class="bottom_two_corners"></div> And then use CSS to do the background as you were doing. This way though, your content div can be a normal square box, and the corner divs can be used to add the rounded corners only (no content). Hopefully this makes sense to you If not, i'll try to elaborate more. Ryan
  5. What is the file being used for? Is the file used for data-storage (read/write by a computer)? or is it like a document where it's a bunch of text intended to be read by a human (and not a computer). If it's for data-storage, use a Database or XML (I guess you could use INI - ewwwwww). A Database would probably be the easiest.
  6. Sounds like a job for.... *ModRewrite* http://www.workingwith.me.uk/articles/scripting/mod_rewrite Throw it in your .htaccess file
  7. Hello There, I don't mean to be rude, but if you have to ask how much power you need for a server, are you sure you can configure it to do what you'd like? Linux (assuming that's what your server will run), especially without a GUI (which is what most server configs are), is not something you'll want to just jump into. Also, why build your own? Will your server have redundancy? Will it have "server-grade" components? These are things to consider depending on how serious you are. For example, you could easily use an old PC, even with a 1GHz processor and 128 MB of RAM for your personal site so your friends and family can visit, but YouTube/Vimeo/etc are clearly running on better hardware. All in your intended use. If you decide to continue, the rule of thumb is the more power the better (for single-servers anyway). RAM is fairly cheap now, so i'd say no less than 2GB for video. Honestly, you can probably get away with 1 GB or even 512MB, but again, there's no excuse not to have more these days. I think 2GB of RAM and a 3GHz Processor for a server should last you many years to come. Just my opinion, but I usually err on the safe side of "Better safe than sorry" Ryan
  8. I can vouch for FPDF - a pleasure to work with! The documentation does a great job of explaining it, though you'll have to put your mind into "graph" mode as the layout usually involves setting an X/Y Coordinate and then having the library do what you need it to do.
  9. No need for those... Donate 10% of your budget on those products to this guy... http://sourceforge.net/projects/php-screw/ It could be what you are after. But ***REALLY****. Donate to him. Developing this stuff is hard work. And no, I am not that guy. By the way, your thread title is misleading... Try adding "Protection from" to the beginning because as it stands right now, I thought you wanted to pirate something in PHP...and not pay for it This is why you may not have received as many posts as you would have liked Ryan
  10. Hey there! First...why checkboxes? A few server a good purpose, but why not use something like "select" fields that are intended for a large selection of options. Just saying... Doesn't make sense to me. As for your question... Try to loop (for or foreach) through all 100 and then loop through all 100 within the loop. ex. Looping 1 - 100 Item 1 - Looping 1 - 100 Item 1 Item 2 Item 3... Item 2 - Looping 1 - 100 Item 1 Item 2 Item 3... And so on... This way you can run through all the combinations! If you need help with the syntax/code, try posting back... But please try first!!!
  11. Hey there... Here's something I came up with that'll work just fine. The script in its current state isn't fort knox (actually, you can beat the login again by clearing your browser cookies). I did make this script and usaully what happens in these forums is we only hint at you to find the answer yourself. I actually solved the problem for you, and I don't mind, but please do me and the other forum posters one thing. ***** Learn From The Script***** Do not just implement it and never give it a second thought. Anyway, here it is, functional in full...And well documented! <?php // Start or Resume a Session session_start(); // How long is the user allowed to be idle? $idle = (15 * 60); // In Seconds // See if the User has been idle for too long // If he/she has, then log them out. // Otherwise, update their status. if(isset($_SESSION['time'])){ // Debug debug($idle); // How long from his/her last visit? $time_elapsed = (time() - $_SESSION['time']); if($time_elapsed < $idle){ // Update user's activity $_SESSION['time'] = time(); echo 'Activity Updated'; }else{ // He/She has been idle for too long echo 'You have been idle for too long<br />Please login again'; // Do Your Logout Function Here } }else{ // This is his/her first visit. $_SESSION['time'] = time(); echo 'First Visit'; // Possibly Require Login Here } function debug($idle){ echo '<br />------- Debug -------'; echo '<br />Time: '.time(); echo '<br />Last Activity: '.$_SESSION['time']; echo '<br /> Time Elapsed: '.(time() - $_SESSION['time']); echo '<br />Idle Time: '.$idle; echo '<br />----- End Debug -----<br /><br />'; } ?>
  12. I don't see any errors on the page. Is everything good now?
  13. Hello, Two guesses... #1 - You are reassigning the variable to something that is undefined (aka, blank). right here -> $email = $email; $_SESSION['name'] = $first; $_SESSION['email'] = $email; $_SESSION['telephone'] = $telephone; if $email is not defined (and i don't see that it is), then you will be assigning it no value. #2 - How are you getting from $_POST['email'] to $email? I never saw a statement like $email = $_POST['email']; Ryan
  14. Hello! I Get a 404 for http://zepx.co.cc/links/ I, along with most of the PHP programmers I know, will always use require_once(); We usually use that simply because if it is loaded, you do not want an error returned if it was already included. Maybe try switch both to require_once(); and see if your problem still exists. If it does, see if you can get the webpage working because a live example is like a picture...worth 1000 words! Ryan
  15. Hey There, Thebadbad is absolutely right! if you have variables within single quotes ('), they are always interpreted *literally* Use double quotes (") to have PHP interpret the variables. Logic, though, should not be in quotes at all (like your "if" statement) (($admin == 1) ? '<p><a href="member.php?change=admin">Admin Center</a></p>' : ''), will work but I generally try not to use it. (It acts like a shorthand if/else). What i would do personally is append that data to the array value. Ex. $data = array( '<p><a href="logout.php">Logout</a></p> <p><a href="member.php?change=password">Change Password</a></p> <p><a href="member.php?change=email">Change Email</a></p> <p><a href="member.php?change=account">Close account</a></p>', '<p>Welcome to the members only page '.$_SESSION['s_name'].'!</p> <p>You are logged in as '.$_SESSION['s_username'].' from the IP address '.$_SERVER['REMOTE_ADDR'].'</p>', ); if($admin == 1){ $data[0] .= '<p><a href="member.php?change=admin">Admin Center</a></p>'; } Just a personal Preference Ryan
  16. Hey there, One thing before we get started... *always post your code* (and comment what you expect to get and what you actually get too, for future posts). it never hurts to have more information... Firstly, Sessions are really just temporary storage. They are highly unreliable for permanent storage as the use may clear their browser history, or be on a different computer, and everything is wiped/inaccessible. Don't get me wrong, sessions are great, but you should use the right tool for the job. Wishlists lean more to the permanent storage side, although temporary storage measures, like sessions, can be used to build the wishlist. Definitely look into some long term storage solution, whether it is a file or a database, to store these wishlists. That way, when a user visits your site, you can always regenerate their wishlist, and you are not dependent on them keeping their browser files... Sessions and other temporary storage solutions (variables are one, they are destroyed at the end of the PHP file execution) are sort of the middle men of the PHP game. Okay, so, here are some solutions to use *in conjunction with* sessions. - Databases - MySQL - PostgreSQL - XML There are others, but they may be more trouble than they are worth. MySQL has a lot of support in the PHP community, so i'd go with that one, since it'll be easier to get help. Here's a link to get you started: http://www.tizag.com/mysqlTutorial/ More topics are covered on the left hand side or the continue button on the bottom. Basically, your goal should be to: - Uniquely identify the list (Primary Key) - Tie a user to the list in some way (User id column) - Serialize the array of items in the list, into the database Hope this helps somewhat, i'm sort of taking a shot in the dark as to what it is you are after and your PHP coding comfort level. If you have any questions, I or the other nice people at PHPFreaks will be happy to help out! Also, make sure to mark the thread as "Solved" if someone answers your question. Ryan
  17. Hello, You are trying to use something called "$_GET variables" or variables that are passed via the URL (or URI). $_GET is a cousin of $_POST and the fact is, these methods were both made for HTTP servers, not a terminal/shell or the PHP process itself (which gets executed when you type "php pilename.php" at the command line). How would you go around this? Unless you have a very specific reason for doing it from the command line, which I can't think of very many, I would suggest downloading a server stack that corresponds to your setup like these: LAMP - Linux Apache MySQL PHP WAMP - Windows Apache MySQL PHP MAMP - Macintosh Apache MySQL PHP just google the name and you'll find some downloads. There are other ways to set up a stack without these packages, but the packages, while less customizable because they use default settings to install, are by far the easiest way to do it. Most of the time, the defaults are perfect for a development environment (testing), but should be glanced over before being put into a production environment (live). There is a workaround...but I'd use the above method http://bytes.com/topic/php/answers/491693-passing-_post-variables-command-line-php Hopefully this helps you out Ryan
  18. rlelek

    Help with SSL?

    Hello all, Sorry if this is in the wrong category, in a bit of a rush with this client and already been searching google When making a SSL certificate, the client wants the "www" prefix as part of the website/ssl (so https://www.example.com rather than https://example.com) now, the question I have is, since the "www" subdomain really just points to the root domain, would i need to create a subdomain in cPanel before I generate the CSR for it to work? or could i just append "www" and everything will work out fine? Sorry if it's a little vague, I don't know how else to explain it, let me try again though... Since http://www.example.com takes you to http://example.com, does the www subdomain even need to be physically created since it is already "understood"? ** Note ** The problem is not with the server/apache, we just need to make sure the SSL certificate doesn't blast out errors/warnings because it is https://www.example.com and not https://example.com. The page itself renders fine. Hopefully that explains it? I'm trying..lol Thanks in advance!
  19. Thank you MadTechie! I was over thinking this i guess... Anyway, thanks for the help! The solution I used is described below... How can I repay you? Is there a "buy (you) a beer" button I can press? lol Solution: RewriteRule ^movies/genres/[^/]+/(\d+)/page/(\d+) /browse.php?type=1&option=genre&option_value=$1&page=$2 [L] RewriteRule ^movies/page/(\d+)/[^/]+/[^/]+/(\d+) /browse.php?type=1&option=genre&option_value=$2&page=$1 [L] the only variables that were required were the genre id and the page # so I just ignored the rest by removing parentheses (no "capture") After I add a function to make sure that page exists, everything will be set!
  20. Hello everyone. I've been trying my best to figure out the best way to introduce some logic to mod_rewrite. Right now, the RewriteRules are *very* repetitive, even with regex's. Here's what I'm looking at... RewriteRule ^movies/genres/([a-zA-Z][^/]+)?/([^/.]+)?/?(page)?/?([^/.]+)?$ /browse.php?type=1&option=genre&option_value=$2&page=$4 [L] Basically, the URL will look like this: http://www.example.com/movies/genres/Comedy/12/page/3 where - Comedy is there for SEO (no pass to PHP) - the '12' is passed to PHP to represent Comedy (genre id) - the '3' is the page number Sorry the Rule is so messy, I'm new to this...and really... I am trying! Anyway, the dilemma comes in when it's the other way around. so instead of the above URL, the user would navigate to something like this... http://www.example.com/movies/page/3/genres/Comedy/12/ any ideas how to introduce some logic? - I've tried grouping the page portion and getting the value from that (may not have been correct) - I also thought if (and only if) a rewrite rule is true, it could go to another rule, sort of like an IF statement Other than that, I have no idea what to do. And I've been googling for hours. Thanks, Ryan
  21. Thank you *very* much! This is a gold mine. I tried to look around PHP.net for something like this, but didn't even think to look at Zend. @redarrow, Thanks, that's what I am after. just some general information before diving into the code for the first time. Besides the specified Zend guidelines (which are very good)... any other specific things you would like to have had before beginning to code for a project? Here are the Zend guidelines.... B.4.7.2. Files Every file that contains PHP code must have a docblock at the top of the file that contains these phpDocumentor tags at a minimum: /** * Short description for file * * Long description for file (if any)... * * LICENSE: Some license information * * @copyright 2008 Zend Technologies * @license http://framework.zend.com/license BSD License * @version $Id:$ * @link http://framework.zend.com/package/PackageName * @since File available since Release 1.5.0 */ B.4.7.3. Classes Every class must have a docblock that contains these phpDocumentor tags at a minimum: /** * Short description for class * * Long description for class (if any)... * * @copyright 2008 Zend Technologies * @license http://framework.zend.com/license BSD License * @version Release: @package_version@ * @link http://framework.zend.com/package/PackageName * @since Class available since Release 1.5.0 * @deprecated Class deprecated in Release 2.0.0 */
  22. Hello Everyone! I have been searching around on google, but couldn't find any coding documentation best practices. I was just curious what guidelines everyone has for providing documentation. I comment my code often, but now that a new development team will be getting involved, we would like a nice, universal commenting structure. Of course, in-line comments will be unique, but... What are some common/important things you would suggest to include in the document's header/first lines of code? Thanks!
  23. Hello everyone! I was just curious how I would go about implementing a dynamic header/footer in Smarty/PHP5 I cannot use the smarty 'include file="header.tpl"' function because I need logic applied to the template. Since the whole point of smarty is to separate these, i really would like to figure this out... and i don't want to use tags in the template. Would I have to access the necessary header/footer data in the business layer for the specific page and then, in the template layer, include those two templates (header/footer) and pass them an array of data to use? I would rather not write "<?php include_once('header.php') ?>" in every script just to get the header logic. Also, even if I did do it by this method, what happens when there are multiple smarty objects? I know each object is separate, but what happens when there is more than one "display" method envoked? example ... [code] // header.php <?php $header = new Smarty; // do all the array assignments [b]$header->display('header.tpl');[/b] ?> // footer.php <?php $footer = new Smarty; // do all the array assignments [b]$footer->display('footer.tpl');[/b] ?> // index.php <?php include_once('header.php'); ?> <?php $index = new Smarty; // do all the array assignments [b]$index->display('index.tpl');[/b] ?> <?php include_once('footer.php'); ?> How would those triple display statements work? Sorry for all these questions, but i've just been so confused Thanks in advance...
  24. Thanks Lodius2000! This is exactly what I was looking for, but as with all scripts, it will need some modification. Thread solved
  25. since this is OO-PHP... if(!$f->login($sess)) $alert->errors('login'); Do I need to define these classes or are they predefined in PHP? Thanks
×
×
  • 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.