How to check for user and email match..?

i have a script which emails temporary download link… the user have to enter the email… this email page is only available to logeed in users… nw i want it to check if the emal entered matches with the users email given when registering… pls help… Additional Details i also wanna let u knw that i use sql to keep the user data… and i use “secure” from as a user account management system… pls help…

what is your database table structure?

you need to run a query that checks the email against the email address of the logged in user based on the cookie/session

actuallyy im very new to php and programming… i dnt understand this much… how can i tell what my table structure is…?? pls help…??

if you have access to phpmyadmin you can see what your structure is from there, if your using cpanel you’ll have phpmyadmin available, most host provide this.

here is an answer someone gave me when i ask the question somewhere else…
but the question is how can i tell it … from what database to check…i mean like database name… host…password… and email colunm and all that…???

Assuming you have your mysql columns like: user | email an array variable $results which retrieves all the info from the user after signing in and $formEmail which is the email entered by the user, this is an example:

$email = $results[‘email’]; //email from mysql corresponding to the current user
$formEmail = $_POST[‘email’]; //email entered in the form, which should be the same as $email

if($formEmail == $email) {
//email address is a match
} else {
//addresses do not match


im trying to check my database structure…

ok when i open the database from phpmyadmin this is what i see.

[table][tr][td]Database [/td] [/tr] [tr] [td] information_schema [/td] [/tr] [tr] [td] secure1234 [/td] [/tr] [tr] [td]Total: 2

[/td][/tr][/table]and when i take the secure1234 database … here is what comes… pls help…\


[/td] [td]Table[/td] [td][/td][td][/td][td][/td][td][/td][td][/td][td] Action [/td] [td]Records [/td] [td]Type[/td] [td]Collation[/td] [td]Size[/td] [td]Overhead[/td] [/tr] [tr] [td][/td] [td]secure_groups [/td] [td][center][/center][/td] [td][center] [/center][/td] [td][center][/center][/td] [td][center] [/center][/td] [td][center][/center][/td] [td][center] [/center][/td] [td]4[/td] [td]MyISAM[/td] [td]utf8_general_ci[/td] [td]3.2 KiB[/td] [td]-[/td] [/tr] [tr] [td][/td] [td]secure_group_members [/td] [td][center][/center][/td] [td][center] [/center][/td] [td][center][/center][/td] [td][center] [/center][/td] [td][center][/center][/td] [td][center] [/center][/td] [td]12[/td] [td]MyISAM[/td] [td]utf8_general_ci[/td] [td]2.1 KiB[/td] [td]-[/td] [/tr] [tr] [td][/td] [td]secure_preferences [/td] [td][center][/center][/td] [td][center] [/center][/td] [td][center][/center][/td] [td][center] [/center][/td] [td][center][/center][/td] [td][center] [/center][/td] [td]1[/td] [td]InnoDB[/td] [td]utf8_general_ci[/td] [td]16.0 KiB[/td] [td]-[/td] [/tr] [tr] [td][/td] [td]secure_users [/td] [td][center][/center][/td] [td][center] [/center][/td] [td][center][/center][/td] [td][center] [/center][/td] [td][center][/center][/td] [td][center] [/center][/td] [td]8[/td] [td]MyISAM[/td] [td]utf8_general_ci[/td] [td]4.0 KiB[/td] [td]-[/td] [/tr] [tr][td]
[/td] [td][center] 4 table(s) [/center][/td] [td][/td][td][/td][td][/td][td][/td][td][/td][td][center] Sum[/center][/td] [td]25[/td] [td][center] MyISAM[/center][/td] [td][center] utf8_general_ci[/center][/td] [td]25.3 KiB[/td] [td]0 B[/td][/tr][/table]

looking at your tables it could either be secure_group_members or secure_users that the script will need to check the email address in.

the code you’ve been provided with looks logical $emailwould be the email address from the database and $formEmail would the email address provided by the user.

if you can post your script so far I should be able to help you better.

this is the original script that generates the expiring link… and after this one its the script that manages the emailin part… as i cannot post the full link at once here is the part one…


<?php // ************************************************************************************************** // Linklok URL V2.01 // Copyright (c) 2003-2008 Vibralogix // // [email protected] // You are licensed to use this product on one domain only. // Please contact us for extra licenses if required. // ************************************************************************************************** // General settings $LinklokKey=""; // Set to random string used to encrypt links $LinklokLocation=""; // Location where files are securely stored $ManualPassword=""; // password used to access manual entry form $ErrorTemplate=""; // Optional error page template (html) // The following variables must be set if you wish to use the email links feature of Linklok $YourCompany=""; // Your company name $YourEmail=""; // Your email address $EmailTemplate=""; // Optional html or text format email template $HTMLEmail="Y"; // Set to Y to send the default email in HTML formator N to send in text format $LinklokLog=""; // Optional text log file to store form entry fields $NotifyEmail=""; // Optional email template sent to admin. Leave blank for default template $LinklokDownloadLog=""; // Optional text log to store downloads $RequireTuring=0; // Set to 1 to use Turing code. Set to 0 to disable $NotifyDownloadEmail=""; // Email address to receive download notificaton email // Optional list of email addresses / services to block if required. You can add delete from this list $FreeEmail[]="yahoo."; $FreeEmail[]="hotmail."; $FreeEmail[]="gmail."; $FreeEmail[]="altavista."; $FreeEmail[]="prontomail."; $FreeEmail[]="talk21."; $FreeEmail[]="address."; $FreeEmail[]="@mail."; $FreeEmail[]="@australia."; $FreeEmail[]="boardermail."; $FreeEmail[]="@canada."; $FreeEmail[]="bolt."; $FreeEmail[]="dbzmail."; $FreeEmail[]="etoast."; $FreeEmail[]="fastmail."; $FreeEmail[]="freemail."; $FreeEmail[]="icqmail."; $FreeEmail[]="jaydemail."; $FreeEmail[]="keromail."; $FreeEmail[]="linuxmail."; $FreeEmail[]="lycos."; $FreeEmail[]="myrealbox."; $FreeEmail[]="netscape."; $FreeEmail[]="popmail."; $FreeEmail[]="themail."; $FreeEmail[]="toast."; $FreeEmail[]="webcity."; // Supported mime types. These are only required for displaying these file types inline. // Linklok can download any file type using the Save As dialog box in the browser. // You can add to this list as required. $mt['.jpg']="image/jpeg"; $mt['.gif']="image/gif"; $mt['.cgm']="image/cgm"; $mt['.gif']="image/gif"; $mt['.htm']="text/html"; $mt['.html']="text/html"; $mt['.txt']="text/plain"; $mt['.pdf']="application/pdf"; $mt['.mpg']="video/mpeg"; $mt['.mpeg']="video/mpeg"; $mt['.rm']="audio/x-pn-realaudio"; $mt['.wmv']="application/x-ms-wmv"; $mt['.swf']="application/x-shockwave-flash"; $mt['.mov']="video/quicktime"; $mt['.asf']="video/x-ms-asf"; $mt['.asx']="video/x-ms-asf"; $mt['.rm']="audio/x-realaudio"; $mt['.ram']="audio/x-pn-realaudio"; $mt['.zip']="application/zip"; // Code beloe this point should not need modifying /////////////////////////////////////////////////////////////////////////////////////////////////////// @error_reporting (E_ALL ^ E_NOTICE); if ($YourEmail!="") { if (!isset($EmailHeaderNoSlashR)) $EmailHeaderNoSlashR=1; if ((!isset($ExtraMailParam)) && (strtolower(@ini_get("safe_mode")) != 'on') && (@ini_get("safe_mode") != '1')) $ExtraMailParam="-f ".$YourEmail; @ini_set(sendmail_from,$YourEmail); } if (!empty($_GET)) while(list($name, $value) = each($_GET)) $$name = $value; if (!empty($_POST)) while(list($name, $value) = each($_POST)) $$name = $value; $found = false; if (!empty($_REQUEST)) { reset($_REQUEST); while (list($namepair, $valuepair) = each($_REQUEST)) { if ($namepair == "LinklokKey") $found = true; if ($namepair == "ManualPassword") $found = true; if ($namepair == "EmailTemplate") $found = true; if ($namepair == "LinklokLog") $found = true; if ($namepair == "LinklokDownloadLog") $found = true; if ($namepair == "YourEmail") $found = true; if ($namepair == "YourCompany") $found = true; if ($namepair == "RequireTuring") $found = true; if ($namepair == "AllowEmailOnce") $found = true; if ($namepair == "AllowIPOnce") $found = true; if (substr($namepair, 0, 15) == "LinklokLocation") $found = true; if (substr($namepair, 0, 9) == "FreeEmail") $found = true; } }

ok here is the link where u can see the script as it is very difficult to post the script here…

here is the link which generates the temporary link

and here is the link for the email form

thankx for ur kind help///

your welcome ,

I’m a little puzzled looking at the scripts you posted it appears that those scripts don’t use a database at all. or if it does I can’t see it anywhere

actualy the thing is that this script does not use a database… but my user management sytem “secure”… uses the database… and this linklok url can be used for two perporses… to generate a secure link… and it also has a feature to mail the secure link …instead of displaying it…
the thing is that… for security reason i want the link to be mailed… now when i set the link to mail it… the problem comes is that… it jux mail the link to what ever email address u enter… but rather i want it to see if the user has logged in and the email entered whould match with the email of the user on the database which the user gave while registering… i hope ytou understand… pls let me knw if u need more datails…

reallyy appriciate your help… thankxx

and i thought this might help you…
this is the script that i use to see if the user is logged in… and if the user is logged in it shows the user name and a link to log out…
and if the user is not logged in … it displays…“please login”,…

jux thought this might help you…
so here is the script

<?php // BEGIN: Secure Protection Code require_once("/var/chroot/home/content/86/5984986/html/secure/globals.php"); // END: Secure Protection Code ?> Untitled Document <?php if (isLoggedIn()) { ?>
            <?= $_SESSION[SECURE_SESSION_PREFIX . "name"]; ?></b></strong>  <a href="../secure/signOut.php" target="_top">Sign Out</a>                   
                 <?   } else { ?>                        
      Please <strong><?php  ?><a href="../secure/login.php?goTo=%2Fsite%2Findex.php" target="_top">Sign in</a>                   
      <?php } ?>

thanks for the scripts,

if you have a session similar to $_SESSION[SECURE_SESSION_PREFIX . “name”] for the userid to identify the user then you could use that in a query.

[php]$sql = mysql_query(“SELECT username, email FROM table WHERE email=’$email’ AND userid=’”.$_SESSION[SECURE_SESSION_PREFIX . “id”].’" ")or die(mysql_error());
$n = mysql_num_rows($sql);
if($n != 0){
//no match
} else {
//there is a match

thankx bro a lot… so how can i use it with the script… i mean the scriipt that i gave… how can i use that with myscript to see if the email matches and to mail the link…

include require_once("/var/chroot/home/content/86/5984986/html/secure/globals.php"); assuming this brings in the database connections ?

then open and add the following to line 893

[php]include require_once("/var/chroot/home/content/86/5984986/html/secure/globals.php");

$sql = mysql_query(“SELECT username, email FROM table WHERE email=’$email’ AND userid=’”.$_SESSION[SECURE_SESSION_PREFIX.“id”]."’ ")or die(mysql_error());
$n = mysql_num_rows($sql);
if($n != 0){
linklokShowMessage($ErrorTemplate,“The email address provided does not match the one we have on file.

Click your browsers BACK button and try again.”);
} [/php]

this should only allow users who match the email address in the database as long as they are logged in.

You’ll need to adjust the quest to match the names of your columns and sessions.

thanks bro alot… ill try this and ill let u knw what happens… thankzzzz

im realy sory bro… can u tell me what things in here i need to adjust the quest to match the names of mycolumns and sessions. realy sory about all this… i dnt understand any php thing… im totally new… but im trying to learn…

don’t worry about it, we all have to start somewhere.

I made a typo on my last post I meant query not quest sorry. can you post the contents of globals.php but remove any sensitive information like passwords ect I don’t need to see them.

I’m not sure which table your users info is stored in which ever table it is, is the table that will be used in the query.

here is the link from where u can download the user management system i use “secure”…but it needs another thing called formfield to run it… but i dnt think you will need that… that one is not free to download… but “secure” is free… still if u download secure u will be able to look at all of its contents…

okay looked through the files I think this is what you need;

$sql = mysql_query(“SELECT user_id, email FROM " . SECURE_TABLE_PREFIX . “users WHERE email=’$email’ AND user_id=’”.$_SESSION[SECURE_SESSION_PREFIX.“userId”].”’ ")or die(mysql_error());
$n = mysql_num_rows($sql);
if($n != 0){
linklokShowMessage($ErrorTemplate,“The email address provided does not match the one we have on file.

Click your browsers BACK button and try again.”);

Sponsor our Newsletter | Privacy Policy | Terms of Service