Jump to content

laffin

Members
  • Posts

    1,200
  • Joined

  • Last visited

Everything posted by laffin

  1. I didnt see anything with a download link but its not hard if u take their download script and name it download.php (remember to add the php tags <?php and ?> than create a new script say listings.php <?php include '../library/config.php'; include '../library/opendb.php'; $query = "SELECT id,name, size FROM upload2"; $result = mysql_query($query) or die('Error, query failed'); while($listing=mysql_fetch_array($result)) { ist($id,$name, $size) = $listing; echo "<a href=\"download.php?id={$id}\">{$name}</a>- {$size}<br />\n"; } ?> [/code] however that is oversimplified listing, but it should work. so go ahead and make it pretty
  2. Yes yer correct. U may want to use preg_replace_callback as this will allow u to use custom replacements for those iffy variables
  3. laffin

    preg_replace

    Vague examples again yer code shows yer preg patterns yet no example of wut the variables are, $msg I expanded yer code to this <?php header('Content-type: text/plain'); //$alpha = 'apple'; //$beta = 'bob'; echo $msg = "{alpha} {beta} clone\n"; echo $msg2 = preg_replace("/\{(\w+)\}/e", "\$\\1", $msg); ?> When I tried it I got this So I added $alpha and $beta variables (uncomment from code sample) and then i got {alpha} {beta} clone apple bob clone so I dunno the problem
  4. use validation routines preg_match works good here if u expect an email addy, than use a pattern for email addresses if u expect a name, than use a pattern that just accepts spaces and alpha characters if u expect a number, than .... .... when it comes to free form input boxes, such as comments than use html_entities or similar functions, which will replace html tags with their meta character equivalents. and if yer putting this into a mysql database. remember to use mysql_real_escape_string
  5. laffin

    preg_replace

    Before I forget U can test yer preg_stuff here online REGex TESTER v1.5.3 - test/validate regular expressions,...
  6. 1) post yer sql tables, the table names do no one any good. as far as we are concerned, they could be called a,b,c,d,e,f. they just dont provide enough information to give u any type of help. for all we know, u didnt make a field for the ads image.
  7. I can tell u almost exactly wut u will need for php. u can use php.net, to read on how they work, and examples u will need $_POST/$_GET variables $_POST is used with form method "post" which most forms use $_GET is used on the uri, like http://www.google.com?q=tutorials u can use fopen/fwrite/fclose or my preferred functions of file_get_contents/file_put_contents. thats pretty basicly all the functions u need for the php script. but u still need the code to handle the processing (if/else)
  8. PHP is a processing lanuage and its quite simple to test the script without a web server. But if U have a usb key, U can build a development environment for php. I have everything but mysql on my usb key, with php, quickphp (a development webserver), and devphp (a php editor) I wud say, first build your form. than work on getting the variables from the form (even if its for display), this will show u yer form is working proper, and that the processing script is getting the variables. once u verify this, u can remove the display portion, and process the form data, in your case save it to a file. than final step is showing the overview of the data, like a spreadsheet (use tables), so a user can select which data to display and finally the display portion. the form u shudn have any problem, but its the start of the whole project the rest is just processing. we point, u read, and think and give ideas and sample code we can fix, refine, suggest.
  9. laffin

    preg_replace

    No clue wut yer trying to do ya have to provide samples and wuts wrong with it vague questions get no answers
  10. Obviously, ya misinterpreted somethin Create a form submit action shud save the form data to a txt file not submit button, as javascript/html dusn have access to the server. so u sould have the form page the form processing page (after processing, remember show them some confirmation or redirect to another page) and validation page(Shows what u entered, this could be the with form processing) and we dont do homework for ppl. u write code or toss ideas how it shud work and we respond in kind if we gave u the answers, u wudn learn anything
  11. yeah, thats how I see it as well.
  12. U cant use sessions without invoking session_start first. in that code ur using session variables prior to session_start
  13. u mean like <?php echo $_SERVER['SERVER_NAME']; ?>
  14. subdomains arent handled by PHP or htaccess. Subdomains are handled by yer dns provider.
  15. if statements with yer task as the expression, when task is not isset, than diplay 'This is some text'
  16. use a redirection header. and some time/date functions to figure out the hr <?php // @(#) $Id$ // +-----------------------------------------------------------------------+ // | Copyright (C) 2008, http://yoursite | // +-----------------------------------------------------------------------+ // | This file is free software; you can redistribute it and/or modify | // | it under the terms of the GNU General Public License as published by | // | the Free Software Foundation; either version 2 of the License, or | // | (at your option) any later version. | // | This file is distributed in the hope that it will be useful | // | but WITHOUT ANY WARRANTY; without even the implied warranty of | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | // | GNU General Public License for more details. | // +-----------------------------------------------------------------------+ // | Author: pFa | // +-----------------------------------------------------------------------+ // function nl($str) { echo "{$str} <BR />\n"; } nl( $time=strtotime(date("H:i"))); // Current Hour nl( $window_start=strtotime(date('07:00'))); // Window Open At nl( $window_close=strtotime(date('11:00'))); // Window Closes At if($time < $window_start || $time > $window_start) { header("HTTP/1.1 503 Service Temporarily Unavailable"); header("Status: 503 Service Temporarily Unavailable"); die(); } echo "Welcome, please login"; ?>
  17. options are preceded by '--' or on windows '-'. there shudda been a help document that comes with it or u can search google again to see how to use wget
  18. why the colons? it might be easier to use urlencode <?php echo urlencode("Health & Beauty");
  19. or use pathinfo example from php.net <?php $path_parts = pathinfo('/www/htdocs/index.html'); echo $path_parts['dirname'], "\n"; echo $path_parts['basename'], "\n"; echo $path_parts['extension'], "\n"; echo $path_parts['filename'], "\n"; // since PHP 5.2.0 ?>
  20. JUst Remember to name your array with the appended [] like <input type="checkbox" name="delarray[]" value="xxx"> where xxx is the id of the row ya want to delete. this will show up in php as u guessed <?php $delarray=$_POST['delarray']; ?>
  21. Well, Comgratz Long as ppl learn something is good
  22. Q: is there some reason you want to share the session information? Like yer sharing the same MySQL database or something? Because there may be a way to set/copy session data from one domain to another. but as gizmola states, it will have its drawbacks. 1) Once ppl realize this is what yer site is doing, be prepared for hacking attempts against the script. I really dun see any advantage to this, unless yer using the same userbase across all sites. the thought is to create something like email validators work. a custom link is given, and information can be retrieved from a central database server. and store the relevant session data here for sites to grab and use.
  23. Kinda useless, cuz ya can use a proxy server to do the same thing. Which is more wut yer looking for... Ya can find proxy scripts in php on google as well....
  24. So the cart is hosted on a remote server, not on same server. that wud answer the question why so much trouble. but if they allow u to have different clients, there should be some info on the api on how to set this. ya may want to check, paypal ipn services instead, there is no cart, but building a cart system shudn be difficult I did a google search of: cart script paypal and very first link: Shop-Script A simple cart system Once ya have the scripts running on yer local server, its a lot easier to manage wut they can and cant do.
  25. In yer database, there is some reference between user and their cart. if for some reason either one fails, u will either get a generic user or a generic cart. when I mean by user_id, i use it in terms of the databse, as databases usually start with table, id int autoincrement primary key. Just a reference to the how the user is referenced throughout yer script.
×
×
  • 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.