Programming › Re: Gdevit.com Finally Completed Guys!! by Thirdwrist(m): 10:54pm On Jun 13, 2016 |
bug report: after sign up the webpage does not redirect you to home page or profile just remains in the sign up page.
the site is really fast i am supper impressed you walk your talk... |
Programming › Re: Gdevit.com Finally Completed Guys!! by Thirdwrist(m): 10:35pm On Jun 13, 2016 |
wow the site looks too good... Nice job. |
Culture › Re: Ooni Ogunwusi Performs Olokun On Philadelphia Bridge,USA(pics by Thirdwrist(m): 4:33pm On Jun 13, 2016 |
mrvitalis: Are u sure the Bible is not fake?? What if I show u books that majority of the Bible stories was copied from?? With facts will u believe?? please show me.. |
Programming › Re: My First Real PHP Based Website by Thirdwrist(op): 11:32am On Jun 13, 2016 |
Thank you very much I have rectified the issue thanks to you Sir... I would be grateful if you follow more of my recent posts on this tread and be as generous as you are now to administer solutions to my errors. Thank you again Sir. sleepingdemon: Op the content of the file you outline is it index1.php? The class you provided, if ran, would return "you are an oop genius" the error you are recieving is from the index1.php class, not the class. besides, i guess you want the file to print out you are an oop genius and also usernames and id gotten from the user table.
if that is the case, ive corrected your class to be like this, and it should work.
But i repeat, the error of exec you are getting is from index1.php, not this file.
<?php class user{ //inniating variables to be used in db_connect method. // Database assess values. public $db_host= "localhost"; public $username=""; public $password= ""; public $db_name="php_database"; public $dbc; public $sql; public $row; public $result; public $something;
function __construct(){ $this->connect(); } // method to connect to database function connect(){ try{ $this->dbc= new PDO("mysql:host=$this->db_host; dbname=$this->db_name;charset=utf8", $this->username, $this->password); } catch (PDOException $e){ echo "failed to connect to database pdo "; echo $e->getmessage(); exit(); } return $this->dbc; }
public function dbr(){ $this->sql="SELECT username, id FROM users"; $stmt=$this->dbc->query($this->sql); return $stmt; return $stmt->fetchAll(PDO::FETCH_ASSOC); } } $usermanagment= new user();
echo "you are an OOP genius"; echo "<br>"; try { $answer=$usermanagment->dbr();
foreach ($answer as $row) { print $row['id'] . "\t"; print $row['username'] . "\n"; } } catch(PDOException $ex) { echo $ex->getmessage(); //handle me. } echo "<br>"; echo $usermanagment->sql;
?> |
Programming › Re: My First Real PHP Based Website by Thirdwrist(op): 11:27am On Jun 13, 2016 |
Thank you Sir, I have fixed that. thank you... Realphilo: Check your index1.php file @ line 34 |
Programming › Re: My First Real PHP Based Website by Thirdwrist(op): 11:24am On Jun 13, 2016 |
The signup script is as follows [codes]
#sighup script below // Save form values in variables as well as clear it of any malicious characters $fname=mysql_real_escape_string($_POST['fname']); $lname=mysql_real_escape_string($_POST['lname']); $email=mysql_real_escape_string($_POST['email']); $gset=mysql_real_escape_string($_POST['gset']); $department=mysql_real_escape_string($_POST['dpt']); $pass1=mysql_real_escape_string($_POST['pass1']); $pass2=mysql_real_escape_string($_POST['pass2']); require "db_connect.php"; //checking lenght of string if (strlen($lname) > 30 || strlen($lname)< 3 ){ $output="Invalid Last name"; require_once "signup.php"; die; } elseif (strlen($fname) > 30 || strlen($fname)< 3 ){ $output="Invalid First name"; require_once "signup.php"; die; } elseif (strlen($pass1) > 50 || strlen($pass1)< 7 ){ $output="Invalid password, Password must be minimum of 7 units"; require_once "signup.php"; die; }
//if email is already reistered $sql="SELECT Email FROM users WHERE email='{$email}'"; $result= mysql_query($sql); //if the two passwords are the same if($pass1!=$pass2){ $output= "Please make sure the two passwords are the same "; require_once "signup.php"; die(); }
elseif(mysql_num_rows($result)==True){
$output= "This Email address has already been regisered here"; require_once "signup.php"; die(); } else{ $pass1=md5(mysql_real_escape_string($pass1)); $sql=" INSERT INTO users SET First_name ='{$fname}', Last_name = '{$lname}', Email= '{$email}', Pass= '{$pass1}', Graduation_set='{$gset}', Department='{$department}'"; try{ $result=mysql_query($sql); } catch(MYSQLException $e){ $output="Failed to register, Please try again and if problem persist contact the admin". $e->getmessage(); }
}
echo "welcome bro";
[/codes] Please help review if you see any inconsistency i will be more than happy to correct it. And any security flaw |
Programming › Re: My First Real PHP Based Website by Thirdwrist(op): 11:22am On Jun 13, 2016 |
The login script is as follows
$email=mysql_real_escape_string($_POST['email']); $pass=md5(mysql_real_escape_string($_POST['pass1'])); $sql="SELECT * FROM users WHERE Email='{$email}'"; require "db_connect.php"; $result=mysql_query($sql); if (mysql_num_rows($result)){ $sql="SELECT * FROM users WHERE Email='{$email}' AND Pass='$pass'"; $result=mysql_query($sql); if(mysql_num_rows($result)==true){ Echo "welcome man"; //require_once($_SERVER['DOCUMENT_ROOT']. "/Experiments/gstosa/index.html" ; die; } else{ $output="Incorrect password"; require "signin.php";
}
}
else{ $output="Incorrect email address"; //$output="Your email is not registered or wasn't entered correctly"; require "signin.php"; die; }
Please help review if you see any inconsistency i will be more than happy to correct it. And any security flow. |
Programming › Re: My First Real PHP Based Website by Thirdwrist(op): 1:42am On Jun 03, 2016 |
I am trying to login to my site with facebook, but it isnt communicating with the database. After login it does not store the user details in the table i created. CREATE TABLE users( uid int auto_increment not null primary key, Fuid not null int, Ffname varchar(100) not null, flname varchar(100) not null, Femail varchar(100) not null ) DEFAULT CHARACTER SET utf8 ENGINE=InnoDB
I got the codes from here http://www.krizna.com/demo/login-with-facebook-using-php/dhtml18larisoft nauman673 hcpaul guru01 davidthegeek sonoflucifer hitz Adesege |
Programming › Re: Hilarious Memes you can relate with as a Programmer by Thirdwrist(m): 10:25am On Jun 01, 2016 |
if yourl want to treat a woman like an object at less do it with class, die(); |
Car Talk › Re: 'Witch' Number Plate In Garki Abuja {pics} by Thirdwrist(m): 7:16pm On May 24, 2016 |
ireneony: are you the on the pic? Thats me. He took the picture... |
Programming › Re: My First Real PHP Based Website by Thirdwrist(op): 9:30am On May 24, 2016 |
This is the whole code as requested Thanks for help in advance, i really appreciate. ALLU
<?php class user{ //inniating variables to be used in db_connect method. // Database assess values. public $db_host= "localhost"; public $username=""; public $password= ""; public $db_name="php_database"; public $dbc; // method to connect to database function connect(){ try{ $this->dbc= new PDO("mysql:host=$this->db_host; dbname=$this->db_name;charset=utf8", $this->username, $this->password); } catch (PDOException $e){ echo "failed to connect to database pdo "; echo $e->getmessage(); exit(); } return $this->dbc; } public $sql; public $row; public $result; public $something; public function dbr(){ $this->sql="SELECT username, id FROM users"; foreach ($this->result->fetch($sql) as $row) { print $row['id'] . "\t"; print $row['username'] . "\n"; } } } $usermanagment= new user(); $usermanagment->connect(); echo "you are an OOP genius"; $usermanagment->dbr(); echo $usermanagment->sql;
?>
|
Programming › Re: My First Real PHP Based Website by Thirdwrist(op): 3:33am On May 24, 2016 |
sinkernet: If u ever get stuck, I'll be @ your service How do I rectify this? public $sql; public $row; public $result; public $something; public function dbr(){ $this->sql="SELECT username, id FROM users"; foreach ($this->result->exec($sql) as $row) { print $row['id'] . "\t"; print $row['username'] . "\n"; }
It reply's : Fatal error: Call to a member function exec() on a non-object in E:\xampp\htdocs\Experiments\gstosa\index1.php on line 34 dhtml18 larisoft nauman673 hcpaul guru01 davidthegeek sonoflucifer hitz Adesege |
Programming › Re: How To Roast A Monitor Lizard by Thirdwrist(m): 10:33pm On May 23, 2016 |
Op to much french in the write up, Abi na speaking in tongue sef.... |
Programming › Re: Please Explain This Script To Me Php OOP by Thirdwrist(op): 12:29am On May 17, 2016 |
dhtml18 guru01 davidthegeek sonoflucifer hitz |
|
Programming › Please Explain This Script To Me Php OOP by Thirdwrist(op): 12:14am On May 17, 2016 |
I am making a desperate move to OOP in PHP, before now i coded in procedural with little hitches I dicided to finally make the move to OOP in this new site i am working on, but the hitches are much just to create a login script is like asking a lion to borrow you some of his meat. Please if I can get any one to explain this codes to me it would be good, I understand the other parts of the codes, but this file "mbah". Please if you have a better OOP PDO login and register it will be much appreciated a link to the code on Github : https://github.com/actuallymentor/oop-pdo-login <?php /** * DB - A simple database class * * @author Author: Vivek Wicky Aswal. (https://twitter.com/#!/VivekWickyAswal) * @git https://github.com/indieteq/PHP-MySQL-PDO-Database-Class * @version 0.2ab * */ require("Log.class.php" ; class DB { # @object, The PDO object private $pdo;
# @object, PDO statement object private $sQuery;
# @array, The database settings private $settings;
# @bool , Connected to the database private $bConnected = false;
# @object, Object for logging exceptions private $log;
# @array, The parameters of the SQL query private $parameters; /** * Default Constructor * * 1. Instantiate Log class. * 2. Connect to database. * 3. Creates the parameter array. */ public function __construct() { $this->log = new Log(); $this->Connect(); $this->parameters = array(); } /** * This method makes connection to the database. * * 1. Reads the database settings from a ini file. * 2. Puts the ini content into the settings array. * 3. Tries to connect to the database. * 4. If connection failed, exception is displayed and a log file gets created. */ private function Connect() { $this->settings = parse_ini_file("settings.ini.php" ; $dsn = 'mysql:dbname='.$this->settings["dbname"].';host='.$this->settings["host"].''; try { # Read settings from INI file, set UTF8 $this->pdo = new PDO($dsn, $this->settings["user"], $this->settings["password"], array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8" ); # We can now log any exceptions on Fatal error. $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); # Disable emulation of prepared statements, use REAL prepared statements instead. $this->pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); # Connection succeeded, set the boolean to true. $this->bConnected = true; } catch (PDOException $e) { # Write into log echo $this->ExceptionLog($e->getMessage()); die(); } } /* * You can use this little method if you want to close the PDO connection * */ public function CloseConnection() { # Set the PDO object to null to close the connection # http://www.php.net/manual/en/pdo.connections.php $this->pdo = null; } /** * Every method which needs to execute a SQL query uses this method. * * 1. If not connected, connect to the database. * 2. Prepare Query. * 3. Parameterize Query. * 4. Execute Query. * 5. On exception : Write Exception into the log + SQL query. * 6. Reset the Parameters. */ private function Init($query,$parameters = "" { # Connect to database if(!$this->bConnected) { $this->Connect(); } try { # Prepare query $this->sQuery = $this->pdo->prepare($query); # Add parameters to the parameter array $this->bindMore($parameters);
# Bind parameters if(!empty($this->parameters)) { foreach($this->parameters as $param) { $parameters = explode("\x7F",$param); $this->sQuery->bindParam($parameters[0],$parameters[1]); } }
# Execute SQL $this->succes = $this->sQuery->execute(); } catch(PDOException $e) { # Write into log and display Exception echo $this->ExceptionLog($e->getMessage(), $query ); die(); }
# Reset the parameters $this->parameters = array(); } /** * @void * * Add the parameter to the parameter array * @param string $para * @param string $value */ public function bind($para, $value) { $this->parameters[sizeof($this->parameters)] = ":" . $para . "\x7F" . utf8_encode($value); } /** * @void * * Add more parameters to the parameter array * @param array $parray */ public function bindMore($parray) { if(empty($this->parameters) && is_array($parray)) { $columns = array_keys($parray); foreach($columns as $i => &$column) { $this->bind($column, $parray[$column]); } } } /** * If the SQL query contains a SELECT or SHOW statement it returns an array containing all of the result set row * If the SQL statement is a DELETE, INSERT, or UPDATE statement it returns the number of affected rows * * @param string $query * @param array $params * @param int $fetchmode * @return mixed */ public function query($query,$params = null, $fetchmode = PDO::FETCH_ASSOC) { $query = trim($query);
$this->Init($query,$params);
$rawStatement = explode(" ", $query); # Which SQL statement is used $statement = strtolower($rawStatement[0]); if ($statement === 'select' || $statement === 'show') { return $this->sQuery->fetchAll($fetchmode); } elseif ( $statement === 'insert' || $statement === 'update' || $statement === 'delete' ) { return $this->sQuery->rowCount(); } else { return NULL; } } /** * Returns the last inserted id. * @return string */ public function lastInsertId() { return $this->pdo->lastInsertId(); } /** * Returns an array which represents a column from the result set * * @param string $query * @param array $params * @return array */ public function column($query,$params = null) { $this->Init($query,$params); $Columns = $this->sQuery->fetchAll(PDO::FETCH_NUM); $column = null;
foreach($Columns as $cells) { $column[] = $cells[0]; }
return $column; } /** * Returns an array which represents a row from the result set * * @param string $query * @param array $params * @param int $fetchmode * @return array */ public function row($query,$params = null,$fetchmode = PDO::FETCH_ASSOC) { $this->Init($query,$params); return $this->sQuery->fetch($fetchmode); } /** * Returns the value of one single field/column * * @param string $query * @param array $params * @return string */ public function single($query,$params = null) { $this->Init($query,$params); return $this->sQuery->fetchColumn(); } /** * Writes the log and returns the exception * * @param string $message * @param string $sql * @return string */ private function ExceptionLog($message , $sql = "" { $exception = 'Unhandled Exception. <br />'; $exception .= $message; $exception .= "<br /> You can find the error back in the log."; $errorcode = $message;
if(!empty($sql)) { # Add the Raw SQL to the Log $message .= "\r\nRaw SQL : " . $sql; } # Write into log $this->log->write($message);
return $errorcode; } } ?>
|
Programming › Re: Please How Do I Recreate This Design by Thirdwrist(op): 9:08pm On May 09, 2016 |
sonOfLucifer: Your question isn't clear enough.
If you want a responsive image, use relative measurement. img{ width:100% }
The image should resize accordingly. The image should resize accordingly.[/quote]you have to view this from a computer system to be able to understand what i mean. I want to write on an image and as well let the writing be responsive, and how do i also center the writing and thumbs, like in the picture of the web site attached.
|
Programming › Please How Do I Recreate This Design by Thirdwrist(op): 5:19pm On May 09, 2016 |
How do i recreate this big home picture in the home page of texasexes.org with the name : "join today" & "login" in bootstrap ? in a very responsive manner. Your input will be much appreciated. I have been trying to do it but my success is trickling in, in drops. My previous code. <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0" user-scalable="no"> <title>Bootstrap 101 Template</title>
<link rel="stylesheet" href="custom.css"> <link href="css/bootstrap.min.css" rel="stylesheet">
</head> <body class=""> <div id="imgholder"> <div id="overimage"> <div id="welcomediv"> <h1 id="welcome">Welcome to FFT Old Students Association</h1> <br/>
<a href="#" class="btn btn-primary" id="welcomethumb">last man </a> <a href="#" class="btn btn-primary" id="welcomethumb">last man </a> </div> </div> <img src="FFT.jpg" class="bigimg"> </div>
Css: .body{ margin-left:0; margin-right:0; padding-right:0; padding-left:0; } #imgholder{ position:relative; } #overimage{ width:100%; height:100%; position:absolute;
}
#welcome{ font-family:Impact,Charcoal, sans-serif; color:#FFFAF0; text-align:center; margin:auto; clear:left; /*position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); */ } #welcomediv{ background-color:; margin: 0 auto; width:50%; vertical-align:center; min-height:100%; min-height:100vh; display:flex; align-items:center; }
#welcomethumb{ }
|
Travel › Re: Images From Abuja - The Pride Of Nigeria by Thirdwrist(m): 2:05pm On May 08, 2016 |
mrpayne: Not every picture is a part of Abuja. The Churchgate glass office structure is in Victoria island just behind Kings College Annexe. I finished from there and I woke up to the site of that building almost every morning for 3 years. Also the earlier picture with beautiful serene residential buildings is a private estate quite close to chevron estate in Lekki. OP pls verify ur data before spreading as info to avoid misleading people. There is also church gate in Abuja located in Central Area before NNPC mega filling station. And that's the building. Most all the pictures he pasted are from Central Area. |
Business › Can I Run A Proper Business With Just A Name From CAC? by Thirdwrist(op): 7:24pm On May 03, 2016 |
I want to start an advertising company self funded. But the challenge is that my funds aren't that much, I called CAC today and asked them how much it was to get a business name and they replied "N10,700" then I asked for opening a limited liability company and they said N70,000.
So what I want to know is if I can just register the business name and begin working and then register the limited liability company later. The advert business idea isn't new though an amazing one, if I open one with just a business name is it adviceble? Can transact with other companies with just the name? Please advise me. I reside in Abuja. Thank you in advance. |
Business › Can I Start An Advert Company With Just A Business Name From CAC by Thirdwrist(op): 7:13pm On May 03, 2016 |
I want to start an advertising company self funded. But the challenge is that my funds aren't that much, I called CAC today and asked them how much it was to get a business name and they replied "N10,700" then I asked for opening a limited liability company and they said N70,000.
So what I want to know is if I can just register the business name and begin working and then register the limited liability company later. The advert business idea isn't new though an amazing one, if I open one with just a business name is it adviceble? Can I work with big companies with just a business name? Please advise me. I reside in Abuja. Thank you in advance. |
Programming › Re: Learn VB.NET And C# Without Stress. by Thirdwrist(m): 11:40am On Apr 22, 2016 |
|
Programming › Help Me Cross Check My Visual Basic Code by Thirdwrist(op): 11:33am On Apr 22, 2016 |
I was asked to do an assignment for someone on Visual basic, I programme only in PHP and Javascript but I thought to myself that it would'nt be hard to learn the syntax of VB, albeit the project was a simply one and knowledge in the previous languages will come in handy. I was asked to build a programme to find the mean of 5 numbers And a programme to calculate the volume of a cylinder. I cant compile this code on visual studio because i dont have that amount of data to download 6gb compiler, so please just help me cross check. Mean of 5 numbers
Imports System Public Class Calculatemean Private val1 As Integer Private val2 As Integer Private val3 As Integer Private val4 As Integer Private val5 As Integer Private sum As Integer Private result As Integer Private divider As Integer 'Public methods Public Sub AcceptDetails() Console.Write("Enter first value: " val1= Console.ReadLine Console.Write("Enter second value: " val2= Console.ReadLine Console.Write("Enter third value: " val3= Console.ReadLine Console.Write("Enter fourth value: " val4= Console.ReadLine Console.Write("Enter last value: " val5= Console.ReadLine divider= 5 End Sub
Public Function GetMean() As double sum = val1 + val2 + val3 + val4 + val5 result = sum / divider return result End Function Public Sub Display() Console.WriteLine("Mean: {0}", GetMean) End Sub
Shared Sub Main() Dim M As New Mean() M.Acceptdetails() M.Display() Console.ReadLine() End Sub End Class
Volume of a cylinder Imports System Public Class volumeofcylinder Private radius As Integer Private hieght As Integer Private pie As Double Private radius2 As Integer Private result As Double 'Public methods Public Sub AcceptDetails() Console.Write("Enter Radius: " radius= Console.ReadLine Console.Write("Enter height: " height= Console.ReadLine pie= 3.143 End Sub
Public Function GetVolume() As double radius2= radius * radius result = pie * radius2 * height return result End Function Public Sub Display() Console.WriteLine("Volume : {0}", GetVolume) End Sub
Shared Sub Main() Dim C As New cylinder() C.Acceptdetails() C.Display() Console.ReadLine() End Sub End Class
|
Sports › Re: Egypt Vs Nigeria: Player Rating by Thirdwrist(m): 9:09pm On Mar 29, 2016 |
That your rating is too harsh, you for Kuku mah give all of them 0/10 |
Programming › Re: My Blog Pictures Will No Longer Show On Facebook. by Thirdwrist(m): 7:56am On Mar 05, 2016 |
mindboggler: 467 views and no help or suggestions? Aahh it's not good nau. If your blog is editable by code, then you need to add what is called meta tags, there is the normal one and there is twitter Facebook meta tags. |
Education › Re: Jamb's Additional 40 Marks, A Bonus Or Compensation? by Thirdwrist(m): 7:47am On Mar 05, 2016 |
samokog: Sorry, it has been confirmed no body scored 399. The guy only score 199 How did you go about confirming that? Please explain more, I do love to know. |
Programming › How Do I Change The Color Of A Grid In Bootstrap by Thirdwrist(op): 1:53am On Mar 05, 2016 |
I created a custom style sheet and added this line of CSS, to change the color of the grids but no way. CUSTOM.CSS >
col-md-3{ color:#f8f8f8; }
|
Education › Re: I Feel Bad About My Jamb Score by Thirdwrist(m): 9:54am On Mar 02, 2016 |
Fedric: i wrote my jamb 29th, i was so disappointed in my self. i never knew i could score as low as 188 out of 400 marks. i feel bad and disappointed in my self. i have loved to study optometry,
what can i study with this low mark?
which university will welcome me?
gasp; despirited Your new score is now 228 Check it on jamb website and see, my old score was 191 now its 231, jamb added 40 more points for everyone. WWW.jamb.org.ng |
Programming › My First Real PHP Based Website by Thirdwrist(op): 10:17pm On Feb 29, 2016 |
MY FIRST REAL PHP SITE When you are inspired by some great purpose, some extraordinary project, all of your thoughts break their bonds: your mind transcends limitations, your consciousness expands in every direction and you find yourself in a new, great and wonderful world. Dormant forces, faculties and talents come alive and you discover yourself to be a greater person than you ever dreamed of…… (The monk who sold his Ferari).
One of my plans this year is to build a PHP site for my ex secondary school Alumni and one for the school itself, to someone else it might seem like a walk in the park, but mine isn’t the case, I am very new to the PHP world though I am quite fluent in HTML and CSS and understand the syntax of JavaScript.
This will be a deliberate effort of mine to swim with the sharks, its obvious I will make a lot of mistakes and get frustrated a lot of times, which brings me to the aim of me starting this tread, they are a lot of good programmers over here, on whose shoulder I can lean on, I will post every single code of mine here and regularly update my progress for critique and when I need help.
Tools: Bootstrap, Xampp Sublime.
Thank you all in advance. |
Programming › Re: I Dared Two Expert Hackers To Destroy My Life. Here’s What Happened - Kevin Roos by Thirdwrist(m): 10:36am On Feb 26, 2016 |
Wow, this is mad, people making and stretching their minds. I will be their some day bro. |
|
Programming › Re: The Greatest Programmer On Nairaland by Thirdwrist(m): 12:14pm On Feb 24, 2016 |
This is interesting, what's the challenge about then? And it's Dhtml18, the other account isn't in use. |