#!/usr/bin/perl use strict; use lib qw(/usr/home/web/users/a0017451/html/cgi-bin); use CGI qw(:standard escapeHTML); use AklaatDB; use AklaatDB::Session; my $ScriptLocation = "http://www.aklaat.com/cgi-bin"; my $baseurl = 'http://www.aklaat.com/'; my $mailprog = '/usr/sbin/sendmail'; my $basedir = '/usr/home/web/users/a0017451/html/'; my $returnemail = 'admin@aklaat.com'; my ($count, @FileData, @temp, $name, $value, $buffer); if ($ENV{'REQUEST_METHOD'} eq 'POST') { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } else { $buffer = $ENV{'QUERY_STRING'}; } my (@temp, $name, $value, %QUERY, %SETTINGS); @temp = split /&/, $buffer; for(@temp) # Get Query String and put it in hash %QUERY { ($name, $value) = split /=/, $_; $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $QUERY{$name} = $value; } # If the cookie containing the session ID is present, use the ID to look up # an existing session. If the attempt fails or there was no cookie, create # a new session and prepare a cookie to send to the client that contains # the session ID. If all attempts to open a session fail, we can't continue. my $usernameCookie = cookie ("aklaat_user_name"); my $emailCookie = cookie ("aklaat_user_email"); my $realnameCookie = cookie ("aklaat_user_real_name"); my $http_referer = $ENV{'HTTP_REFERER'}; $http_referer =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; # Convert all Hex back to regular characters if($http_referer =~ /$ScriptLocation/ || $SETTINGS{'accounts'} eq 'fullpublic' || $SETTINGS{'accounts'} eq 'viewonly') # Check to see if they came from different page { if($http_referer =~ /$ScriptLocation/) { if($ENV{'CONTENT_LENGTH'} != 0) {GetPostData();} # if POST info was sent, put information in hash %POST if($QUERY{'action'} eq 'AddUser') { AddUser(); } else { LoadPage('','','','','',''); } } } else { LoadPage('','','','','',''); } ############################################################# sub LoadPage { my($error_email,$error_user_name,$error_password,$error_display_name,$error_country,$error_how) = @_; my ($email, $username, $realname, $country, $region, $how, $password1, $password2); print "Content-type:text/html\n\n"; print< للتسجيل في موقع أكلات شهية HTMLTOP my $data_file="includes/style.htm"; open(DAT, "$basedir$data_file") || die("Could not open file!"); my @raw_data=; close(DAT); my $line; foreach $line (@raw_data) { print "$line"; } my $data_file="includes/style1.htm"; open(DAT, "$basedir$data_file") || die("Could not open file!"); my @raw_data=; close(DAT); my $line; foreach $line (@raw_data) { print "$line"; } $data_file="includes/script.htm"; open(DAT, "$basedir$data_file") || die("Could not open file!"); @raw_data=; close(DAT); foreach $line (@raw_data) { print "$line"; } print< A { TEXT-DECORATION: none } LI { color:#f0af21 } A:hover { COLOR: #cc0000; TEXT-DECORATION: underline } .home-title { FONT-SIZE: 17px; COLOR: #cc0000; FONT-FAMILY: "Simplified Arabic" } .home-text { FONT-SIZE: 15px; COLOR: #000000; FONT-FAMILY: "Simplified Arabic" } .sub-text { FONT-SIZE: 15px; COLOR: #cc4a00; FONT-FAMILY: "Simplified Arabic" } .V9 {FONT-FAMILY: 'Simplified Arabic'; FONT-SIZE: 15px; font-weight: bold} .T12 {FONT-SIZE: 12px; FONT-FAMILY: 'Tahoma'; font-weight: bold} .T14 {FONT-SIZE: 14px; FONT-FAMILY: 'Tahoma'; font-weight: bold} HTMLTOP require "../ui/top.pl"; print<

كن عضواً في مجتمع أكلات شهية

إذا كنت قد سجلت مسبقاً في الموقع إضغط هنا.


* البريد الإلكتروني HTMLTOP $email = $QUERY{'email'}; print ""; if ($error_email ne '') { print "
$error_email
"; } print<
* اسم المستخدم HTMLTOP $username = $QUERY{'username'}; print ""; if ($error_user_name ne '') { print "
$error_user_name
"; } print<
* كلمة السر HTMLTOP $password1 = $QUERY{'password1'}; print ""; if ($error_password ne '') { print "
$error_password
"; } print<
* تأكيد كلمة السر HTMLTOP $password2 = $QUERY{'password2'}; print ""; print<
* الإسم المستخدم في الموقع HTMLTOP $realname = $QUERY{'realname'}; print ""; if ($error_display_name ne '') { print "
$error_display_name
"; } print<
* البلد HTMLTOP $country = $QUERY{'country'}; LoadCountries('0'); if ($error_country ne '') { print "
$error_country
"; } print<
المنطقة HTMLTOP $region = $QUERY{'region'}; print ""; print<
* كيف عرفت عن موقع أكلات HTMLTOP $how = $QUERY{'how'}; print ""; if ($error_how ne '') { print "
$error_how
"; } print<

الإشتراكات

 

* يجب تعبئة هذا الحقل.

 

مزايا أن تكون عضوا

  1. تقييم الوصفات.
  2. المشاركة في تقديم وصفاتكم وأشياء أخرى.
  3. الاشتراك مجاناً.
HTMLTOP require "../ui/nav.pl"; print ""; $data_file="includes/key_press.htm"; open(DAT, "$basedir$data_file") || die("Could not open file!"); @raw_data=; close(DAT); foreach $line (@raw_data) { print "$line"; } print ""; exit(0); } ############################################################# sub AddUser { my ($error,$x, $password, $emailcontent, $dbh, $usernum, $query, $error_email,$error_user_name,$error_password,$error_display_name,$error_country,$error_how, $chkNewRecipes, $chkNewRates, $chkTips); $error = 0; if (AklaatDB::trim($QUERY{'email'}) eq '') { $error_email = 'الرجاء ادخال البريد الإلكتروني'; $error = 1; } if (AklaatDB::trim($QUERY{'username'}) eq '') { $error_user_name = 'الرجاء ادخال اسم المستخدم'; $error = 1; } if (AklaatDB::trim($QUERY{'password1'}) eq '') { $error_password = 'الرجاء ادخال كلمة السر'; $error = 1; } if (AklaatDB::trim($QUERY{'realname'}) eq '') { $error_display_name = 'الرجاء ادخال الإسم المستخدم في الموقع'; $error = 1; } if (AklaatDB::trim($QUERY{'country'}) eq '') { $error_country = 'الرجاء ادخال البلد'; $error = 1; } if (AklaatDB::trim($QUERY{'how'}) eq '') { $error_how = 'الرجاء ادخال كيف عرفت عن موقع أكلات'; $error = 1; } if($QUERY{'email'} !~ /[\w\-]+\@[\w\-]+\.[\w\-]+/) # Check for valid e-mail address { $error_email = 'الرجاءالتأكد من إدخال البريد الإلكتروني الصحيح'; $error = 1; } if(length($QUERY{'username'}) < 3) { $error_user_name = 'اسم المستخدم لابد أن يكون أكثر من ثلاثة خانات'; $error = 1; } if(length($QUERY{'realname'}) < 3) { $error_display_name = 'الإسم المستخدم في الموقع لابد أن يكون أكثر من ثلاثة خانات'; $error = 1; } if($QUERY{'password1'} ne $QUERY{'password2'}) { # Make sure the two passwords they typed in match $error_password = 'الرمزان السريان غير متطابقان'; $error = 1; } else { if(length($QUERY{'password1'}) < 3) { $error_password = 'كلمة السر لابد أن تكون أكثر من ثلاثة خانات'; $error = 1; } else { $QUERY{'password'} = $QUERY{'password1'}; # Put matching passwords in hash and delete password 1 and 2 } } if ($error == 1) { LoadPage($error_email,$error_user_name,$error_password,$error_display_name,$error_country,$error_how); exit (0); } $dbh = AklaatDB::connect (); $dbh->do ('SET NAMES CP1256'); $dbh->do ('SET COLLATION_CONNECTION=CP1256_GENERAL_CI'); my $sql_username = AklaatDB::trim(AklaatDB::fix_quotes($QUERY{'username'})); my $sql_email = AklaatDB::trim(AklaatDB::fix_quotes($QUERY{'email'})); my $sql_realname = AklaatDB::trim(AklaatDB::fix_quotes($QUERY{'realname'})); my $userExist = $dbh->selectrow_array ("SELECT COUNT(*) FROM users WHERE username = '$sql_username'"); my $emailExist = $dbh->selectrow_array ("SELECT COUNT(*) FROM users WHERE email = '$sql_email'"); my $realnameExist = $dbh->selectrow_array ("SELECT COUNT(*) FROM users WHERE realname = '$sql_realname'"); my $usernum = $dbh->selectrow_array ("SELECT max(usernum) + 1 FROM users"); $error = 0; if (($userExist == 0) && ($emailExist == 0) && ($realnameExist == 0)) { if ($QUERY{'chkNewRecipes'} eq 'on') { $chkNewRecipes = 'y'; } else { $chkNewRecipes = 'n'; } if ($QUERY{'chkNewRates'} eq 'on') { $chkNewRates = 'y'; } else { $chkNewRates = 'n'; } if ($QUERY{'chkTips'} eq 'on') { $chkTips = 'y'; } else { $chkTips = 'n'; } my $sql_password = AklaatDB::trim(AklaatDB::fix_quotes($QUERY{'password'})); my $sql_country = AklaatDB::trim(AklaatDB::fix_quotes($QUERY{'country'})); my $sql_region = AklaatDB::trim(AklaatDB::fix_quotes($QUERY{'region'})); my $sql_how = AklaatDB::trim(AklaatDB::fix_quotes($QUERY{'how'})); $query = "INSERT INTO users (usernum, rights, active, email, username, password,date, realname,country, region, how, notify_recipes, notify_rates, notify_tips) "; $query .= "values ($usernum,'guest','yes','$sql_email','$sql_username','$sql_password',CURDATE(),'$sql_realname','$sql_country','$sql_region','$sql_how','$chkNewRecipes','$chkNewRates','$chkTips');"; $dbh->do ("$query"); } elsif ($userExist > 0) { $error_user_name = 'اسم المستخدم المختار محجوز الرجاء إختيار اسم مستخدم آّخر'; $error = 1; } elsif ($emailExist > 0) { $error_email = 'البريد الإلكتروني محجوز الرجاء إختيار بريد إلكتروني آخر'; $error = 1; } elsif ($realnameExist > 0) { $error_display_name = 'الاسم المختار محجوز الرجاء إختيار اسم آّخر'; $error = 1; } $dbh->disconnect(); if ($error == 0) { $emailcontent = "Account creation information.\nAn account with http://www.aklaat.com has been created under the following:\n\nUser Name: $QUERY{'username'}\nPassword: $QUERY{'password'}"; SendMail($SETTINGS{'returnemail'}, $QUERY{'email'}, 'Account Creation',$emailcontent); createCookies($sql_username, $sql_realname, $sql_email, "+3h"); } else { LoadPage($error_email,$error_user_name,$error_password,$error_display_name,$error_country,$error_how); } exit(0); } ############################################################# sub createCookies { my ($username, $userRealName, $email, $period, $redirectPage) = @_; my $usernameCookie = cookie (-name => "aklaat_user_name", -value => $username, -expires => $period); my $realnameCookie = cookie (-name => "aklaat_user_real_name", -value => $userRealName, -expires => $period); my $emailCookie = cookie (-name => "aklaat_user_email", -value => $email, -expires => $period); if ($QUERY{'filename'} ne '') { print redirect(-cookie => [ $usernameCookie, $realnameCookie, $emailCookie ], -url => "../rates/PostRate.pl?filename=$QUERY{'filename'}"); } else { print redirect(-cookie => [ $usernameCookie, $realnameCookie, $emailCookie ], -url => 'done_add.pl'); } } ############################################################# sub SendMail { my ($from, $to, $subject, $content) = @_; # Open The Mail Program open(MAIL,"|$mailprog -t"); print MAIL "To: $to\n"; print MAIL "From: $from\n"; print MAIL "Subject: $subject\n"; print MAIL "$content\n\n"; print MAIL "-" x 75 . "\n\n"; close (MAIL); } ############################################################ sub GetPostData { my (@pairs, $pair, $name, $value, $buffer, $x, %POST); read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; # Change all +'s to spaces $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; # Convert all Hex back to regular characters if($QUERY{'sub'} ne 'no') { $value =~ s/\/\>/g; $value =~ s/\|/\&\#124/g; $value =~ s/\=/\&\#61/g; $value =~ s/\r/
/g; # Replace hard returns $value =~ s/\n//g; # remove newlines $value =~ s/\cM//g; # remove ^M's } $POST{$name} = $value; } } ############################################################ sub LoadCountries { my($selection) = @_; my $dbh; my $sth; my $id; my $name; $dbh = AklaatDB::connect (); $dbh->do ('SET NAMES CP1256'); $dbh->do ('SET COLLATION_CONNECTION=CP1256_GENERAL_CI'); $sth = $dbh->prepare ("SELECT * FROM countries ORDER BY cn_name"); $sth->execute (); print < EOM if ($selection eq '0') { print <الرجاء اختيار البلد EOM } while (my $ref = $sth->fetchrow_hashref ()) { $id = $ref->{cn_id}; $name = $ref->{cn_name}; if ($selection eq $name) { print <$name EOM } else { print <$name EOM } } print ""; $sth->finish (); $dbh->disconnect (); }