Jump to content

madk

Members
  • Posts

    21
  • Joined

  • Last visited

    Never

Everything posted by madk

  1. I don't have a query now, which is why I'm posting here for help. I can't wrap my brain around how the joins should be created.
  2. Here is the query I was using but this was because I had the platform stored in the collections table where it doesn't belong: SELECT collections.platform, COUNT(collections.id) AS count FROM collections, platforms WHERE collections.user_id = $user_id AND collections.platform = platforms.id GROUP BY collections.platform ORDER by platforms.name ASC
  3. Hello all, I've need to come up with a query to display a count of all games grouped by platform in a users collection. I need to output these in alpha order of the platform name. My knowledge of sql is limited to basic queries and I feel a bit out of my league here. Here is the basic structure of my tables. users ------- id collections ------------- id user_id game_id games -------- id platform platforms ------------ id name Thanks for any help in advance!
  4. It'll be on Linux but I have to deploy it across about 15 sites on separate servers, which is why I'm looking for a script that I can just call easily. I'll look into the sed command.
  5. Hello, I'm got a client running some code that contains a function called date_format. We are porting over to PHP 5 and now PHP5 has it's own date_format function. I am looking for a script that will parse all php files and rename any references to the function call. Just wondering if anyone has an code I could look at so I don't recreate the wheel. Thanks in advance.
  6. madk

    one result

    Quick question - what is the most officiant way to get one result from a query?
  7. Same yourself time and headaches and use ZenCart over OSC.
  8. First off...wrong forum. This forum is to test complete code for errors. Secondly if I understand correctly, PHP isn't your answer. You should probably look into a javascript solution to control your dropdown boxes. Any PHP integration will happen server side and require the page to reload completely in order to take effect. With javascript you could have this all happen instantly within the browser. Do a google search for javascript form controls. Good luck!
  9. 9/10 times I just optimize using a simple time measurement as most of my scripts are not memory intensive. If you are worried about memory usage in a long script you can always free up memory after you are done using a variable.
  10. <?php require ('sql_connect.php4'); sql_connect('nut_blog'); $id = $_POST['id']; $query = "select * FROM blog WHERE id='$id'"; if ($results = mysql_query($query)) { $row = mysql_fetch_array ($results); $title = $row['title']; $author = $row['author']; $id = $row['id']; $date = $row['date']; $entry = $row['entry']; } ?> <html> <head> </head> <style type="text/css"> BODY { background: url(http://www.pickellnutrition.com/pics/mainback.jpg); background-repeat: no-repeat; overflow:hidden} .style1 {font-family: Georgia, "Times New Roman", Times, serif} </style> <center> <form action="SimpleEditSave.php" method="POST"> <table> <tr> <td> Entry Title: </td> <td> <input type="text" name="title" size="40" maxsize="100" value="<?= echo $title ?>" /> </td> <td> User: </td> <td> <input type="text" name="title" size="20" maxsize="50" value="<?= echo $user ?>" /> </td> </tr> <tr> <td colspan=2> <p> </p> <p>Entry Text: </p></td> </tr> <tr> <td> <textarea name="entry" cols="100" rows="15"><?= echo $entry ?></textarea> </td> </tr> <tr> <td> <form action="SimpleEditSave.php" method="post"> <input type="hidden" name="id" value="<?php echo $id ; ?>" /> <input type="submit" name="submit" value="Edit" /> </form> </td> <td> <form action="SimpleEditList.php" method="post"> <input type="submit" name="submit" value="Cancel" /> </form> </td> </tr> </center> </html> If I understand what you are looking to accomplish the above code should work.
  11. Suggested Improvements ----------------------- Content, content, content. Obviously the site is new but you have to provide content if you want users to stick around. As it stands I would probably leave your site as soon as your index loads. The design is bland and really shows off your lack of content. I see a user system but see no benefits of creating an account. Content: 0/10 --------------- There is nothing to see here. You state the site is an entertainment site so expand on this idea. Design: 1/10 --------------- Grey, black, white = boring. I would work on adding content and then showing off this content on the front page. Maybe like a recent additions box or links to your games or videos. Use some images and don't be afraid of color. Try a different font too. Functionality: 5/10 ------------------- Everything seems to function properly. Need For Improvement: 10/10 ---------------------------- If you want to try to establish a full featured sited you have a lot of work ahead of you. But fortunately the sky is the limit with a new site so keep up the good work.
  12. SOLVED function thumbJPG($jpgFile) { // Get dimensions of original list($width_orig, $height_orig) = getimagesize($jpgFile); $image_p = imagecreatetruecolor(150, 150); $image = imagecreatefromjpeg($jpgFile); if($width_orig > $height_orig) { $off_w = ($width_orig-$height_orig)/2; $off_h = 0; $width_orig = $height_orig; } elseif($height_orig > $width_orig) { $off_w = 0; $off_h = ($height_orig-$width_orig)/2; $height_orig = $width_orig; } else { $off_w = 0; $off_h = 0; } imagecopyresampled($image_p, $image, 0, 0, $off_w, $off_h, 150, 150, $width_orig, $height_orig); // Output imagejpeg($image_p, $jpgFile, 100); }
  13. Hello all, I'm trying to modify my thumbnail function to crop my thumbnails to 150 x 150. I don't want to resize the image I just want to crop off the extra area to create the square. I can't wrap my brain around all of the variables of imagecopyresampled to accomplish this. Could someone please guide me. I appreciate it. function thumbJPG($jpgFile) { // Get dimensions of original list($width_orig, $height_orig) = getimagesize($jpgFile); if($width_orig > $height_orig) { $height = 150; $width = (int) (($height / $height_orig) * $height_orig); $image_p = imagecreatetruecolor($width, $height); $image = imagecreatefromjpeg($jpgFile); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig); } else { $width = 150; $height = (int) (($width / $width_orig) * $height_orig); $image_p = imagecreatetruecolor($width, $height); $image = imagecreatefromjpeg($jpgFile); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig); } // Output imagejpeg($image_p, $jpgFile, 100); }
  14. This afternoon I tried to setup a simple single page login form. The username and password are pulled from an include file and not a db. Does anyone notice any faults? Hosted here: http://www.mattkris.com/admin/admin_login.php Username: test Password: dummy Thanks in advance. <? session_start(); include_once("../config.php"); // Setup defaults $error = ""; if(isset($_POST['admin_name']) && isset($_POST['admin_pass'])) { if(empty($_POST['admin_name'])) { $error .= "Please enter a username.<br />"; } if(empty($_POST['admin_pass'])) { $error .= "Please enter a password.<br />"; } if(!empty($_POST['admin_name']) && !empty($_POST['admin_pass'])) { if ($_POST['admin_name'] != USER_NAME || $_POST['admin_pass'] != USER_PASS) { // If login details don't match $error .= "Login Error"; } else { // Login matches, set session and forward $_SESSION['username'] = $user; $url = 'Location:' . SITE_URL . 'admin/index.php'; header($url) ; exit; } } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title><? echo SITE_NAME; ?> - Admin Menu</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" type="text/css" href="style.css" /> <script type="text/javascript"> function focusit() { document.getElementById('admin_name').focus(); } window.onload = focusit; </script> </head> <body> <div style="padding-top: 100px"> <form name="login" action="admin_login.php" method = "post"> <? if(!empty($error)) { ?> <div class = "notice"> <? echo $error; ?> </div> <? } ?> <table class = "login" cellspacing="0" cellpadding="5"> <tr bgcolor="#808080"> <td style="color:#FFFFFF"><b>Admin Login</b></td> <td></td> <td></td> </tr> <tr> <td rowspan="3"></td> <td> Username<br /></td> <td> <input type="text" id="admin_name" name="admin_name" value="" /></td> </tr> <tr> <td>Password </td> <td><input type="password" id="admin_pass" name="admin_pass" value="" /></td> </tr> <tr> <td><input type="hidden" name="e" value="0" /></td> <td><input type="submit" name="submit" value="Log In" /></td> </tr> </table> </form> </div> </body> </html>
  15. Hello all, I'm about to write a small script that will be responsible for sending email to about 100-200 clients. My first few emails went out using a while loop and calling the mail function each time. The emails went out fine and (as far as I know) all of the clients received the emails. I have heard of people having trouble while using the mail functions. Normally this is because the servers can't handle the load. This leads me to 2 questions: 1. Should I explore other options for sending out small newsletters? 2. Instead of looping through the email addresses and calling mail() for each one, should I add multiple recipients and just make one call to mail()? ie. // multiple recipients $to = 'aidan@example.com' . ', '; $to .= 'wez@example.com'; Please send me some advice. Thank you, Matt Kris
  16. If I was you I would move over to Zen Cart. Still pretty tough to work with but definitely an improvement over osCommerce. Great community as well. I also just stumbled upon Magento (http://www.magentocommerce.com/). Haven't tried it yet but it looks promising. Default template and feature set is amazing.
  17. I believe these have all been fixed with htmlentities. I'm also implementing a bit more validation in the contact form. This should show up in a matter of minutes.
  18. This is a small project I am working on to help me learn how to integrate the Google Maps API. The project is at about 90% with only a few minors areas to clean up. Please work your magic and let me know of any areas that need my attention. Please ignore: - Image uploads: I am working on this code today - Error screen: I am implementing a 404 page today Feel free to hammer away at everything else. http://www.sk8parks.org Thank you, madk
  19. UPDATE 2 My idea has failed.  The SID shows up in the URL but is not actually passed.  I'm starting to think I may have to live with my sloppy URLs.
  20. Hello, Not sure if this is the correct forum but you guys have not steered me wrong in the past. On my site I just started using URL rewrites to clean up my urls.  So for example a page that is normally: http://www.mysitename.com/view-post.php?id=5 Will output as: http://www.mysitename.com/post/5/ Now my problem is that I am also needing to pass session ID to the next page because I am using a login system borrowed from the forum software I use.  The forum software appends the ID using a function called append_sid() and appends the SID only if it is needed.  If I apply this function to my rewritten URL I get something like http://www.mysitename/post/5/&id=asdfdsf32rasdfadf.  This obviously won't do the trick. I am looking for a way that I can still use URL rewrites and pass along the session ID. UPDATE As I was editing this I decided to try to change my Rewrite Rule.  Now my posts output as: http://www.mysitename.com/post/14/post.php Now I can append the SID to it and it appears to work fine.  I'm mainly doing this because my old site wasn't getting indexed will due to the sloppy URLs.  Do you think this should solve my problem? Thanks in advance, Matt
  21. Hello friends, I have just recently taken over a site that had some major problems when viewed in Firefox. I so far have hammered out all the kinks except one big one. The header on the main index page is messed up. Looks fine in IE but in Firefox it is jacked. I have having a hell of a time sifting through this code to figure out what is going on. [a href=\"http://www.beadhaven.com/\" target=\"_blank\"]http://www.beadhaven.com/[/a] Could someone provide some insight? I would GREATLY appreciate it. Thanks, MDK
×
×
  • 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.