Jump to content

Gighalen

Members
  • Posts

    193
  • Joined

  • Last visited

    Never

Posts posted by Gighalen

  1. I think you need to add a DISTINCT UID thingie to your SQL string. It's been a while since I've done anything, but DISTINCT UID should only select UID that are different, so the value of 1 would only appear in the SUM function once.

     

    If that makes any sense >< I'm horrible at explaining things sometimes.

  2. There doesn't necessarily have to be an error for that error to occur.

     

    What you need is the variable being passed off to mysql_num_rows to be an array from a database.

     

    Like

    $q = mysql_query();
    

     

    and then pass $q off to mysql_num_rows

  3. Oh man, I forgot all about validating! lol.

     

    And yeah, I was going to go back and remake the 30 day guarantee logo... The original was a white background from a free template I got somewhere.. I just cropped it in photoshop in about 30 seconds because I was anxious to get everything up and running.

     

    Thanks for the feedback :P

  4. A web hosting company I made...

     

    www.sitepearl.com

     

    Feedback would be appreciated.

     

    It's not '100%' yet, as I am still fine-tuning a few aspects of it, but the main content is up and running.

     

    And FYI, it DOES work, so if you need some web space, feel free to sign up lol.

    -24/7 support

    -Free scripts (eCarts, forums, etc)

    -Plans starting at $7.95..

    -30 day money back guarantee.

    -FREE domain (on Advanced + Pro package).

    www.sitepearl.com

     

  5. So what happens if a user disables sessions and tries to view a page that requires one? like an admin page or something? Will it have the same effect as a user being logged in and not having the appropriate privlidges?

     

    I'm have IE 8.0 installed and looked for that feature, but couldn't find it :(

  6. Alright, so in the past I have based all my auth methods for user logins based on a session. Like userlevel = 9, etc.

     

    I noticed, however, that MySpace uses a little widget called MyToken in the url which looks very similar to a random md5 hash and upon further research I learned that this randonly generated alpha-numeric combination is generated based on the time, ip address, and a few other things and is used to authenticate users to view certain features on the site, for instance, viewing a private profile.

     

    Does anyone have any ideas as to why they did this? Why not just have the authentication stuff embedded into the login session? I'm just wondering which is safer/more reliable and which method would you use?

     

    Thanks in advance,

    Gig

  7. Ok, there are errors all throughout that script - I don't even know where to begin.

     

    I recommend going to http://www.w3schools.com and reading their little tutorial on PHP - it should teach you the basics of PHP in just under a few hours. Naturally, we cannot help you if you have absolutely no idea what you are doing - so come back when you at least have a basic understanding of what your script is trying to do and general idea of what the PHP syntax should look like.

  8. While I cannot help you.. I would make two suggestions.

     

    a) Since you are new to PHP, this is perhaps biting off more than you can chew. I would suggest getting some basic books and work your way up. Sounds like you are trying to do backflips before learning how to walk so-to-speak.

     

    b) it's regarded as bad practice to use <? ?> as your PHP tags. Servers may have the short open tags disabled.. otherwise, the shorthand php tags may get confused with XML tags. You should use <?php ?> instead.

     

    Cheers,

     

    NRG

     

    Agreed.

     

    A). If you need some help with the basics, I can probably help you out a little - Just add me on AIM or something.

     

    B). Shorthand tags should never be used - even if your php config file is set up to read them. If you ever transfer the files over to another server that isn't configured to read it - it will spit all sorts of errors out at you and just display your php code as plain text.

     

     

  9. Your form is sending off the variables that a user inputs to a file called apply.php. This file will handle organizing the values into a single message and sending them to your email. My guess is that the file either does not declare the $_POST variables correctly or does not exist (since you do not seem to know where it is).

  10. Just to throw my little 2 cents in, you can add this line on code in your opening FORM tag to confirm the deletion of said rows. That is, given you have a seperate FORM for each. Anyways, this will prompt you to confirm the delete to prevent you from accidently deleting something.

     

    onclick="if (confirm('Are you sure?')) {return true;} else {return false;}"

  11. It depends what you are trying to do.

     

    I use pure CSS for basic, 5 page sites that don't do too incredibly much or hold a lot of data, but I use tables in sites in which there is a lot of output so I can arrange it all nice and pretty-like.

     

    But In applications, like this game I'm building now, I use tables + iframes.

     

    But I never use "FRAMES", period.

  12. That is a very basic query. You could probally use it even with MySQL 1.0 lol. If there was a 1.0.

     

    You need to do it yourself. Go to the MySQL forum and ask how to access your MySQL panel and run basic create table queries.

     

    If all else fails, you can always IM me on MSN or AIM.

  13. a) This post belongs in dreamweaver help or w.e....

    b) It would be really error-free-ing awesome if you worded things in a manner that others could easily understand.

    c) It's just not cool to have 3 posts, with 2 of therin being quotations of the first.

     

    Text sent via echo from a php file saved on a PC will not execute because you need to install Apache.

     

    As far as your background image goes, try checking to see that your resources images are in the proper directory in concurence with your html/php files.

  14. Pretty sure this works. Let me know if it doesnt.

    <?php
    $idir = "../media/photos/";   // Path To Images Directory 
    $tdir = "../media/photos/thumbs/";   // Path To Thumbnails Directory 
    $twidth = "125";   // Maximum Width For Thumbnail Images 
    $theight = "100";   // Maximum Height For Thumbnail Images 
    $mwidth = "600";   // Maximum Width For main Images 
    $mheight = "480";   // Maximum Height For main Images 
    if (!isset($_GET['subpage'])) { ?> 
    <h3>Upload Photo</h3>
      <form method="post" action="?subpage=upload" enctype="multipart/form-data"> 
       File:<br /> 
      <input type="file" name="imagefile" class="form"> 
      <br /><br /> 
      <input type="text" name="photoname">
      <br><br>
      <textarea name="description"></textarea><br><br>
      <input name="submit" type="submit" value="Sumbit" class="form">  <input type="reset" value="Clear" class="form"> 
      </form> 
    <? 
    } 
    else  if (isset($_GET['subpage']) && $_GET['subpage'] == 'upload') { 
    $url = $_FILES['imagefile']['name'];
    		if ($_FILES['imagefile']['type'] == "image/jpg" || $_FILES['imagefile']['type'] == "image/jpeg" || $_FILES['imagefile']['type'] == "image/pjpeg") 
    	{ 
        		$file_ext = strrchr($_FILES['imagefile']['name'], '.');
       		    $copy = copy($_FILES['imagefile']['tmp_name'], "$idir" . $_FILES['imagefile']['name']);
        			if ($copy) {
    $simg = imagecreatefromjpeg("$idir" . $url);
          $currwidth = imagesx($simg);   // Current Image Width 
          $currheight = imagesy($simg);   // Current Image Height 
          if ($currheight > $currwidth) {   // If Height Is Greater Than Width 
             $zoom = $mwidth / $currheight;   // Length Ratio For Width 
             $newheight = $mheight;   // Height Is Equal To Max Height 
             $newwidth = $currwidth * $zoom;   // Creates The New Width 
          } else {
            $zoom = $mwidth / $currwidth;   // Length Ratio For Height 
            $newwidth = $mwidth;   // Width Is Equal To Max Width 
            $newheight = $currheight * $zoom;   // Creates The New Height 
          } 
          $dimg = imagecreate($newwidth, $newheight);   // Make New Image For Thumbnail 
          imagetruecolortopalette($simg, false, 256);   // Create New Color Pallete 
          $palsize = ImageColorsTotal($simg); 
          for ($i = 0; $i < $palsize; $i++) {
           $colors = ImageColorsForIndex($simg, $i);   // Number Of Colors Used 
           ImageColorAllocate($dimg, $colors['red'], $colors['green'], $colors['blue']);
          } 
          imagecopyresized($dimg, $simg, 0, 0, 0, 0, $newwidth, $newheight, $currwidth, $currheight);
          imagejpeg($dimg, "$idir" . $url);
    
          print 'Image uploaded successfully.<br />'; 
      
          $simg = imagecreatefromjpeg("$idir" . $url);
          $currwidth = imagesx($simg);   // Current Image Width 
          $currheight = imagesy($simg);   // Current Image Height 
          if ($currheight > $currwidth) {   // If Height Is Greater Than Width 
             $zoom = $twidth / $currheight;   // Length Ratio For Width 
             $newheight = $theight;   // Height Is Equal To Max Height 
             $newwidth = $currwidth * $zoom;   // Creates The New Width 
          } else {
            $zoom = $twidth / $currwidth;   // Length Ratio For Height 
            $newwidth = $twidth;   // Width Is Equal To Max Width 
            $newheight = $currheight * $zoom;   // Creates The New Height 
          } 
          $dimg = imagecreate($newwidth, $newheight);   // Make New Image For Thumbnail 
          imagetruecolortopalette($simg, false, 256);   // Create New Color Pallete 
          $palsize = ImageColorsTotal($simg); 
          for ($i = 0; $i < $palsize; $i++) {
           $colors = ImageColorsForIndex($simg, $i);   // Number Of Colors Used 
           ImageColorAllocate($dimg, $colors['red'], $colors['green'], $colors['blue']);
          } 
          imagecopyresized($dimg, $simg, 0, 0, 0, 0, $newwidth, $newheight, $currwidth, $currheight);
          imagejpeg($dimg, "$tdir" . $url);
          imagedestroy($simg);   // Destroying The Temporary Image 
          imagedestroy($dimg);   // Destroying The Other Temporary Image 
          print 'Image thumbnail created successfully.';   // Resize successful 
        } else { 
          print '<font color="#FF0000">ERROR: Unable to upload image.</font>';   // Error Message If Upload Failed 
        } 
      } else { 
        print '<font color="#FF0000">ERROR: Wrong filetype (has to be a .jpg or .jpeg. Yours is ';
        print $file_ext;   // Show The Invalid File's Extention 
        print '.</font>'; 
      } 
    
    }

  15. Correction on videos.php:

               
    <p class="header">Video Archive</p>        
    <?php
    $q = mysql_query("SELECT * FROM files");
    $num = mysql_num_rows($q);
    if($num == 0){
    echo "<br><br><br><center>No Videos uploaded yet! Check back soon!<center>";
    }
    else
    {
    $query = mysql_query("SELECT * FROM files");
    $i = 0;
    echo "<table align=\"center\">";
    while($data = mysql_fetch_array($query)){
    if($col == 0){
    echo "<tr>";
    }
    echo "<td onclick=\"parent.location.href='viewvideo.php?id=".$data['id']."'\" width=\"125px\" height=\"100px\" style=\"border:1px #000000 solid;\"><img src=\"images/movies.png\" width=\"123px\" height=\"98px\"></td>";
    if($col == 3){
    echo "</tr>";
    $i = 0;
    $num--;
    }
    else
    {
    $i--;
    $col++;
    }
    }
    }
    echo "</table>";
    ?>

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