Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,205,615 members, 7,993,092 topics. Date: Monday, 04 November 2024 at 06:03 AM

Post your PHP Problems Here - Webmasters (16) - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Post your PHP Problems Here (64932 Views)

Thread For All Your Blogging Related Problems Here / Get And Request For Your Php Problems Here / Connecting To Your Gmail Account From Your Php Application. (2) (3) (4)

(1) (2) (3) ... (13) (14) (15) (16) (17) (18) (19) (Reply) (Go Down)

Re: Post your PHP Problems Here by lovebondz(m): 11:39pm On Jan 30, 2015
fraphael:
Hw to b changin content

What?
Re: Post your PHP Problems Here by lovebondz(m): 12:05am On Jan 31, 2015
xyluz:
But maybe its just me being paranoid

Oh, okay. I guess its the same for most developers.

1 Like

Re: Post your PHP Problems Here by fordables: 11:11am On Jan 31, 2015
I have a serious issue...my website account has been suspended and I want to transfer to another hosting site...is it a must I must re subscribe before I copy my files from my c panel cos I can't access my c panel or is it possible they give me few days window to copy my file for my c panel
Re: Post your PHP Problems Here by aje75(m): 3:32pm On Feb 01, 2015
lovebondz:


Oh, okay. I guess its the same for most developers.

except u right??

1 Like

Re: Post your PHP Problems Here by aje75(m): 3:38pm On Feb 01, 2015
Walexwal:
yes sir! Pls can you help me rectify it bro?

first bro dont use sir. am ur home boy nd definately not a pro. k i think u shuld check ur connection string for ur server name and password. d complain seemz line 9 on forum.php am sure u ar aware. lets see where we go from dere.

1 Like

Re: Post your PHP Problems Here by lovebondz(m): 9:50pm On Feb 01, 2015
aje75:


except u right??

Oh, on the contrary, I am uber paranoid about my apps especially web apps. Always looking for vulnerabilities and testing with known attack vectors.

So, I do understand what he was talking about.

1 Like

Re: Post your PHP Problems Here by aje75(m): 10:46pm On Feb 01, 2015
lovebondz:


Oh, on the contrary, I am uber paranoid about my apps especially web apps. Always looking for vulnerabilities and testing with known attack vectors.

So, I do understand what he was talking about.

i get. one has to be sofar d project goes online. som bada*s guyz out dere

1 Like

Re: Post your PHP Problems Here by Nobody: 6:33am On Feb 02, 2015
Check this out harrisnigeria at dot com
Re: Post your PHP Problems Here by xyluz: 9:09pm On Feb 02, 2015
fraphael:
Hw to b changin content


You need to explain what you mean...
Re: Post your PHP Problems Here by Adesege(m): 4:02pm On Feb 03, 2015
Walexwal:
Pls knidly help me on my site problem. www.agripreneurforum.com. I just uploaded this script. I was told the problem is with my mysql database but I don't know how to create it. Pls kindly help!

Sup Walexwal, i guess you are a lil bit confused here. Take into consideration what has been said by the other guys.

As a security measure, ensure you use strict naming convention on your files and folders. Instead of having a 'config' folder in the root directory, you can just use 'include/config', 'inc/config', 'system/init', 'system/config', 'engine/init' or anything out of the norm.

I assume that you are new to PHP programming or new to using a site on remote server, so to better clarify things to your understanding, copy the codes in 'connections/forum.php' here so i can help.

1 Like

Re: Post your PHP Problems Here by chido4real(m): 11:17am On Feb 04, 2015
I need 3 guys for a web application project. I'm mostly into user interface design but I need web programmers urgently for a job. If you are really good at web programming, contact me on this number: 08083845557 (whatsapp) or on BBM: 74F278DC. Please note, you must have worked on a project before and you must be ready to prove real world experience in projects like this.
Its a photo sharing website for Nigerians. Functions like instagram but the difference will be communicate to the developers. Must be able to handle millions of users and include features like commenting, liking, sharing and anonymous user posting.
Re: Post your PHP Problems Here by Walexwal: 9:49pm On Feb 07, 2015
[quote author=Adege post=30393228]
Re: Post your PHP Problems Here by Adesege(m): 10:11pm On Feb 07, 2015
For security reasons, please do not include your 'real' password and username, i do not need them and they are to be kept private.

It appears that your mysql host is not using "localhost" as its host name. Rather, go to 'user account details' in your control panel to see the value for your host name or you contact them.

I can see other errors in the code, but let's deal with this first.

Walexwal:
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_forum = "localhost";
$database_forum = "riches24_luckygist";
$username_forum = "riches24_lucky";
$password_forum = "achebeizuchi";
$forum = mysql_pconnect($hostname_forum, $username_forum, $password_forum) or trigger_error(mysql_error(),E_USER_ERROR);
?>
<?php
function prevent_multi_submit($type = "post", $excl = "validator"wink {
$string = "";
foreach ($_POST as $key => $val) {
// this test is to exclude a single variable, f.e. a captcha value
if ($key != $excl) {
$string .= $val;
}
}
if (isset($_SESSION['last'])) {
if ($_SESSION['last'] === md5($string)) {
return false;
} else {
$_SESSION['last'] = md5($string);
return true;
}
} else {
$_SESSION['last'] = md5($string);
return true;
}
}
/////////////////////////////
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = ""wink
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != ""wink ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != ""wink ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != ""wink ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != ""wink ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != ""wink ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
/////////////
////////////////////////////////////////
if(isset($_SESSION['member'])){
$idux= mysql_real_escape_string($_SESSION['member']);
mysql_select_db($database_forum, $forum);
$query_rsusers = mysql_query("SELECT * FROM users WHERE username = '$idux' "wink or die(mysql_error());
$row_rsusers = mysql_fetch_assoc($query_rsusers);
/////////////////////
///////////////////////////////////////////
mysql_select_db($database_forum, $forum);
$query_cr = mysql_query("SELECT sum(unit) AS unit, sum(amount) as amount FROM credit WHERE user = '$idux'"wink or die(mysql_error());
$totalRows_cr = mysql_num_rows($query_cr);
$row_cr = mysql_fetch_array($query_cr);
//////////////////////
}
mysql_select_db($database_forum, $forum);
$query_rset = "SELECT * FROM settings where id = 1";
$rset = mysql_query($query_rset, $forum) or die(mysql_error());
$row_rset = mysql_fetch_assoc($rset);
$totalRows_rset = mysql_num_rows($rset);
$sitename = $row_rset['sitename'];
$adsense = $row_rset['adsense'];
$adsense2 = $row_rset['adsense2'];
$clhomeadsense = $row_rset['clhomeadsense'];
$crhomeadsense = $row_rset['crhomeadsense'];
?
Re: Post your PHP Problems Here by aje75(m): 10:52am On Feb 08, 2015
Walexwal:
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_forum = "localhost";
$database_forum = "riches24_luckygist";
$username_forum = "riches24_lucky";
$password_forum = "achebeizuchi";
$forum = mysql_pconnect($hostname_forum, $username_forum, $password_forum) or trigger_error(mysql_error(),E_USER_ERROR);
?>
<?php
function prevent_multi_submit($type = "post", $excl = "validator"wink {
$string = "";
foreach ($_POST as $key => $val) {
// this test is to exclude a single variable, f.e. a captcha value
if ($key != $excl) {
$string .= $val;
}
}
if (isset($_SESSION['last'])) {
if ($_SESSION['last'] === md5($string)) {
return false;
} else {
$_SESSION['last'] = md5($string);
return true;
}
} else {
$_SESSION['last'] = md5($string);
return true;
}
}
/////////////////////////////
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = ""wink
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != ""wink ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != ""wink ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != ""wink ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != ""wink ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != ""wink ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
/////////////
////////////////////////////////////////
if(isset($_SESSION['member'])){
$idux= mysql_real_escape_string($_SESSION['member']);
mysql_select_db($database_forum, $forum);
$query_rsusers = mysql_query("SELECT * FROM users WHERE username = '$idux' "wink or die(mysql_error());
$row_rsusers = mysql_fetch_assoc($query_rsusers);
/////////////////////
///////////////////////////////////////////
mysql_select_db($database_forum, $forum);
$query_cr = mysql_query("SELECT sum(unit) AS unit, sum(amount) as amount FROM credit WHERE user = '$idux'"wink or die(mysql_error());
$totalRows_cr = mysql_num_rows($query_cr);
$row_cr = mysql_fetch_array($query_cr);
//////////////////////
}
mysql_select_db($database_forum, $forum);
$query_rset = "SELECT * FROM settings where id = 1";
$rset = mysql_query($query_rset, $forum) or die(mysql_error());
$row_rset = mysql_fetch_assoc($rset);
$totalRows_rset = mysql_num_rows($rset);
$sitename = $row_rset['sitename'];
$adsense = $row_rset['adsense'];
$adsense2 = $row_rset['adsense2'];
$clhomeadsense = $row_rset['clhomeadsense'];
$crhomeadsense = $row_rset['crhomeadsense'];
?


wow. how generous of you bro putting ur username and password online
Re: Post your PHP Problems Here by Walexwal: 1:27pm On Feb 08, 2015
aje75:



wow. how generous of you bro putting ur username and password online
that's not my password sir. Its the former one
Re: Post your PHP Problems Here by Adesege(m): 6:17pm On Feb 08, 2015
Have you gotten it corrected?

Walexwal:
that's not my password sir. Its the former one
Re: Post your PHP Problems Here by xyluz: 10:48am On Feb 09, 2015
Walexwal:
that's not my password sir. Its the former one

Regardless, i think you revealed too much.
Re: Post your PHP Problems Here by jorlarmind: 11:27pm On Feb 09, 2015
Yea. I reload my system with window 7 starter some days ago, now i am trying to connect my wireless internet,i realise d wifi is not displaying ,mean why the computer wifi is on,on the keyboard
Kindly help with solutions
Thanks.
Re: Post your PHP Problems Here by xyluz: 11:40am On Feb 10, 2015
jorlarmind:
Yea. I reload my system with window 7 starter some days ago, now i am trying to connect my wireless internet,i realise d wifi is not displaying ,mean why the computer wifi is on,on the keyboard
Kindly help with solutions
Thanks.

Although this place is for PHP programming problems... so my answer might not be accurate or helpful... but i believe what you need is the right drivers.

You can download the proper driver for your windows system

Follow this link: http://windows.microsoft.com/en-us/windows7/automatically-get-recommended-drivers-and-updates-for-your-hardware

Make more search online if the link is not helpful.
Re: Post your PHP Problems Here by ps3o(m): 8:43pm On Feb 15, 2015
I am a web developer and an ICT Solutionist.
to the OP, create a whatsapp group for nairalanders.
[link=http://wedevelop.tk]WEDEVELOP[/link]
[link=http://sobalajehosting.tk]WEBHOSTING SERVICE[/link]
[link=http://foralldevelopers.com]ForAllDevelopers Web[/link]
Re: Post your PHP Problems Here by Vijon(m): 2:53pm On Feb 21, 2015
gud day all,plz help me out wit dis-i cant preview my php files on my wampserver again.if i try accessing it tru d server,it returns an error message.den if i try to open d file using dreamwaver cs5,it trigger d browser to start downloading d php file repeatedly.i ve try uninstalling nd re-installing d wampserver bt d problem is still dere.any help my pple
Re: Post your PHP Problems Here by babihouse(m): 6:35pm On Feb 22, 2015
Vijon:
gud day all,plz help me out wit dis-i cant preview my php files on my wampserver again.if i try accessing it tru d server,it returns an error message.den if i try to open d file using dreamwaver cs5,it trigger d browser to start downloading d php file repeatedly.i ve try uninstalling nd re-installing d wampserver bt d problem is still dere.any help my pple

Have you created a site on your dreamweaver? Have you try accessing the PHP page using the url? Try this out.
Re: Post your PHP Problems Here by Adesege(m): 9:49am On Feb 24, 2015
Create a folder in C:\wamp\www, say 'sample'. Then launch ur browser and access http://localhost/sample. Ensure your wampserver is on and has the green icon on the taskbar.

Vijon:
gud day all,plz help me out wit dis-i cant preview my php files on my wampserver again.if i try accessing it tru d server,it returns an error message.den if i try to open d file using dreamwaver cs5,it trigger d browser to start downloading d php file repeatedly.i ve try uninstalling nd re-installing d wampserver bt d problem is still dere.any help my pple
Re: Post your PHP Problems Here by xyluz: 12:40pm On Feb 26, 2015
Vijon:
gud day all,plz help me out wit dis-i cant preview my php files on my wampserver again.if i try accessing it tru d server,it returns an error message

What error message did you get?
Re: Post your PHP Problems Here by kentc3: 2:56pm On Feb 26, 2015
This code Uploads a picture into a database, but when i try to retrieve it and display it, the result is blank... i need you guys assistant on how to overcome this coz i ve been stuck here for weeks.. i will really appreciate it... Below is the Upload Script

if(isset($_POST['submit']))
{
$name=$_POST['name'];
$email=$_POST['email'];
$pic=$_FILES['photo']['name'];

if((!empty($_FILES['photo'])) && ($_FILES['photo']['error']==0))
{
$filename=basename($_FILES['photo']['name']);
$ext= substr($filename, strrpos($filename,'.')+1);
if(($ext == "jpg" || $ext == "gif" || $ext == "JPG" || $ext == "jpeg" || $ext == "JPEG" || $ext == "PNG" || $ext == "png" || $ext == "GIF"wink &&($_FILES['photo']['size']<100000000))
{

$newname=dirname(__FILE__).'/images1/'.$filename;
if(!file_exists($newname))
{
if((move_uploaded_file($_FILES['photo']['tmp_name'],$newname)))
{

mysql_connect("Localhost","Gospel","gospel"wink or die("Could not connect"wink;
mysql_select_db("picture"wink or die("could not select db"wink;
$insert=mysql_query("INSERT INTO `pix`(`sn`, `fname`, `lname`, `image`) VALUES (NULL,'".$name."','".$email."','".$newname."')"wink or die("database not found"wink;
echo "<img src='$pic' alt='' height='300' width='500'>"."<br>";
echo "<img src='$newname' alt='' height='300' width='500'>"."<br>";
echo "its done! the file has been saved as:".$newname;
}
else
{
echo "Error! problem occured";
}}
else
{
echo "error file:".$_FILES['photo']['name']."already exist";
}}
else
{
echo "File format not supported";
}}
else
{
echo "thank you, no file uploadedd";
}


}


BELOW IS THE RETRIEVE AND DISPLAY SCRIPT

<?php
mysql_connect("Localhost","Gospel","gospel"wink or die("Could not connect"wink;
mysql_select_db("picture"wink or die("could not select db"wink;

$select=mysql_query("SELECT * from `pix` WHERE sn= 23 "wink or die("could not find"wink;
if(mysql_num_rows($select)==true)
{
$me=mysql_fetch_array($select);
?>
<img src="<?php echo $me['image']; ?>" alt="" height="200" width="120">
<?php
}
?>


Please i need a solution... Thanks
Re: Post your PHP Problems Here by xyluz: 3:31pm On Feb 26, 2015
kentc3:

<?php
mysql_connect("Localhost","Gospel","gospel"wink or die("Could not connect"wink;
mysql_select_db("picture"wink or die("could not select db"wink;

$select=mysql_query("SELECT * from `pix` WHERE sn= 23 "wink or die("could not find"wink;
if(mysql_num_rows($select)==true)
{
$me=mysql_fetch_array($select);
?>
<img src="<?php echo $me['image']; ?>" alt="" height="200" width="120">
<?php
}
?>


Try This:

<?php
mysql_connect( "localhost","Gospel","gospel" ) or die( "Could not connect" );
mysql_select_db("picture"wink or die("could not select db"wink;

$select=mysql_query( "SELECT * from `pix` WHERE sn= 23" ) or die( "could not find" );

if($select)
{
$me=mysql_fetch_array($select);

echo "<img src='$me[image]' height='200' width='120'>";

}
?>


If it doesn't work, you can debug by doing var_dump($me), if the image path is being displayed then the problem is your image tag.

++++++++++++++++++++++++++++++++++++++++++++++

FURTHER OBSERVATIONS

kentc3:


$filename=basename($_FILES['photo']['name']);

$ext= substr($filename, strrpos($filename,'.')+1);

if(($ext == "jpg" || $ext == "gif" || $ext == "JPG" || $ext == "jpeg" || $ext == "JPEG" || $ext == "PNG" || $ext == "png" || $ext == "GIF"wink &&($_FILES['photo']['size']<100000000))
{

Try this:

$ext = $_FILES["photo"]["type"].

That way you can say :

if(($ext == "image/jpg"....)){
...
}

This checks if your file is an image and that it has the right extension.


Try not to use $_POST directly, or any other global variable directly, its better you use some kind of filter like

filter_input(INPUT_POST, $fieldname) - read more on that here: http://php.net/manual/en/function.filter-input.php

In my opinion, your database connection should be the first thing you do, if the database is not connected, there's no use doing anything else.


I hope this was helpful.
Re: Post your PHP Problems Here by kentc3: 8:26pm On Feb 26, 2015
xyluz:


Try This:

<?php
mysql_connect( "localhost","Gospel","gospel" ) or die( "Could not connect" );
mysql_select_db("picture"wink or die("could not select db"wink;

$select=mysql_query( "SELECT * from `pix` WHERE sn= 23" ) or die( "could not find" );

if($select)
{
$me=mysql_fetch_array($select);

echo "<img src='$me[image]' height='200' width='120'>";

}
?>


If it doesn't work, you can debug by doing var_dump($me), if the image path is being displayed then the problem is your image tag.

++++++++++++++++++++++++++++++++++++++++++++++

FURTHER OBSERVATIONS



Try this:

$ext = $_FILES["photo"]["type"].

That way you can say :

if(($ext == "image/jpg"....)){
...
}

This checks if your file is an image and that it has the right extension.


Try not to use $_POST directly, or any other global variable directly, its better you use some kind of filter like

filter_input(INPUT_POST, $fieldname) - read more on that here: http://php.net/manual/en/function.filter-input.php

In my opinion, your database connection should be the first thing you do, if the database is not connected, there's no use doing anything else.


I hope this was helpful.



The issue remained the same.... i used the var_dump($me) as u said, and the image path was displayed.... the question now is, how do i rectify it coz i have tried all possible ways i know to no avail.... please help out.. i am getting error such as this

array (size=4)
'sn' => string '11' (length=2)
'fname' => string 'll' (length=2)
'lname' => string 'll' (length=2)
'image' => string 'C:wampwwwimage.sample/images1/20141216_183233.jpg' (length=49)
Re: Post your PHP Problems Here by xyluz: 8:27am On Feb 27, 2015
kentc3:


array (size=4)
'sn' => string '11' (length=2)
'fname' => string 'll' (length=2)
'lname' => string 'll' (length=2)
'image' => string 'C:wampwwwimage.sample/images1/20141216_183233.jpg' (length=49)

Try uploading the file without changing the name.

Try these debugging tips:

Did you check inside the images folder?
Is the image there?
If the image is there what name does it have?
Manually put an image inside the image folder (copy and paste), then try using your code to display the image...

Does it display the manually uploaded image?

Hope this was helpful?


Updated: check the image

Re: Post your PHP Problems Here by Nobody: 5:14pm On Feb 27, 2015
kentc3:


BELOW IS THE RETRIEVE AND DISPLAY SCRIPT

<?php
mysql_connect("Localhost","Gospel","gospel"wink or die("Could not connect"wink;
mysql_select_db("picture"wink or die("could not select db"wink;

$select=mysql_query("SELECT * from `pix` WHERE `sn`= 23 "wink or die("could not find"wink;
if(mysql_num_rows($select)==true)
{
$me=mysql_fetch_array($select);
?>
<img src="<?php echo $me['image']; ?>" alt="" height="200" width="120">
<?php
}
?>


Please i need a solution... Thanks

notice any changes to the code ? check the bolded .





side talk -- mysql extension is deprecated,use mysqli instead

(1) (2) (3) ... (13) (14) (15) (16) (17) (18) (19) (Reply)

Top Google Searches By Nigerians 2015;Arsenal,Buhari,Diezani Arrest tops d list. / Mark Zuckerberg Eating Pounded Yam And Eforiro (Photo) / Setting Up Wamp Server To Run On Local Area Network

(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. 80
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.