Would anyone else around here happen to know how i can add links to
Links 2.0 in batches? I doubt that single adding EACH link manually 1
at a time is the best it can get. Any help or tip on this?
Jul 14, 2005, 8:37 PM
Enthusiast (854 posts)
Jul 14, 2005, 8:37 PM
Post #2 of 21
Views: 12027
Please post product specific questions and comments in their designated forums.
As to your question, that depends on how the data you want to insert is comprised. The general concept is thus:
1) open linksid.txt for reading, retrieve last inserted ID, close file.
2) make backup of links.db
4) open links.db for writing, open old data file for reading
5) for each record read, increment ID number
6) format and/or insert values where needed (in Links format)
7) print new record to links.db
8) close old data file & links.db
9) open linksid.txt for writing, print new value, close.
Philip
------------------
Limecat is not pleased.
As to your question, that depends on how the data you want to insert is comprised. The general concept is thus:
1) open linksid.txt for reading, retrieve last inserted ID, close file.
2) make backup of links.db
4) open links.db for writing, open old data file for reading
5) for each record read, increment ID number
6) format and/or insert values where needed (in Links format)
7) print new record to links.db
8) close old data file & links.db
9) open linksid.txt for writing, print new value, close.
Philip
------------------
Limecat is not pleased.
Jul 14, 2005, 9:22 PM
Enthusiast (854 posts)
Jul 14, 2005, 9:22 PM
Post #4 of 21
Views: 11911
No problem. if you need further assistance with the actual coding, don't hesitate to ask. the more specific you can be on your requirements (including sample data to be imported) the easier and quicker we can help you.
Philip
------------------
Limecat is not pleased.
Philip
------------------
Limecat is not pleased.
Jul 14, 2005, 9:29 PM
Novice (14 posts)
Jul 14, 2005, 9:29 PM
Post #5 of 21
Views: 11985
Actually, i do need more help. See thing with me is that these things look like reading Japanese, because i am not any good with coding anything let alone trying to tweak them.
I want to import links like this into my "Teens" category..
Squeeze My Tits|http://www.littlethumbs.com/free/tresseme/Perfect-Nude-Teens/?coupon=1002835|Cutie plays with her boobies outside and squeezes them together wearing only a tshirt
Sweet Bikini Tresseme|http://www.littlethumbs.com/free/tresseme/Hot-Teen-Models/?coupon=1002835|Hottie in a bikini she has a killer tight body and and ass you can write home about
Perfect Nubile Ravon|http://www.littlethumbs.com/free/ravon/breasts/?coupon=1002835|These girls are blossoming into beautiful women
Hottie Ravon Tight Ass|http://www.littlethumbs.com/free/ravon/girls-naked/?coupon=1002835|Exclusive content of the freshent girls
Sexy Nubile Ravon|http://www.littlethumbs.com/free/ravon/girls-wild/?coupon=1002835|Naked teen girls and erotic women
They are broken down in this format.... Title|URL|Description
Usually if it was a TGP script, it could be imported like that, but these are freesites for linklists and Links is one of the best scripts for Linklist, i was told. So i am trying to see if there is a way i can import freesite title,url,description like that. I have thousands of them to add, and i cannot do them all one by one.
I hope i was a bit more specific, and if you think i am missing anything, please do not hesistate to tell me. Btw, the site i am using this for is http://freesitearchive.com if you would like to take a look. Thank you very much once again, and i really appreciate every feedback you give me.
I want to import links like this into my "Teens" category..
Squeeze My Tits|http://www.littlethumbs.com/free/tresseme/Perfect-Nude-Teens/?coupon=1002835|Cutie plays with her boobies outside and squeezes them together wearing only a tshirt
Sweet Bikini Tresseme|http://www.littlethumbs.com/free/tresseme/Hot-Teen-Models/?coupon=1002835|Hottie in a bikini she has a killer tight body and and ass you can write home about
Perfect Nubile Ravon|http://www.littlethumbs.com/free/ravon/breasts/?coupon=1002835|These girls are blossoming into beautiful women
Hottie Ravon Tight Ass|http://www.littlethumbs.com/free/ravon/girls-naked/?coupon=1002835|Exclusive content of the freshent girls
Sexy Nubile Ravon|http://www.littlethumbs.com/free/ravon/girls-wild/?coupon=1002835|Naked teen girls and erotic women
They are broken down in this format.... Title|URL|Description
Usually if it was a TGP script, it could be imported like that, but these are freesites for linklists and Links is one of the best scripts for Linklist, i was told. So i am trying to see if there is a way i can import freesite title,url,description like that. I have thousands of them to add, and i cannot do them all one by one.
I hope i was a bit more specific, and if you think i am missing anything, please do not hesistate to tell me. Btw, the site i am using this for is http://freesitearchive.com if you would like to take a look. Thank you very much once again, and i really appreciate every feedback you give me.
Jul 15, 2005, 2:24 PM
Enthusiast (854 posts)
Jul 15, 2005, 2:24 PM
Post #6 of 21
Views: 11926
Looks like enough info. I'll see if I can write an import script for you this weekend. I just need to familiarize myself with the database formats again since I haven't run Links 2.0 in a few years.
Philip
------------------
Limecat is not pleased.
Philip
------------------
Limecat is not pleased.
Jul 17, 2005, 10:12 AM
Novice (14 posts)
Jul 17, 2005, 10:12 AM
Post #8 of 21
Views: 11970
How was your weekend Phillip? Hope it was good. I spent mine adding links manually to Links 2, and the sad part is that i was only able to add 450 total, pretty sad huh? Hehe. I really hope the import scripting came across your mind this weekend, and you thought about some non coding, non perl knowing webmaster out there that desperately needs help with adding links to Links 2. lol. Hope to hear from you soon, and thanks for even considering doing that for me, thats one of the nicest things someone has ever done for me on the internet or thought about doing for me. hehe
-Greg
-Greg
Jul 17, 2005, 9:13 PM
Novice (14 posts)
Jul 17, 2005, 9:13 PM
Post #10 of 21
Views: 11991
No problem bro, Monday and Tuesday is great for me. I am watching this thread, and it lets me know by email when you reply. So please post here when you do it or if you get time to do it. So i can come by and found out how i can get it from you. Thank you very much once again, and i really appreciate this.
-Greg
-Greg
Jul 18, 2005, 2:20 PM
Enthusiast (854 posts)
Jul 18, 2005, 2:20 PM
Post #11 of 21
Views: 11941
Okay, here's permilimary version (untested).
Adjust $import_db, $date, $cat, $cname, $cmail as desired. Place the script in your admin directory and chmod to 755. Your original links.db will be backed up, but you should download a copy of links.db and your other database just in case.
require "links.cfg"; #change to full path if necessary
my $time = time();
my $bk_name = $db_script_path . '/data/links.db.' . $time;
my $import_db = $db_script_path . '/data/import.db';
my $id = 0;
my $date = '18-Jul-2005';
my $cat = 'Free';
my $cname = 'Contact Name';
my $cmail = 'Contact Email';
open (ID, $db_links_id_file_name) or die $!;
$id = <ID>;
chomp($id);
close ID;
rename($links_db_name, $bk_name);
open (OLD, $bk_name) or die $!;
open (NEW, ">$links_db_name") or die $!;
while (<OLD>) {
print NEW $_;
}
close NEW;
close OLD;
open (NEW, "+>$links_db_name") or die $!;
open (OLD, $import_db) or die $!;
while (my $line = <OLD>) {
chomp($line);
my ($title, $url, $desc) = split /\|/, $line;
my $line = join ("|", (++$id, $title, $url, $date, $cat, $desc, $cname, $cmail, 0, 'No', 'No', 0, 0, 'No');
print NEW $line . "\n";
}
close OLD;
close NEW;
open (ID, ">$db_links_id_file_name") or die $!;
print ID $id;
close ID;
print "Content-type: text/html\n\n";
print "import complete";
Philip
------------------
Limecat is not pleased.
Adjust $import_db, $date, $cat, $cname, $cmail as desired. Place the script in your admin directory and chmod to 755. Your original links.db will be backed up, but you should download a copy of links.db and your other database just in case.
Code:
#!/usr/bin/perl require "links.cfg"; #change to full path if necessary
my $time = time();
my $bk_name = $db_script_path . '/data/links.db.' . $time;
my $import_db = $db_script_path . '/data/import.db';
my $id = 0;
my $date = '18-Jul-2005';
my $cat = 'Free';
my $cname = 'Contact Name';
my $cmail = 'Contact Email';
open (ID, $db_links_id_file_name) or die $!;
$id = <ID>;
chomp($id);
close ID;
rename($links_db_name, $bk_name);
open (OLD, $bk_name) or die $!;
open (NEW, ">$links_db_name") or die $!;
while (<OLD>) {
print NEW $_;
}
close NEW;
close OLD;
open (NEW, "+>$links_db_name") or die $!;
open (OLD, $import_db) or die $!;
while (my $line = <OLD>) {
chomp($line);
my ($title, $url, $desc) = split /\|/, $line;
my $line = join ("|", (++$id, $title, $url, $date, $cat, $desc, $cname, $cmail, 0, 'No', 'No', 0, 0, 'No');
print NEW $line . "\n";
}
close OLD;
close NEW;
open (ID, ">$db_links_id_file_name") or die $!;
print ID $id;
close ID;
print "Content-type: text/html\n\n";
print "import complete";
Philip
------------------
Limecat is not pleased.
Jul 18, 2005, 8:56 PM
Novice (14 posts)
Jul 18, 2005, 8:56 PM
Post #13 of 21
Views: 11928
Hey Phillip, i cut and paste the script coding into a text file, and saved it as import.cgi, and i uploaded it to the admin directory, and set the chmod to 755. However, i get an error when i visit the page.
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@freesitearchive.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
That is the error message that i get when i visit the page. Maybe if i am doing something wrong with the saving process. I wouldn't know, but can you please let me know if the process that i described up top is the proper process to running the script? Thank you very much.
http://www.freesitearchive.com/admin/import.cgi
-Greg
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@freesitearchive.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
That is the error message that i get when i visit the page. Maybe if i am doing something wrong with the saving process. I wouldn't know, but can you please let me know if the process that i described up top is the proper process to running the script? Thank you very much.
http://www.freesitearchive.com/admin/import.cgi
-Greg
Jul 18, 2005, 9:48 PM
Enthusiast (854 posts)
Jul 18, 2005, 9:48 PM
Post #14 of 21
Views: 11993
change
to
Philip
------------------
Limecat is not pleased.
Code:
my $line = join ("|", (++$id, $title, $url, $date, $cat, $desc, $cname, $cmail, 0, 'No', 'No', 0, 0, 'No');to
Code:
my $line = join ("|", (++$id, $title, $url, $date, $cat, $desc, $cname, $cmail, 0, 'No', 'No', 0, 0, 'No'));Philip
------------------
Limecat is not pleased.
Jul 18, 2005, 10:19 PM
Novice (14 posts)
Jul 18, 2005, 10:19 PM
Post #15 of 21
Views: 11940
Still no luck i did everything you said to do. I am sorry for taking so much of your time with this Phillip, and i thank you for the time you put into it. I know you coded it right, so it is not a coding problem. I set the proper chmod, which is 755. Maybe it should be in a different directory? Right now it is in admin directory. I can send you my ftp access via private message if you would like to check it and see certain things for yourself. Maybe you will notice something that i am not seeing.
Jul 22, 2005, 8:22 PM
Enthusiast (854 posts)
Jul 22, 2005, 8:22 PM
Post #18 of 21
Views: 11905
Below is a simpler script. It will only import the data itself. You must MANUALLY set the starting ID number and update linksid.txt when you finished with the import. Please backup all data prior to running.
my $path = 'C:/links'; #path to data files
my $db = 'old.db'; #data file to import
my $id = 50;
my $date = '18-Jul-2005';
my $cat = 'Free';
my $cname = 'Contact Name';
my $cmail = 'Contact Email';
open (OUT, ">>$path" . "/links.db") or die $!;
open (IN, $path . "/$db") or die $!;
while (my $line = <IN>) {
chomp($line);
my ($title, $url, $desc) = split /\|/, $line;
print OUT join ("|", ($id++, $title, $url, $date, $cat, $desc, $cname, $cmail, 0, 'No', 'No', 0, 0, 'No')) . "\n";
}
close IN;
close OUT;
print "Content-type: text/html\n\n";
print "Import complete.";
Philip
------------------
Limecat is not pleased.
Code:
#!/perl/bin/perl my $path = 'C:/links'; #path to data files
my $db = 'old.db'; #data file to import
my $id = 50;
my $date = '18-Jul-2005';
my $cat = 'Free';
my $cname = 'Contact Name';
my $cmail = 'Contact Email';
open (OUT, ">>$path" . "/links.db") or die $!;
open (IN, $path . "/$db") or die $!;
while (my $line = <IN>) {
chomp($line);
my ($title, $url, $desc) = split /\|/, $line;
print OUT join ("|", ($id++, $title, $url, $date, $cat, $desc, $cname, $cmail, 0, 'No', 'No', 0, 0, 'No')) . "\n";
}
close IN;
close OUT;
print "Content-type: text/html\n\n";
print "Import complete.";
Philip
------------------
Limecat is not pleased.
Jul 24, 2005, 9:30 AM
Novice (14 posts)
Jul 24, 2005, 9:30 AM
Post #19 of 21
Views: 11874
Hey Phillip, i copied and pasted it. Then saved it as i.cgi, when i uploaded it to the admin directory, i changed the Chmod to 755, and i visit this link to activate or run the script..
http://www.freesitearchive.com/admin/i.cgi
i still come across with the same error, those are the process that i use to try to run it, if you see anything that i did wrong there, please let me know. Thank you very much.
-Greg
http://www.freesitearchive.com/admin/i.cgi
i still come across with the same error, those are the process that i use to try to run it, if you see anything that i did wrong there, please let me know. Thank you very much.
-Greg
Jul 24, 2005, 3:56 PM
Enthusiast (854 posts)
Jul 24, 2005, 3:56 PM
Post #20 of 21
Views: 11818
1)Is the path to perl set correctly?
2)Do you have the $path variable set to the directory containing links.db and the data file you want to import?
3)Did you set the $db variable to the name of file you want imported?
If you answered "yes" for all three questions, then there isn't much I can suggest. I'd need admin/telnet access to investigate the issue further.
Philip
------------------
Limecat is not pleased.
2)Do you have the $path variable set to the directory containing links.db and the data file you want to import?
3)Did you set the $db variable to the name of file you want imported?
If you answered "yes" for all three questions, then there isn't much I can suggest. I'd need admin/telnet access to investigate the issue further.
Philip
------------------
Limecat is not pleased.