bigbob
Members-
Posts
17 -
Joined
-
Last visited
Never
Everything posted by bigbob
-
take a look here: http://php.about.com/od/finishedphp1/ss/php_login_code_2.htm
-
you would run the query: <?php //Get it from the "SEARCH" form... $accountname = $_POST['account_name']; $result = mysql_query("SELECT * FROM table_name WHERE account_name= '$accountname'"); //Then you would output it in a variable $i = 0; $num = mysql_numrows($result); $accoutname=mysql_result($result, $i,"Account Name"); $paid=mysql_result($result, $i,"Paid"); while ($i < $num) { echo $accountname; echo $paid; } ?> There's a basic listing for a search function
-
Well, not too shure about this but u could make a textBox with 0 border and limit the textbox to 50 or 100 chars. put your result in a variable like this: $article_body=mysql_numrows($result); then put the initial value in the text box as "<?php echo $article; ?>"; That should do the trick
-
but we arent doing a javascript function...we are doing a php function.
-
How about trying this: <?php require("config.php"); $user = mysql_real_escape_string($_POST['user']); $pw = md5(sha1(md5(md5($_POST['pw'])))); session_start(); if ($result = mysql_query("SELECT * FROM user_info WHERE username = '$user' and password = '$pw'")){ if (mysql_num_rows($result) > 0) { $_SESSION['LOGGEDIN'] = TRUE; $_SESSION['UNAME'] = $user; } if ($SESSION['LOGGEDIN'] = TRUE){ header("Location: account.php");}} else { die('You have typed in an incorrect password or/and username. Click <a href=\"index.php\">here</a> to try again.'); }} } ?> <form id="form1" name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"> <label></label> <table width="202" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000" bgcolor="#666666"> <tr> <th width="198" scope="col">Login System</th> </tr> <tr> <td height="63">Username: <input name="username2" type="text" id="username2" size="33" /> Password:<br /> <label> <input name="password" type="password" id="password" size="33" /> <input name="button2" type="submit" id="button2" value="Submit" /> <a href="register.php">Register here!</a></label></td> </tr> </table> <div align="center"> </div> </form> <div align="center"> Foser, for your form action, use echo $_SERVER['PHP_SELF'] next time. Oh, and Nightslyr, with all due respect, the PHP function code should be BEFORE the html form code.
-
Im pretty sure that that will work. Try it though.
-
yes here is how: <?php function logout() { session_destroy(); if ($_SESSION['LOGGEDIN'] == FALSE){ header('Location: /login.php'); exit;} else { header('Location: /account.php'); } } ?> <html> //This is your form <form id="form1" name="form1" method="post" action=""> <label></label> <input type="submit" name="logout" id="logout" value="Logout" onClick="logout()" /> </form> </html> Please note that when you call the "HEADER" command it is always followed by (' and closed by '); so u would change header(Location: /login.php); to header('Location: /login.php');
-
here ya go all fixed up: <?php if ( have_posts() ){ while ( have_posts() ) { the_post(); } } $prev_id = get_previous_post(TRUE); $prevpost = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID={$prev_id->ID}", 'ARRAY_A'); $prev_date = strtotime($prevpost['post_date']); ?> <h2><?php previous_post_link('%link') ?></h2> <small>Posted: <?php echo date('l, F jS, Y', $prev_date); ?></small><br /> <?php echo $prevpost['post_content']; ?> <?php endwhile; else: ?> <p><?php _e('Sorry, no posts matched your criteria.'); ?></p> <?php endif; ?> Try and see if it works =D
-
hmm. can u show me ur code?
-
Ok. lets walk you through it. <?php $prev_id = get_previous_post(TRUE); $prevpost = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID={$prev_id->ID}", 'ARRAY_A'); $prev_date = strtotime($prevpost['post_date']); ?> First part: $prev_id = get_previous_post(TRUE); this saves a variable called $prev_id as the result of a function called get_previous_post. It saves the value as either TRUE or FALSE. In this case, you are defining it as "TRUE". Second part: $prevpost = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID={$prev_id->ID}", 'ARRAY_A'); This puts a MySQL query command into a variable. I am not sure why you would want to put "$wpdb->" in front, but there it assigns the value "TRUE" or "FALSE" to a variable called wpdb AND prevpost. This is not necessary. Consider revising. Third: $prev_date = strtotime($prevpost['post_date']); This outputs the command STRING TO TIME. It converts a string into time and saves it into a variable called prevpost. I do not know why there is a ['post_date'] inside it. Consider revising to: $prev_date = strtotime($_COOKIE['post_date']); or $prev_date = strtotime($_SESSION['post_date']); or $prev_date = strtotime($post_date);
-
yes. Password protect it with .htaccess. Here, i'll walk you through it. 1. Open a notepad. 2. Type this code in: AuthUserFile /your/directory/here/.htpasswd AuthGroupFile /dev/null AuthName "Secure Document" AuthType Basic <LIMIT GET PUT POST> require user username </LIMIT> where /your/directory/here/ is your directory and /.htpasswd is the password u want to protect it with. 3. Save it as .htaccess and set the file type to All. 4. Upload to ur main directory. 5. Your done!
-
Make sure this line is correct: $update = "UPDATE topics SET fid = 'gdis' WHERE pinned='No'"; Make sure you are updating the correct table and you are looking in your MySQL for the correct table. You may have intended to write this: $update = "UPDATE some_other_table SET fid = 'gdis' WHERE pinned='No'"; Or you're looking in the wrong table in the PhpMyAdmin. Sorry, cant see anything wrong with that code. ???
-
You can do what thorpe said: <?php function foo() { if($handle = fopen($url)){ fwrite($handle, $info); fclose($handle); } else { foo(); } } foo(); ?> but u can add a couple lines of code. <?php $i = 0; function foo() { if($i == 5) { if($handle = fopen($url)){ fwrite($handle, $info); fclose($handle); $i++; } } else { foo(); $i++; } } foo(); ?>
-
that means u are redirecting to a page that redirects back the main which redirects back the redirect page which redirects back to the main.... and so on. I find it helps to draw it out. Index.php -redirects- Redirect.php Redirect.php -redirects- Index.php <----There is your problem. You are redirecting between the same 2 pages forever in a circle.
-
I think u can do this: <?php $var = $_POST['var']; $var = 4; ?>
-
Oh. I have to make frames? Oh is there any javascript that lets me change the text on the browser header?
-
Hi. I need help with my PHP System. I would like to change the http:// address at the top so that users do not know the name of the php file. For example: You click on a link that points to: http://www.somesite.com/somefile.php. But on the browser at the top it still shows: http://www.somesite.com. How can i manage to edit the url but stay on that page? Any help is appreciated. Thank You, Bob