Jump to content
Larry Ullman's Book Forums

nick

Members
  • Posts

    29
  • Joined

  • Last visited

Everything posted by nick

  1. I was wondering if anyone might know how I would be able to allow a user the ability to add youtube video links to their site like a video blog for subscribers. My 2nd question is where did larry place the instructions for Paypal for the second example. I thought that I saw him give an explanation of how to do the 2nd example with Paypal at some point. Thanks for all your help in advance Nick
  2. It is saying that the $dbc file is Undefined variable: dbc
  3. I had tried that and was getting an error. saying a system error had occured. because of the code i am using from the book. I am including a header file a config file and a mysql file where should this include be placed. Also it should not matter it I have the code laid out like this should it <?php include('whateverFile/etc...'); include(path-to-file/php_function.php); ?> Some Html <?php some more code?> more html so on and so on Hope this makes sense
  4. How can I change this into a function and include the file and call the function I assumed it would be something similar to this but I guess I was wrong. I was hoping for some ideas thanks funtion function_name($id){ $qv2='SELECT * FROM coaches WHERE sport_id = $id'; $rv2 = mysqli_query($dbc, $qv2); if(mysqli_num_rows($rv2) > 0){ while($row = mysqli_fetch_array($rv2, MYSQLI_ASSOC)) { $title = $row['title']; if($title == 'Head Coach'){ echo'<p align="left" style="font-family: Verdana, Geneva, sans-serif; font-size: 10pt; text-align: center;"> ' ; echo $row['coach_name'] . ' ' . $row['title']; echo "\n<br />\n"; echo '<a href="mailto:' . $row['coach_email'] . ' ">' . $row['coach_email'] . '</a>'; echo "\n<br />\n"; echo "<br />\n"; //echo "\n</p>"; } if ($title != 'Head Coach'){ echo $row['coach_name'] . ' - ' . $row['title']; echo '<br />'; } } echo'</p>'; }else{echo 'nothing here to see';} }
  5. This not working for me. I have a windows server that I am working on that I am not use to. I am having to use mysql instead of mysqli connect function because that keeps giving me an error and I copied and pasted the .htaccess file info you linked to but the file is still accessible from the browser. please advise.
  6. I am wanting to use the mysql.inc.php and the config file to connect the database but I don't have access to the folder above httdocs on this server. I know that the book talks about not having access to the folder above the root but I am not sure that I understand how to make the files work together in my situation. Please advise.
  7. I am trying to use to encrypt my paypal button for security purposes. I have used a site called http://www.stellarwe...yption_php.php. there example works fine but when I try to use my public certificate and private certificate and the certificate that paypal provides it will not process. I know that it is encoding my information but paypal keeps telling me "We were unable to decrypt the certificate id." I am at a loss. My code is as follows If you have any ideas please respond
  8. here is the original code if(isset($_GET['id'])&&(strlen($_GET['id']) == 40)&&(substr($_GET['id'],0,1) !='.')){ $file =PDFS_DIR.$_GET['id']; // if all 3 conditons are true then the path is defined if(file_exists($file)&&(is_file($file))) { //SQL for the path to the pdf $q = 'SELECT title, description, file_name FROM pdfs WHERE tmp_name = "'.mysqli_real_escape_string($dbc, $_GET['id']) .'"'; $r = mysqli_query($dbc, $q); if(mysqli_num_rows($r) == 1) { // if everything is ok $row = mysqli_fetch_array($r, MYSQLI_ASSOC); $valid = true; [s]if(isset($_SESSION['user_not_expired'])){[/s] header('Content-type:application/pdf'); header('Content-Disposition:inline; filename="' .$row['file_name'] . '"'); $fs = filesize($file); header("Content-Length:$fs\n"); readfile($file); exit(); }else{ // inactive account $page_title = $row['title']; include('./includes/header.html'); echo "<h3>$page_title</h3>"; if(isset($_SESSION['user_id'])) { echo '<p class="error">Thank you for your interest in this content. Unfortunately your account has expired. Please <a href="renew.php">renew your account</a> in order to access this file</p>'; }else{ echo'<p class="error">Thank you for your interest in this content. You must be logged in as a registered user to view this file</p>'; } echo"<div>{$row['description']}</div>"; include('./includes/footer.html'); }//End of user IF-ELSE }// End of Mysqli_num_rows() IF }// End of file_exists() IF }// End of $_GET['id'] IF if(!$valid){ // if not VALID //Set $page_title to error and display an error message $page_title = "Error"; include('./includes/header.html'); echo '<p class="error">This page has been accessed in error.</p>'; include('./includes/footer.html'); } ?> the mark through code I did away with because I don't want people to pay to use this site and I have done away with this portion of the other pages so the only reason they couldn't access the pages is because they aren't logged in. I think the portion that has the line through it, which i removed or commented out is the right portion to remove to make sure that the only reason someone couldn't visit the page is because they aren't logged in. The question I guess I am asking did i think correctly or have I left a security loop hole of some sort. thanks for your help
  9. If I want to put a forum in the admin portion of my site like the first example will that be safe. It seems as though it would be safe just curious.
  10. I am creating a site that structures is similar to the knowledge is power site but I don't need them to pay to register. I am wondering if I remove this portion *if (isset($_SESSION['user_id']) && !isset($_SESSION['user_not_expired'])) { echo '<p class="error">Thank you for your interest in this content. Unfortunately your account has expired. Please <a href="renew.php">renew your account</a> in order to access site content.</p>'; } from the categories page will that mess anything else up. I am pretty sure by removing this portion of the code that it will eliminate the need to check for a expiration date. Thanks for your help Nick
  11. I have saw this used on several sites where there are several words all together and some larger and some smaller what is this effect called and what is used to achieve it.
  12. Thanks Larry. I really appreciate your response and help. I really enjoy your books and look forward to reading the new ones you publish.
  13. I want to use the first site login portion to access the admin portion of the site for a simple cms. I will not really need the login portion for anyone with a subscription will this be safe or will it need to be a protected folder like the second site example to be safe. I will not be storing any payment info. Thanks
  14. I apologize guys for not being as clear as possible. I am working on a site for a car lot. I will need the initial image of the car and several others inside. I want to insert several images 1 which will show like in a list of products and the other would pictures would be for like a details page which have the initial image plus the remaining images and longer descriptions. I just wanted to make sure that using 2 queries would be okay and safe or an okay practice since I had never done this before with multiple queries. I appreciate you all taking time to help.
  15. the reason being is I will have 5 to 8 pictures and an identifier . I will want another table for the info describing the pictures with a unique identifier because i can't or I don't think I should have have a description with 5 to 8 pic it would be redundant. I hope that helps explain a little better.
  16. something like this is what I had in mind mysqli_query("INSERT INTO table1 (columnA,columnB) VALUES ('something',123)"); mysqli_query("INSERT INTO table2 (columnX,columnY) VALUES ('foo','bar')"); this would have information for both tables placed split up and put into separate tables maybe with one identifier for both
  17. I want to use the database design from the first example in the book but I want to use the admin portion to add multiple pictures. I am going to add a separate table to the database in order to customize it for my use. My question is, When I add a new record in the admin portion and upload portion to pages information portions to the picture table is there a way to upload them with multiple locations or will I have to use to queries and will the same principle apply when I am deleting that page and the pictures. I just wanted to make sure this was an acceptable practice and if so if any one has an example that would be awesome
  18. I am working on a site where the data will change and I update hopefully on a regular basis as they sell items. I want to create something that allows them to go in and delete or flag it doesn't matter. I just tried using the example from the book I mentioned earlier and can't get it to work. do you have any samples of code that show an example of what your are refering to. Thanks
  19. I have created a page to update a page but can't figure out how to set up a page to delete a page. I was reading a book that said hyperlinks shouldn't be used to preform actions like deleting. The only refererence material I have for deleting information is from the PHP6 and MYSQL5 book. I was hoping to recieve some insight regarding this subject. Thanks
  20. well in most of the examples in the book. for the $page_title var it will be like $page_title = "About Us" or something of that nature. I was just curious is there was a similar way to do meta info becasue I wast planning on doing something like the following <?php //can something like this be done $meta_info ="Something Something"; $page_title = 'PDFS'; include('./includes/header.html'); some info include('./includes/header.html'); ?>
  21. I notice in your code that when using a template format you have the header and footer code and You include the title with a variable. Is there a way to do that with the meta tags as well. Thanks
  22. So instead of read print I would read insert from that example
  23. I was reading through the index and found this function fgetcsv(). I was just wondering how much detail there was on this subject. I am have several of your books including the effortless eCommerce and the advanced php 5 book(Plus one more PHP 6 and MySQL 5). The reason I am asking is because I have need to use that function to extract values and insert them into a MySQL database every so often and want to do it dynamically. I would like to buy your new book but I just wasn't sure how much it covered on that topic or if the books I have covered anything on it that I missed.
  24. I checked with hosting company and magic quotes were turned on and I had those turned off and it seemed to stop with the code I presently had listed above will that still be safe.
  25. I am using if (!empty($_POST['title'])) { $t = mysqli_real_escape_string($dbc, strip_tags($_POST['title'])); } else { $add_page_errors['title'] = 'Please enter the title!'; } This code from the book but when I add a new page and use a word like don't it ends up looking like don/'t. Is this because of the mysqli_real_escape_string because I if build something similar for a client I don't won't that to show up but I would like for it to still be safe. Thanks for you help with.
×
×
  • Create New...