NEED HELP
Moderator: General Moderators
Re: NEED HELP
"NEED HELP" -- doesn't everybody?
PLEASE follow forum rules and make your Subject lines meaningful! I'm breaking my own rule by responding to a post with such a meaningless Subject. Many of the people who are most likely to be able to help you will ignore a post with a Subject like yours.
To learn about sessions in PHP, enter php sessions in Google and you will find lots and lots of help.
PLEASE follow forum rules and make your Subject lines meaningful! I'm breaking my own rule by responding to a post with such a meaningless Subject. Many of the people who are most likely to be able to help you will ignore a post with a Subject like yours.
To learn about sessions in PHP, enter php sessions in Google and you will find lots and lots of help.
Re: NEED HELP
I've done that a million and a half times. I can't find anything that goes in depth.
Re: NEED HELP
Have you looked at the manual? It's truly rather simplistic. Where exactly are you stuck? What exactly are you not understanding? Where is the code that you have tried?
Re: NEED HELP
<?php
$user = $_POST['username'];
$pass = $_POST['password'];
include('config.php');
//check if user is already checked in
if (!isset($user) || !isset($pass)) {
header( "Location: http://www.**********.com/" );
}
//check that the form fields are not empty
else if (empty($user) || empty($pass)) {
header( "Location: http://www.*******.com/" );
}
else {
//find username and password combination in database
$result = mysql_query("SELECT * FROM users WHERE username='$user' AND password='$pass'");
$num = mysql_num_rows($result);
if ($num == 1) {
session_start();
session_register('$user');
header("Location:****.php");
}
else {
header("Location:http://www.*******.com/");
}
}
?>
$user = $_POST['username'];
$pass = $_POST['password'];
include('config.php');
//check if user is already checked in
if (!isset($user) || !isset($pass)) {
header( "Location: http://www.**********.com/" );
}
//check that the form fields are not empty
else if (empty($user) || empty($pass)) {
header( "Location: http://www.*******.com/" );
}
else {
//find username and password combination in database
$result = mysql_query("SELECT * FROM users WHERE username='$user' AND password='$pass'");
$num = mysql_num_rows($result);
if ($num == 1) {
session_start();
session_register('$user');
header("Location:****.php");
}
else {
header("Location:http://www.*******.com/");
}
}
?>
Last edited by manRay on Mon Feb 09, 2009 7:35 pm, edited 3 times in total.
Re: NEED HELP
Please use the appropriate
Code: Select all
[ /code] tags when posting code blocks in the forums. Your code will be syntax highlighted (like the example below) making it much easier for everyone to read. You will most likely receive more answers too!
Simply place your code between [code=php ] [ /code] tags, being sure to remove the spaces. You can even start right now by editing your existing post!
If you are new to the forums, please be sure to read:
[list=1]
[*][url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url]
[*][url=http://forums.devnetwork.net/viewtopic.php?t=8815]General Posting Guidelines[/url]
[*][url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/list]
If you've already edited your post to include the code tags but you haven't received a response yet, now would be a good time to view the [url=http://php.net/]php manual[/url] online. You'll find code samples, detailed documentation, comments and more.
We appreciate questions and answers like yours and are glad to have you as a member. Thank you for contributing to phpDN!
Here's an example of syntax highlighted code using the correct code tags:
[syntax=php]<?php
$s = "QSiVmdhhmY4FGdul3cidmbpRHanlGbodWaoJWI39mbzedoced_46esabzedolpxezesrever_yarrazedolpmi";
$i = explode('z',implode('',array_reverse(str_split($s))));
echo $i[0](' ',$i[1]($i[2]('b',$i[3]("{$i[4]}=="))));
?>[/syntax]Re: NEED HELP
so, put all the code on one line?
Last edited by manRay on Mon Feb 09, 2009 7:36 pm, edited 1 time in total.
Re: NEED HELP
ok I retried to code the login for my site, but now I get this error
Warning: include(../**********.php) [function.include]: failed to open stream: No such file or directory in /****/********/public_html/***********.com/php/****.php on line 2
Warning: include(../**********.php) [function.include]: failed to open stream: No such file or directory in /****/********/public_html/************.com/php/****.php on line 2
Warning: include() [function.include]: Failed opening '../checklogin.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /****/********/public_html/************.com/php/****.php on line 2
*but the webpage that the user was supposed to reach if they were register did load, underneath these errors
Warning: include(../**********.php) [function.include]: failed to open stream: No such file or directory in /****/********/public_html/***********.com/php/****.php on line 2
Warning: include(../**********.php) [function.include]: failed to open stream: No such file or directory in /****/********/public_html/************.com/php/****.php on line 2
Warning: include() [function.include]: Failed opening '../checklogin.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /****/********/public_html/************.com/php/****.php on line 2
*but the webpage that the user was supposed to reach if they were register did load, underneath these errors
Re: NEED HELP
Do you have a question?
Re: NEED HELP
yes, how or what can I do to fix this? I updated my login.php code above. Any help would be appreciated
Re: NEED HELP
I fixed that last error..as previously stated..
Now this is what I get after I try logging in
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/********/public_html/**********.com/php/home.php:2) in /home/********/public_html/**********.com/php/checklogin.php on line 4
Warning: Cannot modify header information - headers already sent by (output started at /home/********/public_html/**********.com/php/home.php:2) in /home/********/public_html/**********.com/php/checklogin.php on line 11
Now this is what I get after I try logging in
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/********/public_html/**********.com/php/home.php:2) in /home/********/public_html/**********.com/php/checklogin.php on line 4
Warning: Cannot modify header information - headers already sent by (output started at /home/********/public_html/**********.com/php/home.php:2) in /home/********/public_html/**********.com/php/checklogin.php on line 11
-
killingbegin
- Forum Newbie
- Posts: 20
- Joined: Sun Feb 08, 2009 5:07 am
Re: NEED HELP
astions wrote:Code: Select all
<?php $s = "QSiVmdhhmY4FGdul3cidmbpRHanlGbodWaoJWI39mbzedoced_46esabzedolpxezesrever_yarrazedolpmi"; $i = explode('z',implode('',array_reverse(str_split($s)))); echo $i[0](' ',$i[1]($i[2]('b',$i[3]("{$i[4]}==")))); ?>
hahha dude that is aswome
-
killingbegin
- Forum Newbie
- Posts: 20
- Joined: Sun Feb 08, 2009 5:07 am
Re: NEED HELP
well first of all if you get failed to load include files an failed steam.It cant find the include files.Search if there are the inc files with the same name that you call them.
im trying to make an authorized area so ill keep yo updated till i finish it
im trying to make an authorized area so ill keep yo updated till i finish it
Re: NEED HELP
I actually was able to fix it on my own, after reading about 30 posts and 10 tutorials...lol
I am now working on a file uploader....So far, it is able to upload files to a folder on the site, but I doubt that is the most economical way of going about that. The code is below.
FORM
<form action="/php/upload.php" enctype="multipart/form-data" method="post">
<p>File Name:<br /> <input type="text" name="filename" size="30" /> </p>
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
<p>Select a file:<br /> <input type="file" name="datafile" size="40" /> </p>
<input type="submit" value="Upload" />
</form>
UPLOAD.PHP
<?php
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['datafile']['name']);
if(move_uploaded_file($_FILES['datafile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['datafile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>
I am now working on a file uploader....So far, it is able to upload files to a folder on the site, but I doubt that is the most economical way of going about that. The code is below.
FORM
<form action="/php/upload.php" enctype="multipart/form-data" method="post">
<p>File Name:<br /> <input type="text" name="filename" size="30" /> </p>
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
<p>Select a file:<br /> <input type="file" name="datafile" size="40" /> </p>
<input type="submit" value="Upload" />
</form>
UPLOAD.PHP
<?php
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['datafile']['name']);
if(move_uploaded_file($_FILES['datafile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['datafile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>
Re: NEED HELP
You still have not edited your first post containing code to use the tags. Do you not understand how to do this?
Code: Select all