|
|
tylermenezes |
| January 27, 2007, 12:06am |
|
|
Posts: 200
Gender:  Male
Posts Per Day: 0.09
Reputation: 91.30%
Reputation Score: +21 / -2
Time Online: 1 days 5 hours 56 minutes
Location: Redmond, Washington
Age: 19
|
Okay Justin, could you please help me here. Your E-Blah expertise would be of GREAT help... I'm designing a PERL script for my school's library and I need to have it done by Monday, Jan. 29, 2007! My school's library has what they call "library passes" because everyone at my school hangs out in the library during lunch and plays video games on the computers. People can get a pass in the morning for that day, or can ask a librarian for a pass for the entire quarter. What I need your help with is creating the member system. The one in E-Blah is great, so maybe you can help here? What I need to do: - Be able to issue daily passes, good only for one day.
- Be able to issue semester passes, issued for, say "Quarter 1", valid until the librarian changes the semester
- Get able to get a list of all students (semester passes and daily lunch passes) that can be in the library that day.
I already have the console, login, and request pass features done, but there's no way for the librarians to issue passes, because I have no idea how to store names, quarter pass (boolean), and valid date (if quarter pass is false). Again, PLEASE help. I need this by Monday, because that's the start of the new quarter, and they said if I could get it done by then they'd love to use it. I'm reading a book I bought on PERL, but I'll never finish it in time, and I know VERY little about the language. I don't have any money to donate right now, but if you help I'll donate as soon as I get some. Thanks so much! If you need a copy of the existing code, it's attached.
 |
This post contains attachments; to download them you must login. |
|
|
| |
|
|
|
|
|
Justin |
|
|
Posts: 15,196
Gender:  Male
Posts Per Day: 4.37
Reputation: 93.25%
Reputation Score: +304 / -22
Time Online: 37 days 19 hours 48 minutes
Location: Tallassee, AL
Age: 25
|
You want a full scaled member back end in a few days? Ouch. It's not that hard, but if you don't know much perl it will be.
I'd try to do it with XML myself. Just do it that way. I'm not sure how you'd do the other stuff, it's something you'd have to actually plan out. You'll want to get the current time, probably, and add X amount of days to it to state how long it's valid for (then the code blocks it if it goes over those dates, etc). |
| I do installs for $25 and upgrades for $20.Technical support is always free. Donate to E-Blah! My Websites: Revolution Reality (My Blog) | Portfolio"But you, O Lord, are a compassionate and gracious God, slow to anger, abounding in love and faithfulness." — Psalm 86:15 NIV |
|
|
|
|
|
tylermenezes |
|
|
Posts: 200
Gender:  Male
Posts Per Day: 0.09
Reputation: 91.30%
Reputation Score: +21 / -2
Time Online: 1 days 5 hours 56 minutes
Location: Redmond, Washington
Age: 19
|
I just really need some way of having PERL process a file with user information in it like:
\n - new person | - seporator
something like that, I could probably do the processing code, but I have no idea how to get the processing into arrays. If you could give me some example code to seperate:
username|quarter(1/0)|dateissued|lunch(1/2/3)
into arrays named "username", "quarter", "dateissued", and "lunch" then I could do the rest. I already figured out to do date arrhythmic and revoking of passes.
If XML would be easier, let me know. Keep in mind that if it requires an additional Perl module, my website server host won't install it. I kind of like the way E-Blah does it though. Everything I need is there in the Eblah code somewhere... Member deletions, date registered, ranks, etc. if you could even give me some guidance as to how you did this for E-Blah, that would be really helpful.
Thanks!
Thanks for the help! |
| |
|
|
|
|
|
Justin |
| January 27, 2007, 12:03pm |
|
|
Posts: 15,196
Gender:  Male
Posts Per Day: 4.37
Reputation: 93.25%
Reputation Score: +304 / -22
Time Online: 37 days 19 hours 48 minutes
Location: Tallassee, AL
Age: 25
|
|
|
|
|
|
tylermenezes |
|
|
Posts: 200
Gender:  Male
Posts Per Day: 0.09
Reputation: 91.30%
Reputation Score: +21 / -2
Time Online: 1 days 5 hours 56 minutes
Location: Redmond, Washington
Age: 19
|
Thanks you so much!
How could I load a specific member though? i.e.
Tyler|1||2 Justin|0|January 27 2007|1
and someone is looking for a member named Tyler so I look for a line starting with Tyler?
Thanks again, again! |
| |
|
|
|
|
|
Justin |
|
|
Posts: 15,196
Gender:  Male
Posts Per Day: 4.37
Reputation: 93.25%
Reputation Score: +304 / -22
Time Online: 37 days 19 hours 48 minutes
Location: Tallassee, AL
Age: 25
|
|
|
|
|
|
tylermenezes |
|
|
Posts: 200
Gender:  Male
Posts Per Day: 0.09
Reputation: 91.30%
Reputation Score: +21 / -2
Time Online: 1 days 5 hours 56 minutes
Location: Redmond, Washington
Age: 19
|
So that will look for each new line in the file?
My code should look like:
open(FH3,"./libpass/list.txt"); $memberdb = <FH3>; close (FH3); foreach(@line) { ($username,$quarter,$dateisued,$lunch) = split(/\|/,$memberdb); print "Name: $username<br />Quarter: $quarter<br />Date: $date<br />Lunch: $lunch<p />" }
And that would give me
Name: Tyler Quarter: 3 Date: Lunch: 2
Name: Justin Quarter: Date: January 27 2007 Lunch: 1
Is this correct?
Thanks again, again, again! |
| |
|
|
|
|
|
Justin |
|
|
Posts: 15,196
Gender:  Male
Posts Per Day: 4.37
Reputation: 93.25%
Reputation Score: +304 / -22
Time Online: 37 days 19 hours 48 minutes
Location: Tallassee, AL
Age: 25
|
More like this ...
|
Code
open(FH3,"./libpass/list.txt");
@memberdb = <FH3>;
close (FH3);
chomp @memberdb;
foreach $arraystring (@memberdb) {
($username,$quarter,$dateisued,$lunch) = split(/\|/,$arraystring);
print "Name: $username<br />Quarter: $quarter<br />Date: $date<br />Lunch: $lunch<p />"
} |
|
|
| I do installs for $25 and upgrades for $20.Technical support is always free. Donate to E-Blah! My Websites: Revolution Reality (My Blog) | Portfolio"But you, O Lord, are a compassionate and gracious God, slow to anger, abounding in love and faithfulness." — Psalm 86:15 NIV |
|
|
|
|
|
tylermenezes |
|
|
Posts: 200
Gender:  Male
Posts Per Day: 0.09
Reputation: 91.30%
Reputation Score: +21 / -2
Time Online: 1 days 5 hours 56 minutes
Location: Redmond, Washington
Age: 19
|
|
|
|
|
|
Justin |
|
|
Posts: 15,196
Gender:  Male
Posts Per Day: 4.37
Reputation: 93.25%
Reputation Score: +304 / -22
Time Online: 37 days 19 hours 48 minutes
Location: Tallassee, AL
Age: 25
|
|
|
|
|
|
tylermenezes |
|
|
Posts: 200
Gender:  Male
Posts Per Day: 0.09
Reputation: 91.30%
Reputation Score: +21 / -2
Time Online: 1 days 5 hours 56 minutes
Location: Redmond, Washington
Age: 19
|
Thanks! You rock!
Line should be $arraystring though, right?
I actually do have one queston, what could I use to delete a member's line, assuming I know the member's full name ($username)? |
| |
|
|
|
|
|
Justin |
|
|
Posts: 15,196
Gender:  Male
Posts Per Day: 4.37
Reputation: 93.25%
Reputation Score: +304 / -22
Time Online: 37 days 19 hours 48 minutes
Location: Tallassee, AL
Age: 25
|
|
|
|
|
|
tylermenezes |
|
|
Posts: 200
Gender:  Male
Posts Per Day: 0.09
Reputation: 91.30%
Reputation Score: +21 / -2
Time Online: 1 days 5 hours 56 minutes
Location: Redmond, Washington
Age: 19
|
How could I do that? I'm new to PERL remember, I know the print method, how to set cookies, use lines, and if lines, but that's it. |
| |
|
|
|
|
|
Justin |
|
|
Posts: 15,196
Gender:  Male
Posts Per Day: 4.37
Reputation: 93.25%
Reputation Score: +304 / -22
Time Online: 37 days 19 hours 48 minutes
Location: Tallassee, AL
Age: 25
|
|
|
|
|
|
tylermenezes |
|
|
Posts: 200
Gender:  Male
Posts Per Day: 0.09
Reputation: 91.30%
Reputation Score: +21 / -2
Time Online: 1 days 5 hours 56 minutes
Location: Redmond, Washington
Age: 19
|
Ok, here's what I've got:
|
Code
sub deleteuser{
my $td = shift;
$openpg = "$dir/list.txt";
open(FH3,"$openpg");
@memberdb = <FH3>;
close (FH3);
chomp @memberdb;
foreach $arraystring (@memberdb) {
($username,$quarter,$dateisued,$lunch) = split(/\|/,$arraystring);
push(@usernames, $username);
push(@quarters, $quarter);
push(@dateissueds, $dateisued);
push(@lunches, $lunch);
}
$count = 0;
foreach $user (@usernames) {
if($user eq $td){
delete @usernames[$count];
delete @quarters[$count];
delete @dateissueds[$count];
delete @lunches[$count];
$count--;
}
$count++;
}
$c2 = "0";
foreach $user (@usernames){
if($ct eq "0"){
$user = "\n$user";
}
$openpg = "$dir/list.txt";
open(FH4,">$openpg");
print FH4 "$user|$quarters[$ct]|@dateissueds[$ct]|@lunches[$ct]";
close (FH4);
print "$user|$quarters[$ct]|@dateissueds[$ct]|@lunches[$ct]<br>";
$c2++;
}
} |
|
This works, but it has a few strange problems. If I try to delete "Joe Smith" and there's also a user named "John Smith", they're both deleted. Could you tell me what I'm doing wrong? |
| |
|
|
|
|
|
|