dj scousey
Members-
Posts
18 -
Joined
-
Last visited
Never
About dj scousey
- Birthday 10/03/1986
Contact Methods
-
MSN
djscousey@scouselandonline.com
-
Website URL
http://www.scouselandradio.net
Profile Information
-
Gender
Male
-
Location
Lanzarote
dj scousey's Achievements
Newbie (1/5)
0
Reputation
-
Hi all, Im coming to my wits end here!! Right let me explain my situation: I have a shoutbox that i have made, by reading different tutorials; which has resulted in me having 2 different databases getting accessed. (one for logon and one for the shouts/smilies). I have my login script just how i want it now, and also my shout script too (apart from one thing) On the form which the users fill in to post a shout, i would like their email address already in the input value attribute. BUT.... i cant seem to do it, as once they are inside the main shoutbox, they are running off one database ($shouts) and the information i need is in the other database ($login). What i was THINKING was, is there anyway of making a seperate php file to grab the data from the $login database and echo it, and then put an include on my shoutbox input value attribute section?? the thing i got stuck with was, how does it know which email address to get... because i dont know how to cross reference between 2 different databases. any help would be greatly appreciated!!
-
currently it only displays 10 entries on the shoutpage. i know how to change it to show more than 10 entries, but the thing is, i dont know how to make it show e.g 15 entries per page.
-
Hi all, I have just created a shoutbox using PHP & MySQL. But what i want to do is, put a limit of 15 shouts on the box, and then anything more than that you can access by clicking Next Page/Prev Page. The code i have for the box is as follows: <html> <head><title>SLR - ShoutBox</title> <link href="default.css" rel="stylesheet" type="text/css"> <meta http-equiv="refresh" content="45"> <style type="text/css"> a:link {color: black; weight: bold;} a:visited {color: black; weight: bold;} a:active {color: black; weight: bold;} a:hover {color: red; weight: bold;} body {background-color: #BDD8F6;} .txtBox {boackground-color: #ffff99;}</style></head> <div align="left"> <table width="150" cellspacing="0" cellpadding="0" align="center" class="phpshout_table"> <tr><td class="phpshout_table"> <table border="0" border-color="#00CCFF"><tr><td bgcolor="#3399ff" width="174"> <center><b>ShoutBox</b></center> </td></tr></table> <form name="shout" method="post" action="shout.php"> <div align="left"> <input name="name" type="text" id="name" value="Name" size="25" maxlength="10" class="txtBox" onclick="this.value=''"> <input name="contact" type="text" id="contact" value="URL/Email" size="25" class="txtBox" onclick="this.value=''"> <input name="message" type="text" id="message" value="Message" size="25" onclick="this.value=''"> <font size="1px"><a href="admin.php"> Board Admin </a> <a href="javascript:this.location.reload();">Refresh</a></font> <input name="shout" type="submit" id="shout" value="Shout!" color="#33ccff"> </div> </form> </td> </tr> <?php session_start(); $l = mysql_connect ( "localhost" , "shoutuser" , "shoutuser" ) or die("Error connecting:<BR><BR>".mysql_error()); mysql_select_db( "shouts" ) or die("Error getting db:<BR><BR>".mysql_error()); function getShouts() { $query = mysql_query("SELECT * FROM shouts ORDER BY id DESC LIMIT 10") or die(mysql_error()); while ($row = mysql_fetch_array($query) ) { $name = stripslashes($row['Name']); $contact = stripslashes($row['Contact']); $shout = stripslashes($row['Shout']); if(empty($contact)) { echo '<p><span class="author"><b>'.$name.'</b></span> - <span class="shout">'.$shout.'</span></p>'; } else { echo '<tr border="1" border-color="#00CCFF"><td class="phpshout_posts"><p><a href="'.$contact.'" target="_blank"><strong>'.$name.'</strong></a></span> - <span class="shout">'.$shout.'</span></p></td></tr>'; } } ?> </td></tr> </table> </div> <?php } if ( isset ( $_POST['shout'] ) ) { $name = addslashes($_POST['name']); $contact = addslashes($_POST['contact']); $message = $_POST['message']; if ( ( isset($name) ) && ( isset($message) ) ) { // getting smilie list $smilies = mysql_query("SELECT * FROM smilies") or die(mysql_error()); while($get = mysql_fetch_array ($smilies)) { $alt = $get['Alt']; $smilie = $get['URL']; $message = str_replace( $get['Symbol'] , '<img src="smilies/'.$smilie.'" border="0" width="15" height="15" alt="'.$alt.'">' , $message); $themessage = addslashes($message); // replacing all smilies } mysql_query("INSERT INTO shouts (Name, Contact, Shout) VALUES ( '$name' , '$contact' , '$message' )") or die(mysql_error()); $_SESSION['has_posted'] = 'yes'; header("Location: shout.php"); // if required fields aren't empty, process into database } else { echo '<script>alert("Some fields were not filled out!");</script>'; header("Location: shout.php"); // if required fields were left empty, show an error dialog } }/* else { echo '<script>alert("Please follow the form to this page.");</script>'; header("Location: shout.php"); } /* STARTING THE MAIN SCRIPT NOW */ getShouts(); mysql_close($l); ?> </body></html> Any ideas?? Thanks
-
Have a look at this external query. Might shed some light on your problem. Click Here
-
nope, it wont print anything
-
Maybe the following... $city_name = $_GET['city']; $city = $db->get_row("SELECT * FROM cities WHERE CityName = '$city_name'");
-
The following code is what i have on my Actions on the "Login" button: on (release) { if(userName.length > 0 && userPassword.length > 0) { myVars = new LoadVars(); myVars.username = userName.text myVars.pass = userPassword.text myVars.action = 'login'; myVars.sendAndLoad(php_file, myVars, 'POST'); myVars.onLoad = function() { if(!this.error && this.user > 0) { _root.gotoAndStop('registered'); } else { _root.gotoAndStop('no_registered'); } userName.selectable = true; userPassword.selectable = true; loginButton.enabled = true; } userName.selectable = false; userPassword.selectable = false; loginButton.enabled = false; } }
-
On the "Login" button i have the following Actions: on (release) { if(userName.length > 0 && userPassword.length > 0) { myVars = new LoadVars(); myVars.username = userName.text myVars.pass = userPassword.text myVars.action = 'login'; myVars.sendAndLoad(php_file, myVars, 'POST'); myVars.onLoad = function() { if(!this.error && this.user > 0) { _root.gotoAndStop('registered'); } else { _root.gotoAndStop('no_registered'); } userName.selectable = true; userPassword.selectable = true; loginButton.enabled = true; } userName.selectable = false; userPassword.selectable = false; loginButton.enabled = false; } }
-
nope, nothing shows. try yourself, i dont mind giving out username and passwords at this present time, as it is all still W.I.P http://www.scouselandfusion.com/viparea.html DJScousey amateur1
-
not sure if its of any use to you, but maybe the following would be better? <?php $sql = "SELECT * FROM cities where city_name='münchen'" echo $sql; ?>
-
Ok, i have entered that code into my user.php file. Then i tried to log into my password protected area, but i am still getting the "Invalid username or password" and that is all... would having the login script in flash cause effect as to why i am not being able to see the query result??¿¿??
-
**** sorry for all this messing about.
-
Ok, so i have replaced the previous code with the one above, but i dont understand where exactly i am going to be "seeing" my query result. I'm totally confuzzled now... its racking my brain..... ??? :-\
-
function login($username,$pass) { global $db,$table; $username = trim($username); $pass = md5(trim($pass)); $query = mysql_query("SELECT * FROM $table WHERE userName = '$username' AND userPassword = '$pass'"); return mysql_num_rows($query); } i presume you mean the above code, fenway? That is the code that it uses to check the users credentials in the database. Then the following code then decides if the password is right to point send the user to the next page, and if incorrect not to send the user, and so on. if(isset($HTTP_POST_VARS["action"])) { switch($HTTP_POST_VARS["action"]) { case "register": $result = register($HTTP_POST_VARS['username'],$HTTP_POST_VARS['pass'],$HTTP_POST_VARS['email'],$HTTP_POST_VARS['question'],$HTTP_POST_VARS['answer']); print $result; break; case "login": $result = login($HTTP_POST_VARS['username'],$HTTP_POST_VARS['pass']); print "user=" . $result; break; case "forget": $result = forget($HTTP_POST_VARS['email']); print $result; break; case "new_password": $result = new_password($HTTP_POST_VARS['username'],$HTTP_POST_VARS['email'],$HTTP_POST_VARS['answer']); print $result; break; } } ?> Thanks
-
Still no joy im afraid. I have changed all the GLOBAL scenes to global but it still wont let me. On the flash file i have it running through, it allows me to register and then it says i am able to login also. But when i come to login, i get the error: "invalid username or password" . I dont understand why it allows me to go to the Registration Complete page without the data being placed into the DB. www.scouselandfusion.com/viparea.html (The page where it is) Thanks ???