Jump to content

simcoweb

Members
  • Posts

    1,104
  • Joined

  • Last visited

Everything posted by simcoweb

  1. Thanks for the post and suggestion. Instead of a timestamp I think i'm going to just use a random code like this: // Random confirmation code $confirm_code=md5(uniqid(rand())); Which would then be appended to the confirmation link in the email and snagged like this: http://www.yourweb.com/confirm.php?passkey=$confirm_code $_GET['passkey']; with a query that would check that against results and set the status to '1' or whatever. Is there any reason why I should use the timestamp over the random code?
  2. Heh..ok, at least we're getting something Please post your whole new code so I can see line 35. If it's the variables then just change them back to how you had them.
  3. Your query should be like so: <?php # setup SQL statement $SQL = " SELECT * FROM links WHERE category = '$category' "; ?> And try changing part to this in the while loop: <?php # display results echo ("<P><DT><B>$category</B><BR>\n"); while ($row = mysql_fetch_array($retid)) { $siteurl = " . $row['siteurl'] . "; $sitename = " . $row['sitename'] . "; ?> Also, I believe those ( ) around your echo statements could be why they aren't printing. Personally i've not seen echo statements start or end with anything but quotes. They may be ok and that may be allowed syntax but if the display still isn't working then try removing them and just having them like this: echo "<DD><A HREF='$siteurl'>$sitename</A></DD>\n";
  4. You need to add the database statement: <? # connect to database $cid = mysql_connect($host,$usr,$pwd); mysql_select_db($db) or die(mysql_error()); if (!$cid) { echo("ERROR: " . mysql_error() . "\n"); } ?>
  5. I have code for uploading a single file and then inserting that file name into the mysql database. What I need some help with is uploading 3 images at once and how i'd modify the code accordingly in order to coordinate the form with the upload script. Here's what I have for a single upload: <? if(isset($_POST['upload']) { $ServerRoot = $_SERVER['DOCUMENT_ROOT']; // Grabs the home directory of your hosting. $Directory = 'uploads/'; // Folder that will be uploaded to relative to the public_html. $MaxFileSize = '10240'; // Maximum file size allowed. $AllowedFiles = array(jpg,gif,png,psd,zip,rar,bmp); // The allowed file extensions $FileExtension = $_FILES['file']['type']; $FileSize = $_FILES['file']['size']; $FileName = $_FILES['file']['name']; if($FileSize > $MaxFileSize) { echo 'Your file is too big!'; exit; } if(!in_array($FileType) { echo 'You are not allowed to upload that file type!'; exit; } $UploadFile = move_uploaded_file($_FILES['file']['tmp_name'], $ServerRoot$Directory); if($UploadFile !== TRUE) { echo 'Problem uploading!'; exit; } echo "File uploaded successfully: http://www.your-domain/'.$Directory$_FILES['file']['name']."; } else { echo " <form name='upload' encrypte='multipart/form-data' action="'.$_SERVER['PHP_SELF'].'" method='post'> "; echo "<input type='upload' name='file' size='30' />"; } ?>
  6. It might be advisable to get a shopping cart system that has what's known as a 'configurator' which is exactly what you're trying to create. It starts with the 'core' product and the person selects their options which adds to the price. Then they confirm and place their order.
  7. Try changing to this and see what happens: <?php //setting cookie based on variable that has been pass by url //the REQUEST command can retrieve variables from variables being pass by url //like something.php?favmovie=starwars setcookie("language", $_REQUEST['lang'], time()+3600,"/",""); $langcookie = $_COOKIE['language']; if ($langcookie == "en") { include 'main_en.html'; } elseif ($langcookie == "he") { include 'main_he.html'; } elseif ($language_en = 'NULL') { include 'regularpage.html'; } //see if it even retrieves the cookie right if ($langcookie == "en") { echo 'the cookie is read as en'; } if ($langcookie == "he") { echo 'the cookie is read as he'; } ?>
  8. Here's exactly what you're looking for with instructions and everything: http://www.mariovaldez.net/software/sitefilo/
  9. You can use the ugly gray box .htaccess method if you're needing just one common username/password shared by all. Or, for the prettier login page, you'd use PHP. It's not necessary that you have a database. You can use a textfile for the storage of the username/password combo. It's not as secure but for your purposes it could work. In those tutorials, just replace the references with the database to using the fopen, fread and fwrite functions built into PHP. There's a bunch of tutorials on how to open files, write to them and then close 'em up. You could most likely find exactly what you're looking for over at www.hotscripts.com but that wouldn't teach you alot. If you want to code it yourself then work up some preliminary code and post it here when you have trouble
  10. Sounds to me that you just need to add another step in the process that would go between the creation of and the download of the PDF file. Step One: click here to create the PDF file Step Two: PDF file created successfully! Would you like to a) print it, b) download it c) have it emailed to you as an attachment? Step Three: whichever they choose To do this you'd have to have the PDF file created and placed in a folder on your server then provide the links to it to accomplish the tasks.
  11. Makes perfect sense. I think that $row line was a leftover from other versions of my code. I didn't catch that it was declaring it twice. Thanks for the help, everyone. It's displaying properly now.
  12. Ok, before we all warmy swarmy and take showers together.... another small issue has arisen. The best way I can describe it is it's not showing all the entries in the database. It's leaving one item out of each list. For example, I have this: $sql = "SELECT * FROM subcategories WHERE cat_id='1'"; cat_id #1 has 7 entries. It only displays 6. cat_id #2 has 24 entries. It only displays 23. There's 7 main categories ( cat_id=' ' ). The item that is getting dropped is the very first item in the database in each incident. Ideas?
  13. sasa, your changes worked. Thanks for that. I now have two columns! Yay!
  14. Jesirose, i'm doing it on my local machine (XAMP) so I can attach a screenshot only.
  15. Ok, i'm lost. My code creates just one column. Not two. Is there a tweak here that I missed that someone posted?
  16. I want to display sub-category titles/links in a two column format. I've got this code currently but it's only displaying a single column. <?php // run query $sql = "SELECT * FROM subcategories"; $results = mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_array($results) or die(mysql_error()); while ($row = mysql_fetch_array($results)){ $totalColumns = 2; $i = 1; echo "<table border='0' cellpadding='2'>"; for ($b=0;$b<3;$b++) { if ($i == 1) echo "<tr>"; echo "<td>"; echo "<a href='getcat.php?". $row['subcat_id'] . "'>" . $row['subcat_name'] . "</a>"; echo "</td>"; if ($i == $totalColumns) { echo "</tr>"; $i = 0; } $i++; } echo "</table>"; } ?> I want it to look like: boatsbooks stuffjunk thingscrap etc.
  17. As I mentioned, there won't be any 'username' in this process since there's no registration and no future login required. Essentially it justs validates the existence of their email address as a 'live' email to avoid some spam bomber. Also, in another function, it checks against that email address to make sure only one ad has been submitted using it. This keeps spammers from mass insertion unless, of course, they wish to validate each and every email address they want to use. Perhaps we could adapt your example to work with just the timestamp as the identifying factor?
  18. I'm creating a similar classifieds system to CraigsList.org. When posting an ad, unlike other classifieds systems, they do not require you to register. Instead they verify/validate your email address by sending an 'activation' or 'verification' link to the email address you've entered into the ad posting form. Upon receipt of the email the person clicks on the link and it returns them to the site with a 'success' page and final step in posting the ad. I've read up on some activation tutorials but most apply to registering new members for a site and not just specific to validating the email address as real. I don't need usernames, passwords, etc. Just the email verified. The obvious and most popular method is to use a timestamp, attach it to a url and email it to the person with the url having a link back to the validation script and attaching the timestamp to it, pluck it with a $_GET and compare it to the user_id or similar field. Any help or guidance on the right way to do this would be marvelous. I'm not 100% on how to get the timestamp set and if it needs to have any specific encryption or other manipulation to avoid malicious hacks. A 2nd part to this is, during the steps of creating the ad there's a 'pause' in the process for this validation. What i'm assuming is the best approach here is the following: 1. person completes the form and submits 2. the validation email is sent to person AND the ad is inserted into the database while a page displays the message about the email sent and what they need to do 3. the person validates the email by clicking on the link which then changes the ad 'status' to 'on' ( or, a 1 instead of default 0) 4. the person clicks the final OK button to submit the ad and update status (this step could be eliminated and done in step 3 perhaps) Anyone have a better plan or experience with this they can share?
  19. Hiya Toon: Thanks for the response. Basically the email address inserted by the ad poster serves two purposes. The first one is when he tries to post the ad, it sends a validation email to authenticate the email address as real. The ad poster clicks on the authentication link then returns to the site where the ad is confirmed and posted. The second purpose is for people to respond to the ad. Based upon your explanation, anyone responding to the ad, their email is sent to a 'dummy' box where it is then resent to the email address of the ad poster? There must be some switchover or way that once it's there it knows where to send it to the required email destination. Not sure how this would work.
  20. If any of you have every posted an ad at craigslist.org it provides 3 methods of email contact: 1. use the email address as indicated 2. still use your email but have the emails 'cloaked' as a @craigslist.org address 3. do not want replies via email (phone or whatever would be in the ad) When the select option #2 all emails are sent with an address like this: job_1323453@craigslist.org What I want to know how to do is take my email, which say is bozo@theclown.com, and have it sent as job_1323453@craigslist.org Anyone?
  21. I don't see any $_GET call setting anything.
  22. The problem is you are including a variable but there's no place on that page where the variable value/content is set. I'm not sure why you don't just include the file like you did the footer.php: <?php include("nameofthetemplate.php") ?>
  23. Do us a favor and use the 'code' insertion icons for pasting your code in the posts. And, please paste all your code for this 'template.php' file.
×
×
  • 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.