Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-20-2001, 01:57 PM
jrwap's Avatar
jrwap jrwap is offline
 
Join Date: Oct 2001
Posts: 57
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I just installed a new script that works as a yahoo style directory. In order for some one to add a site, they need to fill in a valid emal address and username which is then saved in a database. I would like them to have to be a member in order for them to post. How can I do this?

I would like the add part of the script to check to see if they are a member, and send their username and password from vbulletin to the database for the directory. That way they can simply use their site wide user name and password to add more sites or edit them in the future.

Thanks,

-JRW
Reply With Quote
  #2  
Old 05-20-2001, 02:02 PM
MrLister's Avatar
MrLister MrLister is offline
 
Join Date: Oct 2001
Posts: 434
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

that could be done but not without letting someone look at the source and tweaking it. i did that once before for a similar kind of script
Reply With Quote
  #3  
Old 05-20-2001, 02:41 PM
jrwap's Avatar
jrwap jrwap is offline
 
Join Date: Oct 2001
Posts: 57
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, here is the code that I'm working with:

Code:
	$error=0;
	if($submit){

		// Validate the Site Name
		if(strlen(trim($SiteName)) < 10){
			$error = 1;
			$error_html .= "Site Name is invalid, (should be at least 10 characters in length).<br><br>\n";
		}
		if(strlen(trim($SiteName)) > 100){
			$error = 1;
			$error_html .= "Site Name is invalid, (should be less than 100 characters in length).<br><br>\n";
		}

		// Validate the Site URL
		if($auto_validate=="Y"){
			if(!$get_url=@fopen($SiteURL,"r")){
				$error = 1;
				$error_html .= "Site URL is invalid.<br><br>\n";
			}
		}

		// Validate the Description
		if(strlen(trim($Description)) > 255){
			$error = 1;
			$error_html .= "Description is invalid, (should be less than 255 characters in length).<br><br>\n";
		}
		if(strlen(trim($Description)) < 25){
			$error = 1;
			$error_html .= "Description is invalid, (should be at least 25 characters in length).<br><br>\n";
		}

		// Validate the Category
		if(!$Category){
			$error = 1;
			$error_html .= "Category selection is invalid.<br><br>\n";
		}

		// Validate the User Name
		if(strlen(trim($UserName)) < 5){
			$error = 1;
			$error_html .= "User Name is invalid, (should be at least 5 characters in length).<br><br>\n";
		}
		if(strlen(trim($UserName)) > 50){
			$error = 1;
			$error_html .= "User Name is invalid, (should be less than 50 characters in length).<br><br>\n";
		}
		
		// Validate the Email Address
		if(!ereg("^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}\$",$UserEmail)){
			$error = 1;
			$error_html .= "Email Address is invalid.<br><br>\n";
		}
		?>
		<table cellpadding="5" cellspacing="0" border="0">
			<tr>
				<td align="left" valign="top"><font size="<? echo $font_size;?>" face="<? echo $font_face;?>">
				<?
				if($error=="1"){
					echo "<br><font color=\"#FF0000\"><b>Your submission is incomplete for the following reasons:</b></font>";
					echo "<blockquote>".$error_html."</blockquote>\n";
					echo "Please <a href=\"javascript:history.go(-1)\">go back</a> and try again.";
				} else {
					$insert=mysql_query("insert into temp (SiteName,SiteURL,Description,Category,UserEmail,UserName) values ('$SiteName','$SiteURL','$Description','$Category','$UserEmail','$UserName')",$db);
					echo "<br>Submission Complete.  You site awaits a pending review before final submission into the database.<br><br>";
					echo "Here is the info you sent:";
					$find_cat=mysql_query("select * from categories where ID='$Category'",$db);
					$find_row=mysql_fetch_array($find_cat);
					$found_cat=$find_row[Category];
					echo "<blockquote><b>Site Name:</b> ".$SiteName."<br><br>\n<b>Site URL:</b> <a href=\"".$SiteURL."\" target=\"_blank\">".$SiteURL."</a><br><br>\n<b>Description:</b> ".$Description."<br><br>\n<b>Category:</b> ".eregi_replace("_"," ",$found_cat)."<br><br>\n<b>Email Address:</b> <a href=\"mailto:".$UserEmail."\">".$UserEmail."</a><br><br>\n<b>User Name:</b> ".$UserName."</blockquote>";
					$subject = "Site needs validating...";
					$content = "Site needs validating, go here: ".$base_url."/admin/";
					mail($owner_email,$subject,$content,"From: $UserEmail");
				}
				?>
				</font></td>
			</tr>
		</table>
<?
}
The part at the bottom is what I would like to know how to change.

Thanks again,

-JRW
Reply With Quote
  #4  
Old 05-20-2001, 03:03 PM
MrLister's Avatar
MrLister MrLister is offline
 
Join Date: Oct 2001
Posts: 434
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hmm i'm not very good at mysql connections but i can do basic. if you wish to use different username and passwords from vBB and have the users store stuff in a different database you would need two connections in there, another database and you'd have to edit the other database. sorry i can't help further because this is out of my reach.
Reply With Quote
  #5  
Old 05-21-2001, 03:10 PM
jrwap's Avatar
jrwap jrwap is offline
 
Join Date: Oct 2001
Posts: 57
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I really want everyone to have the same username and password site wide, even if it is stored exactly the same way in a different database. I just need to know how to check the given username and password against the vb database and then I should be able to same it in the directory database for future use.

-JRW
Reply With Quote
  #6  
Old 05-21-2001, 04:20 PM
Martz's Avatar
Martz Martz is offline
 
Join Date: Oct 2001
Location: UK
Posts: 156
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, afaik you wouldn't need to access the database again for the username and password as they should already be validated and have a cookie. This means that you only need to include the cookie function (where and whatever that may be) to check they are logged in, otherwise display a link so they can do a vB login and get the cookie required?

Also I think you need to make sure that the cookie is available to the entire domain, and not just vB.

Sorry i can't help more, but I think thats the approcahe you may need to take? Could someone confirm this or tell me I am wrong
Reply With Quote
  #7  
Old 05-21-2001, 11:05 PM
jrwap's Avatar
jrwap jrwap is offline
 
Join Date: Oct 2001
Posts: 57
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok let me try to explain what I need a little clearer. This directory script uses its own database. It asks for a username and and email address. The site is then added into the directory after the admin has ok'ed it. The user can go back into the directory and edit the site listing by entering the username and email address.

What I want the script to ask for a username and password. Then it will check it against the vbulletin database. If the username and passwrod match, they can be entered into the directory database. Then the script will simply check its own database if the user wants to edit the site listing.

I just need to know how to check a username and password against the vbulletin database before allowing the site into the directory. That way only registered users will be able to add to the directory.

Thanks,

-JRW
Reply With Quote
  #8  
Old 05-22-2001, 05:55 PM
jrwap's Avatar
jrwap jrwap is offline
 
Join Date: Oct 2001
Posts: 57
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anyone?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:06 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04374 seconds
  • Memory Usage 2,244KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete