only one
Members-
Posts
437 -
Joined
-
Last visited
Never
Everything posted by only one
-
The page has 2000 lines of code, I don't want to paste it all. No basically by placing a ! infront of the isset() function it asks if $_POST['staylogged'] isn't set.
-
Retrieving values from database table to list box
only one replied to ashrafzia's topic in PHP Coding Help
$add1 .= By using a . before the = you can extand the variable and too echo $form just echo "$form"; -
oh, i wouldn't do what you are doing the way you are Add a new row for every view with the id of the thing it's on, then just use the mysql_num_rows() function.
-
if($_GET['q'] == 'Login') { if($logged) { $_GET['q'] = "Home"; } else { $title = "<a href=\"$_SERVER[php_SELF]?q=Login\">Login</a> "; $content = true; $contents = " <form action=\"$_SERVER[php_SELF]?q=Login\" method=\"post\" name=\"login\"> <table class=\"board\"> <tr> <td class=\"board_title\" colspan=\"2\">Login</td> </tr> <tr> <td>Username</td> <td><input type=\"text\" name=\"username\" value=\"$_POST[username]\" class=\"textbox2\" maxlength=\"20\" /></td> </tr> <tr> <td>Password</td> <td><input type=\"password\" name=\"password\" class=\"textbox2\" maxlength=\"32\" /></td> </tr> <tr> <td> Stay logged in: <input type=\"checkbox\" name=\"staylogged\" /> </td> </tr> <tr> <td colspan=\"2\"><input type=\"submit\" name=\"submit\" class=\"submit1\" value=\"Login\" /></td> </tr> </table> </form> "; if(isset($_POST['submit'])) { if($_POST['username'] == NULL) { $error = true; $errors .= "<li> Please fill in your Username. </li>"; } if($_POST['password'] == NULL) { $error = true; $errors .= "<li> Please fill in your Password. </li>"; } if(!$error) { $username = htmlentities("$_POST[username]"); $password = md5("$_POST[password]"); $query = mysql_query("SELECT * FROM `users` WHERE `username` = '$username' AND `password` = '$password'"); $row = mysql_fetch_array($query); if($row) { $time = date("D d F Y H:i:s"); $ip = $_SERVER['REMOTE_ADDR']; mysql_query("INSERT INTO `user_logs` (`userid`,`ip`,`time`) VALUES ('$row[id]','$ip','$time')"); mysql_query("DELETE FROM `guests` WHERE `ip` = '$_SERVER[REMOTE_ADDR]'"); if(!isset($_POST['staylogged'])) { $_SESSION['user'] = "$row[username]"; } else { setcookie("user", $row[username]); } header("location: $_SERVER[php_SELF]"); die("<meta http-equiv=\"refresh\" content=\"0;URL=$_SERVER[php_SELF]\" />"); $content = false; $success = true; $successfully = "<li><font color=\"#00cc00\">Successfully</font>: Logged in... Welcome "$username".</li>"; } else { $error = true; $errors .= "<li><font color=\"#ff0000\">Error</font>: Incorrect Username and Password combination.</li> "; } } } } }
-
mysql_query("SELECT * FROM `table` ORDER BY `field` DESC LIMIT 100");
-
A link? http://onlyonerule.pwnds.info/forum/
-
Im not too sure if you can create files, check the fwrite() function.
-
I was just showing a quick example. I tried that but the i still need to put the $_SESSION['user'] in and its not keeping its data
-
Retrieving values from database table to list box
only one replied to ashrafzia's topic in PHP Coding Help
Try something like this: $sql = "SELECT * from programmes"; $result = mysql_query($sql, $conn) or die(mysql_error()); while($row = mysql_fetch_array($result)) { $add1 .= "<option value='$row[programe_name]'>$row[programe_name]</option>"; $add2 .= "<option value='$row[no_of_semesters]'>$row[no_of_semesters]</option>"; } $form = " <body> <form action='studentregistrationform.php' method='post' enctype='multipart/form-data'> <td>Programe:</td> <td> <select name='programe'> $add1 </select> </td> </tr> <tr> <td>Semester:</td> <td> <select name='semester'> $add2 </select> </td> </table> </form>"; -
You have too use a small L this one: if(date('L')==SATURDAY) { $tiempe = date('l dS \of F Y h:i:s A',strtotime('+48')); } http://php.net/date
-
No. Still not working. The session has the same id the whole way through but the weird thing is if i set $_SESSION['user'] again as the value of the array: if($_SESSION['user']) { $query = mysql_query("SELECT * FROM `users` WHERE `username` = '$_SESSION[user]'"); $user = mysql_fetch_array($query); $_SESSION['user'] = $user[username]; $logged = true; } The session stays, but it the value of the user variable is 0.
-
Never thought of that.
-
php above <html> causes IE to enter quirks mode
only one replied to fixxxer's topic in PHP Coding Help
That's impossible.. A simple session_start() funcion can't write any HTML to the document. I make my page, one with php and the index page, I then include the php page on the top of the index page and let the php page set the values of the varuabls too be shown on the index page. -
Yes, if(date("l") == saturday) { $tiempe = date('l dS \of F Y h:i:s A',strtotime('+48')); }
-
php above <html> causes IE to enter quirks mode
only one replied to fixxxer's topic in PHP Coding Help
I'm sorry but unless you are printing anything in that PHP code it shouldn't cause any problems, it's proboally just your HTML or CSS. My website being a perfect example of it working fine. -
[SOLVED] Upload - If same filename exists
only one replied to sotusotusotu's topic in PHP Coding Help
I put on an md5'd string of the date when i upload files: <?php $date = md5(date("YmdHis")); if(file_exists($date .$HTTP_POST_FILES['userfile']['name'])) { echo "error.. Please refresh the page.."; }else{ if(@copy($HTTP_POST_FILES['userfile']['tmp_name'], $date .$HTTP_POST_FILES['userfile']['name'])) { echo "successfully.."; }else{ echo "error.."; } } ?> <form enctype="multipart/form-data" action="?view=Upload" method="post" name="upload"> <input type="file" name="userfile" /> -
<!--#include file="cgi-bin/at/in.cgi?yourdomain.com" -->
-
Is it that difficult? it's only a simple array. http://www.phpfreaks.com/PHP_Reference/Arrays/10.php
-
Um where's your mysql_connect and mysql_select_db functions?
-
You could use that code to set a value for each day. Basically that code is setting an array for week 40 to week 44 in the year then you can recal that array an say you want to know the day of the month the first day of week 44 is you can simply echo $array[44][1][mday].
-
I know that already i placed session_start(); ontop of each page, heres some code like you asked: When they log in declare it: if($row) { $time = date("D d F Y H:i:s"); $ip = $_SERVER['REMOTE_ADDR']; mysql_query("INSERT INTO `user_logs` (`userid`,`ip`,`time`) VALUES ('$row[id]','$ip','$time')"); mysql_query("DELETE FROM `guests` WHERE `ip` = '$_SERVER[REMOTE_ADDR]'"); if(!isset($_POST['staylogged'])) { $_SESSION["user"] = $row[username]; } else { setcookie("user", $row[username]); } I have this on the top of every page aswell: if($_SESSION['user']) { $query = mysql_query("SELECT * FROM `users` WHERE `username` = '$_SESSION[user]'"); $user = mysql_fetch_array($query); $logged = true; } if($_COOKIE['user']) { $query = mysql_query("SELECT * FROM `users` WHERE `username` = '$_COOKIE[user]'"); $user = mysql_fetch_array($query); $logged = true; }
-
http://www.md5.rednoize.com/
-
I'd advise if you want to gather the information from that cookie to use $_COOKIE['sAuth']; rather than just sAuth. And yes it should be secure.