kingdragonz Posted April 23, 2011 Posted April 23, 2011 help me about coding: <div align="left"> <tr> <td class="alt1" width="100%"> <if condition="is_array($navbits)"> <table cellpadding="0" cellspacing="0" border="0"> <tr valign="bottom"> <td><a href="#" onclick="history.back(1); return false;"><img src="$stylevar[imgdir_misc]/navbits_start.gif" alt="$vbphrase[go_back]" border="0" /></a></td> <td width="100%"><span class="navbar"><a href="$vboptions[forumhome].php$session[sessionurl_q]" accesskey="1">$vboptions[bbtitle]</a></span> $navbits[breadcrumb]</td> </tr> <tr> <td class="navbar" style="font-size:10pt; padding-top:1px" colspan="3"><if condition="$_SERVER['REQUEST_METHOD'] == 'POST'"><img class="inlineimg" src="$stylevar[imgdir_misc]/navbits_finallink_$stylevar[textdirection].gif" alt="" border="0" /><else /><a href="$navbar_reloadurl"><img class="inlineimg" src="$stylevar[imgdir_misc]/navbits_finallink_$stylevar[textdirection].gif" alt="$vbphrase[reload_this_page]" border="0" /></a></if> <strong>$navbits[lastelement]</strong></td> </tr> </table> <else /> <br> </br> </if> </td> <table cellpadding="0" cellspacing="0" border="0" width="20%" align="right"> <tr align="left"> <if condition="$show['member']"> <td class="alt2" nowrap="nowrap"> <div class="smallfont"> <strong><phrase 1="$bbuserinfo[username]" 2="member.php?$session[sessionurl]u=$bbuserinfo[userid]">$vbphrase[welcome_x_link_y]</phrase></strong><br /> <phrase 1="$pmbox[lastvisitdate]" 2="$pmbox[lastvisittime]">$vbphrase[last_visited_x_at_y]$vbphrase[threads]</phrase> <if condition="$show['notifications']"> <div><span id="notifications"><a href="usercp.php$session[sessionurl_q]">$vbphrase[your_notifications]:</a> <strong>$notifications_total</strong></span></div> <if condition="$show['popups']"> <script type="text/javascript"> vBmenu.register("notifications"); </script> <else /> <script type="text/javascript" src="clientscript/vbulletin_notifications_nopopups.js?v=$vboptions[simpleversion]"></script> <script type="text/javascript"> vBulletin.register_control("vB_Notifications_NoPopups", "notifications"); </script> </if> <else /><if condition="$show['pmstats']"> <div><phrase 1="$vbphrase[unread_x_nav_compiled]" 2="$vbphrase[total_x_nav_compiled]" 3="$session[sessionurl_q]">$vbphrase[private_messages_nav]</phrase></div> </if></if> <if condition="$show['pmwarning']"><div><strong><phrase 1="$vbphrase[pmpercent_nav_compiled]">$vbphrase[your_pm_box_is_x_full]</phrase></strong></div></if> </div> </td> <else /> <td class="alt2" nowrap="nowrap" style="padding:0px"> <!-- login form --> <form action="login.php?do=login" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, $show[nopasswordempty])"> <script type="text/javascript" src="clientscript/vbulletin_md5.js?v=$vboptions[simpleversion]"></script> <table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0"> <tr> <td class="smallfont" style="white-space: nowrap;"><label for="navbar_username">$vbphrase[username]</label></td> <td><input type="text" class="bginput" style="font-size: 11px" name="vb_login_username" id="navbar_username" size="10" accesskey="u" tabindex="101" value="$vbphrase[username]" onfocus="if (this.value == '$vbphrase[username]') this.value = '';" /></td> <td class="smallfont" nowrap="nowrap"><label for="cb_cookieuser_navbar"><input type="checkbox" name="cookieuser" value="1" tabindex="103" id="cb_cookieuser_navbar" accesskey="c" />$vbphrase[remember_me]</label></td> </tr> <tr> <td class="smallfont"><label for="navbar_password">$vbphrase[password]</label></td> <td><input type="password" class="bginput" style="font-size: 11px" name="vb_login_password" id="navbar_password" size="10" tabindex="102" /></td> <td><input type="submit" class="button" value="$vbphrase[log_in]" tabindex="104" title="$vbphrase[enter_username_to_login_or_register]" accesskey="s" /></td> </tr> </table> <input type="hidden" name="s" value="$session[sessionhash]" /> <input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" /> <input type="hidden" name="do" value="login" /> <input type="hidden" name="vb_login_md5password" /> <input type="hidden" name="vb_login_md5password_utf" /> </form> <!-- / login form --> </td> </if> </tr> </table></tr></table> <br /><br /><br /> <table border="0" cellspacing="0" cellpadding="0" width="50px"> <tr align="left"> <if condition="$show['member']"> <right><td class="vbmenu_control"><a href="login.php?$session[sessionurl]do=logout&logouthash=$bbuserinfo[logouthash]" onclick="return log_out('$vbphrase[sure_you_want_to_log_out]')">$vbphrase[log_out]</a></td></right> </if> </table> </div></tr></table> $vbphrase[threads]: $totalthreads, $vbphrase[posts]: $totalposts, who can make like this:
jje Posted April 23, 2011 Posted April 23, 2011 You mean the design? Or the PHP? What is your question?
jje Posted April 23, 2011 Posted April 23, 2011 I personally found http://www.phpeasystep.com/phptu/6.html useful accomplishing this task
Guest Geoff Posted April 24, 2011 Posted April 24, 2011 Are you trying to use this in an application?
jje Posted April 24, 2011 Posted April 24, 2011 Unlike other languages such as ASP.NET, you do not need to compile PHP applications - you simply create a single file per page. In the tutorial I posted earlier, you need to create a few files: main_login.php - This will be similar to your second snapshot you posted earlier. check_login.php - This will not be a page, but simply handle the login information received from main_login.php. login_success.php - This will be similar to your first snapshot you posted earlier. But first, you need to create a MySQL Database and create/assign users to it. Learn more here. Then, in phpMyAdmin (click on the link in your cPanel home), click on your newly created database and click on the 'SQL' tab. In the box, paste: CREATE TABLE `members` ( `id` int(4) NOT NULL auto_increment, `username` varchar(65) NOT NULL default '', `password` varchar(65) NOT NULL default '', `posts` varchar(65) NOT NULL default '', `thread` varchar(65) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=2; To insert a new user: INSERT INTO `members` VALUES (1, 'john', '1234', '0', '0'); Create a new file called 'check_login.php' and paste in via Code Edit: <?php $host="localhost"; // Host name $username=""; // Mysql username $password=""; // Mysql password $db_name="test"; // Database name $tbl_name="members"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // username and password sent from form $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; // To protect MySQL injection (more detail about MySQL injection) $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" session_register("myusername"); session_register("mypassword"); header("location:login_success.php"); } else { echo "Wrong Username or Password"; } ?> Replace the value of $username $password $db_name with the correct info. Username and DB_Name should be prefixed with your cPanel username. Rename the page with screenshot 1 to login_success.php. Then Code Edit it. Add this to the very top of the page: <? session_start(); if(!session_is_registered(myusername)){ header("location:main_login.php"); } ?> Then replace the username with <?php echo $_SESSION['username']; ?> Rename the page with screenshot 2 to main_login.php. Then Code Edit it. Wrap the two input/text boxes with... <form method=post action=check_login.php> ... Then add the attributes to the text box and password field: name=username name=password If you wish to create a forum, follow the tutorial at: http://www.phpeasystep.com/phptu/12.html
jje Posted April 24, 2011 Posted April 24, 2011 What do you mean by compile? What do you wish to do? Or do you want me to make a working login for you?
jje Posted April 24, 2011 Posted April 24, 2011 I don't understand. What are the snapshots you have just posted for? What question would you like me to answer? What do you want me to do?
kingdragonz Posted April 24, 2011 Author Posted April 24, 2011 Oplet.us make login.php oplet like Slowbos forum
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now