
Snooble
Members-
Posts
311 -
Joined
-
Last visited
Never
Everything posted by Snooble
-
same problem. Snooble
-
noway? an included file is completly pasted into the doc? I thought it was? Ok i'll give it a go, ta Snooble
-
you should never need to echo something before redirect. It's pointless. But if you want a time delay use a meta refresh. PLACE THIS IN HEADER: <meta http-equiv="refresh" content="10; URL=pagetoredirectto.php"> content is where you place the seconds to wait. that one waits 10 seconds and send to "pagetoredirecto.php" Snooble
-
I have 2 pages, register.php, checkregister.php. in register i thought i would (before each form textfield) place an if statement. Which looks like this: (I have the includes at the top of the page to start session... <?php if(isset($_SESSION['usernamereg'])){ echo 'Please Eneter A Username:<input name="username" type="text" id="username" size="10" maxlength="10" value="'.$_SESSION['usernamereg'].'/>'; } else { echo '<input name="username" type="text" id="username" size="10" maxlength="10"/>'; } ?> On check register i have this: <?php include 'expire.php'; include 'sessionstartandsql.php'; $_POST['username'] = $_SESSION['usernamereg']; $_POST['password'] = $_SESSION['passwordreg']; $_POST['email'] = $_SESSION['emailreg']; if ($_POST['username'] == NULL){ header("Location: register.php");} if ($_POST['password'] == NULL){ header("Location: register.php");} if ($_POST['email'] == NULL){ header("Location: register.php");} $sql = "INSERT INTO wmusers VALUES ('".$_POST['username']."', '".$_POST['password']."', '".$_POST['email']."', '0', '0', '0')"; mysql_query($sql) or die ("Couldn't execute $sql: " . mysql_error()); ?> Any help? At the moment i get taken to the register page but i ALWAYS get the textfield without anything in it and without the "Please Eneter A Username:" bit echo'd. There must be something wrong with the register page i think. Snooble (Thanks in advance)
-
to stop the sessions starting via URL, use the POST method. instead of GET. search google and have a read on how to use the two commands. Quick lesson: GET command retrieves info from the URL (ex. mysite.com/index.php?blah=yes) $_GET['blah'] would equal yes. Sending via POST means it's hidden from the users eyes. (ONLY disadvantage is, it doesn't let the user bookmark the exact page) change get to POST and stop the form to write into the URL, rather send the variables via POST. Snooble
-
lol, you need to decide on what you want. If you want a pop up box like javascript? Type: javascript:alert("shoob-ba-doob-a-doo-wa"); into your url. If you want to open a page with width and height restraints google it. if you want to send the user to another page displaying the wrong fields. You can do all the above, I suggest just a mix of the last two, as javascript alerts i find childish. if you read my last post you'll find out how to create the validation on the form page itself. Then you can just echo simple commands before/after the text boxes. Par example: <?php if(isset($_POST['conference'])){ //FORM VALIDATION }else{ ?> INSERT FORM HERE <?php } ?> Where it says "Form validation" enter the if statements. if($_POST['VARIABLE'] = ""){ echo "VARIABLE not entered";} simple!? Snooble
-
Need some database structure help - advanced issue
Snooble replied to simcoweb's topic in PHP Coding Help
i would use a seperate table per division. and an extra for your cat id etc. The more tables the merryer. as with the registration, just make a switch statement, checking what division the user is part of. Therefore getting echo'd the correct forms. Snooble. (Big project, like building 6 sites!) -
<?php if(!isset($_SESSION['MembersID'])) { header('location: '.$config_website_url.'/'.$config_website_url_topic.'/index.php?page=account&view=login'); } else { ?> PUT ALL YOUR PAGE INORMATION HERE! <?php } ?> Just changing the first statement to a negative works fine. if(!isset($_SESSION['MembersID'])) Snooble
-
have you changed the form actions.. Snooble
-
By using header("Location: place.php") You cant output anything before using the function. So make sure it's at the top of your page. <?php if($blah == ""){ echo $blah " is blank, please enter information to continue"; } elseif($blah2 == ""){ echo $blah2 " is blank"; } else{ header("Location: complete.php"); } ?> Man, i'm so tired. Sorry i think that code is fine, i need a rest havn't slept in a LONG time. errm you can do the checking on the same page as the forms by changing the action to the page name and doing an if statement: <?php if(isset($_POST['conference'])){ //FORM CHECKING HEADER("LOCATION: COMPLETE.PHP"); } ?> Sorry about the mess, tried to give you a little on where to start. The above can go directly on the form page, when it detects the form has been posted (on submit) it will check the information, if it's ok, goto complete.php. otherwise echo whats wrong. Just take bits from the two and make it neat. Apologies, if you are still in need of help, PM me and i'll sort it in a couple of hours. Snooble (Will still post just in case)... zzzzzzzz
-
<form action="test.php" method="POST"> <input name="button1" type="image" src="http://www.newcomedy.net/imgs/button_01.gif" /> </form> <form action="test.php" method="POST"> <input name="button2" type="image" src="http://www.newcomedy.net/imgs/button_02.gif" /> </form> <br><br> <?php if(!isset($_POST['button1_x'] && ($_POST['button2_x'])) echo "None of the buttons were pressed"; elseif(isset($_POST['button2_x'])) echo "Button 2 was pressed"; elseif(isset($_POST['button1_x'])) echo "Button 1 was pressed"; ?> Snooble (Balls. Orio is too damn fast, i had to look at my code)
-
the action of the form should aim at something like : "checkform.php" In that you should place lots of if statements. <?php if($blah == ""){ echo "$blah is blank, please enter information to continue"'; } ?> That's the basics, you can upgrade as you go. Snooble
-
post the form to itself. <form action="test.php" method="POST"> <input name="button1" type="image" src="http://www.newcomedy.net/imgs/button_01.gif" /> </form> <form action="test.php" method="POST"> <input name="button2" type="image" src="http://www.newcomedy.net/imgs/button_02.gif" /> </form> <br><br> <?php if(isset($_POST['button1'])) echo "Button1 was pressed"; elseif(isset($_POST['button2'])) echo "Button2 was pressed"; else echo "None of the buttons were pressed"; ?>
-
[SOLVED] name generator script, isn't working :( help please
Snooble replied to interpim's topic in PHP Coding Help
kill the lines between the echos... It happened to me a couple of nights ago. Snooble $name=$first.$middle.$last; -
chmod will fix that. Snooble (Note: CHMODDING a file to 777 is dangerous. I suggest to look at what you need to change before changing it. Google!)
-
both, BRILLIANT examples of what i'm looking for. Will take what i need from them, should work fine. Are there any suggestions of a good captcha to use? I've never used one before. Not after any SSL encrypted thing, Just want to know the basics. Thank you SNooble
-
Hello everyone, I have a register form, posting to a checkregister form which then goes to a completed form. Forms on register page: Username Password Password Again Email -------------------------- Can someone tell me some security i can implement on my checkregister page. Such as to stop blank entries, to tell the user if they have entered a username that's already in the db, no duplicate entries for email or username. make sure the passwords match otherwise tell them. Thanks, Bit lost here, Snooble
-
it shouldn't be hard at all. I know almost nothing about MySQL. But, goto the registration page, find where it POST's the form to, keep searching till you find the SQL query and underneath write it INSERTing the same variables to another db? Snooble
-
Works beautifully. Thought it'd print em all. But obviously hits the one that works and stops. Thanks Snooble
-
ridiculous. you've never send the action through get. Here's a quick example: Create page.php with this form in it: <form name="form1" method="post" action="page2.php"> <table width="100%" height="30%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="202" height="50%"> </td> <td width="28" height="50%"> </td> <td colspan="2"> </td> </tr> <tr> <td height="40"><div align="right"><span class="style1">Field you want to edit </span></div></td> <td width="28" height="40"> </td> <td height="40" colspan="2"><input name="field" type="text" id="songtitle" size="20" /></td> </tr> <tr> <td height="53"> </td> <td width="28" height="53"> </td> <td width="83" height="53"> </td> <td width="157"><div align="left"> <input type="submit" name="Submit" value="Edit" /> </div></td> </tr> </table> </form> Create page2.php with this query on it (make sure your connected to database): $sql = "UPDATE [b]TABLE [/b]SET [b]FIELDNAME [/b]= '[b]".$_POST['field']."[/b]' WHERE [b]FIELD [/b]= '[b]SOMETHING TO DEFINE ROW[/b]' LIMIT 1"; mysql_query($sql) or die ("Couldn't execute $sql: " . mysql_error()); Not tested but should work. Snooble
-
<?php if($list['point'] == "0"){ echo " Rank : Newbie"; } elseif($list['point']. < "5" && != "0"){ echo " Rank : Beginner"; } elseif($list['point']. < "10" && => "5"){ echo " Rank : Rookie"; } ?>
-
<?php include 'sessionstartandsql.php'; include 'expire.php'; if(!isset($_SESSION['username'])){ header("Location: mustlogin.php"); } elseif($_SESSION['points1'] == 1){ header("Location: cheater.php"); } $_SESSION['point'] = "".rand(0, 10).".".rand(0, 9)."".rand(0, 9).""; echo "You Scored:".$_SESSION['point']." points"; $result = $list['point'] + $_SESSION['point']; echo "Your Total Points Are: ". $result; $_SESSION['points1'] = 1; $sql = "UPDATE wmusers SET point = '$result' WHERE username = '".$list['username']."' LIMIT 1"; mysql_query($sql) or die ("Couldn't execute $sql: " . mysql_error()); ?> full script. Apologies, session start's within the included files. Snooble
-
Best way to allow members to edit their own pages...
Snooble replied to Druid's topic in PHP Coding Help
you shouldn't let them use php at all. You can write alot of dangerous script in php. Cookie stealers, one small very acheivable example. I suggest html entities. Have a look on google. Snooble -
<?php elseif($_SESSION['points1'] == 1){ header("Location: cheater.php"); } ?> make sense? futher down the page i set $_SESSION['points1'] to 1 using $_SESSION['points1'] = 1; so when i refresh the page it should take me to "cheater.php" shouldn't it? Thanks, Snooble