-
Posts
312 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by Cronthenoob
-
-
Teenage mutant ninja ................BUNNIES!
-
Weeeee . . . .You know too much about PHP, I can never find this stuff with google. Thanks.And I got it working perfectly.
-
Great! Thanks!But what about forest fires?Only YOU can prevent SQL injection! -
He said he doesnt have access to PHP or any server side scripting.actually, it is done with php. here is a post that deals with the bbcode, and you can o something similar for smileys. -
-
You could probably do it with javascript. Just tell it to find anywhere : and ) are together and replace it with an image.
-
Yepdoes my example validate? -
Thats strange, but i managed to get it to work by moving around a few things.
-
You should make preview pages for them, so we can see what they look like before we download them. :ph34r:
-
I was experiencing the same problem.You've got to put your second set of <ul> tags inside a <li> otherwise it won't validate.
-
Php document?
in PHP
the include file doesnt need a doctype or head unless its going to be specifically for that purpose. And i'm pretty sure you can make an include file any extension you want as long as the page that calls it is labled .php
-
On the actual page that space isnt there. And i went ahead and added the PHPHeader and cookie information have to be set before any output occurs. And see that extra line up at the top? That's output, lol.I only know this from making the same mistake many times. Also, I would advise that you use <?PHP instead of <?, as the latter can also signify XML code. -
The Login Page ::
<? if ($_GET['action'] == "login") { $login_password=$_POST['password']; $login_username=$_POST['username']; $query="select * from table where username='$login_username'"; $results=mysql_query($query); echo mysql_error(); $e=mysql_fetch_array($results); $veri_password=$e[password]; $activated=$e['valid_email']; $veri_username=$e['username']; if (mysql_affected_rows() < 1) { echo "<div class='error'>Username Does Not Exist!<br /></div>"; } if (mysql_affected_rows() >= 1) { if ($login_password != $veri_password) { echo "<div class='error'>Incorrect Password!<br /></div>"; } elseif ($login_password == $veri_password) { echo "Hello, ".$veri_username."! (<a href='index.php?login=logout'>log out</a>)"; $cookie_data= $e['username'].'-'.$e['password'].'-'.$e['e_mail'].'-'.$e['u_id']; setcookie("welcomeback", $cookie_data, time()+3600); $_GET['login'] = "ignoredefaultlogin"; } } } if ($_GET['login'] != "ignoredefaultlogin") { if (isset($_COOKIE['welcomeback'])){ $cookie_info = explode("-", $_COOKIE['welcomeback']); $username=$cookie_info[0]; $password=$cookie_info[1]; $email=$cookie_info[2]; $userid=$cookie_info[3]; echo "Hello, ".$username."! (<a href='index.php?login=logout'>log out</a>)"; $_GET['login'] = "ignoredefaultlogin"; } else { ?> <a href="index.php?login=register" class="links">Click here to register!</a> <br /> <form name="login" method="post" action="index.php?action=login" class="form"> <font class="formtext">Username: <br /> <input type="text" name="username" size="15"> <br /> Password: <br /> <input type="password" name="password" size="15"></font> <div style="height:5px;margin:0px;padding:0px;"></div> <input type="submit" class="standard_button" value="Login"> </form> <? } }
The index page where the login page is called::
<table height="100%" width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><?PHP include("login.php");?></td> </tr> </table>
-
What causes this error? And how can I fix it?Warning: Cannot modify header information - headers already sent by (output started at Site\index.php:4) in Site\login.php on line 27I only get it when I am trying to set a cookie.
-
Thanks
-
Good luck, hope you get it working.
-
I've got a loop, that I need to stop after a certain number of times through.If I use exit() then everything beyond that point doesnt load into the page. Is there another way I can stop the loop but load the rest of the page?Heres my code.
<?PHP $query="SELECT * from cddb_albums order by album_id DESC"; $results=mysql_query($query); echo mysql_error(); $newalbum=1; while($e = mysql_fetch_array($results)) { if ($newalbum <= 5) { echo $e[album_title]."<br />"; $newalbum=$newalbum+1; if ($newalbum == "6") { exit(); } } } ?>
-
Heres the code for the form and the dropdown lists. Took me a while to figure out how to set up the loops.
if ($_REQUEST['action'] == "todo") { echo "My <b><font color=\"red\">School</b></font> To Do List"; echo "<br><br>"; if ($_REQUEST['subaction'] == "edititem") { $query="select * from list_items where priority >= '1' and l_id='$_REQUEST[l_id]' order by priority"; $results=mysql_query($query); echo mysql_error(); $e=mysql_fetch_array($results)?> <form name="addtodo" method="post" action="todo.php?action=edittodo&l_id=<?=$e[l_id]?>&groups=<?=$e[groups]?>"> Item: <input type="text" name="item" size="10" value="<?=$e[item]?>"> Link: <input type="text" name="links" size="10" value="<?=$e[links]?>"> <input type="submit" value="Update!"><br> </form><? } else { } $query="select * from list_items where priority >= '1' and groups='school' order by priority"; $results=mysql_query($query); echo mysql_error(); while ($e=mysql_fetch_array($results)) { $new=1; $rows = mysql_num_rows($results); echo mysql_error(); echo "<select name=\"p\" onChange=\"MM_jumpMenu('parent',this,0)\">"; while ($new <= $rows) { echo "<option value=\"todo.php?action=changepriority&oldpriority=".$e[priority]."&newpriority=".$new."&l_id=".$e[l_id]."&groups=".$e[groups]."\""; if ($e[priority] == $new ) { echo " selected>".$new."</option><br>"; } else { echo ">".$new."</option><br>"; } $new++; } if ($e[links] == "") { echo "</select><a href=\"todo.php?action=deleteitem&l_id=$e[l_id]&delpriority='$e[priority]'&groups=$e[groups]\"><img src=\"delete.gif\" border=\"0\" height=\"20\" width=\"20\"></a><a href=\"todo.php?action=schooltodo&subaction=edititem&l_id=$e[l_id]\"><img src=\"edit.gif\" border=\"0\" height=\"20\" width=\"20\"></a>".$e[item]."<br><br>"; } else { echo "</select><a href=\"todo.php?action=deleteitem&delpriority=$e[priority]&l_id=$e[l_id]&groups=$e[groups]\"><img src=\"delete.gif\" border=\"0\" height=\"20\" width=\"20\"></a><a href=\"todo.php?action=schooltodo&subaction=edititem&l_id=$e[l_id]\"><img src=\"edit.gif\" border=\"0\" height=\"20\" width=\"20\"></a><a href=\"".$e[links]."\">".$e[item]."</a><br><br>"; } } ?> <form name="addtodo" method="post" action="todo.php?action=addtodo"> Item: <input type="text" name="item" size="10"> Link: <input type="text" name="links" size="10"> <input type="submit" value="add!"><br> <input type="radio" name="groups" value="school">School<input type="radio" name="groups" value="work">Work<input type="radio" name="groups" value="finance">Financial<input type="radio" name="groups" value="other">Other </form> <? }
And heres the code to interact with the database and change the priority.
if ($_REQUEST['action'] == "changepriority"){ // This is what happens when the old priority is Less than the new priority =================================================================== if ($_REQUEST[oldpriority] < $_REQUEST[newpriority]) { $newpriority=$_REQUEST[newpriority]; $oldpriority=$_REQUEST[oldprioirty]; $change=$newpriority - $oldpriority; $other=$change+$oldpriority+1; $query="update list_items set priority = priority - 1 where priority > '$_REQUEST[oldpriority]' and priority < '$other' and groups='$_REQUEST[groups]'";mysql_query($query); $query="update list_items set priority='$newpriority' where l_id='$_REQUEST[l_id]' and groups='$_REQUEST[groups]'"; mysql_query($query); } //========================================================================================================================================== //This is what happens when the old priority is greater than the new priority ========================== elseif ($_REQUEST[oldpriority] > $_REQUEST[newpriority]) { $query="update list_items set priority=priority+1 where priority >= '$_REQUEST[newpriority]' and priority <= '$_REQUEST[oldpriority]' and groups='$_REQUEST[groups]'";mysql_query($query); $query="update list_items set priority='$_REQUEST[newpriority]' where l_id='$_REQUEST[l_id]' and groups='$_REQUEST[groups]'"; mysql_query($query); } //======================================================================================================}
And heres the SQL so you can make the table in your database. So its a little easier to see how its setup.
CREATE TABLE `list_items` ( `l_id` int(11) NOT NULL auto_increment, `priority` int(11) NOT NULL, `item` varchar(32) NOT NULL, `links` varchar(64) NOT NULL, `groups` varchar(16) NOT NULL, PRIMARY KEY (`l_id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=21;
-
Do you want to do something Like this???Its done in PHP, just click on the first link.Not sure if that is the sort of thing you are looking for.
-
Thanks!I'll be working on it here pretty shortly, I'll let you know if I get it to work correctly.
-
I don't want the user to have to type in anything, just click a link and get verified.I'm just trying to organize my thoughts here. . .I need to 1.)create a field in my database called verified_email and set the default to false2.)create a field in my database to store a random numberWhen a user clicks to submit the form I need to:1.)generate a random number.2.)Send the random number to the database for that username.3.)Generate an email with a link that contains the username and the randomly generated number.When a user clicks on the email link:1.)Goes to a page that takes the random number and username from the link, matches it to whats in the database, and changes verified_email from false to true.Ok thats what I think I need to get done.Time to go home for the day, guess I have the weekend to think it some more.
-
When the user submits the form it sends an email to the email they supplied.The email contains a link that changes a field in the database that says that users account is verified, allowing the user to log in.Don't know if thats the real name for it, thats just what I found when i searched for it in google.
-
I've been googleing this for a good half hour.Anybody have any tutorials on creating a double opt-in email verification system?Or suggestions on another good way to verify an email address.
-
Thanks! That works.To turn multiple spaces into one space, you'll need a regular expression like this:$RegExp = '%[\s]{2,}%';$Text = preg_replace($RegExp, ' ', $Unfiltered);
Hope it helps
EDIT: Oh, i missunderstood what you wanted to do. Instead of using a regular expression, this should work just as well:
$Text = str_replace(' ', '', $Text)
That will give you what you need, and it's plenty faster than regular expressions too.
Double opt-in Email Verification
in PHP
Posted