
kumarrana
Members-
Posts
28 -
Joined
-
Last visited
Never
Everything posted by kumarrana
-
That is very helpful.
-
I am looking for some ideas or links to read online materials. I need help on formatting such as auto-link for www, auto-mailto for [email protected]. Moreover I just finish writing blog but any contents posted by user can't be appeared as they typed (Like paragraph, alignment, and so on). I was thinking about writing config file and "include" on all PHP files but I just don't have any idea on how to create a config file that do all what I just explained.
-
Thanks, Darak and Dw for the idea.
-
It is kidda stupid to ask. I used a hard coded time format "July 04, 2007" stored on MySQL. Now I want to display a message a week from that date. Anybody know any easy solution.
-
Thanks Kevin7 for the link. I will check it out.
-
Can somebody tell me how to extract certain length of the string, echo it and link it to different page? For Sentence like " This is the PHP blog". I only want to display "This is the ..." and link it to different page.
-
Even knowing that, I could not avoid the header problem. Instead I used echo "<meta http-equiv = \"refresh\" content = \"1; URL=test.php\">"; Can that be alternative solution? In past I had problem setting session once page is refreshed which I could not debug. I have login.php page included on index.php page. login.php will only appear if session is not set. My login.php page resides in <div></div>. Please somebody help me to get out this pain. btw I tried flush()
-
What do you mean by stickied post? Can you give the link
-
I am well aware of the error I have been getting but I just can't fix it. Error is Warning: Cannot modify header information - headers already sent by (output started at ..................index.php:18) in ........................login.php on line 28.Can anybody find bugs on it here is the login.php file included on index.php page <?php require_once('mysql_login.php'); session_start(); $errorMessage = ''; if(isset($_POST['txtUserId']) && isset($_POST['txtPassword'])) { // check if the username and password combination is correct $userpass = md5($_POST['txtPassword']); $username = $_POST['txtUserId']; $result = mysql_query("SELECT * FROM user WHERE password='$userpass' AND username='$username'") or die("Couldn't query the user-database."); $row_user = mysql_fetch_array($result); $num = mysql_result($result, 0); if(!$num) { $errorMessage = 'Sorry, wrong username / password'; } else { $_SESSION['autheticate'] = true; $_SESSION['identification'] = $row_user['identification']; $_SESSION['admin'] = $row_user['admin']; // after login we move to the main page header('Location: ../index.php'); exit; } } ?> and my index page look like this <?php session_start(); if(isset($_SESSION['autheticate'])) { $identification = $_SESSION['identification']; $admin = $_SESSION['admin']; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Title</title> <link rel="stylesheet" href="includes/style.css" type="text/css" /></head> <body> <?php include("header.htm"); echo "<div class = \" verticalmenu \" >"; if(!isset($_SESSION['autheticate'])) { include("includes/login.php"); //echo "<a href = includes/logout.php> Logout </a>"; } else { include("includes/logout.php"); } echo "</div>"; ?> </body> </html> Can anybody tell me what am I doing wrong?
-
I see. Got it. Another problem was it was creating multiple file extension while uploading the file. I fixed both. Thanks bunch for you help.
-
I think I got it. I think there is something to do with file extension when it uploads the file and writes name into database. Let me try that first. I will let you know.
-
Not Found The requested URL /blogRedesign/file_upload/ResumeOne.doc was not found on this server.
-
Nop, Does not work? Thanks
-
It is such a stupid questions that I can't fix link problem in my PHP script. Code looks lie this $attached_file = $result_row['attachment']; // Access uploaded file name from database echo "<br><a href=file_upload/$attached_file> Attachment</a>"; //Link to the file, file_upload is folder where file is uploaded Can body find glitch in it?
-
Thaks a bunch. I think I am ganna stick with your code.
-
I am ganna give you full code, may be that will help more. Rest of the code works besides validating body of the form. ($_POST['body']) function verify_user_input() { echo "<br> Post: >". $_POST['body']; if($_POST['title'] == "") { $error = "Blank title not allowed"; echo $error; } else if($_POST['category'] == "") { $error = "Blank Category Not allowed"; echo $error; } else if($_POST['body'] == "") { echo "Empty body not allowed"; } else { echo "<br> New post submitted successfully"; } } verify_user_input(); //dump_in_mysql_post(); } else { echo "Submit Blog Entry"; echo "<form action=\"$PHP_SELF\" method=\"POST\">"; echo "Title: <input type = text name = title> <br><br>"; echo "Category: <input type = text name = category><br><br>"; echo "Body: <br><br>"; echo "<textarea name = body cols = 40 rows = 15> </textarea> <br><br>"; echo "<input name=submit type=submit value=New Post>"; echo "</form>"; }
-
Yes it echos $_POST['body'] part. Sorry for confusion it compiles and runs; I missed semicolon while copying and pasting.
-
It seems stupid but I could not debug form validation. Code looks like this function verify_user_input() { if($_POST['title'] == "") { $error = "Blank title not allowed"; echo $error; } else if($_POST['category'] == "") { $error = "Blank Category Not allowed"; echo $error; } else if($_POST['body'] == "") { $error = "Empty body not allowed"; echo $error } else { echo "<br> New post submitted successfully"; } } This code cold not validate $_POST['body'] part, others work fine. Form input for this part look like this; echo "<textarea name = body cols = 40 rows = 15> </textarea> <br><br>"; Any idea what is wrong?
-
I never used AJAX yet. I am just trying to do everything on either PHP or MySQL. If anybody wanna look at the code, and give me an idea, that would be great.
-
Yes I am using PHP and MySql. That makes perfect sense but my goal is to have user edit, their content in the same page. Basically if user is editing their post, display both, old post as well as editing form at the same spot.
-
Hey, I have been writing a blog but stuck on little things. Mine Display page has paging options after contents get long. Once I have edit, delete, post and other options on posts, it works fine but automatically linked to the first page. Make sense? Mean, if post is located in page 4, and user hits edit, editing part works but page moves to page 1. Which is kinda annoying. Any idea how to fix?
-
Great! Seem to be working. . Thanks a lot.
-
function dump_in_mysql_post() { $title = stripslashes($_POST['title']); $category = stripslashes($_POST['category']); $body = stripslashes($_POST['body']); echo $title . "<br>". $category . "<br>" . $body . "<br>"; $dump_in_mysql_post = "INSERT INTO `post` VALUES('$postid', '$title', '$category', '$body', '$identification', '$date_created')"; $dump_in_mysql_post = mysql_query($dump_in_mysql_post); if(!$dump_in_mysql_post) { echo "Error on querying post ". "<b> ". mysql_error() . "</b>"; } else { echo "Title : " . $title . " <br> " ; echo "Category: " . $category . " <br> "; echo "Body: " . $body . " <br> "; echo "Identification : " . $identification; echo "Blog entry has been submitted"; } }
-
I am using stripslashes(). Like $title = stripslashes($_POST['title']). Doesn't it do like mysql_real_escape_string()? Can you give a analogous example? That would be grea.
-
I am writing a blog, but I have been getting same error on my mysql. My MySQL field types are postid/(int(6)), title/(varchar(200)), category/(varchar(200)), post/(longtext), identification/(int(11)), date_crated/(timestamp). What I noticed is when I have really long post (100 words), I get error like " You have an error in your SQL syntax". Plus my timestamps is giving all zero values. Anybody has any idea what is wrong with my table?