Jump to content

jasonc

Members
  • Posts

    860
  • Joined

  • Last visited

Posts posted by jasonc

  1. I thought this might work and even tried to use a + instead of the . (dot)  cause the whole table to have zeros !  lol

     

    ok back to previous backup made moments before.  and not sure how i add text to the links, please can someone advise.

     

    UPDATE `links` SET `link` = 'http://www.'.`link`
    

  2. oh something went wrong with the convert and caused all the usernames to still be there, made so many other changes and it would take ages to redo from the start.

     

    how can i update the usernames so they are having the userid instead

     

    this is what i have tried and the first part the selects shows all the userid and usernames correctly but the update part is not working.  what am i doing wrong?

     

    UPDATE `links` SET `links`.`author` = `a`.`id`
    
    SELECT `l`.`author`, `a`.`id`, `a`.`username`
    FROM `links` as l
    LEFT JOIN `accounts` as a ON a.username=l.author
    

  3. Ah thanks, that easy.

     

    But the only part that I am lost on now is how to get links.submittedby, look up submittedby in users.username table, get users.id so that the users.id can be copied in to newTable.author

     

    By using the set based insert.  Write your SELECT statement from your first table to get the data like you need it in the destination table (where you are copying to) and then with that SELECT use it as you INSERT.

     

    INSERT INTO newTable ( f1, f2, f3 )
    SELECT f1, f2, f3
    FROM links
    

  4. I have a load of links in my table and would like to move them to a new table but under different fields.

     

    get all the following details from `links` table.

     

    links.id > newTable.id

    links.url > newTable.url

    links.desc > newTable.desc

    links.sourcedesc > newTable.sourcedesc

    links.sourceurl > newTable.sourceurl

    links.clicks > newTable.clicks

     

     

    get links.submittedby, look up submittedby in users.username table, get user.id

     

    users.id > newTable.author

     

     

    place all newTable entries in to a new table.

     

    how would I go about doing this.

  5. try the following...

     

    <!doctype html public "-//w3c//dtd html 3.2//en">
    <html>
    <head>
    <title>Auto Thumbnail generation script from plus2net.com</title>
    </head>
    <body>
    <?
    if (isset($_POST['submit'])) {
    $name = $_POST['gname'];
    		if ($name != "" && !file_exists('../gallery/images/$name')) {
    			mkdir ("../gallery/images/$name", 0777);
    			mkdir ("../gallery/thumbs/$name", 0777);
    		} else {
    			echo "Directory previously created, file uploaded successfully.";
    			}
    }
    
    $add="../gallery/images/$name/".$_FILES[userfile][name]; // the path with the file name where the file will be stored, upload is the directory name. 
    //echo $add;
    if(move_uploaded_file ($_FILES[userfile][tmp_name],$add)){
    echo "Successfully uploaded ".$_FILES[userfile][name]."<br><br>";
    chmod("$add",0777);
    }else{echo "Failed to upload file Contact Site admin to fix the problem";
    exit;}
    
    ///////// Start the thumbnail generation//////////////
    $n_width=100;          // Fix the width of the thumb nail images
    $n_height=100;         // Fix the height of the thumb nail imaage
    $tsrc="../gallery/thumbs/$name/".$_FILES[userfile][name];   // Path where thumb nail image will be stored
    //echo $tsrc;
    if (!($_FILES[userfile][type] =="image/jpeg" OR $_FILES[userfile][type]=="image/gif")){echo "Your uploaded file must be of JPG or GIF. Other file types are not allowed<BR>";
    exit;}
    /////////////////////////////////////////////// Starting of GIF thumb nail creation///////////
    if (@$_FILES[userfile][type]=="image/gif")
    {
    $im=ImageCreateFromGIF($add);
    $width=ImageSx($im);              // Original picture width is stored
    $height=ImageSy($im);                  // Original picture height is stored
    $newimage=imagecreatetruecolor($n_width,$n_height);
    imageCopyResized($newimage,$im,0,0,0,0,$n_width,$n_height,$width,$height);
    if (function_exists("imagegif")) {
    Header("Content-type: image/gif");
    ImageGIF($newimage,$tsrc);
    }
    elseif (function_exists("imagejpeg")) {
    Header("Content-type: image/jpeg");
    ImageJPEG($newimage,$tsrc);
    }
    chmod("$tsrc",0777);
    }////////// end of gif file thumb nail creation//////////
    
    ////////////// starting of JPG thumb nail creation//////////
    if($_FILES[userfile][type]=="image/jpeg"){
    $im=ImageCreateFromJPEG($add); 
    $width=ImageSx($im);              // Original picture width is stored
    $height=ImageSy($im);             // Original picture height is stored
    $newimage=imagecreatetruecolor($n_width,$n_height);                 
    imageCopyResized($newimage,$im,0,0,0,0,$n_width,$n_height,$width,$height);
    ImageJpeg($newimage,$tsrc);
    chmod("$tsrc",0777);
    }
    ////////////////  End of JPG thumb nail creation //////////
    ?>
    <FORM ENCTYPE="multipart/form-data" ACTION="success.php" METHOD=POST>
    If the directory that you would like to select is not present, type in a directory name, description and click submit. The newly created directory should appear within the list below. Otherwise, select the image and directory, click submit and you will be good to go. 
    Name <input type="text" name="gname" id="text" value="">
    Upload this file: <INPUT NAME="userfile" TYPE="file">
    <INPUT TYPE="submit" name="submit" id="submit" VALUE="Send File">
    </FORM>
    If a gallery is not available, you may create a new one. Enter then name of the Gallery in the Gallery field and upload an image. Otherwise, enter the existing gallery name into the Gallery field and upload an image.<br><br><br>
    List of available folders/galleries:<br>
    <?php
    function folderlist(){
      $startdir = '../gallery/images/';
      $ignoredDirectory[] = '.'; 
      $ignoredDirectory[] = '..';
       if (is_dir($startdir)){
           if ($dh = opendir($startdir)){
               while (($folder = readdir($dh)) !== false){
                   if (!(array_search($folder,$ignoredDirectory) > -1)){
                     if (filetype($startdir . $folder) == "dir"){
                           $directorylist[$startdir . $folder]['name'] = $folder;
                           $directorylist[$startdir . $folder]['path'] = $startdir;
                       }
                   }
               }
               closedir($dh);
           }
       }
    return($directorylist);
    }
    
    $folders = folderlist();
      foreach ($folders as $folder){
        $path = $folder['path'];
        $name = $folder['name'];
        echo '' . $name . '<br />';
      }
    ?>
    </body>
    </html>
    

  6. Thanks KevinM1,  I have made a few changes as you suggested, the services page was not changes as this is the new page, the vehicles page is the next to be done and would take a similar look to the services.

     

    I have also removed all of the serif font as far as I can tell, if you spot any please let me know the page title and some of the text that I have missed.  I just went in to all the files and removed the word serif as the CSS had many fonts family types so.

  7. yes please ignor the {{}}  these are just for my reference so i know each section is showing correctly.  these will be removed before the page goes live.

     

    I have recently altered the javascript so it only triggers when something is altered instead of running every few seconds apart.  Seems to have quickened the page somewhat.

  8. **********

    I would really appreciate it if you would not post information of the sites name or url from the live site in your replies.

    **********

     

    Today I am after comments on how the form functions in different browsers.

     

    I have tested the form myself in various browsers and feel it is ready for testing, what I am after is comments on if it works well or if anyone can see any problems that I may face.  I am wanting to know if I have used to much JavaScript or if this is working properly.

     

    The form was just a long form, but decided to break the form up and have each part filled out before the next part opened up to allow the errors to be corrected before the visitor moved on to the rest of the form.

     

    http://alturl.com/ba58n

  9. I have used many versions of code to validate an email in JS but after using it, it fails when another email format shows it face that the code thinks is wrong; but in fact is a valid email.

     

    So opted to using this method which would server the purpose I am after but do not know how to search for the seed from the end of the string instead of from the start.

     

    here is the code I am wanting to use but not sure how I search for the '.' starting from the end of the string.

     

    function checkEmailValid2(email) {
    s = email.indexOf(' ') + 1; // is there a space
    e = email.indexOf('@') + 1; // find the @
    f = email.indexOf('.') + 1; // find the .
    	if ( email != '' && s == 0 && e && f > e + 1 && f < email.length) {
    		return true;
    	} else {
    		return false;
    	}
    }
    

  10. What I would like to find out is how I can echo out all the variables that are in use in the visitors visit.  And have these echoed on the page. (for error checking purposes)  some of my variables i.e.  $username  or $email and a few others are being cleared of its content and I can not find any problems searching all the files for the variable name and checking the lines but think that some other variable is in turn causing theproblems.  so wanting to find a way to place an echo line that shows all the variables and then have the next line

     

    exit;

     

    and just move these two new lines around my scripts to find out where the problems might be.

  11. Yes Paul, but for many months there has been dozens of changes to all of the code and then the whole lot was ripped to pieces and recoded so it would validate and also work with the new feature that were asked for, and then..... more changes to the changes again and recoded one more from scratch so it would not take so long due to all the patches added in!

     

    I still like the original site, but for some time it was going to happen and the site would change again.

     

    There are dozens of features that have been added to the backend and to the admin and customer areas, invoicing system, accounts...  the works.  and it does not stop there, there are still a load of other stuff that will be added in over the next few months due to customer feedback.

  12. I was just wanting to have the page validate.  But w3 says that the 'name' tag is deprecated and to use id' instead for the image.  But this causes the JavaScript to fail.

     

    What would be the correct change in the JavaScript to allow it to work ?

     

    I have tried all sorts with () and []  with ID and Id  none work.

     

    Here is the code I have at the moment...

    /*	Script by FPMC at http://jsarchive.8m.com	Submitted to JavaScript Kit (http://javascriptkit.com)	For this and 400+ free scripts, visit http://javascriptkit.com	*/
    
    src = ['../images/Intro1.jpg', '../images/Intro2.jpg', '../images/Intro3.jpg', '../images/Intro4.jpg', '../images/Intro5.jpg', '../images/Intro6.jpg', '../images/Intro7.jpg'];	//set image paths
    
    duration = 3;	//set duration for each image
    
    //Please do not edit below
    ads=[]; ct=0;
    function switchAd() {
    var n=(ct+1)%src.length;
    if (ads[n] && (ads[n].complete || ads[n].complete==null)) {
    document.getElementById('Intro_Image') = ads[ct=n].src;
    // document['Intro_Image'].src = ads[ct=n].src;
    }
    ads[n=(ct+1)%src.length] = new Image;
    ads[n].src = src[n];
    setTimeout('switchAd()',duration*1000);
    }
    

     

    <img id="Intro_Image" src="images/Intro1.jpg" alt="Intro" style="float: right; height: 160px;">
    

     

    In Firefox Error Console I get this error when page loads..

     

    Warning: Use of getAttributeNodeNS() is deprecated. Use getAttributeNS() instead.

     

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