Jump to content
Larry Ullman's Book Forums

nick

Members
  • Posts

    29
  • Joined

  • Last visited

nick's Achievements

Newbie

Newbie (1/14)

0

Reputation

  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.
×
×
  • Create New...