Jump to content

phpzone

Members
  • Posts

    135
  • Joined

  • Last visited

    Never

Everything posted by phpzone

  1. You can use marquee if you wish, however to get it to work through the validator you would have to dynamically add the marquee with javascript: <script type="text/javascript"> <!-- window.onload = function() { marquee = document.createElement('div'); marquee.setAttribute('id', 'mymarquee'); marquee.innerHTML = ' <!-- INSERT YOUR MARQUEE MARKUP IN HERE -->'; document.getElementById('marquee-placeholder').appendChild( marquee ); } //--> </script> Put some code <div id="marquee-placeholder"><!-- // marquee --></div> in your page and the above code would add a child to this with the marquee content. Using this type of method you can get code to validate right up to XHTML 1.0 (possible 1.1)
  2. It would be equivalent to c:\www\config_files\file.php
  3. print "<p>Your password reminder will be with your shortly. Thank-you.</p>"; print "<meta http-equiv=\"refresh\" content=\"2;url=http://www.sitename.co.uk\">"; You cannot do this. A meta http-equiv should be in the top of your page, in the <head></head> section. However, I think you should be looking at using code such as: <?php exit( header('Location: http://www.sitename.co.uk') ); ?> Note, you cannot send a header if you have printed _anything_ to the page. So to avoid, turn output buffering on at the top of the page and then clear the buffer if you need to redirect: <?php ob_start(); print <<<_HEADER Welcome to so and so site.... _HEADER; // // do lookup for email address etc. // if ( $email_not_found ) { ob_clean(); exit( header('Location: http://www.sitename.co.uk/register') ); } else { // do email stuff print <<<_THANKS Your password has been reset and a copy of the new password sent to your email address. _THANKS; } ?>
  4. Perhaps you need to add a "user_group" system as well, so that you can check what group a user is in and based on that ask them for the password again. You will need a way to check whether they have entered a password for a section already, perhaps again you could add a 'sections_auth' array into your $_SESSION and when they auth in a section, add it's ID in there.
  5. This is all great feedback, thank you. I will take all ideas on board and come back with something else, probably in working form eg. XHTML/CSS/PHP this time. Thanks everyone, you are what makes phpfreaks so great
  6. Appreciate the feedback. True, latest version part is a gimmick. I disagree that static layouts are not used, see the new bbc.co.uk. I'm going for something that is like my wordpress site, which is in the same format. However I was thinking of doing a switchable CSS template, so a more fliud design could be done too, point taken on board. Anyone else?
  7. Hi everyone I've just been working on a graphical layout for my new site design and I wondered if anyone would like to comment? No code here yet, this is just a graphical mockup for commenting on. Thanks! http://www.phpzone.co.uk/phpzone_mockup.png
  8. Other than a book I also strongly recommend: http://hudzilla.org/phpwiki/index.php?title=Main_Page
  9. Ummm.. Backup... Download Ubuntu Studio... Install... Voila ;-) Same OS at both side. I'm joking, but it is an option, you can dual boot. And also... Download install Eclipse (apt-get install eclipse) Download install Aptana and Aptana PHP Plugin (add to update sites on eclipse and download through eclipse update) Apache2... apt-get apache2 PHP5.... apt-get php5 etc. etc. etc. ...
  10. <?php $xmlstr = <<<_XML <?xml version="1.0"?> <Catalog> <Category> <Name>Business to Business</Name> <Site> <Id>Creed</Id> <PopularityRank>4366</PopularityRank> <Description>A simple desc</Description> <HasRecurringProducts>true</HasRecurringProducts> <Commission>75</Commission> </Site> <Site> <Id>Creed 2</Id> <PopularityRank>5000</PopularityRank> <Description>Another simple desc</Description> <HasRecurringProducts>false</HasRecurringProducts> <Commission>7400</Commission> </Site> </Category> </Catalog> _XML; $xml = simplexml_load_string( $xmlstr ); $sites = $xml->xpath("/Catalog/Category/Site"); foreach ( $sites as $site ) { echo "<p>{$site->Id} = {$site->Commission}</p>"; } ?>
  11. Store the details in a Session variable. I usually use the product_id and the quantity, its all you need to store. $_SESSION[ $prod_id ] = $quantity; it shouldn't matter whether they are logged in or not.
  12. Can we see some code, preferably, where you retrieve your variables, where you insert to db and where you validate. Ta.
  13. <?php mail( $recepient, $subject, $mail_body, "From: {$sender}"); ?>
  14. Ok. I don't see the reason for having to 'find' things. I've done this and usually on my sites I have a structure like: /images/ /classes/ /templates/ header.php index.php config.php footer.php My can you not have a standard structure, keep your image.php in /images/ and your class in a folder? Then have a variable in config.php that defines your BASE_PATH and use that?
  15. No probs, maybe someone else can help. Why do you need to do this btw., I would be interested in why there is a need?
  16. I updated my last post, perhaps a system search will help. <?php $basepath = '/var/www/html'; $result = passthru("find {$basepath} -name 'Main.class.php' -print"); echo $result; ?>
  17. Then in Main.class.php you want to include pec.php? Ok... if your other file is always one directory up then the following.... <?php require_once dirname(dirname(__FILE__)) . '/pec.php'; ?> If it's anywhere on the system, I'm not 100% sure but you could use passthru and search with a system command: <?php $basepath = '/var/www/html'; $result = passthru("find {$basepath} -name 'pec.php' -print"); echo $result; ?>
  18. You must give your radio buttons the same name and then simply check $_POST['choice'] to get its value. In this case I would do: <input type="radio" name="choice" value="2500">1<BR> <input type="radio" name="choice" value="1500">2<br><br> <input type="radio" name="choice" value="1000">3<BR> <input type="radio" name="choice" value="500">4<br><br> <input type="radio" name="choice" value="250">5<br><br> You can then get the value: $choice = $_POST['choice']; which would give you 250, or 500, etc. etc. You can do the same with checkboxes, however you will then allow multiple choices, so you would suffix your HTML input name with [] such as <input type="checkbox" name="choices[]" value="2500">1<BR> <input type="checkbox" name="choices[]" value="1500">2<br><br> <input type="checkbox" name="choices[]" value="1000">3<BR> <input type="checkbox" name="choices[]" value="500">4<br><br> <input type="checkbox" name="choices[]" value="250">5<br><br> You would have to process this postback like so: $multi_choices = $_POST['choices']; foreach( $multi_choices as $choice ) { print <<<_MESSAGE <p>Use has chosen $choice</p> _MESSAGE } Hope this helps.
  19. When you upload via FTP you should be able to force lowercase if that will achieve what you want? To be honest I like to name things like NewsObject.php, so I write in the same case in the include files, this might annoy someone else, but I prefer it.
  20. <?php require_once dirname(__FILE__) . '/phpeasycaptcha/Main.class.php'; ?>
  21. Ideally you would have an ID field in that, eg. teamID which is an INT AUTO_INCREMENT so you can refer to the team by an ID number rather than name. I'd also have your teams in one table, and the score in another and join on them, that is if you want to enter the points scored in a single game each team and then have other code to tot up the total anyway. For the form/database part you need to look through your teams and output an input box for each one. A useful feature of PHP is being able to name form inputs in a certain way so that you receive an array back like the following: <input type="text" name="points[1]" value="" /> <input type="text" name="points[2]" value="" /> <input type="text" name="points[3]" value="" /> If that was put into a form and submitted you would be able to retrieve the points in PHP as an array and then you could use foreach to get them, as you loop you would use an SQL INSERT statement to insert the points into the database. $points = $_POST['points']; foreach( $points as $team_id=>$score ) { // create yourself a function that INSERTS to database, and call it like the following: insert_team_points( $team_id, $score ); } Your SQL statement would be something: function insert_team_points( $team_id, $score ) { // make sure we have numbers! $team_id = (int)$team_id; $score = (int)$score; $sql = "INSERT INTO score_table ( team_id, score ) VALUES ( $team_id, $score )"; mysql_query( $sql ) or die ( mysql_error() . ": $sql " ); } I hope these HINTS help. I've deliberately not supplied a full solution, because its good to learn :-)
  22. I don't know why you can't use a database, but I don't want to be bored by office politics, this I agree :-) You need to see if there is any pattern to the structure of your 'B' document, look into perl regular expression and see if you can parse with Regular Expressions. Or, if you can't use a database but can use CSV files why not put the data in a CSV file? (Or would you call this a database too) Or, put the data into an XML file and parse that where required.
  23. Write a wrapper function and use the wrapper, something like: <?php function GetVariable( $name ) { if ( isset( $_GET[ $name ] ) ) { return $_GET[ $name ]; } else { // whatever to do if it doesn't exist } } $name = GetVariable("username"); ?> Obviously code in your $_POST/$_SERVER stuff etc. where required.
  24. You want want it to be a BLOB. However, you could also just upload the image to the filesystem with the insert_id as the filename prefix when you create the user? Do you _need_ it in the database?
×
×
  • 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.