
VirusDoctor
Members-
Posts
39 -
Joined
-
Last visited
Never
Everything posted by VirusDoctor
-
http://www.bidders.co.za quite new still, been running for 6 days and already receives about 45 unique visits daily. I have 6 spots open for a backlink trade. Please take a look at the site and check it against your content before applying for the trade. At least one thing on your site should be related to mine before the trade will happen.
-
Hi guys, I was wondering... is there a way to hide the .php in a url but still make it direct to the correct page? for example: www.test.com/members.php if a user types in members it would direct to members.php but hide the .php in the url. Which would now be www.test.com/members
-
Another (longer) way would be this: <?php if (isset($_POST['Submit'])) { $url = ($_POST['url']); $add = ('.htm'); $result = ($url.$add); echo $result; } ?> just take away the echo when using it, its just there to test the result.
-
Change pw code (password shows in url) help
VirusDoctor replied to VirusDoctor's topic in PHP Coding Help
Hi, I tried that, but when thats done and you click on the link to show the pw change form, nothing happens. <a href="members.php?go=pwreset">Reset Password [/url] Keep in mind that the link above and the code to change the pw (form) aswell as a few other changes like email etc are also done in the same php file. -
Change pw code (password shows in url) help
VirusDoctor replied to VirusDoctor's topic in PHP Coding Help
Nobody have any ideas? -
[SOLVED] Simple Directory Reading Script Errors
VirusDoctor replied to hellonoko's topic in PHP Coding Help
Try this instead... [qcode] <?php //Open images directory $dir = opendir("idea/gallery/"); //List files in images directory while (($file = readdir($dir)) !== false) { echo "filename: " . $file . "<br />"; } closedir($dir); ?> -
Change pw code (password shows in url) help
VirusDoctor replied to VirusDoctor's topic in PHP Coding Help
Each time I try to POST it, the whole pw change html and code no longer works. The problem is that I have to use $_GET for the link on the left which is: <a href="members.php?go=pwreset">Reset Password </a> Otherwise I have no idea how to tell the code that should be on the right hand side to be triggered to show. The code that shows the pw change form is: <form method="GET" action=""> <?php // If the user selected "reset password" from the left menu. if ($_GET['go'] == 'pwreset') { echo '<table align=center class="align"> <tr> <td> <br><br><br><br><br><br><br><br>Are you sure you want to reset your current password? <br><br> </td> </tr> <tr> <td><div style="center2"> <input class="buttons" name="pw_change" type="submit" id="yes" value="Yes"> <input class="buttons" name="option" type="submit" id="no" value="No"></div> </td> </tr> </table>'; }?></form> Using $_POST does nothing. -
Hi guys, before I get completely shouted at here, i know that if one uses the $_GET method its going to show in the url, I just cant seem to find a way around using it for what I'm trying to do. I have a members.php page, in the page are two columns, options on the left and the content for the options on the right (when the relevant option is chosen). Now $_GET works perfectly for every other option as they are not sensitive data but for the pw change, I dont want the pw to show in the url when submitting. Here is my code, any suggestions or fixes welcome. <?php session_start(); if (isset($_SESSION[my_loginstatus])) { require_once("header.php"); require("std_config.php");?> <div class="nav"> <?= buildHeading ("Members Area"); ?> <table class="options" width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="25%" style="border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; padding: 4px;"><table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td><?php echo ("<div class='notice'>Welcome</div><div class='error'>".$_SESSION['name']." ".$_SESSION['surname']."</div><div class='notice2'><hr> Account Balance: R0.00<hr></div>"); ?> </td> </tr> </table> </table> <br> <?= buildHeading ("Account Options"); ?> <table class="options" width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="25%" style="border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; padding: 4px;"><table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td><a href="members.php?go=pwreset">Reset Password </a></td> </tr> <tr> <td>Change Email Address</td> </tr> <tr> <td>Change Address</td> </tr> <tr> <td>Pay Account</td> </tr> <tr> <td>Invoice History</td> </tr> </table> </table> <br> <?= buildHeading ("Auction Options"); ?> <table class="options" width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="25%" style="border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-bottom: 1px solid #CCCCCC; padding: 4px;"><table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td title="All auctions you have won.">Auctions Won</td> </tr> <tr> <td title="All auctions you're currently winning.">Auctions You're Winning</td> </tr> <tr> <td title="All items you have sold.">Sold Items</td> </tr> <tr> <td title="Items currently on sale from you.">Items You're Selling</td> </tr> <tr> <td>Auction History</td> </tr> </table> </table> </div> <div class="content"><?= buildHeading ("Values"); ?> <form method="GET" action=""> <?php // If the user selected "reset password" from the left menu. if ($_GET['go'] == 'pwreset') { echo '<table align=center class="align"> <tr> <td> <br><br><br><br><br><br><br><br>Are you sure you want to reset your current password? <br><br> </td> </tr> <tr> <td><div style="center2"> <input class="buttons" name="pw_change" type="submit" id="yes" value="Yes"> <input class="buttons" name="option" type="submit" id="no" value="No"></div> </td> </tr> </table>'; }?></form> <form method="POST" action=""> <?php // If the user selected Yes, they want to reset their password. if ($_GET['pw_change']) { echo '<table align=center class="align"> <tr> <td> <br><br><br><br><br><div class=notice>Please enter your new password.</div> <br><br> </td> </tr> <table align=center class="regTable3" border="1"> <tr> <td class="bgcolor"> Current Password: </td> <td class="inputbox"> <input class="textinput" type = "password" name = "password" size="17"> </td> </tr> <tr> <td class="bgcolor"> New Password: </td> <td class="inputbox"> <input class="textinput" type = "password" name = "password" size="17"> </td> </tr> <tr> <td class="bgcolor"> Confirm Password: </td> <td class="inputbox"> <input class="textinput" type = "password" name = "confirm" size="17"> </td> </tr> </table> <br> <div class=align> <input class="buttons" name="submit" type="submit" id="login" value="Submit"> </div> </table>'; } ?></form> <?php // If the user entered a new password and clicked submit. if ($_GET['submit']) { $password = md5($_GET['password']); $password2 = ($_GET['password']); $username = $_SESSION['username']; $check = mysql_query("SELECT password FROM users WHERE password='$password' AND username='$username'") or die (mysql_error()); $row = mysql_fetch_assoc($check); // Check if a users current password is equal to their stored password. if ($row['password'] != $password) { echo "<br><br><br><br><br><br><div class=error>Your current password is incorrect.</div>"; } // Check if password and confirmation passwords match. else if (!$_GET['password']) { echo "<br><br><br><br><br><br><div class=error>Please enter a password before pressing Submit.</div>"; } else if ($_GET['password'] != ($_GET['confirm'])) { echo "<br><br><br><br><br><br><div class=error>Your password and confirmation passwords do not match.</div>"; } // If they do match, update the database, tell the user password has changed and log them out. else { $email = ($_SESSION['email']); $query = mysql_query("SELECT actkey FROM users WHERE email = '$email' LIMIT 1") or die(mysql_error()); $row2 = mysql_fetch_assoc($query); $act = $row2['actkey']; mysql_query("UPDATE users SET password='$password' WHERE username='$username'") or die (mysql_error()); mysql_query("UPDATE users SET activated='0' WHERE username='$username'") or die (mysql_error()); $send = mail($email , "Re-activate your account" , "You recently requested a password change which requires your account to be re-activated. \nYour new password is $password2 \n\nClick the link below to activate your account: \nhttp://www.bidders.co.za/activate.php?id=".$act." \n\nPlease do not reply, this is an automated mailer. \n\nThanks", "FROM: [email protected]"); echo "<br><br><br><br><br><br><div class=error>Your password has been changed and you will automatically be logged out. Please check your email address for instructions on how to re-activate your account</div>"; session_destroy(); echo '<meta http-equiv="refresh" content="3;url=logout.php" />'; } } ?></div> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> <?php require("footer.php"); } else { header("Location: login.php"); } ;?>
-
The simple way to do it would be to go into phpmyadmin and add the column to the table manually. Then just use the code I provided above. You dont even need to use ALTER then.
-
lol Adam, thats what I was just about to ask.
-
lol ok... Here's how I do it, in my login page, I have it update a users ip each time they login. Create a new column in your users table called user_ip then just do something like this in your login page $User_IP = $_SERVER['REMOTE_ADDR']; $IP = mysql_query (UPDATE users SET user_ip='$User_IP' WHERE username = '$username'") Hope that helps
-
Ofcourse the above is pretty useless if the user is using proxies, all he would have to do is change the proxy and they will no longer be banned.
-
Hi Dave, if the query is working, you can always mask that error and make it no longer show by using a magic little thing in php: Just add a @ symbol before the query and you will no longer see that error. Please note however that although the error wont show, it doesn't mean it isn't still there Shaun
-
Hi, are you receiving any mysql connect errors or anything thats showing you the connection is failing? Also, I tried that local server package you're using a while back, I ran into various issues with it (assuming you had a typo and what you're really using is called Xampp) I switched to the Apache2Triad package and have never had any issues with it.
-
Display User Info (shipping address & user name etc)?
VirusDoctor replied to popeye IV's topic in PHP Coding Help
Hi Christian, yes you can. Are you using a mysql database to store each users info? If you are, then retrieving the results are fairly simple. Lets say you have a table called users and the users info is stored in that table. You would typically retrieve things this way: (this tutorial is not mine, it was taken from www.webmasterworld.com to give you an example) -
Hi, not sure if you specifically have to design this from scratch but you can find exactly what you're looking for at hotscripts. In my opinion, there's no point in re-inventing the wheel If you absolutely must do it from scratch then I'd create a table with 15 Q's like you said, but I'd do it so that when the poll is either closed or expired, it outputs all the results to a .txt stored on the server and then resets the table for the next poll to run. Hope this helps. Shaun
-
Hey guys, thanks for all the help. The meta refresh is what worked perfectly for what I'm trying to do, thanks Adam! Rajiv, the reason why your fix didn't work is because in my header.php there's quite a bit of stuff going on in there, so when I added it to the isset login block, it made the whole page no longer function. Fortunately the problem is solved now though, thanks again guys. Shaun
-
Hi Adam, I realize that, it seems like it has to do with the way I designed the login script, using the If and Else statements where I have them prevents me from sending header info wherever I want it. I just cant think of how to get around this though or where to play the header info for it to work only once a users login is ok. Shaun
-
adding up toal cost in cart via session problem
VirusDoctor replied to fazz's topic in PHP Coding Help
Hi fazz, I'm no super php guru but from what I can see, you're trying to subtract what php thinks is two strings from each other. You would need to turn the strings into integers first (probably through type casting) and then tell php to to echo the total with a float. The following code is not mine but it may prove useful for this: <?php function strtonumber( $str, $dec_point=null, $thousands_sep=null ) { if( is_null($dec_point) || is_null($thousands_sep) ) { $locale = localeconv(); if( is_null($dec_point) ) { $dec_point = $locale['decimal_point']; } if( is_null($thousands_sep) ) { $thousands_sep = $locale['thousands_sep']; } } $number = (float) str_replace($dec_point, '.', str_replace($thousands_sep, '', $str)); if( $number == (int) $number ) { return (int) $number; } else { return $number; } } ?> -
Hi guys, I've designed my login page for one of my new scripts. The problem is that I'd like the script to display a message "You are now logged in" and then after about 3 seconds, change to the main page after login. It currently doesn't do it. Could anyone assist as to how this can be done? I've tried using header("Location: template.php"); but it doesn't seem to be working and I cant figure this out on my own. Here is the code for the login.php page. <?php session_start(); // Start the session login timer. $start=time(); $_SESSION['time_start']=$start; // We check to see if a session is or isn't active. if (!isset($_SESSION[my_loginstatus])) { require_once("std_config.php"); require_once("header.php"); require_once ("php/qry_mngr.php"); // If the user clicks login... if(isset($_POST['login'])) { $username = trim(addslashes($_POST['username'])); $password = md5(trim($_POST['password'])); $query = mysql_query("SELECT * FROM users WHERE username = '$username' AND password = '$password' LIMIT 1") or die(mysql_error()); $row = mysql_fetch_array($query); if(mysql_num_rows($query) > 0) { // Check if the users account is activated, if it is, log them in and set some session variables. if ($row['activated'] > 0) { $_SESSION[my_loginstatus] = 'true'; $_SESSION['username'] = $username; $_SESSION['name'] = $row['name']; echo ("<br><div class='notice'>Welcome ".$row['name'].", You are now logged in.</div><br>"); mysql_query("UPDATE users SET logged_in='1' WHERE logged_in='0' AND username='$username'") or die (mysql_error()); header("Location: template.php"); } else { echo '<p class="error">Sorry, you must activate your account first. Please check your email for the email.</p> <p>Didn'."'".'t get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p>'; } } else { echo '<br><p class="error">There was an error processing your login, it appears that your username and/or password was incorrect. Please try again.</p> <p class="notice">Didn'."'".'t get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p><br>'; } } else { ?> <br> <div class="error"> Please Login to access your Members Area: </div> <br> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <br> <table class="loginTable" border="1"> <tr> <td class="bgcolor">Username:</td> <td class="inputbox"><input class="textinput" type="text" name="username" value="<?php if(isset($_POST['username'])) { print $_POST['username']; }?>" size="17"></td> </tr> <tr> <td class="bgcolor">Password:</td> <td class="inputbox"><input class="textinput" type="password" name="password" value="" size="17"></td> </tr> </table> <br> <div> <input class="buttons" name="login" type="submit" id="login" value="Login"> </div> </form> <br> <div class="notice"> Didn't get your validation email? <a href="resend.php">Click here</a> to resend the validation email. </div> <br> <div class="notice"> Need an account? <a href="register.php">Click here</a> to register, it's completely free! </div> <br> <?php } require("footer.php"); } else { header("Location: template.php"); } ?>
-
Hi, from what I can see, you need to replace <a href='http://mysite.com/index.php?start=".$previous."'>Previous Page[/url] - <a href='http://mysite.com/index.php?start=".$next."'>Next Page[/url] with <a href='http://mysite.com/index.php?start=".$previous."'>Previous Page</a> - <a href='http://mysite.com/index.php?start=".$next."'>Next Page</a>
-
Thanks for the reply, so the conclusion is that comments dont slow things down much (it at all) and including a large functions.php file in a script many times probably will slow things down. Correct? Shaun
-
[SOLVED] Problem with using preg_replace()
VirusDoctor replied to steve m's topic in PHP Coding Help
Hi, try this code: <?php $str = preg_replace("/\n/", '' ", $_POST['email']); echo $str; ?> -
Hi guys, I have two quick questions to ask (this is really for the people that really know the answer to this, no assumptions or guesses please) Firstly, if a person has many comments or comment blocks in a script, does it slow the script down at all? Like are the comments seen by the server or are they merely ignored? Secondly, if one has a fairly big functions.php file included throughout a script and certain pages of the script only use a few of the functions in the functions.php file, is the whole file processed by php or does it only fetch the functions it needs for that page and ignore the rest? In short, does this slow a script down? Thanks in advance for the reply guys. Shaun
-
Hi thmar, firstly, I doubt yahoo will like that too much, using their smtp surely cant be legal to do? Secondly, I'd advise you to go to google, do a search for Apache2Triad, download and install it. Its one installer that install Apache, mysql, php and phpmyadmin all in one with no errors at all, best is that its all setup and ready to use right after the install is complete. I would then advise you to grab a copy of PHPMailer, go through their tutorial on the site and use that for your script, you wont be sorry. Hope any of that helps Shaun