Jump to content

contra10

Members
  • Posts

    402
  • Joined

  • Last visited

    Never

Posts posted by contra10

  1. I just want to know that if i have an auto incremented table and the auto incremented numbers are lets say 1,2,3,4 to represent each row.

     

    If i delete row 2, whats left in my database is 1,3,4. The next input would be 5. 1,3,4,5.

     

    Question: Is there a way to allow the next created row to be 2 instead of being 5?

     

    I guess I'm just trying to reorganize

  2. i have a form set-up where the user inputs writting and its saved in the db, thing is when i take the lines out of the db the query shows all the words in one line with my word string,

     

    ie. if a user enters this in the form:

    ------------------

    Dear, John

     

    I would like to say hello.

     

    Sincerely,

    Bob

    ----------------------

     

    it comes out as this in the viewing

    ----------------------

    "Dear, John I would like to say hello. Sincerely, Bob"

    ----------------------

     

    heres my code to enter

     

    <font size="1" face="arial, helvetica, sans-serif"> ( You may enter up to 400 characters. )<br> 
    <textarea name="message" wrap="physical" cols="28" rows="4" STYLE="color: #FFFFFF; font-family: Verdana; font-weight: bold; font-size: 11px; background-color: #72A4D2;" onKeyDown="textCounter(this.form.message,this.form.remLen,400);" // change 125 to anything you wish
    onKeyUp="textCounter(this.form.message,this.form.remLen,400);"></textarea>
    

     

    don't think thats too necessary

     

    but heres the important code when i echo the results

    <?php
    $text = ($evdescription);
    $newtext = wordwrap($text, 80, "<br />\n",true); 
    
    echo "<table border='0' align='right' width='500'>";
    echo"<tr><td>";
    echo "<b>COST:</b> $$cost ";
    if ($username == $creator ){
    echo " <a href='http://localhost/events/deleteevent.php?ev=$eidnum'><b>Delete Event </a>| ";
    echo " <a href='http://localhost/events/updateev.php?ev=$eidnum'> Edit </b></a>";
    }
    echo"</td></tr>";
    echo "<tr><td height='25' width='80%' valign='top' align='center' bgcolor='#0183AE'><FONT FACE='ariel' size'12'><h1><b>$evname</b></fOnt></td></tr>";
    echo "<tr><td height='175' valign='top' align='center'>$newtext</td></tr>";
    echo "<tr><td align='left'><b>Date:</b> $as $evday, $evyear </tr>";
    echo "<tr><td aligh='left'><b>Email:</b><i> $evmail</i></td></tr>";
    echo "<tr><td align='left'><b>Address:</b>$evaddress</td></tr>";
    echo"<tr><td align='left'><b>Time:</b> <font size='2' color='red'>$evhour:$evminute $evtimea - $evhourb:$evminuteb $evtimeb</font></td></tr>";
    echo "</table>";
    ?>
    

     

     

  3. im trying to find a way to allow users to upload a comment on the users page and allow the comment to be seen right away.

     

    I did have it before but the problem was that since it was an iframe, if i linked to the users profile page its my actual website in a box. with my website surronding it. afterall it is a little window in a window.

     

    So i created an i frame for the posting part and kept the post on my profile page, it worked but the comments do not get shown unless i reload page. How should i go about this

  4. im trying to find a way to allow users to upload a comment on the users page and allow the comment to be seen right away.

     

    I did have it before but the problem was that since it was an iframe, if i linked to the users profile page its my actual website in a box. with my website surronding it. afterall it is a little window in a window.

     

    So i created an i frame for the posting part and kept the post on my profile page, it worked but the comments do not get shown unless i reload page. How should i go about this

  5. this is the viewing

     

    <?php
    // Create MySQL login values and 
    // set them to your login information.
    $username = "";
    $password = "";
    $host = "localhost";
    $database = "userimages";
    
    // Make the connect to MySQL or die
    // and display an error.
    $link = mysql_connect($host, $username, $password);
    if (!$link) {
        die('Could not connect: ' . mysql_error());
    }
    
    $connect = mysql_select_db($database) or die("Can not select the database: ".mysql_error());
    
    
    $id = $_GET['id'];
    
    if(!isset($id) || empty($id)){
    die("Please select your image!");
    }else{
    
    $query = mysql_query('SELECT `image` FROM `tbl_images` WHERE `userid`= "'.$id.'"');
    $row = mysql_fetch_assoc($query);
    $content = $row['image'];
    
    
    
    $im = imagecreatefromstring($content)or die("Can not select the database: ".mysql_error());; 
    
    $x = imagesx($im); 
    $y = imagesy($im); 
    
    
    $desired_width = 300; 
    $desired_height = $y * ($desired_width/$x); 
    
    $new = imagecreatetruecolor($desired_width, $desired_height)or die("Can not select the database: ".mysql_error());; 
    
    
    
    imagecopyresampled($new, $im, 0, 0, 0, 0, $desired_width, $desired_height, $x, $y)or die("Can not select the database: ".mysql_error());; 
    
    imagedestroy($im); 
    
    header('Content-type: ' . $row['type'] .'');
    imagejpeg($new, null, 85);
    }
    ?>
    

     

     

  6. I'm not sure why this is happening but the images are saved on the database via a users account. KiB files will show but MiB files do not show.

     

    My Max_File_Size does not limit the amount and nowhere in my coding is there a limit to the amount. Plus I can see the actual size and presense of the photo in my database. Any ideas as to why it won't show?

     

    PLEASE HELP

  7. i want to put the length and width in th db

     

    <?php
    $caption = mysql_real_escape_string($_POST['caption']);
    $name = mysql_real_escape_string($_POST['usernamecookie']);
    $city = mysql_real_escape_string($_POST['city']);
    $file = mysql_real_escape_string($_FILES['image']);
    
    if (isset($_FILES['image']) && $_FILES['image']['size'] > 0) { 
      
      // Temporary file name stored on the server
          $tmpName  = $_FILES['image']['tmp_name']; 
      $fileType = $_FILES['image']['type'];
          
      
      
      // Read the file 
          $fp   = fopen($tmpName, 'r');
          $data = fread($fp, filesize($tmpName));
          $data = addslashes($data);
          fclose($fp);
      
      list($width, $height) = getimagesize($file);
    
    
          // Create the query and insert
          // into our database.
          $query = "INSERT INTO `images` (`type`, `image`, `length`, `width`,`userid`, `username`, `caption`, `city`) VALUES ('" . $fileType . "', '" . $data . "', '" . $width . "', '" . $height . "', '" . $id . "', '" . $name . "', '" . $caption . "', '" . $city . "')";
          $results = mysql_query($query) or die(mysql_error());
          
      // Print results
          print "Thank you, your file has been uploaded.";
    
    ?>
    

     

    trying to use the list()

  8. don't really understand the getimagesize function basically i want to get the length and the width of the image before i put it into the db

     

    <?php
    
    if (isset($_FILES['image']) && $_FILES['image']['size'] > 0) { 
      
      // Temporary file name stored on the server
          $tmpName  = $_FILES['image']['tmp_name']; 
      $fileType = $_FILES['image']['type'];
          
      
      // Read the file 
          $fp   = fopen($tmpName, 'r');
          $data = fread($fp, filesize($tmpName));
          $data = addslashes($data);
          fclose($fp);
    
    
          // Create the query and insert
          // into our database.
          $query = "INSERT INTO `images` (`type`, `image`, `userid`, `username`, `caption`, `city`) VALUES ('" . $fileType . "', '" . $data . "', '" . $id . "', '" . $name . "', '" . $caption . "', '" . $city . "')";
          $results = mysql_query($query) or die(mysql_error());
    ?>
    

     

    how do i place that in this code

     

  9. yup, im keeping track of the image type etc...but the file thats not showing is the file that is

     

    [bLOB - 2.5  MiB]

     

    but other files like

    [bLOB - 262.6  KiB]

    [bLOB - 406.5  KiB]

    [bLOB - 39.1  KiB]

     

    they show

     

     

    and when a person uploads they have more than enough space

     

    <form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="changer">
    <input name="MAX_FILE_SIZE" value="512000000000" type="hidden">
    <input name="image" accept="image/jpeg" type="file">
    <tr><td><?php echo "<input type='hidden' name='usernamecookie' value='$usernamecookie'>"?></tr></td>
    <tr><td><?php echo "<input type='hidden' name='iduser' value='$id'>"?></td>
    <input value="Submit" type="submit" name="submit">
    

  10. when a user uploads their file into my db the data is present but for at least some of the images does not show. I checked to see if its in the db and it is. Could it be the size of the file, cause the image that is not showing is 2MiB whereas other files are in the KiB category.

  11. i tried the mt_rand but it doesn't work. The image is shown before the upload as well as after the upload.

     

    my code is like this

    
    <div class="left">
    <?php 
    
    include('settings.php'); 
    // Make sure the user actually 
    // selected and uploaded a file
    
    if(isset($_COOKIE['ID_my_site'])) 
    { 
    $usernamecookie = $_COOKIE['ID_my_site']; 
    }
    
    if(is_numeric($_GET['user'])){
    
    $id = $_GET['user'];
    }
    
    $name = mysql_real_escape_string($_POST['usernamecookie']);
    $idpic = mysql_real_escape_string($_POST['iduser']);
    
    if (isset($_POST['submit']) && ($_FILES['image']) && $_FILES['image']['size'] > 0) { 
      
      // Temporary file name stored on the server
          $tmpName  = $_FILES['image']['tmp_name']; 
      $fileType = $_FILES['image']['type'];
          
      
      // Read the file 
          $fp   = fopen($tmpName, 'r');
          $data = fread($fp, filesize($tmpName));
          $data = addslashes($data);
          fclose($fp);
          
    
          // Create the query and insert
          // into our database.
          $query = "UPDATE `tbl_images` SET `image` = '" . $data . "', `filetype` = '" . $fileType . "' WHERE `userid` = '" . $idpic . "'";
          $results = mysql_query($query) or die(mysql_error());
          
          // Print results
          print "Thank you, your file has been uploaded.";
      
         // Create the URL string
       $url = "http://www.url.com/image/updatemain.php?user=$idpic"; 
       
       // Finall Echo the meta tag
       echo('<meta HTTP-EQUIV="REFRESH" content="0; url='.$url.'">');
      
      }else{
    	  echo "Please do not refresh page or double click on upload. Allow time for download.";
    
    }
    // Close our MySQL Link
    mysql_close($link);
    ?>
    
    <form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="changer">
    <input name="MAX_FILE_SIZE" value="512000000000" type="hidden">
    <input name="image" accept="image/jpeg" type="file">
    <tr><td><?php echo "<input type='hidden' name='usernamecookie' value='$usernamecookie'>"?></tr></td>
    <tr><td><?php echo "<input type='hidden' name='iduser' value='$id'>"?></td>
    <input value="Submit" type="submit" name="submit">
    </div>
    <div class="right">
    <?php
    mysql_connect("localhost", "user", "pass") or die(mysql_error()); 
    mysql_select_db("registration") or die(mysql_error());
    
    $queryi= "SELECT * FROM `users` WHERE `username` = '$usernamecookie'";
    $resulti = mysql_query($queryi) or die(mysql_error());;
    while($responsei = mysql_fetch_assoc($resulti)){
    	$newid = "{$responsei['id']}";
    	$imagevalue= "{$responsei['image']}";
    }
    if ( $imagevalue == 'false'){
    
    echo "<img src='http://www.url.com/profile/replace.png'>";
    
    }else {
    
      echo "<img src='http://www.url.com/image/viewlarge.php?id=$newid&r=mt_rand(1,5000)' 
    onmouseover='this.style.opacity=1;this.filters.alpha.opacity=100'
    onmouseout='this.style.opacity=0.4;this.filters.alpha.opacity=80' />";
    
    }
    ?>
    </div>
    

     

     

  12. I'm saving pics in my db and I have an upload section, and beside the upload form it shows the current picture.

     

    When I upload the pic the pic gets entered into the db but the pic is not uploaded at the side. When i go to the profile page where the pic is being displayed the old one is showed. Only after I refresh the browser does the new pic become visible.

     

    Any ideas as to why this is like that?

  13. I'm trying to attempt to redirect someone from an email to a specific page. the problem is in my header file, if no cookie is set becasue it is a login system, the person gets redirected to the main page. How can i set up a login system where after the person enters their username etc then they can redirected to the page that the email linked them to?

  14. i'm trying to find a caption phrase using "like" i tried breaking down the work into a string and search the query closest to that word submitted in the form. Also if the city is selected then it would have to be that specific caption phrase in the city selected

     

    <?php
    
    //This code runs if the form has been submitted
    if(isset($_POST['submit']) and ($_POST['caption']))  {
    
    $city = "{$_POST['city']}";
    $caption = "{$_POST['caption']}";
    
      $search_text=$_POST['caption'];
    
    $search_text=ltrim($search_text);
    $search_text=rtrim($search_text);
    
    $kt=split(" ",$search_text);
    
    while(list($key,$val)=each($kt)){
    if($val<>" " and strlen($val) > 0){$q .= " `caption` like '%$val% or ";}
    }
    $q=substr($q,0,(strLen($q)-3));
    
    $query="SELECT * FROM `images` WHERE $q";
    if(isset($_POST['submit']) and ($_POST['caption']) and ($_POST['city'])){$query .= "and `city` = '$city' ";}
    
    $img = mysql_query($query);
    while($getimg = mysql_fetch_array($img)) {
    
    $imageid= "{$getimg['id']}";
    $imagecity= "{$getimg['city']}";
    $imagecaption= "{$getimg['caption']}";
    
    	echo "<img src='http://localhost/pictures/imagereplace.php?id=$imageid'><br>";
    	echo "$imagecaption";
    	}
    	}
    
    	?>

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