close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Direct if Username exists using IP and date

Thread began 9/25/2011 10:58 pm by ijk76319396 | Last modified 9/26/2011 4:04 pm by Jason Byrnes | 776 views | 5 replies |

ijk76319396

Direct if Username exists using IP and date

I want to restrict usernames based on IP address and the date. Basically I want the code below to be entered following $loginUsername =

This is the code I want to be there I just don't know how to write it in the redirect if username exists context...

<?php echo((isset($_SERVER["REMOTE_ADDR"]))?$_SERVER["REMOTE_ADDR"]:"") ?>_<?php echo date("Ymd")?>



This is the entire script...

<?php
// *** Redirect if username exists
$MM_flag="MM_insert";
if (isset($_POST[$MM_flag])) {
$MM_dupKeyRedirect=$_POST['website'];
$loginUsername = NEED TO KNOW WHAT TO PUT HERE???
$LoginRS__query = sprintf("SELECT voterIP FROM points WHERE voterIP=%s", GetSQLValueString($loginUsername, "text"));
mysql_select_db($database_con2com, $con2com);
$LoginRS=mysql_query($LoginRS__query, $con2com) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);

//if there is a row in the database, the username was found - can not add the requested username
if($loginFoundUser){
$MM_qsChar = "?";
//append the username to the redirect page
if (substr_count($MM_dupKeyRedirect,"?") >=1) $MM_qsChar = "&";
$MM_dupKeyRedirect = $MM_dupKeyRedirect . $MM_qsChar ."requsername=".$loginUsername;
header ("Location: $MM_dupKeyRedirect");
exit;
}
}?>
Sign in to reply to this post

Jason ByrnesWebAssist

this line:

php:
$loginUsername = NEED TO KNOW WHAT TO PUT HERE???



should be something similar to this:

php:
$loginUsername = "".((isset($_SERVER["REMOTE_ADDR"]))?$_SERVER["REMOTE_ADDR"]:"") ."_".date("Ymd")."";
Sign in to reply to this post

ijk76319396

That works and it goes into the database correctly but the redirect feature doesn't work allowing for duplicate entries and no redirection. I don't know if it is because the insert record is based upon the "before page load" or what the issue is. I have attached the page file, hopefully you can see what the problem is.

Attached Files
member_profile_IN.zip
Sign in to reply to this post

Jason ByrnesWebAssist

to troubleshoot, change line 17:

php:
$LoginRS=mysql_query($LoginRS__query, $con2com) or die(mysql_error());




to:

php:
echo("dupe check = ".$LoginRS__query."br/>");
$LoginRS=mysql_query($LoginRS__query, $con2com) or die(mysql_error());




and 51:

php:
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());




to:

php:
die("Insert = ".$WA_Sql);
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());



report back the sql statements this writs to the screen

Sign in to reply to this post

ijk76319396

The screen shows up and reads: Insert=

Sign in to reply to this post

Jason ByrnesWebAssist

I have created a support ticket so we can look into this issue further.

To view and edit your support ticket, please log into your support history:
supporthistory.php

If anyone else is experiencing this same issue, please append to this thread.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...