Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,149 members, 7,818,451 topics. Date: Sunday, 05 May 2024 at 04:07 PM

I Am Stuck : I Need Help Pls - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / I Am Stuck : I Need Help Pls (2042 Views)

Pls I Want To Create A Php Site, Help Pls / I Nairalanders I Am Stuck With This Google Site Verification / How To Translate A Scanned Jpeg Document Into English: Urgent Help Pls! (2) (3) (4)

(1) (2) (Reply) (Go Down)

I Am Stuck : I Need Help Pls by segsalerty(m): 8:09pm On Mar 17, 2009
I cant figure whats going on my people , I correctly fixed up a well programmed Signup/User Login web pages connected to MySQL , imagine i ran the stuff on my local server and it worked fine ,
I almost cried when i Uploaded it unto my hosting server ! cry cry
At first , i noticed something when i was about to create db and tables on my hosting site PHPmy Admin , the php connection code is different from whats i used , according to the stuffs i read , it said i should connect using $mysqli= mysqli_connect("localhost", "username", "password", "db_name"wink;
then followed by $sql="I PUT THE QUERY HERE";
then , $result = ($mysqli, $sql);
image my hosting site gave me this to use after creating the db as the only way i can connect PHP to my MYSql .
well, i think its the hosting site apache thats using a low version of Apache version 1.3.41 (Unix) ;
while i run / test my site locally with v2.2.8 , whats going on ? can anybody help me and tell me what to do ?
i even found out that any page thet i try to inherit php function to use in my webpages ( using the include function * include("the_file.inc"wink * ) any .php page i use this will be distorted and wont open well , i already offloaded the thing off my server , i put the one i designed there before ,
it sucks ,
can anybody help ?
i want you buddies to use what i came up with new ! its like a community web stuff where you buddies can sign up, sign in , download , share stuffs , and a small forun , not really that big !
Please , i need to do something !
HELP !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Re: I Am Stuck : I Need Help Pls by Nobody: 9:43pm On Mar 17, 2009
Looks rather complicated. . .
Re: I Am Stuck : I Need Help Pls by nitation(m): 9:52pm On Mar 17, 2009
@Segsalerty

Your problem is connecting to MYSQL DB. You don speak all Wole Soyinka finish. Try this:

<?php
phpinfo();
?>


and upload it to your server. After which you should paste the result here. Also, provide us with the code you 're using to connect to MYSQL

- nitation
Re: I Am Stuck : I Need Help Pls by yawatide(f): 9:55pm On Mar 17, 2009
nitation, u r a brave man cos I have read the above at least 3 times and stil can't grab it.

Hmm, might b cos it isn't formatted (hint to poster cool)
Re: I Am Stuck : I Need Help Pls by segsalerty(m): 10:33pm On Mar 17, 2009
Uhmmm. @nitation sir.
Check sir and help me solve this shit !
www.segsalerty.com/segun.php
thats the link
thanks so much in advance !
I am not only having problem connection to my db but my pages with .php display horribly on my website after hosting but always fine on local server !
like my hosting doesnt support some php features(functions),
Re: I Am Stuck : I Need Help Pls by nitation(m): 10:41pm On Mar 17, 2009
@Segsalerty

Your hosting company is running a recent version of PHP. I think the problem now lies within your code. Kindly post your code and lets get it started.

@ Yawa

I had to use binoculars to get the wordings right. Anyway, the stuff dey pain the dude, you no go blame am.

- nitation

Edit: Less i forget, remove phpinfo from your server for security reasons
Re: I Am Stuck : I Need Help Pls by segsalerty(m): 10:56pm On Mar 17, 2009
ah ah , Thanks @nitation , i found out on my phpinfo() on my host site that some features are disabled !

Directive Local Value Master Value
allow_call_time_pass_reference On On
allow_url_fopen Off Off
allow_url_include Off Off
always_populate_raw_post_data Off Off

I created some functions sir ! they disabled use of functions too cry cry
error display too is off


but , i cant understand the sql thing
how can i even edit these stuffs to suite whats configured on my local server
Re: I Am Stuck : I Need Help Pls by segsalerty(m): 11:02pm On Mar 17, 2009
see my code for my homepage , i included an external url files for my DB logon and for login validation and stuffs like that , i will include that too
Thanks

Re: I Am Stuck : I Need Help Pls by segsalerty(m): 11:07pm On Mar 17, 2009
login_segs_users.inc
contains the following below sir



<?php
if(!isset($_POST["username"])){
$log= "Login Here";
}
elseif(($_POST["username"] == ""wink || ($_POST["pin"] == ""wink){
$log= "Empty Username/Password";
}
else{
$user=strip_tags($_POST["username"]);
$pon=strip_tags($_POST["pin"]);
$you=$_POST["membership"];
include("mysqli.inc"wink;
$sql= "SELECT user_name, pass_word FROM users WHERE user_name = '".$user."' AND pass_word= '".$pon."' AND mem_ber= '".$you."' ";
$result= mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));
if(mysqli_num_rows($result) == 1 ) {
header("Location: check_login.php"wink;
mysqli_close($mysqli);
}
else{
$log= "Incorrect (Try Again)";
}
}
?>


and mysqli.inc contain below


<?php
$mysqli= mysqli_connect("localhost", "*****", "*****", "*****"wink;
?>

waiting for help coz i had to remove these new site off my server and put the one i designed about 2weeks ago for the main time i get this fixed
Re: I Am Stuck : I Need Help Pls by segsalerty(m): 1:28pm On Mar 18, 2009
Pls , @all dont leave my silly ass crying ! cry cry cry
This thing is really paining me !
@yawa, @dhtml @omni @nitation , @ webguru? and where are all the gurus ? pls, abeg help me sharp sharp !

i will do whatever it takes to make sure this thing on my local webserver works online perfectly too , i am stuck !
Re: I Am Stuck : I Need Help Pls by OmniPotens(m): 1:55pm On Mar 18, 2009
Starting point as to your localhost and remote site comparism, run the same piece of code

<?php
phpinfo();
?>

to find out what both sides support and doesn't. After that, you should start discovering what goes and what doesn't.

More info coming up soonest.
Re: I Am Stuck : I Need Help Pls by segsalerty(m): 2:12pm On Mar 18, 2009
Yes, i done that already ! my remote doesnt support database connectivity using (mysqli_connect) which is simply the latest valid PHP connection to the MySQL database ,
I guess thats the only difference,
how can i fix that shit sir ?
i want to know if you people connect to MySQL using (mysql_connect) or (mysqli_connect) , these two synax are completely different coz when someone wants to call a fuction ! like ( mysqli_num_rows, mysqli_fetch_array, and so on ) its gonna be a big problem , meanwhile , my localhost doesnt support (mysql)
see the conflict ? how can i test my work when i cant run it on my localserverfirst ?
can anybody help with suggestions?
Re: I Am Stuck : I Need Help Pls by yawatide(f): 2:21pm On Mar 18, 2009
my localhost doesnt support (mysql)

Then this is probably the problem. I use mysql_connect() by the way.

Also, do what I do in times like this: contact your host and have them upload a test file from their end that connects to your database. If it works, they will let you know and from there, you can "borrow" their code wink

Good luck!
Re: I Am Stuck : I Need Help Pls by segsalerty(m): 2:35pm On Mar 18, 2009
@yawatide
you made me cry again when you said "contact your host and have them upload a test file from their end that connects to your database"
I was scammed with the whole hosting stuff , A guy that helped me hosted it just collect my money , No domain registartion details, i dont even know where he hosted it ! the only think i know is use my CPANEL , when he first hosted the thing for me self , i had no DB( it was 0MysQL) , i had to beg him and pay him extra for DB ,, then , he gave me just (5), after providing the DB ! he told me my problem is too much that i too dey bug him that i should cut my coat according to my size and use whatever features is on my cpanel , that i should not come to him again undecided undecided, now , it isnt useful for me cry cry cry cry,
i cant go to him again !
am planning to host another one , am buying the domain soon and host it , hoping that one will work fine ( its a friend that is gonna do this for me now kiss)
i hope he wont do thesame !
Re: I Am Stuck : I Need Help Pls by nitation(m): 2:58pm On Mar 18, 2009
@Segsalerty

I do not understand your problem any longer. If I am correct, you tested your script on localhost and it ran fine. Uploading it to the live server is giving you mess huh . I think am right. I can write a login script for you with a DB structure and test it if it's fine on your server

What about that??

- nitation
Re: I Am Stuck : I Need Help Pls by segsalerty(m): 3:19pm On Mar 18, 2009
I am downgrading now , downgrading what i read , my books took me to a wrong side , One of my Masters here in NL is putting me thru ,
its only few hosting company thats using the latest db connection using the php script fucntion of , $mysqli= mysqli_connect()


now, am going back to $connect = mysql_connect()
see the difference?
i am fixing my codes now , i will get back to all of you
Thanks so much my people kiss
Re: I Am Stuck : I Need Help Pls by yawatide(f): 3:31pm On Mar 18, 2009
hmm, since webguru said u shdnt refer to me as mum, you are now calling me by my first name. It's alright tongue

Anyways, glad to see that you appear to have a solution to your problem. As a personal rule, I always use one version down from the current one, just in case. As you just learned the hard way, not all hosts may use the latest.

Cheers!
Re: I Am Stuck : I Need Help Pls by segsalerty(m): 4:32pm On Mar 18, 2009
HURRAY HURRAY !!!!
Its done

visit: www.segsalerty.com

Go and sign UP now BUDDIES !
I am also sugning up now
Good to go
Re: I Am Stuck : I Need Help Pls by OmniPotens(m): 5:04pm On Mar 18, 2009
Good for you. Enjoy your web but take note of this problem and the solution in case of future references.
Re: I Am Stuck : I Need Help Pls by segsalerty(m): 5:07pm On Mar 18, 2009
Thanks very much for the support sir !
Have you signed up yet? wink wink
Re: I Am Stuck : I Need Help Pls by segsalerty(m): 5:13pm On Mar 18, 2009
cry cry another problem again /, \
please , all off you , help me check this code , the HEADER directs the user to another page after verification on my local host ! now my server , it just reload the page and wont head anywhere , cry
here is my code below , i need help fix this bug pls ,


<?php
if(!isset($_POST["username"])){
$log= "Login Here";
}
elseif(($_POST["username"] == ""wink || ($_POST["pin"] == ""wink){
$log= "Empty Username/Password";
}
else{
$user=strip_tags($_POST["username"]);
$pon=strip_tags($_POST["pin"]);
$you=$_POST["membership"];
include("mysqli.inc"wink;
$sql= "SELECT user_name, pass_word FROM users WHERE user_name = '".$user."' AND pass_word= '".$pon."' AND mem_ber= '".$you."' ";
$result= mysql_query($sql) or die(mysql_error($mysql));
if(mysql_num_rows($result) == 1 ) {
@header("Location: check_login.php"wink; // here is where the problem lies , suppose to take someone go this new page ! it does that on my localhost
}
else{
$log= "Incorrect (Try Again)";
}
}
?>
Re: I Am Stuck : I Need Help Pls by yawatide(f): 5:36pm On Mar 18, 2009
1) Make sure said file is in the same folder/location as where u r calling it from
2) Make sure that you are indeed pulling back a result
3) Make sure you are redirecting b4 outputting any html (as in, put it outside the first HTML tag, if not done already)

Get back to us if neither of these work. Bottom line though, as you said, the person who sold you your package hoodwinked u. sorry o.
Re: I Am Stuck : I Need Help Pls by Nobody: 6:46pm On Mar 18, 2009
i did not read ur codes meticulously but i know ur last construct

if(mysql_num_rows($result) == 1 ) {
@header("Location: check_login.php"wink; // here is where the problem lies , suppose to take someone go this new page ! it does that on my localhost
}
else{
$log= "Incorrect (Try Again)";
}

every code beneath the above will run including those not posted, add an exit() to the header redirect. so it terminates there
Re: I Am Stuck : I Need Help Pls by segsalerty(m): 8:54pm On Mar 18, 2009
I used the exit() function but it took me to the page check_login.php where it didnt load well(half next page loaded) but if i remove the exit ! it will reload the homepage, i figured that after posting the problem , but didnt work still!
NOTE : its working fiine on my local host !
Re: I Am Stuck : I Need Help Pls by yawatide(f): 9:02pm On Mar 18, 2009
hmm,

maybe you should remove the "@" from before the header() as this supresses errors and instead do something like this:
header() or die(); or something like that.

You might have to read up on the die() function, assuming someone else doesn't post back on its proper use.

Good luck!
Re: I Am Stuck : I Need Help Pls by segsalerty(m): 3:16am On Mar 19, 2009
@all cry
@yawatide
honeslty speaking mom ! i've tried everything , i am tired , i done same thing you asked me to do , worked perfectly on my localwebserver but immediately its uploaded onto the worldwibe server , i start to see horrible results,
is anything wrong with my hosting compnay and stuffs like that ?
it pains me now that my users cant sign in after signing up and my website isnt working as it is on my PC here
Pls ma, can i send you my cpanel info so you can crosslook anything bug thats in there for me please? as you know this site is juts personal and like a training stuff for myself , so, there is no big deal in giving you what makes it up so that my problem will be solved !
atleast once its solved now , such wont happen again !
How can i get your email adress to send you the details needed to have access into my cpanel ?
you can simply visit my site (www.segsalerty.com) and fill in contact form ma, filling it with your valid email will make it very easy to get back to you wth the details,
I honourably need your help !
now, i cant read futher since what i've done so far didnt impressed me ,
Thanks so much ma
Re: I Am Stuck : I Need Help Pls by Nobody: 9:46am On Mar 19, 2009
segsalerty:

I used the exit() function but it took me to the page check_login.php where it didnt load well(half next page loaded) but if i remove the exit ! it will reload the homepage, i figured that after posting the problem , but didnt work still!
NOTE : its working fiine on my local host !

then it is working as it shud cos that seem to be what ur code says.
the reason u were taken to the check_login.php page is cos ur last database select returned a result(i think this is what you want), i.e. mysql_num_rows($result) returned 1

if the checklogin.php didnt load well as u have said, then you alone know what is in the check_login.php page.
and yea, try to do away with the @ sign when testing as ur mummy said. you can add it when u wanna go live.

if(mysql_num_rows($result) == 1 ) {
@header("Location: check_login.php"wink; // here is where the problem lies , suppose to take someone go this new page ! it does that on my localhost
}

what is happening above is that if the credentials are correct, user will be forwarded to check_login.php
to me, i think it should be a file like, iAmLoggedIn.php, cos check_login.php looks more like a file that will repeat the login check



@dhtml, I see you are also catching the bug, that happens when u visit some other threads, say jokes.
Re: I Am Stuck : I Need Help Pls by yawatide(f): 11:52am On Mar 19, 2009
segsa,

Do what webdezzi has said.  If that doesn't work, YIM me.  By the way, as a test, i would remove whatever logic is in your check_login page and replace it with "hello world".  If that works, then it is your logic. To that effect, post the code in each of the 2 files you have mentioned here.

If what webdezzi is saying is true,then it isn't surprising that your code is going into an infinite loop.

Good luck!
Re: I Am Stuck : I Need Help Pls by nitation(m): 12:29pm On Mar 19, 2009
@segsalerty

This is a same page login form. Try it out

<?php
session_start();
ob_start();
require_once 'your_path/to_db_config.php';

$errorMsg="";

if (isset($_POST['submit'])) {
$username=$_POST['username'];
$password=$_POST['password'];

$username = stripslashes($username);
$password = stripslashes($password);

$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);

$sql="SELECT * FROM admin_tbl WHERE username='$username' && password='$password'";
$result=mysql_query($sql);

$count=mysql_num_rows($result);

if($count==1){
$_SESSION['username'] = $username;
$_SESSION['password'] = $password;

header("location:index.php"wink;
exit();
}
else
{
$errorMsg="Username or password is not valid";
  }
}
ob_end_flush();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
<head>
<title><?php echo "Login Form; ?></title>
</head>
<body>
>
<font color="#990000"><center><?php echo $errorMsg; ?></center></font>



<form name="loginform" id="loginform" action="login.php" method="post">
<p>
<label><?php echo "Username"; ?>

<input type="text" name="username" id="user_login" class="input" value="" size="20" tabindex="10" />
</label>
</p>
<p>
<label><?php echo "password"; ?>

<input type="password" name="password" id="user_pass" class="input" value="" size="20" tabindex="20" />
</label>

</p>
<p class="submit">
<input type="submit" name="submit" id="submit" value="Log In" tabindex="100" />


</p>
</form>


Note: I decided not to hash the password for your testing. Remember to md5/shal1 all your passwords. Read more about it on www.php.net

Also, The DB structure should look like this:

CREATE TABLE IF NOT EXISTS `admin_tbl` (
 `adminid` int(cool NOT NULL AUTO_INCREMENT,
 `username` varchar(40) NOT NULL,
 `password` varchar(80) NOT NULL,
 PRIMARY KEY (`adminid`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;


- nitation
Re: I Am Stuck : I Need Help Pls by OmniPotens(m): 12:45pm On Mar 19, 2009
Will there still be another Segsalerty or are all of them reading and taking notes of these codes from the background? Soonest another thread will be set up and it will be captioned "login script help" or "login script needed".

@Segsalerty
Just as nitation has posted stuffs here for you, I bet you should start following you own scripts step by step. Don't want to jump into them all at once. If the login section is solved, then you can work on the input checking script if any and of course, your db config. Ensure you are using the proper commands in all. Gradually these things will get solved.
Re: I Am Stuck : I Need Help Pls by Nobody: 6:30pm On Mar 19, 2009
Seeing so many codes at once on a thread. . .i need panadol extra. . .@segun, i will meet you online later tonight to see what help i can render. . .now what happened to my pepper soup?
Re: I Am Stuck : I Need Help Pls by segsalerty(m): 6:38pm On Mar 19, 2009
Thanks all , am working on it , i'll be using any and everyone's idea to fix my bugs,
i havnt gone back to those codes yet , i've being sleeping since moning , i will work on it tonight and let everyone know what i came up to
i hope to get it solved tonight ,

(1) (2) (Reply)

Mtn 200gb 80gb On (glo, Etisalat And Airtel). 80gb ... Place An Oder / How To Get Free Mtn 500mb On Mymtn App / Www.tublat.com For Sale

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 79
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.