
Snooble
Members-
Posts
311 -
Joined
-
Last visited
Never
Everything posted by Snooble
-
please? can anyone help?
-
is there anyone that can help me?
-
Hey, I'm working on a battle script to use... I have all the stats in variables pulled from a mysql db... but i want to reveal the fight one turn at a time... the easiest way of doing this? Im guessing is to while(hp > 0) create an array with each turn in it turns['0'] etc... but how can i reveal them one by one to the user? javascript? Thanks ever so much Sam
-
Hello, This should be easy... here's the external script...: /* An object-oriented Typing Text script, to allow for multiple instances. A script that causes any text inside any text element to be "typed out", one letter at a time. Note that any HTML tags will not be included in the typed output, to prevent them from causing problems. Tested in Firefox v1.5.0.1, Opera v8.52, Konqueror v3.5.1, and IE v6. Browsers that do not support this script will simply see the text fully displayed from the start, including any HTML tags. Functions defined: TypingText(element, [interval = 100,] [cursor = "",] [finishedCallback = function(){return}]): Create a new TypingText object around the given element. Optionally specify a delay between characters of interval milliseconds. cursor allows users to specify some HTML to be appended to the end of the string whilst typing. Optionally, can also be a function which accepts the current text as an argument. This allows the user to create a "dynamic cursor" which changes depending on the latest character or the current length of the string. finishedCallback allows advanced scripters to supply a function to be executed on finishing. The function must accept no arguments. TypingText.run(): Run the effect. static TypingText.runAll(): Run all TypingText-enabled objects on the page. */ TypingText = function(element, interval, cursor, finishedCallback) { if((typeof document.getElementById == "undefined") || (typeof element.innerHTML == "undefined")) { this.running = true; // Never run. return; } this.element = element; this.finishedCallback = (finishedCallback ? finishedCallback : function() { return; }); this.interval = (typeof interval == "undefined" ? 100 : interval); this.origText = this.element.innerHTML; this.unparsedOrigText = this.origText; this.cursor = (cursor ? cursor : ""); this.currentText = ""; this.currentChar = 0; this.element.typingText = this; if(this.element.id == "") this.element.id = "typingtext" + TypingText.currentIndex++; TypingText.all.push(this); this.running = false; this.inTag = false; this.tagBuffer = ""; this.inHTMLEntity = false; this.HTMLEntityBuffer = ""; } TypingText.all = new Array(); TypingText.currentIndex = 0; TypingText.runAll = function() { for(var i = 0; i < TypingText.all.length; i++) TypingText.all[i].run(); } TypingText.prototype.run = function() { if(this.running) return; if(typeof this.origText == "undefined") { setTimeout("document.getElementById('" + this.element.id + "').typingText.run()", this.interval); // We haven't finished loading yet. Have patience. return; } if(this.currentText == "") this.element.innerHTML = ""; // this.origText = this.origText.replace(/<([^<])*>/, ""); // Strip HTML from text. if(this.currentChar < this.origText.length) { if(this.origText.charAt(this.currentChar) == "<" && !this.inTag) { this.tagBuffer = "<"; this.inTag = true; this.currentChar++; this.run(); return; } else if(this.origText.charAt(this.currentChar) == ">" && this.inTag) { this.tagBuffer += ">"; this.inTag = false; this.currentText += this.tagBuffer; this.currentChar++; this.run(); return; } else if(this.inTag) { this.tagBuffer += this.origText.charAt(this.currentChar); this.currentChar++; this.run(); return; } else if(this.origText.charAt(this.currentChar) == "&" && !this.inHTMLEntity) { this.HTMLEntityBuffer = "&"; this.inHTMLEntity = true; this.currentChar++; this.run(); return; } else if(this.origText.charAt(this.currentChar) == ";" && this.inHTMLEntity) { this.HTMLEntityBuffer += ";"; this.inHTMLEntity = false; this.currentText += this.HTMLEntityBuffer; this.currentChar++; this.run(); return; } else if(this.inHTMLEntity) { this.HTMLEntityBuffer += this.origText.charAt(this.currentChar); this.currentChar++; this.run(); return; } else { this.currentText += this.origText.charAt(this.currentChar); } this.element.innerHTML = this.currentText; this.element.innerHTML += (this.currentChar < this.origText.length - 1 ? (typeof this.cursor == "function" ? this.cursor(this.currentText) : this.cursor) : ""); this.currentChar++; setTimeout("document.getElementById('" + this.element.id + "').typingText.run()", this.interval); } else { this.currentText = ""; this.currentChar = 0; this.running = false; this.finishedCallback(); } } how does the funtion work? as i can only use the runALL function... and it's not what i want. Thank you in advance!... Sam
-
Hello, Just started using Microsoft Access 2007. Creating a fairly simple database containing my patients. I would like to create a search feature on the form page, allowing me to search for patients via their surname. The table name is Patients. The field is called Surname. I just need to know how to assign the text box to the sql statement. and use a WHERE command i guess? Thank you in advance! Sam
-
I need an image upload script of some kind. Also a quick run through on it. As i want to display thumbnail's in a table of every image. How would i do that? Thanks Snooble
-
Sorry if this sounds confusing, but i'll give it a shot! First of all... i have a link to an image : http://www.google.co.uk/logos/pavarotti.gif i have that link... i now need a thumbnail of it. Without storing the image on my site. Like hotlinking. But at a width and height of 50px. ----------------------------------------------------------------------------------- Also, I am pulling results from a table... one row at a time. I want it to display 5 on one page then put 5 on the next page etc. I think it's called pageination. so : << < 1 [b]2[/b] 3 4 5 6 > >> Something like that at the bottom with the correct amount of pages according to the results . Thanks alot if you can help! Snooble
-
[SOLVED] What's wrong with this small bit of code!?
Snooble replied to Snooble's topic in PHP Coding Help
you my sir, are a genious... Thank you! -
substr($col_value[0], 0, 10) . "...<a href='/idcomment.php'>(More)</a> It's only showing the first charactor. Then "... (More)". So output = T...(More) why? what have i done wrong.... if i echo out the $col_value i get a huge statement... "The time it took ..." Thanks Snoobs
-
I need to get the row count of a table. how can i do this? I believe there's an sql way? Thanks so much Snoobs
-
[SOLVED] Register Check, Easy, Just need another pair of eyes!
Snooble replied to Snooble's topic in PHP Coding Help
that works perfectly... thank you very much for all your help... it's a very customisable script too! thanks Snooble TOPIC SOLVED -
[SOLVED] Register Check, Easy, Just need another pair of eyes!
Snooble replied to Snooble's topic in PHP Coding Help
that give me an error: Warning: Invalid argument supplied for foreach() in C:\wamp\www\e\2\register.php on line 115 thanks... what now? Snoobs -
[SOLVED] Register Check, Easy, Just need another pair of eyes!
Snooble replied to Snooble's topic in PHP Coding Help
MadTechie... That looks good to me... but the output to the user looks like this: Array ( [0] => Please supply a username [1] => You entered an invalid password [2] => You entered an invalid email [3] => You entered a taken username [4] => You entered a taken email ) i dont want the Array nor the () bits. nor the [number] => bits. thanks though Snooble -
Hello everyone, I have a register submit form and a register check form. The register check form is supposed to send back what went wrong. and the register form is supposed to display the issues to the user. my registercheck.php file looks like this: <?php session_start(); $host="localhost"; $username="username"; $password="password"; $db_name="wezzsmusic"; $tbl_name="wmusers"; mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $errors = array(); if (empty($_POST['username'])) { $errors[] = 'Please supply a username'; } if (empty($_POST['password']) || strlen($_POST['password']) < 6) { $errors[] = 'You entered an invalid password'; } if (empty($_POST['email']) || strpos($_POST['email'], '@') === false) { $errors[] = 'You entered an invalid email'; } $check = "SELECT * FROM wmusers where username='".$_POST['username']."' LIMIT 1"; $checkresult = mysql_query($check); if (mysql_num_rows($checkresult) != 0) { $errors[] = 'You entered a taken username'; } $check2 = "SELECT * FROM wmusers where email='".$_POST['email']."' LIMIT 1"; $checkresult2 = mysql_query($check2); if (mysql_num_rows($checkresult2) != 0) { $errors[] = 'You entered a taken email'; } if (count($errors)) { header("Location: register.php"); exit; } else { $sql = "INSERT INTO wmusers VALUES ('0', '".$_POST['username']."', '".$_POST['password']."', '".$_POST['email']."', '0')"; mysql_query($sql) or die ("Couldn't execute $sql: " . mysql_error()); } ?> how would i send back the problems to register.php. I've never really worked with arrays. Thanks Snooble
-
<?php $errors = array(); if (empty($_POST['username'])) { $errors[] = 'Please supply a username'; } if (empty($_POST['password']) || strlen($_POST['password']) < 6) { $errors[] = 'You entered an invalid password'; } if (empty($_POST['email']) || strpos($_POST['email'], '@') === false) { $errors[] = 'You entered an invalid email'; } $check = "SELECT * FROM wmusers where username='".$_POST['username']."' LIMIT 1"; $checkresult = mysql_query($check); if (mysql_num_rows($checkresult) != 0) { $errors[] = 'You entered a taken username'; } $check2 = "SELECT * FROM wmusers where email='".$_POST['email']."' LIMIT 1"; $checkresult2 = mysql_query($check2); if (mysql_num_rows($checkresult2) != 0) { $errors[] = 'You entered a taken email'; } if (count($errors)) { header("Location: register.php"); exit; } else { $sql = "INSERT INTO wmusers VALUES ('0', '".$_POST['username']."', '".$_POST['password']."', '".$_POST['email']."', '0')"; mysql_query($sql) or die ("Couldn't execute $sql: " . mysql_error()); } ?> EDIT I need to know how to echo out the array of errors Snooble
-
Hello everyone... I'm almost there. I have 2 pages... one shows the register form, one is the check form. I want to have 2 pages... not one... heres the checkregister.php page <?php $errors = array(); if (empty($_POST['username'])) { $errors[] = 'Please supply a username'; } if (empty($_POST['password']) || strlen($_POST['password']) < 6) { $errors[] = 'You entered an invalid password'; } if (empty($_POST['email']) || strpos($_POST['email'], '@') === false) { $errors[] = 'You entered an invalid email'; } $check = "SELECT * FROM wmusers where username='".$_POST['username']."' LIMIT 1"; $checkresult = mysql_query($check); if (mysql_num_rows($checkresult) != 0) { $errors[] = 'You entered a taken username'; } $check2 = "SELECT * FROM wmusers where email='".$_POST['email']."' LIMIT 1"; $checkresult2 = mysql_query($check2); if (mysql_num_rows($checkresult2) != 0) { $errors[] = 'You entered a taken email'; } $_SESSION['errors'] = $errors[]; if (count($errors)) { header("Location: register.php"); exit; } else { $sql = "INSERT INTO wmusers VALUES ('0', '".$_POST['username']."', '".$_POST['password']."', '".$_POST['email']."', '0')"; mysql_query($sql) or die ("Couldn't execute $sql: " . mysql_error()); } ?> I need it to send the errors back to register.php how will i save them and output them on register.php... until they're all correct then it continues to the complete. Make sense? at the moment i cant get it to output the data to the first page when it header's. Thanks Snooble
-
looks good to be.. i'll implement your method now... thanks... topic solved THANK YOU EVER SO MUCH!
-
Hello everyone... I'll give you straight code -> I want this page to check if : username is taken or empty password is empty or less than 6 charactors email is taken, empty, or doesn't include @ if any of those are true, redirect to register.php and explain the error to the user whilst reposting the form for completion again. at the moment its going back to register. but entering the data into the table anyway. also not displaying errors to user. This is the registercheck.php page <?php session_start(); $host="localhost"; $username="username"; $password="password"; $db_name="wezzsmusic"; $tbl_name="wmusers"; mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $check = "SELECT * FROM wmusers where username='".$_POST['username']."' LIMIT 1"; $checkresult = mysql_query($check); if(mysql_num_rows($checkresult) != 0){ header("Location: register.php"); exit;} $_SESSION['usernamereg'] = $_POST['username']; $_SESSION['passwordreg'] = $_POST['password']; $_SESSION['emailreg'] = $_POST['email']; if ($_POST['username'] == NULL){ header("Location: register.php");} if ($_POST['password'] == NULL){ header("Location: register.php");} if ($_POST['email'] == NULL){ header("Location: register.php");} if (!eregi('@', $_SESSION['emailreg'])) { header("Location: register.php");} $sql = "INSERT INTO wmusers VALUES ('0', '".$_POST['username']."', '".$_POST['password']."', '".$_POST['email']."', '0')"; mysql_query($sql) or die ("Couldn't execute $sql: " . mysql_error()); ?> Here's the register.php form: <form id="form1" name="form1" method="post" action="checkregister.php"> <div align="center"> <table border="1" cellspacing="0" cellpadding="0"> <tr> <td width="305"><table width="278" height="131" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="110"> </td> <td width="13"> </td> <td width="155" colspan="2"> </td> </tr> <tr> <td class="style2"><div align="right" class="style4"> <?php $check = "SELECT * FROM wmusers where username='".$_POST['username']."' LIMIT 1"; $checkresult = mysql_query($check); if(isset($_SESSION['usernamereg']) && strlen($_SESSION['usernamereg'] < "1")){ echo '(Empty) Username'; } elseif(mysql_num_rows($checkresult) != 0 && isset($_SESSION['usernamereg'])){ echo '(Taken) Username'; } else{ echo 'Username'; } ?> </div></td> <td class="style2"><div align="center"><span class="register">:</span></div></td> <td height="40" colspan="2" class="style2"><div align="left"> <?php if(isset($_SESSION['usernamereg']) && strlen($_SESSION['usernamereg'] < "1")){ echo '<input name="username" type="text" id="username" size="10" maxlength="10"/>'; } else{ echo '<input name="username" type="text" id="username" size="10" maxlength="10" value="'.$_SESSION['usernamereg'].'"/>'; } ?> </div></td> </tr> <tr> <td class="style2"><img src="images/1.jpg" width="1" height="5" /></td> <td class="style2"><img src="images/1.jpg" width="1" height="1" /></td> <td colspan="2" class="style2"><img src="images/1.jpg" width="1" height="1" /></td> </tr> <tr> <td class="style2"><div align="right" class="style4"> <?php if(isset($_SESSION['passwordreg']) && strlen($_SESSION['passwordreg'] < "1")){ echo '(Empty) Password'; }elseif(strlen($_SESSION['passwordreg'] > "1")){ echo 'Password'; } else{ echo 'Password'; } ?> </div></td> <td class="style2"><div align="center"><span class="register">:</span></div></td> <td height="40" colspan="2" class="style2"><div align="left"> <?php if(isset($_SESSION['passwordreg']) && strlen($_SESSION['passwordreg'] < "1")){ echo '<input name="password" type="password" id="password" size="10" maxlength="10" />'; } elseif(strlen($_SESSION['passwordreg'] > "1")){ echo '<input name="password" type="password" id="password" size="10" maxlength="10" />'; } else{ echo '<input name="password" type="password" id="password" size="10" maxlength="10" />'; } ?> </div></td> </tr> <tr> <td class="style2"><img src="images/1.jpg" width="1" height="5" /></td> <td class="style2"><img src="images/1.jpg" width="1" height="5" /></td> <td colspan="2" class="style2"><img src="images/1.jpg" width="1" height="5" /></td> </tr> <tr> <td class="style2"><div align="right" class="style4"> <?php if(isset($_SESSION['emailreg']) && strlen($_SESSION['emailreg'] < "1")){ echo '(Empty) Email'; } elseif(!eregi('@', $_SESSION['emailreg']) && strlen($_SESSION['emailreg'] > "0")) { echo '(Invalid) Email'; } elseif(strlen($_SESSION['emailreg'] > "1")){ echo 'Email'; } else { echo 'Email'; } ?> </div></td> <td class="style2"><div align="center"><span class="register">:</span></div></td> <td height="40" colspan="2" class="style2"><div align="left"> <?php if(isset($_SESSION['emailreg']) && strlen($_SESSION['emailreg'] < "1")){ echo '<input name="email" type="text" id="email" size="10" />'; } elseif(strlen($_SESSION['emailreg'] > "1")){ echo '<input name="email" type="text" id="email" size="10" value="'.$_SESSION['emailreg'].'"/>'; } else{ echo '<input name="email" type="text" id="email" size="10" />'; } ?> </div></td> </tr> <tr> <td colspan="4"><div align="left"><br /> <div align="right"> <table width="69" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="133"><input type="submit" name="Submit" value="Register" /></td> </tr> </table> <br /> </div> </div></td> </tr> </table></td> </tr> </table> </div> </form> Thanks, Snooble
-
I know this is not .php, most probably Javascript. but... I want to hide code onclick. So i have a bit of code: <?php echo 'yes yes yes'; ?> When a user clicks a button it hides that code. then click it again and it reveals it, without changing page. If i can't hide php, then what about just html? It's done on ebay, where you can click a cross on "my account" page and it hides the box with the X you pressed. Any ideas? I know NOTHING about javascript. Snooble
-
I need to use one of those methods to connect to my database. My database is one created through phpmyadmin. How can i connect to it through one of those methods? Thank you Snooble
-
It's just general, how to connect to an SQL server using a .udl file. I need to know what has to be in one. And where to put the server information. Snooble
-
... didn't work though... i get the error (couldn't connect to database). I was connecting using localhost. checked phpmyadmin settings to get the correct username and password... and used a database that's there. and said couldn't connect... maybe you cant connect locally? Any suggestions? Snooble
-
Thanks, so i should use: Provider=MySQLProv;Data Source=mydb;User Id=myUsername;Password=myPassword; BUT, could you please run me through the difference. As i dont know where to put the host of the sql. (eg. localhost or sql15.ifastnet.com etc) Sorry to be a nightmare.. obviously the rest i understand. Thank you! Snooble
-
I'm connecting to a MySQL database held on a server online. From a program called Automate. It says it passes an SQL statement to the datasource via OLEDB. Beneath the connection string it has the query box. I just need to know how i enter the information to connect to my sql server. because there's obviously some sort of format to the string. Thanks again Snooble
-
An SQL database. And it just says: Connection String: *I'm a text box* so what should i input. Thanks for your help so far