View Full Version : My new website needs your help.
queerfm
07-15-2006, 10:53 AM
Hi guys i have kinda finished my new website just have to link the pages.
But i need some help the new website is at http://www.queerfm.net/newwebsite/
i have to typs of templates people can look at http://www.queerfm.net/newwebsite/templates/blue/
the header where the image saying Queer FM putting unity back into community right up the top is what i need help i want that to go back to the index page of the template the user is on however the header is in this folder
http://www.queerfm.net/newwebsite/header/head.html
so is there away i can make is link to the correct template that the user is using?
at the moment it takes them to the defualt template
Thanks
queerfm
07-15-2006, 07:15 PM
Please help
This would probably be done server-side.
queerfm
07-15-2006, 10:09 PM
dam twey your php my-sql code does not work
Thanks bud once you get this working ill test it out to make sure also ill list your site on our website.
Thanks mate
Even the latest? I tested that one... What's the error?
queerfm
07-16-2006, 08:47 AM
go to http://www.queerfm.net/login.php and you will see
queerfm
07-16-2006, 08:48 AM
i think you are not calling the MYSQL
on line 95
jr_yeo
07-16-2006, 09:08 AM
Parse error: syntax error, unexpected T_IF, expecting ')' in /home/queerfm/public_html/login.php on line 95
ur missing an ' ) ' somewhere in the login.php script :D i think :p
queerfm
07-16-2006, 10:33 AM
i know but where looked everywhere
jr_yeo
07-16-2006, 11:07 AM
could u link to me the login.php here ? :p
let me see :D
queerfm
07-16-2006, 01:27 PM
the script is at this website
http://www.twey.co.uk/?q=loginscript
Er, your link gives me a 404?
queerfm
07-16-2006, 10:43 PM
yes i know i just updated the site to the new templates so all old pagers where deleted sorry.
Ill make a file called login ill post the URL on here if you need it give in 5 min
jr_yeo
07-17-2006, 04:45 AM
could u post ur copy of the login.php script here? :p
dunno if this would help :D
queerfm
07-18-2006, 12:13 PM
<?php session_start(); $userstable = 'users'; mysql_pconnect('localhost', 'username', 'password'); mysql_select_db('database'); function is_email($email) { $qtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]'; $dtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]'; $atom = '[^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+'; $quoted_pair = '\\x5c\\x00-\\x7f'; $domain_literal = "\\x5b($dtext|$quoted_pair)*\\x5d"; $quoted_string = "\\x22($qtext|$quoted_pair)*\\x22"; $domain_ref = $atom; $sub_domain = "($domain_ref|$domain_literal)"; $word = "($atom|$quoted_string)"; $domain = "$sub_domain(\\x2e$sub_domain)*"; $local_part = "$word(\\x2e$word)*"; $addr_spec = "$local_part\\x40$domain"; return preg_match("!^$addr_spec$!", $email); } function head($title) { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title><?php echo($title); ?></title> <style type="text/css"> label { display: block; } label.registerError { border: 1px solid red; } span.registerError { font-weight: bold; color: red; } </style> </head> <body> <?php } function foot() { ?> </body> </html> <?php } function logout() { session_destroy(); setcookie('nick', '', time() - 50); setcookie('pass', '', time() - 50); header('Location: http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']); } function loginForm() { head("Log In"); ?> <form action="<?php echo($PHP_SELF); ?>" method="post"> <p> <label> Username: <input type="text" name="nick"> </label> <label> Password: <input type="password" name="pass"> </label> <label> Remember me? <input type="checkbox" name="rem" value="true"> </label> <label> <input type="submit" value="Log in"> </label> <a href="<?php echo($PHP_SELF); ?>?register">Register</a> </p> </form> <?php foot(); } function login() { global $userstable, $key; $data = isset($_POST['nick']) ? $_POST : $_COOKIE; $nick = mysql_real_escape_string($data['nick']); $pass = isset($_POST['nick']) ? md5($data['pass']) : $data['pass']; $rs = mysql_query("select * from $userstable where nick='$nick' and password='$pass' limit 1;"); if(mysql_num_rows($rs) === 0) die(noSuchUser()); else { $row = mysql_fetch_array($rs); $_SESSION['userid'] = $row['id']; $nextweek = time() + (7 * 24 * 60 * 60); $_SESSION['nick'] = $row['nick']; $_SESSION['pass'] = $row['password']; $_SESSION['email'] = $row['email']; if(isset($_POST['rem'])) { setcookie('nick', $_SESSION['nick'], $nextweek); setcookie('pass', $_SESSION['pass'], $nextweek); } } } function noSuchUser() { head('Error: User Doesn\'t Exist'); ?> <h1>Error: User Doesn't Exist</h1> <p> The username/password combination you have entered is not in our database. Please check that you have entered your username and password correctly. If you have not yet registered, you may do so <a href="<?php echo($PHP_SELF); ?>?register">here</a>. </p> <?php foot(); } function registerForm($vals = array('', '', ''), $errors = array()) { head("Register"); ?> <form action="<?php echo($PHP_SELF); ?>" method="post"> <p> <label<?php if(isset($errors[0])) echo(' class="registerError"'); ?>> Username: <input type="text" name="nick" value="<?php echo(htmlentities($vals[0])); ?>"> <span class="registerError"> <?php if(isset($errors[0])) echo($errors[0]); ?> </span> </label> <label<?php if(isset($errors[1])) echo(' class="registerError"'); ?>> Password: <input type="password" name="pass" value="<?php echo(htmlentities($vals[1])); ?>"> <span class="registerError"> <?php if(isset($errors[1])) echo($errors[1]); ?> </span> </label> <label<?php if(isset($errors[2])) echo(' class="registerError"'); ?>> Email: <input type="text" name="email" value="<?php echo(htmlentities($vals[2])); ?>"> <span class="registerError"> <?php if(isset($errors[2])) echo($errors[2]); ?> </span> </label> <label> <input type="hidden" name="register" value="true"> <input type="submit" value="Register"> </label> </p> </form> <?php foot(); } function register() { global $userstable; $nick = mysql_real_escape_string($_POST['nick']); $pass = $_POST['pass']; $email = mysql_real_escape_string($_POST['email']); if(mysql_num_rows(mysql_query("select * from $userstable where nick='$nick';"))) die(userExists($_POST['nick'])); $errArr = array( empty($_POST['nick']) ? 'Username must not be empty' : null, empty($_POST['pass']) ? 'Password must not be empty' : null, empty($_POST['email']) ? 'Email must not be empty' : null ); $valArr = array( $_POST['nick'], '', // We don't restore the user's password value, since this is the default in most browsers, and the user will expect it. $_POST['email'] ); if(strlen($_POST['nick']) > 20) $errArr[0] = 'Username cannot be longer than 20 characters'; if(strlen($_POST['pass']) < 7) $errArr[1] = 'Password must be longer than 7 characters'; if(empty($errArr[2]) && !is_email($_POST['email'])) $errArr[2] = 'This is not a valid email address'; for($i = 0; $i < count($errArr); $i++) if(!empty($errArr[$i])) die(registerForm($valArr, $errArr)); $pass = md5($pass); // Actual registration mysql_query("insert into $userstable (nick, password, email) values ('$nick', '$pass', '$email');") or die(mysql_error()); login(); } function userExists($nick) { head('Error: User Already Exists'); ?> <h1>Error: User Already Exists</h1> <p> The username "<?php echo(htmlentities($nick)); ?>" already exists in our database. Please check that you have entered your username and password correctly. </p> <?php foot(); } function validateUser() { global $userstable; $id = $_SESSION['userid']; $nick = mysql_real_escape_string($_SESSION['nick']); $pass = mysql_real_escape_string($_SESSION['pass']); $email = mysql_real_escape_string($_SESSION['email']); $rs = mysql_query("select * from $userstable where id=$id and nick='$nick' and password='$pass' and email='$email' limit 1;") or die(mysql_error()); if(!mysql_num_rows($rs)) die(loginForm()); } if(isset($_GET['logout'])) logout(); else if(isset($_GET['register'])) die(registerForm()); else if(isset($_POST['register'])) register(); else if(!isset($_SESSION['nick']) && !isset($_POST['nick']) && !isset($_COOKIE['pass'])) die(loginForm()); else if(!isset($_SESSION['nick']) && (isset($_POST['nick']) || isset($_COOKIE['pass']))) login(); else validateUser(); ?>
thats what the code look like when you get it off his site all on 1 line
Ugh, that's not nice. I think I'll put the code in a seperate file.
Anyway...
Ill make a file called login ill post the URL on here if you need it give in 5 minWhere is it? :-\
queerfm
07-18-2006, 03:44 PM
go to http://www.queerfm.net/login/index.php
jr_yeo
07-18-2006, 04:47 PM
I think I'll put the code in a seperate file.
where is it? :D
queerfm
07-18-2006, 05:00 PM
Thats it that is what it tell me whe i go to that address
Ah... line 1 :)
Use this code (http://www.twey.co.uk/includes/loginscript.phps.txt), which should paste properly. Then we can see where the error really is.
where is [the code]?http://www.twey.co.uk/?q=loginscript :) There's a "Download" link near the bottom.
queerfm
07-18-2006, 10:46 PM
ok sp far thats working however can you make a database that we can uplooad to the server, its just a lot easyer and beter Thanks
queerfm
07-18-2006, 10:49 PM
I tested it and its up but know the database is not working please help
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and nick='russell' and password='russell' and email='' limit 1' at line 1
can you make a database that we can uplooad to the server, its just a lot easyer and beter ThanksNot really, no. Uploading data directly to the MySQL server is possible, but it would require root access, and is a lot trickier than just executing one line of SQL. The script could be modified to create its own environment, though.
I'm unable to reproduce the error. Can you tell me the line number on which it occurs, and your MySQL version?
queerfm
07-19-2006, 06:35 PM
mate your wrong i made it work just i don't think i did it 100% right here is what i placed in a text file.
--
-- Table structure for table `usres`
--
CREATE TABLE `usres` (
`ID` int(4) NOT NULL auto_increment,
`nick` text(20) NOT NULL default '',
`password` text(100) NOT NULL default '',
`email` text(0) NOT NULL default '',
PRIMARY KEY (`ID`)
) ENGINE=MyISAM AUTO_INCREMENT=0 ;
then i uploaded it and it workds just does not seem to save people info when they sign up. so i can't login i.e. i signup as russell password gti0112 but it says user does not exits.
Please help. have you tested this on you sever if you need a sever to test it on please just ask i resell a lot of hosting space and if you can set up my login section that would be GREAT.
have you tested this on you severYes, that's why it's confusing me :)
Well, that looks like the output of a mysqldump to me. mysqldump merely generates code to reconstruct the said database. If you do the same with a text file containing the sample construction code as you did with that, it would have the same effect. I leave it in text form because the two top MySQL interfaces (that I know of) are the standard command-line client and phpMyAdmin, both of which allow direct command entry. On the other hand, saving to a file and then uploading with phpMyAdmin takes longer, and may confuse the average user should they wish to change the name of the table (flexibility of which I attempted to build into the script). With the mysql command-line client, I don't believe provision is made for reading commands from a file, and the chain of shell commands required to cause the same effect may be difficult for some users (and is still more trouble than simply entering the command manually).
I see one error and one possible error with that SQL:
CREATE TABLE `usres` (
`ID` int(4) NOT NULL auto_increment,Firstly, the default table name is "users", not "usres". You can modify it if you wish, but make sure you change the $userstable variable in the script.
Secondly, the column name should be id, not ID. I don't use upper-case in MySQL tables or queries, because the queries aren't case-sensitive but the identifiers are, which I can never remember, so I just step around the whole issue by doing everything in lower-case. :)
Off-topic: incidentally, I noticed this when going through the mysql command-line client documentation to verify the above facts:
-U, --safe-updates Only allow UPDATE and DELETE that uses keys.
-U, --i-am-a-dummy Synonym for option --safe-updates, -U.
queerfm
07-23-2006, 10:31 PM
i am using this one i found some where i found two one that uses access database on ASP that i lke and would use if i could get it to work so people could join with out me having to add them one by one.
the second one is at http://www.queerfm.net/login2/
the only problem with this one is that there is no admin area that i can see who joined and edit there profiles also keep note on them.
Also one last thing thsi does not allow me to give them a different page on sign in like if his name is john he gets is own page.
where if rusty signs in he does NOT get johns page.
Well if any one can help and wants the scripts just ask. i got the queerfm.net/login2/ off of about.com
Sorry, I don't know ASP so I can't help you there.
queerfm
07-26-2006, 05:04 PM
no http://www.queerfm.net/login2/ in not asp its php
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.